summaryrefslogtreecommitdiffstats
path: root/apps/codecs
diff options
context:
space:
mode:
authorMichael Giacomelli <giac2000@hotmail.com>2007-07-11 16:58:11 +0000
committerMichael Giacomelli <giac2000@hotmail.com>2007-07-11 16:58:11 +0000
commit28b0c58726bf0a42da3433d2d1ca5f0e559d9bd1 (patch)
treedb25dbcd0ec1fef6ce6032e5d4164a78136e3283 /apps/codecs
parentde4904a189e761c5699d82c1b777a8e144a000f0 (diff)
downloadrockbox-28b0c58726bf0a42da3433d2d1ca5f0e559d9bd1.tar.gz
rockbox-28b0c58726bf0a42da3433d2d1ca5f0e559d9bd1.zip
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
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/libwma/wmadeci.c5
-rw-r--r--apps/codecs/wma.c12
2 files changed, 12 insertions, 5 deletions
diff --git a/apps/codecs/libwma/wmadeci.c b/apps/codecs/libwma/wmadeci.c
index 3a4e70dc15..3361325887 100644
--- a/apps/codecs/libwma/wmadeci.c
+++ b/apps/codecs/libwma/wmadeci.c
@@ -550,8 +550,11 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx)
if (wfx->codec_id == ASF_CODEC_ID_WMAV1){
s->version = 1;
- }else{
+ }else if (wfx->codec_id == ASF_CODEC_ID_WMAV2 ){
s->version = 2;
+ }else{
+ /*one of those other wma flavors that don't have GPLed decoders */
+ return -1;
}
/* extract flag infos */
diff --git a/apps/codecs/wma.c b/apps/codecs/wma.c
index 71b1720408..ce4eea4579 100644
--- a/apps/codecs/wma.c
+++ b/apps/codecs/wma.c
@@ -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();
}