Debian Codegraph @

src/com/drew/metadata/mov/atoms/TimecodeInformationMediaAtom.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.metadata.mov.media.QuickTimeTimecodeDirectory;
25
26 import java.io.IOException;
27
28 /**
29 * https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-BBCBEAGJ
30 *
31 * @author Payton Garland
32 */
33 public class TimecodeInformationMediaAtom extends FullAtom
34 {
35 int textFont;
36 int textFace;
37 int textSize;
38 int[] textColor;
39 int[] backgroundColor;
40 String fontName;
41
42 public TimecodeInformationMediaAtom(SequentialReader reader, Atom atom) throws IOException
43 {
44 super(reader, atom);
45
46 textFont = reader.getInt16();
47 textFace = reader.getInt16();
48 textSize = reader.getInt16();
49 reader.skip(2); // Reserved
50 textColor = new int[]{reader.getUInt16(), reader.getUInt16(), reader.getUInt16()};
51 backgroundColor = new int[]{reader.getUInt16(), reader.getUInt16(), reader.getUInt16()};
52 fontName = reader.getString(reader.getUInt8());
53 }
54
55 public void addMetadata(QuickTimeTimecodeDirectory directory)
56 {
57 directory.setInt(QuickTimeTimecodeDirectory.TAG_TEXT_FONT, textFont);
58 switch (textFace) {
59 case (0x0001):
60 directory.setString(QuickTimeTimecodeDirectory.TAG_TEXT_FACE, "Bold");
61 break;
62 case (0x0002):
63 directory.setString(QuickTimeTimecodeDirectory.TAG_TEXT_FACE, "Italic");
64 break;
65 case (0x0004):
66 directory.setString(QuickTimeTimecodeDirectory.TAG_TEXT_FACE, "Underline");
67 break;
68 case (0x0008):
69 directory.setString(QuickTimeTimecodeDirectory.TAG_TEXT_FACE, "Outline");
70 break;
71 case (0x0010):
72 directory.setString(QuickTimeTimecodeDirectory.TAG_TEXT_FACE, "Shadow");
73 break;
74 case (0x0020):
75 directory.setString(QuickTimeTimecodeDirectory.TAG_TEXT_FACE, "Condense");
76 break;
77 case (0x0040):
78 directory.setString(QuickTimeTimecodeDirectory.TAG_TEXT_FACE, "Extend");
79 }
80
81 directory.setInt(QuickTimeTimecodeDirectory.TAG_TEXT_SIZE, textSize);
82 directory.setIntArray(QuickTimeTimecodeDirectory.TAG_TEXT_COLOR, textColor);
83 directory.setIntArray(QuickTimeTimecodeDirectory.TAG_BACKGROUND_COLOR, backgroundColor);
84 directory.setString(QuickTimeTimecodeDirectory.TAG_FONT_NAME, fontName);
85 }
86 }