Debian Codegraph @

src/com/drew/metadata/mov/atoms/TimecodeSampleDescriptionAtom.java

raw symbols SCIP
1 /*
2 * Copyright 2002-2019 Drew Noakes and contributors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * More information about this project is available at:
17 *
18 * https://drewnoakes.com/code/exif/
19 * https://github.com/drewnoakes/metadata-extractor
20 */
21 package com.drew.metadata.mov.atoms;
22
23 import com.drew.lang.SequentialReader;
24 import com.drew.lang.annotations.NotNull;
25 import com.drew.metadata.mov.media.QuickTimeTimecodeDirectory;
26
27 import java.io.IOException;
28
29 /**
30 * https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-57409
31 *
32 * @author Payton Garland
33 */
34 public class TimecodeSampleDescriptionAtom extends SampleDescriptionAtom<TimecodeSampleDescriptionAtom.TimecodeSampleDescription>
35 {
36 public TimecodeSampleDescriptionAtom(SequentialReader reader, Atom atom) throws IOException
37 {
38 super(reader, atom);
39 }
40
41 @NotNull
42 @Override
43 TimecodeSampleDescription getSampleDescription(SequentialReader reader) throws IOException
44 {
45 return new TimecodeSampleDescription(reader);
46 }
47
48 public void addMetadata(QuickTimeTimecodeDirectory directory)
49 {
50 if (sampleDescriptions.size() > 0) {
51 TimecodeSampleDescription description = sampleDescriptions.get(0);
52
53 directory.setBoolean(QuickTimeTimecodeDirectory.TAG_DROP_FRAME, (description.flags & 0x0001) == 0x0001);
54 directory.setBoolean(QuickTimeTimecodeDirectory.TAG_24_HOUR_MAX, (description.flags & 0x0002) == 0x0002);
55 directory.setBoolean(QuickTimeTimecodeDirectory.TAG_NEGATIVE_TIMES_OK, (description.flags & 0x0004) == 0x0004);
56 directory.setBoolean(QuickTimeTimecodeDirectory.TAG_COUNTER, (description.flags & 0x0008) == 0x0008);
57 }
58 }
59
60 static class TimecodeSampleDescription extends SampleDescription
61 {
62 int flags;
63 int timeScale;
64 int frameDuration;
65 int numberOfFrames;
66
67 public TimecodeSampleDescription(SequentialReader reader) throws IOException
68 {
69 super(reader);
70
71 reader.skip(4); // Reserved
72 flags = reader.getInt32();
73 timeScale = reader.getInt32();
74 frameDuration = reader.getInt32();
75 numberOfFrames = reader.getInt8();
76 reader.skip(1); // Reserved
77 // Source reference...
78 }
79 }
80 }