static gboolean cb_test_position (char* CurrentURL) { if(myexit==2) return FALSE; g_print("cb_test_position\n"); forward_speed = 255; mplayer_ready(); mplayer_trickplay(update_forward(CurrentURL)); mplayer_play(); myexit = 2; return TRUE; }
void mplayer_restart() { int status; close(mplayer_state.pipe_read); close(mplayer_state.pipe_write); wait(&status); restarting = true; mplayer_start(); if (mplayer_state.playing && !mplayer_state.paused) { int previous_position = mplayer_state.position; mplayer_play(mplayer_state.current_song); mplayer_seek(previous_position); } }
int main (int argc, char *argv[]) { char *pCurrentURL = NULL; char *pPlayURL1 = NULL; char *pPlayURL2 = NULL; int loopFlag = 1; int inputCommand = 0; char arr[1024] = ""; /* Check input arguments */ if (argc < 2) { g_printerr ("Usage: %s <url to play>\n", argv[0]); return -1; } pPlayURL1 = argv[1]; pPlayURL2 = argv[2]; /* Initialisation */ gst_init (&argc, &argv); load_elements (pPlayURL1); pCurrentURL = pPlayURL1; mplayer_play(); // g_print("g_timeout_add\n"); // g_timeout_add (500, (GSourceFunc) cb_test_position, pCurrentURL); while (loopFlag) { usuage(); g_print ("Enter your command here#\n"); inputCommand = getchar (); getchar (); fflush(NULL); switch (inputCommand) { case 'l': rewind_speed = 0; forward_speed = 0; play_speed = 0.0; /* When FW is active and wants to play, then we have to update the speed as 1 and just play from at that position */ if (trickPlay == 1) { trickPlay = 0; /* Set to Max value; the update_forward will reset to 0 */ forward_speed = 255; mplayer_ready(); mplayer_trickplay(update_forward(pCurrentURL)); } else if (mediaStop == 1) { mediaStop = 0; mplayer_trickplay(pCurrentURL); } mplayer_play(); break; case 'p': mplayer_pause(); break; case 's': mediaStop = 1; mplayer_ready(); break; case 'q': mplayer_stop(); loopFlag = 0; break; case 'r': mplayer_pause(); mplayer_trickplay(update_rewind (pCurrentURL)); mplayer_play(); break; case 'f': mplayer_pause(); mplayer_trickplay(update_forward(pCurrentURL)); mplayer_play(); default: break; } } return 0; }