| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 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 |
|
| 31 |
|
| 32 |
|
| 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); |
| 72 |
flags = reader.getInt32(); |
| 73 |
timeScale = reader.getInt32(); |
| 74 |
frameDuration = reader.getInt32(); |
| 75 |
numberOfFrames = reader.getInt8(); |
| 76 |
reader.skip(1); |
| 77 |
|
| 78 |
} |
| 79 |
} |
| 80 |
} |