diff options
-rw-r--r-- | apps/metadata/asf.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/apps/metadata/asf.c b/apps/metadata/asf.c index bbb7298870..45bf9f6431 100644 --- a/apps/metadata/asf.c +++ b/apps/metadata/asf.c | |||
@@ -315,13 +315,10 @@ static int asf_parse_header(int fd, struct mp3entry* id3, | |||
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 if (wfx->audiostream == -1) { |
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 */ | ||
323 | wfx->audiostream = flags&0x7f; | ||
324 | |||
325 | if (propdatalen < 18) { | 322 | if (propdatalen < 18) { |
326 | return ASF_ERROR_INVALID_LENGTH; | 323 | return ASF_ERROR_INVALID_LENGTH; |
327 | } | 324 | } |
@@ -347,9 +344,11 @@ static int asf_parse_header(int fd, struct mp3entry* id3, | |||
347 | if (wfx->codec_id == ASF_CODEC_ID_WMAV1) { | 344 | if (wfx->codec_id == ASF_CODEC_ID_WMAV1) { |
348 | read(fd, wfx->data, 4); | 345 | read(fd, wfx->data, 4); |
349 | lseek(fd,current.size - 24 - 72 - 4,SEEK_CUR); | 346 | lseek(fd,current.size - 24 - 72 - 4,SEEK_CUR); |
347 | wfx->audiostream = flags&0x7f; | ||
350 | } else if (wfx->codec_id == ASF_CODEC_ID_WMAV2) { | 348 | } else if (wfx->codec_id == ASF_CODEC_ID_WMAV2) { |
351 | read(fd, wfx->data, 6); | 349 | read(fd, wfx->data, 6); |
352 | lseek(fd,current.size - 24 - 72 - 6,SEEK_CUR); | 350 | lseek(fd,current.size - 24 - 72 - 6,SEEK_CUR); |
351 | wfx->audiostream = flags&0x7f; | ||
353 | } else { | 352 | } else { |
354 | lseek(fd,current.size - 24 - 72,SEEK_CUR); | 353 | lseek(fd,current.size - 24 - 72,SEEK_CUR); |
355 | } | 354 | } |
@@ -490,24 +489,24 @@ bool get_asf_metadata(int fd, struct mp3entry* id3) | |||
490 | res = asf_parse_header(fd, id3, &wfx); | 489 | res = asf_parse_header(fd, id3, &wfx); |
491 | 490 | ||
492 | if (res < 0) { | 491 | if (res < 0) { |
493 | //DEBUGF("ASF: parsing error - %d\n",res); | 492 | DEBUGF("ASF: parsing error - %d\n",res); |
494 | return false; | 493 | return false; |
495 | } | 494 | } |
496 | 495 | ||
497 | if (wfx.audiostream == -1) { | 496 | if (wfx.audiostream == -1) { |
498 | //DEBUGF("ASF: No WMA streams found\n"); | 497 | DEBUGF("ASF: No WMA streams found\n"); |
499 | return false; | 498 | return false; |
500 | } | 499 | } |
501 | 500 | ||
502 | if (wfx.bitrate < 32000) { | 501 | if (wfx.bitrate < 32000) { |
503 | //DEBUGF("ASF: < 32kbps files not supported\n"); | 502 | DEBUGF("ASF: < 32kbps files not supported\n"); |
504 | return false; | 503 | return false; |
505 | } | 504 | } |
506 | 505 | ||
507 | asf_read_object_header(&obj, fd); | 506 | asf_read_object_header(&obj, fd); |
508 | 507 | ||
509 | if (!asf_guid_match(&obj.guid, &asf_guid_data)) { | 508 | if (!asf_guid_match(&obj.guid, &asf_guid_data)) { |
510 | //DEBUGF("ASF: No data object found\n"); | 509 | DEBUGF("ASF: No data object found\n"); |
511 | return false; | 510 | return false; |
512 | } | 511 | } |
513 | 512 | ||