aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/old/asf_extractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/old/asf_extractor.c')
-rw-r--r--src/plugins/old/asf_extractor.c440
1 files changed, 270 insertions, 170 deletions
diff --git a/src/plugins/old/asf_extractor.c b/src/plugins/old/asf_extractor.c
index 0581ded..6be0a16 100644
--- a/src/plugins/old/asf_extractor.c
+++ b/src/plugins/old/asf_extractor.c
@@ -110,199 +110,288 @@ static const struct
110{ 110{
111 const char *name; 111 const char *name;
112 const LE_GUID guid; 112 const LE_GUID guid;
113} guids[] = 113} guids[] = {
114{
115 { 114 {
116 "error", 115 "error",
117 { 116 {
118 0x0,}}, 117 0x0,
119 /* base ASF objects */ 118 }
119 },
120 /* base ASF objects */
120 { 121 {
121 "header", 122 "header",
122 { 123 {
123 0x75b22630, 0x668e, 0x11cf, 124 0x75b22630, 0x668e, 0x11cf,
124 { 125 {
125 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}}}, 126 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c
127 }
128 }
129 },
126 { 130 {
127 "data", 131 "data",
128 { 132 {
129 0x75b22636, 0x668e, 0x11cf, 133 0x75b22636, 0x668e, 0x11cf,
130 { 134 {
131 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}}}, 135 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c
136 }
137 }
138 },
132 { 139 {
133 "simple index", 140 "simple index",
134 { 141 {
135 0x33000890, 0xe5b1, 0x11cf, 142 0x33000890, 0xe5b1, 0x11cf,
136 { 143 {
137 0x89, 0xf4, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb}}}, 144 0x89, 0xf4, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb
138 /* header ASF objects */ 145 }
146 }
147 },
148 /* header ASF objects */
139 { 149 {
140 "file properties", 150 "file properties",
141 { 151 {
142 0x8cabdca1, 0xa947, 0x11cf, 152 0x8cabdca1, 0xa947, 0x11cf,
143 { 153 {
144 0x8e, 0xe4, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65}}}, 154 0x8e, 0xe4, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65
155 }
156 }
157 },
145 { 158 {
146 "stream header", 159 "stream header",
147 { 160 {
148 0xb7dc0791, 0xa9b7, 0x11cf, 161 0xb7dc0791, 0xa9b7, 0x11cf,
149 { 162 {
150 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65}}}, 163 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65
164 }
165 }
166 },
151 { 167 {
152 "stream bitrate properties", /* (http://get.to/sdp) */ 168 "stream bitrate properties", /* (http://get.to/sdp) */
153 { 169 {
154 0x7bf875ce, 0x468d, 0x11d1, 170 0x7bf875ce, 0x468d, 0x11d1,
155 { 171 {
156 0x8d, 0x82, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2}}}, 172 0x8d, 0x82, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2
173 }
174 }
175 },
157 { 176 {
158 "content description", 177 "content description",
159 { 178 {
160 0x75b22633, 0x668e, 0x11cf, 179 0x75b22633, 0x668e, 0x11cf,
161 { 180 {
162 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}}}, 181 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c
182 }
183 }
184 },
163 { 185 {
164 "extended content encryption", 186 "extended content encryption",
165 { 187 {
166 0x298ae614, 0x2622, 0x4c17, 188 0x298ae614, 0x2622, 0x4c17,
167 { 189 {
168 0xb9, 0x35, 0xda, 0xe0, 0x7e, 0xe9, 0x28, 0x9c}}}, 190 0xb9, 0x35, 0xda, 0xe0, 0x7e, 0xe9, 0x28, 0x9c
191 }
192 }
193 },
169 { 194 {
170 "script command", 195 "script command",
171 { 196 {
172 0x1efb1a30, 0x0b62, 0x11d0, 197 0x1efb1a30, 0x0b62, 0x11d0,
173 { 198 {
174 0xa3, 0x9b, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6}}}, 199 0xa3, 0x9b, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6
200 }
201 }
202 },
175 { 203 {
176 "marker", 204 "marker",
177 { 205 {
178 0xf487cd01, 0xa951, 0x11cf, 206 0xf487cd01, 0xa951, 0x11cf,
179 { 207 {
180 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65}}}, 208 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65
209 }
210 }
211 },
181 { 212 {
182 "header extension", 213 "header extension",
183 { 214 {
184 0x5fbf03b5, 0xa92e, 0x11cf, 215 0x5fbf03b5, 0xa92e, 0x11cf,
185 { 216 {
186 0x8e, 0xe3, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65}}}, 217 0x8e, 0xe3, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65
218 }
219 }
220 },
187 { 221 {
188 "bitrate mutual exclusion", 222 "bitrate mutual exclusion",
189 { 223 {
190 0xd6e229dc, 0x35da, 0x11d1, 224 0xd6e229dc, 0x35da, 0x11d1,
191 { 225 {
192 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe}}}, 226 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe
227 }
228 }
229 },
193 { 230 {
194 "codec list", 231 "codec list",
195 { 232 {
196 0x86d15240, 0x311d, 0x11d0, 233 0x86d15240, 0x311d, 0x11d0,
197 { 234 {
198 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6}}}, 235 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6
236 }
237 }
238 },
199 { 239 {
200 "extended content description", 240 "extended content description",
201 { 241 {
202 0xd2d0a440, 0xe307, 0x11d2, 242 0xd2d0a440, 0xe307, 0x11d2,
203 { 243 {
204 0x97, 0xf0, 0x00, 0xa0, 0xc9, 0x5e, 0xa8, 0x50}}}, 244 0x97, 0xf0, 0x00, 0xa0, 0xc9, 0x5e, 0xa8, 0x50
245 }
246 }
247 },
205 { 248 {
206 "error correction", 249 "error correction",
207 { 250 {
208 0x75b22635, 0x668e, 0x11cf, 251 0x75b22635, 0x668e, 0x11cf,
209 { 252 {
210 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}}}, 253 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c
254 }
255 }
256 },
211 { 257 {
212 "padding", 258 "padding",
213 { 259 {
214 0x1806d474, 0xcadf, 0x4509, 260 0x1806d474, 0xcadf, 0x4509,
215 { 261 {
216 0xa4, 0xba, 0x9a, 0xab, 0xcb, 0x96, 0xaa, 0xe8}}}, 262 0xa4, 0xba, 0x9a, 0xab, 0xcb, 0x96, 0xaa, 0xe8
217 /* stream properties object stream type */ 263 }
264 }
265 },
266 /* stream properties object stream type */
218 { 267 {
219 "audio media", 268 "audio media",
220 { 269 {
221 0xf8699e40, 0x5b4d, 0x11cf, 270 0xf8699e40, 0x5b4d, 0x11cf,
222 { 271 {
223 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b}}}, 272 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b
273 }
274 }
275 },
224 { 276 {
225 "video media", 277 "video media",
226 { 278 {
227 0xbc19efc0, 0x5b4d, 0x11cf, 279 0xbc19efc0, 0x5b4d, 0x11cf,
228 { 280 {
229 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b}}}, 281 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b
282 }
283 }
284 },
230 { 285 {
231 "command media", 286 "command media",
232 { 287 {
233 0x59dacfc0, 0x59e6, 0x11d0, 288 0x59dacfc0, 0x59e6, 0x11d0,
234 { 289 {
235 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6}}}, 290 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6
236 /* stream properties object error correction */ 291 }
292 }
293 },
294 /* stream properties object error correction */
237 { 295 {
238 "no error correction", 296 "no error correction",
239 { 297 {
240 0x20fb5700, 0x5b55, 0x11cf, 298 0x20fb5700, 0x5b55, 0x11cf,
241 { 299 {
242 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b}}}, 300 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b
301 }
302 }
303 },
243 { 304 {
244 "audio spread", 305 "audio spread",
245 { 306 {
246 0xbfc3cd50, 0x618f, 0x11cf, 307 0xbfc3cd50, 0x618f, 0x11cf,
247 { 308 {
248 0x8b, 0xb2, 0x00, 0xaa, 0x00, 0xb4, 0xe2, 0x20}}}, 309 0x8b, 0xb2, 0x00, 0xaa, 0x00, 0xb4, 0xe2, 0x20
249 /* mutual exclusion object exlusion type */ 310 }
311 }
312 },
313 /* mutual exclusion object exlusion type */
250 { 314 {
251 "mutex bitrate", 315 "mutex bitrate",
252 { 316 {
253 0xd6e22a01, 0x35da, 0x11d1, 317 0xd6e22a01, 0x35da, 0x11d1,
254 { 318 {
255 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe}}}, 319 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe
320 }
321 }
322 },
256 { 323 {
257 "mutex unknown", 324 "mutex unknown",
258 { 325 {
259 0xd6e22a02, 0x35da, 0x11d1, 326 0xd6e22a02, 0x35da, 0x11d1,
260 { 327 {
261 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe}}}, 328 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe
262 /* header extension */ 329 }
330 }
331 },
332 /* header extension */
263 { 333 {
264 "reserved_1", 334 "reserved_1",
265 { 335 {
266 0xabd3d211, 0xa9ba, 0x11cf, 336 0xabd3d211, 0xa9ba, 0x11cf,
267 { 337 {
268 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65}}}, 338 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65
269 /* script command */ 339 }
340 }
341 },
342 /* script command */
270 { 343 {
271 "reserved script command", 344 "reserved script command",
272 { 345 {
273 0x4B1ACBE3, 0x100B, 0x11D0, 346 0x4B1ACBE3, 0x100B, 0x11D0,
274 { 347 {
275 0xA3, 0x9B, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6}}}, 348 0xA3, 0x9B, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6
276 /* marker object */ 349 }
350 }
351 },
352 /* marker object */
277 { 353 {
278 "reserved marker", 354 "reserved marker",
279 { 355 {
280 0x4CFEDB20, 0x75F6, 0x11CF, 356 0x4CFEDB20, 0x75F6, 0x11CF,
281 { 357 {
282 0x9C, 0x0F, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB}}}, 358 0x9C, 0x0F, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB
283 /* various */ 359 }
284 /* Already defined (reserved_1) 360 }
285 { "head2", 361 },
286 { 0xabd3d211, 0xa9ba, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} }, 362 /* various */
287 */ 363 /* Already defined (reserved_1)
364 { "head2",
365 { 0xabd3d211, 0xa9ba, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} },
366 */
288 { 367 {
289 "audio conceal none", 368 "audio conceal none",
290 { 369 {
291 0x49f1a440, 0x4ece, 0x11d0, 370 0x49f1a440, 0x4ece, 0x11d0,
292 { 371 {
293 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6}}}, 372 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6
373 }
374 }
375 },
294 { 376 {
295 "codec comment1 header", 377 "codec comment1 header",
296 { 378 {
297 0x86d15241, 0x311d, 0x11d0, 379 0x86d15241, 0x311d, 0x11d0,
298 { 380 {
299 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6}}}, 381 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6
382 }
383 }
384 },
300 { 385 {
301 "asf 2.0 header", 386 "asf 2.0 header",
302 { 387 {
303 0xd6e229d1, 0x35da, 0x11d1, 388 0xd6e229d1, 0x35da, 0x11d1,
304 { 389 {
3050x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe}}},}; 390 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe
391 }
392 }
393 },
394};
306 395
307 396
308struct demux_asf_s 397struct demux_asf_s
@@ -326,7 +415,7 @@ struct demux_asf_s
326}; 415};
327 416
328static int 417static int
329readBuf (struct demux_asf_s * this, void *buf, int len) 418readBuf (struct demux_asf_s *this, void *buf, int len)
330{ 419{
331 int min; 420 int min;
332 421
@@ -338,8 +427,9 @@ readBuf (struct demux_asf_s * this, void *buf, int len)
338 return min; 427 return min;
339} 428}
340 429
430
341static uint8_t 431static uint8_t
342get_byte (struct demux_asf_s * this) 432get_byte (struct demux_asf_s *this)
343{ 433{
344 uint8_t buf; 434 uint8_t buf;
345 int i; 435 int i;
@@ -350,8 +440,9 @@ get_byte (struct demux_asf_s * this)
350 return buf; 440 return buf;
351} 441}
352 442
443
353static uint16_t 444static uint16_t
354get_le16 (struct demux_asf_s * this) 445get_le16 (struct demux_asf_s *this)
355{ 446{
356 uint8_t buf[2]; 447 uint8_t buf[2];
357 int i; 448 int i;
@@ -362,8 +453,9 @@ get_le16 (struct demux_asf_s * this)
362 return buf[0] | (buf[1] << 8); 453 return buf[0] | (buf[1] << 8);
363} 454}
364 455
456
365static uint32_t 457static uint32_t
366get_le32 (struct demux_asf_s * this) 458get_le32 (struct demux_asf_s *this)
367{ 459{
368 uint8_t buf[4]; 460 uint8_t buf[4];
369 int i; 461 int i;
@@ -374,8 +466,9 @@ get_le32 (struct demux_asf_s * this)
374 return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); 466 return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
375} 467}
376 468
469
377static uint64_t 470static uint64_t
378get_le64 (struct demux_asf_s * this) 471get_le64 (struct demux_asf_s *this)
379{ 472{
380 uint8_t buf[8]; 473 uint8_t buf[8];
381 int i; 474 int i;
@@ -384,16 +477,17 @@ get_le64 (struct demux_asf_s * this)
384 if (i != 8) 477 if (i != 8)
385 this->status = DEMUX_FINISHED; 478 this->status = DEMUX_FINISHED;
386 return (uint64_t) buf[0] 479 return (uint64_t) buf[0]
387 | ((uint64_t) buf[1] << 8) 480 | ((uint64_t) buf[1] << 8)
388 | ((uint64_t) buf[2] << 16) 481 | ((uint64_t) buf[2] << 16)
389 | ((uint64_t) buf[3] << 24) 482 | ((uint64_t) buf[3] << 24)
390 | ((uint64_t) buf[4] << 32) 483 | ((uint64_t) buf[4] << 32)
391 | ((uint64_t) buf[5] << 40) 484 | ((uint64_t) buf[5] << 40)
392 | ((uint64_t) buf[6] << 48) | ((uint64_t) buf[7] << 54); 485 | ((uint64_t) buf[6] << 48) | ((uint64_t) buf[7] << 54);
393} 486}
394 487
488
395static int 489static int
396get_guid (struct demux_asf_s * this) 490get_guid (struct demux_asf_s *this)
397{ 491{
398 int i; 492 int i;
399 LE_GUID g; 493 LE_GUID g;
@@ -406,7 +500,7 @@ get_guid (struct demux_asf_s * this)
406 if (this->status == DEMUX_FINISHED) 500 if (this->status == DEMUX_FINISHED)
407 return GUID_ERROR; 501 return GUID_ERROR;
408 for (i = 1; i < GUID_END; i++) 502 for (i = 1; i < GUID_END; i++)
409 if (!memcmp (&g, &guids[i].guid, sizeof (LE_GUID))) 503 if (! memcmp (&g, &guids[i].guid, sizeof (LE_GUID)))
410 return i; 504 return i;
411 505
412 return GUID_ERROR; 506 return GUID_ERROR;
@@ -414,7 +508,7 @@ get_guid (struct demux_asf_s * this)
414 508
415 509
416static int 510static int
417asf_read_header (struct demux_asf_s * this) 511asf_read_header (struct demux_asf_s *this)
418{ 512{
419 int guid; 513 int guid;
420 uint64_t gsize; 514 uint64_t gsize;
@@ -426,62 +520,67 @@ asf_read_header (struct demux_asf_s * this)
426 get_le64 (this); /* object size */ 520 get_le64 (this); /* object size */
427 get_le32 (this); /* number of header objects */ 521 get_le32 (this); /* number of header objects */
428 get_byte (this); /* reserved 1 */ 522 get_byte (this); /* reserved 1 */
429 get_byte (this); /* reserved 2 */ 523 get_byte (this); /* reserved 2 */
430 while (this->status != DEMUX_FINISHED) 524 while (this->status != DEMUX_FINISHED)
525 {
526 guid = get_guid (this); /* object ID */
527 gsize = get_le64 (this); /* object size */
528 if (gsize < 24)
529 goto fail;
530 switch (guid)
431 { 531 {
432 guid = get_guid (this); /* object ID */ 532 case GUID_ASF_FILE_PROPERTIES:
433 gsize = get_le64 (this); /* object size */ 533 guid = get_guid (this); /* file ID */
434 if (gsize < 24) 534 get_le64 (this); /* file size */
435 goto fail; 535 get_le64 (this); /* creation date */
436 switch (guid) 536 get_le64 (this); /* nb_packets */
437 { 537 this->length = get_le64 (this); /* play duration in 100 ns units */
438 case GUID_ASF_FILE_PROPERTIES: 538 get_le64 (this); /* send duration */
439 guid = get_guid (this); /* file ID */ 539 get_le64 (this); /* preroll */
440 get_le64 (this); /* file size */ 540 get_le32 (this); /* flags */
441 get_le64 (this); /* creation date */ 541 get_le32 (this); /* min size */
442 get_le64 (this); /* nb_packets */ 542 get_le32 (this); /* max size */
443 this->length = get_le64 (this); /* play duration in 100 ns units */ 543 get_le32 (this); /* max bitrate */
444 get_le64 (this); /* send duration */ 544 break;
445 get_le64 (this); /* preroll */ 545 case GUID_ASF_DATA:
446 get_le32 (this); /* flags */ 546 goto headers_ok;
447 get_le32 (this); /* min size */ 547 break;
448 get_le32 (this); /* max size */ 548 case GUID_ASF_CONTENT_DESCRIPTION:
449 get_le32 (this); /* max bitrate */ 549 len1 = get_le16 (this);
450 break; 550 len2 = get_le16 (this);
451 case GUID_ASF_DATA: 551 len3 = get_le16 (this);
452 goto headers_ok; 552 len4 = get_le16 (this);
453 break; 553 len5 = get_le16 (this);
454 case GUID_ASF_CONTENT_DESCRIPTION: 554 this->title = EXTRACTOR_common_convert_to_utf8 (
455 len1 = get_le16 (this); 555 &this->input[this->inputPos],
456 len2 = get_le16 (this); 556 len1,
457 len3 = get_le16 (this); 557 "UTF-16");
458 len4 = get_le16 (this); 558 this->inputPos += len1;
459 len5 = get_le16 (this); 559 this->author = EXTRACTOR_common_convert_to_utf8 (
460 this->title = EXTRACTOR_common_convert_to_utf8 (&this->input[this->inputPos], 560 &this->input[this->inputPos],
461 len1, 561 len2,
462 "UTF-16"); 562 "UTF-16");
463 this->inputPos += len1; 563 this->inputPos += len2;
464 this->author = EXTRACTOR_common_convert_to_utf8 (&this->input[this->inputPos], 564 this->copyright = EXTRACTOR_common_convert_to_utf8 (
465 len2, 565 &this->input[this->inputPos],
466 "UTF-16"); 566 len3,
467 this->inputPos += len2; 567 "UTF-16");
468 this->copyright = EXTRACTOR_common_convert_to_utf8 (&this->input[this->inputPos], 568 this->inputPos += len3;
469 len3, 569 this->comment = EXTRACTOR_common_convert_to_utf8 (
470 "UTF-16"); 570 &this->input[this->inputPos],
471 this->inputPos += len3; 571 len4,
472 this->comment = EXTRACTOR_common_convert_to_utf8 (&this->input[this->inputPos], 572 "UTF-16");
473 len4, 573 this->inputPos += len4;
474 "UTF-16"); 574 this->rating = EXTRACTOR_common_convert_to_utf8 (
475 this->inputPos += len4; 575 &this->input[this->inputPos],
476 this->rating = EXTRACTOR_common_convert_to_utf8 (&this->input[this->inputPos], 576 len5,
477 len5, 577 "UTF-16");
478 "UTF-16"); 578 this->inputPos += len5;
479 this->inputPos += len5; 579 break;
480 break; 580 default:
481 default: 581 this->inputPos += gsize - 24;
482 this->inputPos += gsize - 24;
483 }
484 } 582 }
583 }
485 584
486headers_ok: 585headers_ok:
487 this->inputPos += sizeof (LE_GUID) + 10; 586 this->inputPos += sizeof (LE_GUID) + 10;
@@ -502,12 +601,12 @@ fail:
502 video/x-ms-wax: wva: wma metafile; */ 601 video/x-ms-wax: wva: wma metafile; */
503 602
504/* mimetype = application/applefile */ 603/* mimetype = application/applefile */
505int 604int
506EXTRACTOR_asf_extract (const char *data, 605EXTRACTOR_asf_extract (const char *data,
507 size_t size, 606 size_t size,
508 EXTRACTOR_MetaDataProcessor proc, 607 EXTRACTOR_MetaDataProcessor proc,
509 void *proc_cls, 608 void *proc_cls,
510 const char *options) 609 const char *options)
511{ 610{
512 struct demux_asf_s this; 611 struct demux_asf_s this;
513 size_t slen; 612 size_t slen;
@@ -521,60 +620,60 @@ EXTRACTOR_asf_extract (const char *data,
521 ret = 0; 620 ret = 0;
522 if (1 == asf_read_header (&this)) 621 if (1 == asf_read_header (&this))
523 { 622 {
524 snprintf (duration_str, 623 snprintf (duration_str,
525 sizeof (duration_str), 624 sizeof (duration_str),
526 "%llu ms", (unsigned long long) (this.length / 10000LL)); 625 "%llu ms", (unsigned long long) (this.length / 10000LL));
527 if ( ( (this.title != NULL) && 626 if ( ( (this.title != NULL) &&
528 (0 < (slen = strlen(this.title))) && 627 (0 < (slen = strlen (this.title))) &&
529 (0 != proc (proc_cls, 628 (0 != proc (proc_cls,
530 "asf", 629 "asf",
531 EXTRACTOR_METATYPE_TITLE, 630 EXTRACTOR_METATYPE_TITLE,
532 EXTRACTOR_METAFORMAT_C_STRING, 631 EXTRACTOR_METAFORMAT_C_STRING,
533 "text/plain", 632 "text/plain",
534 this.title, 633 this.title,
535 slen + 1)) ) || 634 slen + 1)) ) ||
536 ( (this.author != NULL) && 635 ( (this.author != NULL) &&
537 (0 < (slen = strlen(this.author))) && 636 (0 < (slen = strlen (this.author))) &&
538 (0 != proc (proc_cls, 637 (0 != proc (proc_cls,
539 "asf", 638 "asf",
540 EXTRACTOR_METATYPE_AUTHOR_NAME, 639 EXTRACTOR_METATYPE_AUTHOR_NAME,
541 EXTRACTOR_METAFORMAT_C_STRING, 640 EXTRACTOR_METAFORMAT_C_STRING,
542 "text/plain", 641 "text/plain",
543 this.author, 642 this.author,
544 slen + 1)) ) || 643 slen + 1)) ) ||
545 ( (this.comment != NULL) && 644 ( (this.comment != NULL) &&
546 (0 < (slen = strlen(this.comment))) && 645 (0 < (slen = strlen (this.comment))) &&
547 (0 != proc (proc_cls, 646 (0 != proc (proc_cls,
548 "asf", 647 "asf",
549 EXTRACTOR_METATYPE_COMMENT, 648 EXTRACTOR_METATYPE_COMMENT,
550 EXTRACTOR_METAFORMAT_C_STRING, 649 EXTRACTOR_METAFORMAT_C_STRING,
551 "text/plain", 650 "text/plain",
552 this.comment, 651 this.comment,
553 slen + 1)) ) || 652 slen + 1)) ) ||
554 ( (this.copyright != NULL) && 653 ( (this.copyright != NULL) &&
555 (0 < (slen = strlen(this.copyright))) && 654 (0 < (slen = strlen (this.copyright))) &&
556 (0 != proc (proc_cls, 655 (0 != proc (proc_cls,
557 "asf", 656 "asf",
558 EXTRACTOR_METATYPE_COPYRIGHT, 657 EXTRACTOR_METATYPE_COPYRIGHT,
559 EXTRACTOR_METAFORMAT_C_STRING, 658 EXTRACTOR_METAFORMAT_C_STRING,
560 "text/plain", 659 "text/plain",
561 this.copyright, 660 this.copyright,
562 slen + 1)) ) || 661 slen + 1)) ) ||
563 (0 != proc (proc_cls, 662 (0 != proc (proc_cls,
564 "asf", 663 "asf",
565 EXTRACTOR_METATYPE_MIMETYPE, 664 EXTRACTOR_METATYPE_MIMETYPE,
566 EXTRACTOR_METAFORMAT_C_STRING, 665 EXTRACTOR_METAFORMAT_C_STRING,
567 "text/plain", 666 "text/plain",
568 "video/x-ms-asf", 667 "video/x-ms-asf",
569 strlen("video/x-ms-asf") + 1)) || 668 strlen ("video/x-ms-asf") + 1)) ||
570 (0 != proc (proc_cls, 669 (0 != proc (proc_cls,
571 "asf", 670 "asf",
572 EXTRACTOR_METATYPE_DURATION, 671 EXTRACTOR_METATYPE_DURATION,
573 EXTRACTOR_METAFORMAT_C_STRING, 672 EXTRACTOR_METAFORMAT_C_STRING,
574 "text/plain", 673 "text/plain",
575 duration_str, 674 duration_str,
576 strlen(duration_str) + 1)) ) 675 strlen (duration_str) + 1)) )
577 ret = 1; 676 ret = 1;
578 } 677 }
579 free (this.title); 678 free (this.title);
580 free (this.author); 679 free (this.author);
@@ -584,4 +683,5 @@ EXTRACTOR_asf_extract (const char *data,
584 return ret; 683 return ret;
585} 684}
586 685
686
587/* end of asf_extractor.c */ 687/* end of asf_extractor.c */