diff options
| author | Dave Chapman <dave@dchapman.com> | 2007-07-11 23:01:18 +0000 |
|---|---|---|
| committer | Dave Chapman <dave@dchapman.com> | 2007-07-11 23:01:18 +0000 |
| commit | fe0d92d51ff2d59b33910fe1ea3910e21783e94f (patch) | |
| tree | 7fa5bfeef6c8e1bb072f9fb65e5a5c94597e7592 | |
| parent | 5737254429fd1d37ced19aa7b1b397c4794c383b (diff) | |
| download | rockbox-fe0d92d51ff2d59b33910fe1ea3910e21783e94f.zip rockbox-fe0d92d51ff2d59b33910fe1ea3910e21783e94f.tar.gz rockbox-fe0d92d51ff2d59b33910fe1ea3910e21783e94f.tar.bz2 rockbox-fe0d92d51ff2d59b33910fe1ea3910e21783e94f.tar.xz | |
Make the ASF parser reject streams which are not wmav1 or wmav2. Also restore some DEBUGF error message to indicate why a file has been rejected.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13857 a1c6a512-1295-4272-9138-f99709370657
| -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 bbb7298..45bf9f6 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, if (!asf_guid_match(&guid, &asf_guid_stream_type_audio)) { //DEBUGF("Found stream properties for non audio stream, skipping\n"); lseek(fd,current.size - 24 - 50,SEEK_CUR); - } else { + } else if (wfx->audiostream == -1) { lseek(fd, 4, SEEK_CUR); //DEBUGF("Found stream properties for audio stream %d\n",flags&0x7f); - /* TODO: Check codec_id and find the lowest numbered audio stream in the file */ - wfx->audiostream = flags&0x7f; - if (propdatalen < 18) { return ASF_ERROR_INVALID_LENGTH; } @@ -347,9 +344,11 @@ static int asf_parse_header(int fd, struct mp3entry* id3, if (wfx->codec_id == ASF_CODEC_ID_WMAV1) { read(fd, wfx->data, 4); lseek(fd,current.size - 24 - 72 - 4,SEEK_CUR); + wfx->audiostream = flags&0x7f; } else if (wfx->codec_id == ASF_CODEC_ID_WMAV2) { read(fd, wfx->data, 6); lseek(fd,current.size - 24 - 72 - 6,SEEK_CUR); + wfx->audiostream = flags&0x7f; } else { lseek(fd,current.size - 24 - 72,SEEK_CUR); } @@ -490,24 +489,24 @@ bool get_asf_metadata(int fd, struct mp3entry* id3) res = asf_parse_header(fd, id3, &wfx); if (res < 0) { - //DEBUGF("ASF: parsing error - %d\n",res); + DEBUGF("ASF: parsing error - %d\n",res); return false; } if (wfx.audiostream == -1) { - //DEBUGF("ASF: No WMA streams found\n"); + DEBUGF("ASF: No WMA streams found\n"); return false; } if (wfx.bitrate < 32000) { - //DEBUGF("ASF: < 32kbps files not supported\n"); + DEBUGF("ASF: < 32kbps files not supported\n"); return false; } asf_read_object_header(&obj, fd); if (!asf_guid_match(&obj.guid, &asf_guid_data)) { - //DEBUGF("ASF: No data object found\n"); + DEBUGF("ASF: No data object found\n"); return false; } |