Debian Codegraph @

src/com/drew/metadata/mov/media/QuickTimeVideoDescriptor.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.media;
22
23 import com.drew.lang.annotations.NotNull;
24 import com.drew.metadata.mov.QuickTimeDescriptor;
25
26 import static com.drew.metadata.mov.media.QuickTimeVideoDirectory.*;
27
28 /**
29 * @author Payton Garland
30 */
31 public class QuickTimeVideoDescriptor extends QuickTimeDescriptor
32 {
33 public QuickTimeVideoDescriptor(@NotNull QuickTimeVideoDirectory directory)
34 {
35 super(directory);
36 }
37
38 @Override
39 public String getDescription(int tagType)
40 {
41 switch (tagType) {
42 case TAG_HEIGHT:
43 case TAG_WIDTH:
44 return getPixelDescription(tagType);
45 case TAG_DEPTH:
46 return getDepthDescription(tagType);
47 case TAG_COLOR_TABLE:
48 return getColorTableDescription(tagType);
49 case TAG_GRAPHICS_MODE:
50 return getGraphicsModeDescription();
51 default:
52 return super.getDescription(tagType);
53 }
54 }
55
56 private String getPixelDescription(int tagType)
57 {
58 String value = _directory.getString(tagType);
59 return value == null ? null : value + " pixels";
60 }
61
62 private String getDepthDescription(int tagType)
63 {
64 Integer value = _directory.getInteger(tagType);
65 if (value == null)
66 return null;
67
68 switch (value) {
69 case (1):
70 case (2):
71 case (4):
72 case (8):
73 case (16):
74 case (24):
75 case (32):
76 return value + "-bit color";
77 case (40):
78 case (36):
79 case (34):
80 return (value - 32) + "-bit grayscale";
81 default:
82 return "Unknown (" + value + ")";
83 }
84 }
85
86 private String getColorTableDescription(int tagType)
87 {
88 Integer value = _directory.getInteger(tagType);
89 if (value == null)
90 return null;
91
92 switch (value) {
93 case (-1):
94 Integer depth = _directory.getInteger(TAG_DEPTH);
95 if (depth != null && depth < 16) {
96 return "Default";
97 } else {
98 return "None";
99 }
100 case (0):
101 return "Color table within file";
102 default:
103 return "Unknown (" + value + ")";
104 }
105 }
106
107 private String getGraphicsModeDescription()
108 {
109 Integer value = _directory.getInteger(TAG_GRAPHICS_MODE);
110 if (value == null)
111 return null;
112
113 switch (value) {
114 case (0x00):
115 return "Copy";
116 case (0x40):
117 return "Dither copy";
118 case (0x20):
119 return "Blend";
120 case (0x24):
121 return "Transparent";
122 case (0x100):
123 return "Straight alpha";
124 case (0x101):
125 return "Premul white alpha";
126 case (0x102):
127 return "Premul black alpha";
128 case (0x104):
129 return "Straight alpha blend";
130 case (0x103):
131 return "Composition (dither copy)";
132 default:
133 return "Unknown (" + value + ")";
134 }
135 }
136 }