summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/metadata/asf.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/apps/metadata/asf.c b/apps/metadata/asf.c
index 19dba02416..bbb7298870 100644
--- a/apps/metadata/asf.c
+++ b/apps/metadata/asf.c
@@ -235,7 +235,7 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
235 235
236 asf_read_object_header((asf_object_t *) &header, fd); 236 asf_read_object_header((asf_object_t *) &header, fd);
237 237
238 DEBUGF("header.size=%d\n",(int)header.size); 238 //DEBUGF("header.size=%d\n",(int)header.size);
239 if (header.size < 30) { 239 if (header.size < 30) {
240 /* invalid size for header object */ 240 /* invalid size for header object */
241 return ASF_ERROR_OBJECT_SIZE; 241 return ASF_ERROR_OBJECT_SIZE;
@@ -246,7 +246,7 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
246 /* Two reserved bytes - do we need to read them? */ 246 /* Two reserved bytes - do we need to read them? */
247 lseek(fd, 2, SEEK_CUR); 247 lseek(fd, 2, SEEK_CUR);
248 248
249 DEBUGF("Read header - size=%d, subobjects=%d\n",(int)header.size, (int)subobjects); 249 //DEBUGF("Read header - size=%d, subobjects=%d\n",(int)header.size, (int)subobjects);
250 250
251 if (subobjects > 0) { 251 if (subobjects > 0) {
252 header.datalen = header.size - 30; 252 header.datalen = header.size - 30;
@@ -255,16 +255,16 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
255 datalen = header.datalen; 255 datalen = header.datalen;
256 256
257 for (i=0; i<(int)subobjects; i++) { 257 for (i=0; i<(int)subobjects; i++) {
258 DEBUGF("Parsing header object %d - datalen=%d\n",i,(int)datalen); 258 //DEBUGF("Parsing header object %d - datalen=%d\n",i,(int)datalen);
259 if (datalen < 24) { 259 if (datalen < 24) {
260 DEBUGF("not enough data for reading object\n"); 260 //DEBUGF("not enough data for reading object\n");
261 break; 261 break;
262 } 262 }
263 263
264 asf_read_object_header(&current, fd); 264 asf_read_object_header(&current, fd);
265 265
266 if (current.size > datalen || current.size < 24) { 266 if (current.size > datalen || current.size < 24) {
267 DEBUGF("invalid object size - current.size=%d, datalen=%d\n",(int)current.size,(int)datalen); 267 //DEBUGF("invalid object size - current.size=%d, datalen=%d\n",(int)current.size,(int)datalen);
268 break; 268 break;
269 } 269 }
270 270
@@ -284,7 +284,7 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
284 read_uint64le(fd, &play_duration); 284 read_uint64le(fd, &play_duration);
285 id3->length = play_duration / 10000; 285 id3->length = play_duration / 10000;
286 286
287 DEBUGF("****** length = %lums\n", id3->length); 287 //DEBUGF("****** length = %lums\n", id3->length);
288 288
289 /* Read the packet size - uint32_t at offset 68 */ 289 /* Read the packet size - uint32_t at offset 68 */
290 lseek(fd, 20, SEEK_CUR); 290 lseek(fd, 20, SEEK_CUR);
@@ -313,11 +313,11 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
313 read_uint16le(fd, &flags); 313 read_uint16le(fd, &flags);
314 314
315 if (!asf_guid_match(&guid, &asf_guid_stream_type_audio)) { 315 if (!asf_guid_match(&guid, &asf_guid_stream_type_audio)) {
316 DEBUGF("Found stream properties for non audio stream, skipping\n"); 316 //DEBUGF("Found stream properties for non audio stream, skipping\n");
317 lseek(fd,current.size - 24 - 50,SEEK_CUR); 317 lseek(fd,current.size - 24 - 50,SEEK_CUR);
318 } else { 318 } else {
319 lseek(fd, 4, SEEK_CUR); 319 lseek(fd, 4, SEEK_CUR);
320 DEBUGF("Found stream properties for audio stream %d\n",flags&0x7f); 320 //DEBUGF("Found stream properties for audio stream %d\n",flags&0x7f);
321 321
322 /* TODO: Check codec_id and find the lowest numbered audio stream in the file */ 322 /* TODO: Check codec_id and find the lowest numbered audio stream in the file */
323 wfx->audiostream = flags&0x7f; 323 wfx->audiostream = flags&0x7f;
@@ -362,12 +362,12 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
362 uint16_t strlength[5]; 362 uint16_t strlength[5];
363 int i; 363 int i;
364 364
365 DEBUGF("Found GUID_CONTENT_DESCRIPTION - size=%d\n",(int)(current.size - 24)); 365 //DEBUGF("Found GUID_CONTENT_DESCRIPTION - size=%d\n",(int)(current.size - 24));
366 366
367 /* Read the 5 string lengths - number of bytes included trailing zero */ 367 /* Read the 5 string lengths - number of bytes included trailing zero */
368 for (i=0; i<5; i++) { 368 for (i=0; i<5; i++) {
369 read_uint16le(fd, &strlength[i]); 369 read_uint16le(fd, &strlength[i]);
370 DEBUGF("strlength = %u\n",strlength[i]); 370 //DEBUGF("strlength = %u\n",strlength[i]);
371 } 371 }
372 372
373 if (strlength[0] > 0) { /* 0 - Title */ 373 if (strlength[0] > 0) { /* 0 - Title */
@@ -392,11 +392,11 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
392 uint16_t count; 392 uint16_t count;
393 int i; 393 int i;
394 int bytesleft = current.size - 24; 394 int bytesleft = current.size - 24;
395 DEBUGF("Found GUID_EXTENDED_CONTENT_DESCRIPTION\n"); 395 //DEBUGF("Found GUID_EXTENDED_CONTENT_DESCRIPTION\n");
396 396
397 read_uint16le(fd, &count); 397 read_uint16le(fd, &count);
398 bytesleft -= 2; 398 bytesleft -= 2;
399 DEBUGF("extended metadata count = %u\n",count); 399 //DEBUGF("extended metadata count = %u\n",count);
400 400
401 for (i=0; i < count; i++) { 401 for (i=0; i < count; i++) {
402 uint16_t length, type; 402 uint16_t length, type;
@@ -450,20 +450,20 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
450 450
451 lseek(fd, bytesleft, SEEK_CUR); 451 lseek(fd, bytesleft, SEEK_CUR);
452 } else { 452 } else {
453 DEBUGF("Skipping %d bytes of object\n",(int)(current.size - 24)); 453 //DEBUGF("Skipping %d bytes of object\n",(int)(current.size - 24));
454 lseek(fd,current.size - 24,SEEK_CUR); 454 lseek(fd,current.size - 24,SEEK_CUR);
455 } 455 }
456 456
457 DEBUGF("Parsed object - size = %d\n",(int)current.size); 457 //DEBUGF("Parsed object - size = %d\n",(int)current.size);
458 datalen -= current.size; 458 datalen -= current.size;
459 } 459 }
460 460
461 if (i != (int)subobjects || datalen != 0) { 461 if (i != (int)subobjects || datalen != 0) {
462 DEBUGF("header data doesn't match given subobject count\n"); 462 //DEBUGF("header data doesn't match given subobject count\n");
463 return ASF_ERROR_INVALID_VALUE; 463 return ASF_ERROR_INVALID_VALUE;
464 } 464 }
465 465
466 DEBUGF("%d subobjects read successfully\n", i); 466 //DEBUGF("%d subobjects read successfully\n", i);
467 } 467 }
468 468
469#if 0 469#if 0
@@ -474,7 +474,7 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
474 } 474 }
475#endif 475#endif
476 476
477 DEBUGF("header validated correctly\n"); 477 //DEBUGF("header validated correctly\n");
478 478
479 return 0; 479 return 0;
480} 480}
@@ -490,24 +490,24 @@ bool get_asf_metadata(int fd, struct mp3entry* id3)
490 res = asf_parse_header(fd, id3, &wfx); 490 res = asf_parse_header(fd, id3, &wfx);
491 491
492 if (res < 0) { 492 if (res < 0) {
493 DEBUGF("ASF: parsing error - %d\n",res); 493 //DEBUGF("ASF: parsing error - %d\n",res);
494 return false; 494 return false;
495 } 495 }
496 496
497 if (wfx.audiostream == -1) { 497 if (wfx.audiostream == -1) {
498 DEBUGF("ASF: No WMA streams found\n"); 498 //DEBUGF("ASF: No WMA streams found\n");
499 return false; 499 return false;
500 } 500 }
501 501
502 if (wfx.bitrate < 32000) { 502 if (wfx.bitrate < 32000) {
503 DEBUGF("ASF: < 32kbps files not supported\n"); 503 //DEBUGF("ASF: < 32kbps files not supported\n");
504 return false; 504 return false;
505 } 505 }
506 506
507 asf_read_object_header(&obj, fd); 507 asf_read_object_header(&obj, fd);
508 508
509 if (!asf_guid_match(&obj.guid, &asf_guid_data)) { 509 if (!asf_guid_match(&obj.guid, &asf_guid_data)) {
510 DEBUGF("ASF: No data object found\n"); 510 //DEBUGF("ASF: No data object found\n");
511 return false; 511 return false;
512 } 512 }
513 513