From: Francois B <mrs...@us...> - 2005-06-26 21:51:26
|
Update of /cvsroot/openneo/openneo/firmware In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31047 Modified Files: mpeg.c Log Message: Mpeg flag change, mute on stop and wait for pause and resume Index: mpeg.c =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/mpeg.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** mpeg.c 23 May 2005 14:08:42 -0000 1.21 --- mpeg.c 26 Jun 2005 21:51:15 -0000 1.22 *************** *** 119,123 **** static bool mpeg_is_initialized = false; ! static int status = MPEG_STATUS_STOP; static char single_file[MAX_PATH]; --- 119,123 ---- static bool mpeg_is_initialized = false; ! static int status = MPEG_STATUS_STOPPED; static char single_file[MAX_PATH]; *************** *** 544,548 **** playing = false; is_playing = false; ! status = MPEG_STATUS_STOP; } CHCR3 &= ~0x0001; /* Disable the DMA interrupt */ --- 544,548 ---- playing = false; is_playing = false; ! status = MPEG_STATUS_STOPPED; } CHCR3 &= ~0x0001; /* Disable the DMA interrupt */ *************** *** 860,863 **** --- 860,864 ---- /* Stop the current stream */ + mas_writereg( MAS_REG_MUTE, 0 ); play_pending = false; playing = false; *************** *** 881,885 **** mpeg_errno = 1; cur_rollback = 0; ! dj_notify( MPEG_MSG_STATUS_CHANGED, MPEG_STATUS_STOP, MPEG_REASON_END_OF_PLAYLIST ); break; } --- 882,886 ---- mpeg_errno = 1; cur_rollback = 0; ! dj_notify( MPEG_MSG_STATUS_CHANGED, MPEG_STATUS_STOPPED, MPEG_REASON_END_OF_PLAYLIST ); break; } *************** *** 887,891 **** //At this stage, the file has been open and id3 info parsed //The driver can now be considered playing ! current_state = MPEG_STATUS_PLAY; if( cur_rollback ) { --- 888,892 ---- //At this stage, the file has been open and id3 info parsed //The driver can now be considered playing ! current_state = MPEG_STATUS_PLAYING; if( cur_rollback ) { *************** *** 923,926 **** --- 924,928 ---- single_file_playing = false; cur_rollback = 0; + mas_writereg( MAS_REG_MUTE, 0 ); break; *************** *** 928,931 **** --- 930,934 ---- DEBUGF("MPEG_STOP\n"); + mas_writereg( MAS_REG_MUTE, 1 ); current_state = MPEG_STATUS_STOP_PENDING; *************** *** 934,940 **** stop_playing(); mpeg_stop_done = true; ! dj_notify( MPEG_MSG_STATUS_CHANGED, MPEG_STATUS_STOP, MPEG_REASON_STOP_COMMAND ); ! current_state = MPEG_STATUS_STOP; break; --- 937,943 ---- stop_playing(); mpeg_stop_done = true; ! dj_notify( MPEG_MSG_STATUS_CHANGED, MPEG_STATUS_STOPPED, MPEG_REASON_STOP_COMMAND ); ! current_state = MPEG_STATUS_STOPPED; break; *************** *** 943,947 **** current_state = MPEG_STATUS_PAUSE_PENDING; ! /* Stop the current stream */ paused = true; playing = false; --- 946,952 ---- current_state = MPEG_STATUS_PAUSE_PENDING; ! mas_writereg( MAS_REG_MUTE, 1 ); ! ! /* Stop the current stream */ paused = true; playing = false; *************** *** 949,954 **** pause_track = current_track_counter; stop_dma(); ! dj_notify( MPEG_MSG_STATUS_CHANGED, MPEG_STATUS_PAUSE, 0 ); ! current_state = MPEG_STATUS_PAUSE; break; --- 954,959 ---- pause_track = current_track_counter; stop_dma(); ! dj_notify( MPEG_MSG_STATUS_CHANGED, MPEG_STATUS_PAUSED, 0 ); ! current_state = MPEG_STATUS_PAUSED; break; *************** *** 957,960 **** --- 962,966 ---- current_state = MPEG_STATUS_PLAY_PENDING; + mas_writereg( MAS_REG_MUTE, 0 ); /* Continue the current stream */ *************** *** 971,976 **** start_dma(); } ! ! current_state = MPEG_STATUS_PLAY; break; --- 977,983 ---- start_dma(); } ! ! dj_notify( MPEG_MSG_STATUS_CHANGED, MPEG_STATUS_PLAYING, 0 ); ! current_state = MPEG_STATUS_PLAYING; break; *************** *** 1440,1444 **** current_state = 0; remove_current_tag(); ! dj_notify( MPEG_MSG_STATUS_CHANGED, MPEG_STATUS_STOP, MPEG_REASON_END_OF_PLAYLIST ); break; } --- 1447,1451 ---- current_state = 0; remove_current_tag(); ! dj_notify( MPEG_MSG_STATUS_CHANGED, MPEG_STATUS_STOPPED, MPEG_REASON_END_OF_PLAYLIST ); break; } *************** *** 1506,1509 **** --- 1513,1520 ---- queue_post(&mpeg_queue, MPEG_PAUSE, NULL); yield(); + + while( current_state != MPEG_STATUS_PAUSED && current_state == MPEG_STATUS_PAUSE_PENDING ) + sleep_thread(); + wake_up_thread(); } *************** *** 1511,1515 **** { queue_post(&mpeg_queue, MPEG_RESUME, NULL); ! yield(); } --- 1522,1530 ---- { queue_post(&mpeg_queue, MPEG_RESUME, NULL); ! yield(); ! ! while( current_state != MPEG_STATUS_PLAYING && current_state == MPEG_STATUS_PLAY_PENDING ) ! sleep_thread(); ! wake_up_thread(); } *************** *** 1543,1550 **** if(is_playing || playing || play_pending) ! ret |= MPEG_STATUS_PLAY; if(paused) ! ret |= MPEG_STATUS_PAUSE; if(mpeg_errno) --- 1558,1565 ---- if(is_playing || playing || play_pending) ! ret |= MPEG_STATUS_PLAYING; if(paused) ! ret |= MPEG_STATUS_PAUSED; if(mpeg_errno) *************** *** 1649,1652 **** --- 1664,1670 ---- void mpeg_init() { + /* Mute the MAS */ + mas_writereg( MAS_REG_MUTE, 1 ); + mpeg_errno = 0; |