void handle_pause(){ char date[256]; getDate(date); char res_pause[1024]; sprintf(res_pause, "RTSP/1. 200 OK\r\n" "CSeq: %s\r\n" "Session : %i\r\n\r\n", cseq, rtspSessionID); printf("-------------S -> C-------------\n" "%s\n", res_pause); write(rtsp_sock,res_pause,strlen(res_pause)); printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n PAUSE!!! \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); pauseStream(streamer); }
int pauseMusic(sp_session *session , char *uri , char *name ) { TRACE_2( PLAYERMANAGER , "pauseMusic()."); int status = PC_SUCCESS; char response[255] = { 0 }; LOCK_MUTEX( PLAYERMANAGER , &mutexSession ); sp_error error; if( pausing == FALSE ) { pauseStream( name ); error = sp_session_player_play( session , 0 ); if( error != SP_ERROR_OK ) { TRACE_ERROR( PLAYERMANAGER , "Cannot pause track, reason: %s" , sp_error_message( error ) ); status = PC_ERROR; snprintf( response , 255 , "NOK: Cannot pause track, reason: %s" , sp_error_message( error ) ); sendVoid( ( void * )response , strlen( response ) ); } else { TRACE_1( PLAYERMANAGER , "Success to pause track."); pausing = TRUE; snprintf( response , 255 , "OK"); sendVoid( ( void * )response , strlen( response ) ); } } else if( pausing == TRUE ) { playStream( name ); error = sp_session_player_play( session , 1 ); if( error != SP_ERROR_OK ) { TRACE_ERROR( PLAYERMANAGER , "Cannot play track, reason: %s" , sp_error_message( error ) ); status = PC_ERROR; } else { TRACE_1( PLAYERMANAGER , "Success to play track."); pausing = FALSE; } } UNLOCK_MUTEX( PLAYERMANAGER , &mutexSession ); return status; }