annotate TOOLS/movinfo.c @ 1197:80ca716ce5e9

Made surface locks switchable via preprocessor.
author atmosfear
date Sat, 23 Jun 2001 10:18:23 +0000
parents f8bc3143449f
children 75bd6146cc77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 // show QuickTime .mov file structure (C) 2001. by A'rpi/ESP-team
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
2 // various hacks by alex@naxine.org
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
3
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
4 /*
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
5 Blocks: 4bytes atom_size
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
6 4bytes atom_type (name)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
7 ...
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
8
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
9 By older files, mdat is at the beginning, and moov follows it later,
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
10 by newer files, moov is at the begininng.
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
11
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
12 Fontosabb typeok:
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
13
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
14 trak: track: ezeken belul van egy-egy stream (video/audio)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
15 tkhd: track header: fps (video esten picture size is itt van)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
16 vmhd: video media handler (video stream informaciok)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
17 smhd: sound media handler (audio stream informaciok)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
18 */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
23 #undef NO_SPECIAL
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
24
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
25 char *atom2human_type(int type)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
26 {
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
27 switch (type)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
28 {
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
29 case 0x766F6F6D: return ("Information sections"); /* moov */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
30 case 0x6468766D: return ("Movie header"); /* mvhd */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
31 case 0x6169646D: return ("Media stream"); /* mdia */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
32 case 0x64686D76: return ("Video media header"); /* vmhd */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
33 case 0x64686D73: return ("Sound media header"); /* smhd */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
34 case 0x6468646D: return ("Media header"); /* mdhd */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
35 case 0x666E696D: return ("Media information"); /* minf */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
36 case 0x726C6468: return ("Handler.."); /* hdlr */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
37 case 0x6B617274: return ("New track (stream)"); /* trak */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
38 case 0x75716D72: return ("rmqu");
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
39 case 0x65657266: return ("free");
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
40 case 0x64686B74: return ("Track header"); /* tkhd */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
41 case 0x61746475: return ("User data"); /* udta */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
42 case 0x7461646D: return ("Movie data"); /* mdat */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
43 case 0x6C627473: return ("Sample information table"); /* stbl */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
44 case 0x64737473: return ("Sample description"); /* stsd */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
45 case 0x6F637473: return ("Chunk offset table"); /* stco */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
46 case 0x73747473: return ("Sample time table"); /* stts */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
47 case 0x63737473: return ("Sample->Chunk mapping table"); /* stsc */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
48 case 0x7A737473: return ("Sample size table"); /* stsz */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
49 }
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
50 return("unknown");
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
51 }
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
52
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
53 #define S_NONE 0
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
54 #define S_AUDIO 1
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
55 #define S_VIDEO 2
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
56 int stream = S_NONE;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
57 int v_stream = 0;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
58 int a_stream = 0;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
59
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 unsigned int read_dword(FILE *f){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 unsigned char atom_size_b[4];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 if(fread(&atom_size_b,4,1,f)<=0) return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 return (atom_size_b[0]<<24)|(atom_size_b[1]<<16)|(atom_size_b[2]<<8)|atom_size_b[3];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
66 void *video_stream_info(FILE *f, int len)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
67 {
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
68 int orig_pos = ftell(f);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
69 unsigned char data[len-8];
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
70 int i;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
71 char codec[len-8];
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
72
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
73 len -= 8;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
74 for (i=0; i<len; i++)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
75 fread(&data[i], 1, 1, f);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
76
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
77 strncpy(codec, &data[43], len-43);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
78 printf(" [codec: %s]\n", &codec);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
79 fseek(f,orig_pos,SEEK_SET);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
80 }
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
81
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
82 void *audio_stream_info(FILE *f, int len)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
83 {
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
84 int orig_pos = ftell(f);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
85 unsigned char data[len-8];
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
86 int i;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
87
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
88 len -= 8;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
89 for (i=0; i<len; i++)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
90 fread(&data[i], 1, 1, f);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
91
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
92 printf(" [%d bit", data[19]);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
93 if (data[17] == 1)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
94 printf(" mono");
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
95 else
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
96 printf(" %d channels", data[17]);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
97 printf("]\n");
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
98 fseek(f,orig_pos,SEEK_SET);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
99 }
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
100
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 void lschunks(FILE *f,int level,unsigned int endpos){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 unsigned int atom_size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 unsigned int atom_type;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 int pos;
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
105
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 while(endpos==0 || ftell(f)<endpos){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 pos=ftell(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 atom_size=read_dword(f);// if(fread(&atom_size_b,4,1,f)<=0) break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 if(fread(&atom_type,4,1,f)<=0) break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 if(atom_size<8) break; // error
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
113 printf("%08X: %*s %.4s (%08X) %05d [%s] (begin: %08X)\n",pos,level*2,"",&atom_type,atom_type,atom_size,
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
114 atom2human_type(atom_type), pos+8); // 8: atom_size fields (4) + atom_type fields (4)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
115
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
116 #ifndef NO_SPECIAL
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
117 if (atom_type == 0x64686D76)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
118 {
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
119 stream = S_VIDEO;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
120 printf(" Found VIDEO Stream #%d\n", v_stream++);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
121 }
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
122
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
123 if (atom_type == 0x64686D73)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
124 {
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
125 stream = S_AUDIO;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
126 printf(" Found AUDIO Stream #%d\n", a_stream++);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
127 }
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
128
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
129 if (atom_type == 0x64686B74) // tkhd - track header
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
130 {
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
131 int i;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
132 unsigned char data[atom_size];
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
133 int fps, x, y;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
134
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
135 for (i=0; i<atom_size; i++)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
136 fread(&data[i], 1, 1, f);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
137
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
138 fps = data[3];
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
139 x = data[77];
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
140 y = data[81];
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
141 printf(" Movie fps: %d\n", fps); /* na ez itt az atbaszas ;( */
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
142 printf(" Picture size: %dx%d\n", x, y);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
143 if (x == 0 && y == 0)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
144 printf(" Possible audio stream!\n");
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
145 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 if(atom_type==0x64737473) { // stsd
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 unsigned int tmp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 unsigned int count;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 fread(&tmp,4,1,f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 count=read_dword(f);// fread(&count,4,1,f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 printf("desc count = %d\n",count);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 for(i=0;i<count;i++){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155 unsigned int len;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 unsigned int format;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 len=read_dword(f); // fread(&len,4,1,f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158 fread(&format,4,1,f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 printf(" desc #%d: %.4s (%d)\n",i+1,&format,len);
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
160 if (stream == S_VIDEO)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
161 video_stream_info(f, len);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
162 if (stream == S_AUDIO)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
163 audio_stream_info(f, len);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 fseek(f,len-8,SEEK_CUR);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 if(atom_type==0x6F637473) { // stco
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 int len,i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 len=read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 printf("Chunk table size :%d\n",len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 for(i=0;i<len;i++) printf(" chunk #%d: 0x%X\n",i+1,read_dword(f));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 if(atom_type==0x73747473) { // stts
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 int len,i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 len=read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 printf("T->S table size :%d\n",len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 for(i=0;i<len;i++){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 int num=read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 int dur=read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 printf("%5d samples: %d duration\n",num,dur);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 if(atom_type==0x63737473) { // stsc
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 int len,i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 len=read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 printf("S->C table size :%d\n",len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 for(i=0;i<len;i++){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 int first=read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 int spc=read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 int sdid=read_dword(f);
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
198 if (stream == S_AUDIO)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
199 printf(" chunk from %d: %d Khz (desc: %d)\n", first, spc, sdid);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
200 else
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
201 printf(" chunk %d... %d s/c desc: %d\n",first,spc,sdid);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 if(atom_type==0x7A737473) { // stsz
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 int len,i,ss;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 ss=read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 len=read_dword(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 printf("Sample size table len: %d\n",len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 if(ss){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 printf(" common sample size: %d bytes\n",ss);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 } else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 for(i=0;i<len;i++) printf(" sample #%d: %d bytes\n",i+1,read_dword(f));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 }
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
217 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 #if 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 switch(atom_type){
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
221 case 0x7461646D: // mdat Movie data
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 case 0x75716D72: // rmqu
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 case 0x65657266: // free JUNK
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 case 0x64686B74: // tkhd Track header
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 case 0x61746475: // udta User data
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226 case 0x64737473: // stsd Sample description
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 case 0x6F637473: // stco Chunk offset table
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 case 0x73747473: // stts Sample time table
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 case 0x63737473: // stsc Sample->Chunk mapping table
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 case 0x7A737473: // stsz Sample size table
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 default: lschunks(f,level+1,pos+atom_size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 switch(atom_type){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 case 0x766F6F6D: // moov
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 case 0x61726D72: // rmra
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238 case 0x61646D72: // rmda
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 lschunks(f,level+1,pos+atom_size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242 fseek(f,pos+atom_size,SEEK_SET);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
246 int main(int argc,char* argv[])
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
247 {
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
248 FILE *f;
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
249
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
250 if ((f = fopen(argc>1?argv[1]:"Akira.mov","rb")) == NULL)
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
251 return 1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
253 printf("%.8s %.4s (%.8s) %05s [%s]\n\n",
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
254 "position", "atom", "atomtype", "len", "human readable atom name");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255
1175
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
256 lschunks(f, 0, 0);
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
257
f8bc3143449f sok hacking
al3x
parents: 1
diff changeset
258 printf("\nSummary: streams: %d video/%d audio\n", v_stream, a_stream);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 }