1
0
Fork 0
forked from len0rd/rockbox

Don't assume files are WMAv2, instead actually check that they are and quit gracefully if they are not.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13855 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Giacomelli 2007-07-11 16:58:11 +00:00
parent de4904a189
commit 28b0c58726
2 changed files with 12 additions and 5 deletions

View file

@ -331,18 +331,22 @@ enum codec_status codec_main(void)
/* Remember the resume position - when the codec is opened, the
playback engine will reset it. */
resume_offset = ci->id3->offset;
if (codec_init()) {
LOGF("WMA: Error initialising codec\n");
retval = CODEC_ERROR;
goto exit;
}
/* Copy the format metadata we've stored in the id3 TOC field. This
/* Copy the format metadata we've stored in the id3 TOC field. This
saves us from parsing it again here. */
memcpy(&wfx, ci->id3->toc, sizeof(wfx));
wma_decode_init(&wmadec,&wfx);
if(wma_decode_init(&wmadec,&wfx)< 0){
LOGF("WMA: Unsupported or corrupt file\n");
retval = CODEC_ERROR;
goto exit;
}
/* Now advance the file position to the first frame */
ci->seek_buffer(ci->id3->first_frame_offset);
@ -369,7 +373,7 @@ enum codec_status codec_main(void)
}
/* Deal with any pending seek requests - ignore them */
if (ci->seek_time)
if (ci->seek_time)
{
ci->seek_complete();
}