summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer/mpegplayer.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-01-02 13:36:17 +0000
committerDave Chapman <dave@dchapman.com>2007-01-02 13:36:17 +0000
commit53952460045e24f778cae9f5163b6cf46d28355f (patch)
treea0c337d4aadaffb567360d6534ec7a092221f650 /apps/plugins/mpegplayer/mpegplayer.c
parente367ec3a3870a63a12725a625000449c663dd19b (diff)
downloadrockbox-53952460045e24f778cae9f5163b6cf46d28355f.tar.gz
rockbox-53952460045e24f778cae9f5163b6cf46d28355f.zip
Fix audio for Coldfire targets - the EMAC was being initialised in the main thread, not the audio thread. Also fix some comments and kill the video thread if the audio thread can not be created.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11883 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mpegplayer/mpegplayer.c')
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index d046e1e01a..25a5d1a600 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -307,7 +307,6 @@ static void init_mad(void* mad_frame_overlap)
307 307
308 mad_stream_init(&stream); 308 mad_stream_init(&stream);
309 mad_frame_init(&frame); 309 mad_frame_init(&frame);
310 mad_synth_init(&synth);
311 310
312 /* We do this so libmad doesn't try to call codec_calloc() */ 311 /* We do this so libmad doesn't try to call codec_calloc() */
313 frame.overlap = mad_frame_overlap; 312 frame.overlap = mad_frame_overlap;
@@ -532,6 +531,9 @@ static void mad_decode(void)
532 int file_end = 0; /* A count of the errors in each frame */ 531 int file_end = 0; /* A count of the errors in each frame */
533 int framelength; 532 int framelength;
534 533
534 /* We need this here to init the EMAC for Coldfire targets */
535 mad_synth_init(&synth);
536
535 init_pcmbuf(); 537 init_pcmbuf();
536 538
537 /* This is the decoding loop. */ 539 /* This is the decoding loop. */
@@ -825,7 +827,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
825 /* Initialise our malloc buffer */ 827 /* Initialise our malloc buffer */
826 mpeg2_alloc_init(audiobuf,audiosize); 828 mpeg2_alloc_init(audiobuf,audiosize);
827 829
828 /* Grab most of the buffer for the compressed video - leave 4MB for mpeg audio, and 512KB for PCM audio data */ 830 /* Grab most of the buffer for the compressed video - leave some for
831 PCM audio data and some for libmpeg2 malloc use. */
829 buffer_size = audiosize - (PCMBUFFER_SIZE+AUDIOBUFFER_SIZE+LIBMPEG2BUFFER_SIZE); 832 buffer_size = audiosize - (PCMBUFFER_SIZE+AUDIOBUFFER_SIZE+LIBMPEG2BUFFER_SIZE);
830 DEBUGF("audiosize=%d, buffer_size=%d\n",audiosize,buffer_size); 833 DEBUGF("audiosize=%d, buffer_size=%d\n",audiosize,buffer_size);
831 buffer = mpeg2_malloc(buffer_size,-1); 834 buffer = mpeg2_malloc(buffer_size,-1);
@@ -839,7 +842,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
839 if (mpa_buffer == NULL) 842 if (mpa_buffer == NULL)
840 return PLUGIN_ERROR; 843 return PLUGIN_ERROR;
841 844
842 /* Use 0.5MB of the remaining 4MB for audio data */
843 pcm_buffer_size = PCMBUFFER_SIZE; 845 pcm_buffer_size = PCMBUFFER_SIZE;
844 pcm_buffer = mpeg2_malloc(pcm_buffer_size,-2); 846 pcm_buffer = mpeg2_malloc(pcm_buffer_size,-2);
845 847
@@ -922,6 +924,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
922 (uint8_t*)audio_stack,AUDIO_STACKSIZE,"mpgaudio" IF_PRIO(,PRIORITY_PLAYBACK))) == NULL) 924 (uint8_t*)audio_stack,AUDIO_STACKSIZE,"mpgaudio" IF_PRIO(,PRIORITY_PLAYBACK))) == NULL)
923 { 925 {
924 rb->splash(HZ,true,"Cannot create audio thread!"); 926 rb->splash(HZ,true,"Cannot create audio thread!");
927 rb->remove_thread(videothread_id);
925 return PLUGIN_ERROR; 928 return PLUGIN_ERROR;
926 } 929 }
927 930