summaryrefslogtreecommitdiff
path: root/apps/codecs/wma.c
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/wma.c
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/wma.c')
-rw-r--r--apps/codecs/wma.c12
1 files changed, 8 insertions, 4 deletions
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)
331 /* Remember the resume position - when the codec is opened, the 331 /* Remember the resume position - when the codec is opened, the
332 playback engine will reset it. */ 332 playback engine will reset it. */
333 resume_offset = ci->id3->offset; 333 resume_offset = ci->id3->offset;
334 334
335 if (codec_init()) { 335 if (codec_init()) {
336 LOGF("WMA: Error initialising codec\n"); 336 LOGF("WMA: Error initialising codec\n");
337 retval = CODEC_ERROR; 337 retval = CODEC_ERROR;
338 goto exit; 338 goto exit;
339 } 339 }
340 340
341 /* Copy the format metadata we've stored in the id3 TOC field. This 341 /* Copy the format metadata we've stored in the id3 TOC field. This
342 saves us from parsing it again here. */ 342 saves us from parsing it again here. */
343 memcpy(&wfx, ci->id3->toc, sizeof(wfx)); 343 memcpy(&wfx, ci->id3->toc, sizeof(wfx));
344 344
345 wma_decode_init(&wmadec,&wfx); 345 if(wma_decode_init(&wmadec,&wfx)< 0){
346 LOGF("WMA: Unsupported or corrupt file\n");
347 retval = CODEC_ERROR;
348 goto exit;
349 }
346 350
347 /* Now advance the file position to the first frame */ 351 /* Now advance the file position to the first frame */
348 ci->seek_buffer(ci->id3->first_frame_offset); 352 ci->seek_buffer(ci->id3->first_frame_offset);
@@ -369,7 +373,7 @@ enum codec_status codec_main(void)
369 } 373 }
370 374
371 /* Deal with any pending seek requests - ignore them */ 375 /* Deal with any pending seek requests - ignore them */
372 if (ci->seek_time) 376 if (ci->seek_time)
373 { 377 {
374 ci->seek_complete(); 378 ci->seek_complete();
375 } 379 }