forked from len0rd/rockbox
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
This commit is contained in:
parent
5737254429
commit
fe0d92d51f
1 changed files with 7 additions and 8 deletions
|
@ -315,13 +315,10 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
|
||||||
if (!asf_guid_match(&guid, &asf_guid_stream_type_audio)) {
|
if (!asf_guid_match(&guid, &asf_guid_stream_type_audio)) {
|
||||||
//DEBUGF("Found stream properties for non audio stream, skipping\n");
|
//DEBUGF("Found stream properties for non audio stream, skipping\n");
|
||||||
lseek(fd,current.size - 24 - 50,SEEK_CUR);
|
lseek(fd,current.size - 24 - 50,SEEK_CUR);
|
||||||
} else {
|
} else if (wfx->audiostream == -1) {
|
||||||
lseek(fd, 4, SEEK_CUR);
|
lseek(fd, 4, SEEK_CUR);
|
||||||
//DEBUGF("Found stream properties for audio stream %d\n",flags&0x7f);
|
//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) {
|
if (propdatalen < 18) {
|
||||||
return ASF_ERROR_INVALID_LENGTH;
|
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) {
|
if (wfx->codec_id == ASF_CODEC_ID_WMAV1) {
|
||||||
read(fd, wfx->data, 4);
|
read(fd, wfx->data, 4);
|
||||||
lseek(fd,current.size - 24 - 72 - 4,SEEK_CUR);
|
lseek(fd,current.size - 24 - 72 - 4,SEEK_CUR);
|
||||||
|
wfx->audiostream = flags&0x7f;
|
||||||
} else if (wfx->codec_id == ASF_CODEC_ID_WMAV2) {
|
} else if (wfx->codec_id == ASF_CODEC_ID_WMAV2) {
|
||||||
read(fd, wfx->data, 6);
|
read(fd, wfx->data, 6);
|
||||||
lseek(fd,current.size - 24 - 72 - 6,SEEK_CUR);
|
lseek(fd,current.size - 24 - 72 - 6,SEEK_CUR);
|
||||||
|
wfx->audiostream = flags&0x7f;
|
||||||
} else {
|
} else {
|
||||||
lseek(fd,current.size - 24 - 72,SEEK_CUR);
|
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);
|
res = asf_parse_header(fd, id3, &wfx);
|
||||||
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
//DEBUGF("ASF: parsing error - %d\n",res);
|
DEBUGF("ASF: parsing error - %d\n",res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wfx.audiostream == -1) {
|
if (wfx.audiostream == -1) {
|
||||||
//DEBUGF("ASF: No WMA streams found\n");
|
DEBUGF("ASF: No WMA streams found\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wfx.bitrate < 32000) {
|
if (wfx.bitrate < 32000) {
|
||||||
//DEBUGF("ASF: < 32kbps files not supported\n");
|
DEBUGF("ASF: < 32kbps files not supported\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
asf_read_object_header(&obj, fd);
|
asf_read_object_header(&obj, fd);
|
||||||
|
|
||||||
if (!asf_guid_match(&obj.guid, &asf_guid_data)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue