-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuickTimeAtom.cs
More file actions
183 lines (179 loc) · 7.13 KB
/
QuickTimeAtom.cs
File metadata and controls
183 lines (179 loc) · 7.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
using System;
using System.Collections.Generic;
namespace QuickTimeParser
{
static class QuickTimeAtom
{
private static readonly Dictionary<string, string> atoms = new Dictionary<string, string>
{
{"moov", "MOVie container atom"},
{"trak", "TRAcK container atom"},
{"clip", "CLIPping container atom"},
{"matt", "track MATTe container atom"},
{"edts", "EDiTS container atom"},
{"tref", "Track REFerence container atom"},
{"mdia", "MeDIA container atom"},
{"minf", "Media INFormation container atom"},
{"dinf", "Data INFormation container atom"},
{"udta", "User DaTA container atom"},
{"cmov", "Compressed MOVie container atom"},
{"rmra", "Reference Movie Record Atom"},
{"rmda", "Reference Movie Descriptor Atom"},
{"gmhd", "Generic Media info HeaDer atom (seen on QTVR)"},
{"stbl", "Sample TaBLe container atom"},
{"©cpy", ""},
{"©day", ""},
{"©dir", ""},
{"©ed1", ""},
{"©ed2", ""},
{"©ed3", ""},
{"©ed4", ""},
{"©ed5", ""},
{"©ed6", ""},
{"©ed7", ""},
{"©ed8", ""},
{"©ed9", ""},
{"©fmt", ""},
{"©inf", ""},
{"©prd", ""},
{"©prf", ""},
{"©req", ""},
{"©src", ""},
{"©wrt", ""},
{"©nam", ""},
{"©cmt", ""},
{"©wrn", ""},
{"©hst", ""},
{"©mak", ""},
{"©mod", ""},
{"©PRD", ""},
{"©swr", ""},
{"©aut", ""},
{"©ART", ""},
{"©trk", ""},
{"©alb", ""},
{"©com", ""},
{"©gen", ""},
{"©ope", ""},
{"©url", ""},
{"©enc", ""},
{"play", "auto-PLAY atom"},
{"WLOC", "Window LOCation atom"},
{"LOOP", "LOOPing atom"},
{"SelO", "play SELection Only atom"},
{"AllF", "play ALL Frames atom"},
{"name", ""},
{"MCPS", "Media Cleaner PRo"},
{"@PRM", "adobe PReMiere version"},
{"@PRQ", "adobe PRemiere Quicktime version"},
{"cmvd", "Compressed MooV Data atom"},
{"dcom", "Data COMpression atom"},
{"rdrf", "Reference movie Data ReFerence atom"},
{"url ", ""},
{"alis", ""},
{"rsrc", ""},
{"rmqu", "Reference Movie QUality atom"},
{"rmcs", "Reference Movie Cpu Speed atom"},
{"rmvc", "Reference Movie Version Check atom"},
{"rmcd", "Reference Movie Component check atom"},
{"rmdr", "Reference Movie Data Rate atom"},
{"rmla", "Reference Movie Language Atom"},
{"ptv ", "Print To Video - defines a movie's full screen mode"},
{"stsd", "Sample Table Sample Description atom"},
{"avc1", ""},
{"mp4v", ""},
{"qtvr", ""},
{"mp4a", ""},
{"raw ", "PCM"},
{"alac", "Apple Lossless Audio Codec"},
{"mp4s", ""},
{"3ivx", ""},
{"3iv1", ""},
{"3iv2", ""},
{"xvid", ""},
{"divx", ""},
{"div1", ""},
{"div2", ""},
{"div3", ""},
{"div4", ""},
{"div5", ""},
{"div6", ""},
{"stts", "Sample Table Time-to-Sample atom"},
{"stss", "Sample Table Sync Sample (key frames) atom"},
{"stsc", "Sample Table Sample-to-Chunk atom"},
{"stsz", "Sample Table SiZe atom"},
{"stco", "Sample Table Chunk Offset atom"},
{"co64", "Chunk Offset 64-bit (version of \"stco\" that supports > 2GB files)"},
{"dref", "Data REFerence atom"},
{"gmin", "base Media INformation atom"},
{"smhd", "Sound Media information HeaDer atom"},
{"vmhd", "Video Media information HeaDer atom"},
{"hdlr", "HanDLeR reference atom"},
{"mdhd", "MeDia HeaDer atom"},
{"pnot", "Preview atom"},
{"crgn", "Clipping ReGioN atom"},
{"load", "track LOAD settings atom"},
{"tmcd", "TiMe CoDe atom"},
{"chap", "CHAPter list atom"},
{"sync", "SYNChronization atom"},
{"scpt", "tranSCriPT atom"},
{"ssrc", "non-primary SouRCe atom"},
{"elst", "Edit LiST atom"},
{"kmat", "compressed MATte atom"},
{"ctab", "Color TABle atom"},
{"mvhd", "MoVie HeaDer atom"},
{"tkhd", "TracK HeaDer atom"},
{"meta", "METAdata atom"},
{"ftyp", "FileTYPe (?) atom (for MP4 it seems)"},
{"mdat", "Media DATa atom"},
{"free", "FREE space atom"},
{"skip", "SKIP atom"},
{"wide", "64-bit expansion placeholder atom"},
{"nsav", "NoSAVe atom"},
{"ctyp", "Controller TYPe atom (seen on QTVR)"},
{"pano", "PANOrama track (seen on QTVR)"},
{"hint", "HINT track"},
{"hinf", ""},
{"hinv", ""},
{"hnti", ""},
{"imgt", "IMaGe Track reference (kQTVRImageTrackRefType) (seen on QTVR)"},
{"FXTC", "Something to do with Adobe After Effects (?)"},
{"PrmA", ""},
{"code", ""},
{"FIEL", ""}
};
/// <summary>
/// Checks if found string is valid QuickTime atom
/// </summary>
/// <param name="atomName">Name of the atom</param>
/// <returns>True if found string is valid QuickTime atom, False otherwise</returns>
public static bool IsValidAtom(string atomName)
{
return atoms.ContainsKey(atomName);
}
/// <summary>
/// Checks if found atom is a container
/// </summary>
/// <param name="atomType">Name of the atom</param>
/// <returns>True if found atom is a container, False otherwise</returns>
public static bool IsContainerAtom(string atomType)
{
string[] containerAtoms = {
"moov", "trak", "mdia", "minf", "stbl", "edts", "udta", "meta",
"ilst", "dinf", "mvex", "moof", "traf", "gmhd", "rmra", "rmda"
};
return Array.IndexOf(containerAtoms, atomType) >= 0;
}
/// <summary>
/// Checks if found string is unused space atom
/// </summary>
/// <param name="atomType">Name of the atom</param>
/// <returns>True if found atom is an unused space atom, False otherwise</returns>
public static bool IsUnusedSpaceAtom(string atomType)
{
return atomType == "free" || // An atom that designates unused space in the movie data file.
atomType == "skip" || // An atom that designates unused space in the movie data file.
atomType == "wide"; // An atom that designates reserved space in the movie data file.
}
}
}