void playerSetPause(int pause_flag) { switch (pc.state) { case PLAYER_STATE_STOP: break; case PLAYER_STATE_PLAY: if (pause_flag) playerPause(); break; case PLAYER_STATE_PAUSE: if (!pause_flag) playerPause(); break; } }
void loadPlaylistFromStateFile(FILE * fp, char * buffer, int state, int current, unsigned time) { char * ptrptr; char * temp; int song; if(!myFgets(buffer,PLAYLIST_BUFFER_SIZE,fp)) { ERROR("error parsing state file \"%s\"\n",playlist_stateFile); exit(EXIT_FAILURE); } while(strcmp(buffer,PLAYLIST_STATE_FILE_PLAYLIST_END)) { song = atoi(strtok_r(buffer,":",&ptrptr)); if(!(temp = strtok_r(NULL,"",&ptrptr))) { ERROR("error parsing state file \"%s\"\n", playlist_stateFile); exit(EXIT_FAILURE); } if(addToPlaylist(stderr,temp)==0 && current==song) { if(state!=PLAYER_STATE_STOP) { playPlaylist(stderr,playlist.length-1,0); } if(state==PLAYER_STATE_PAUSE) { playerPause(stderr); } if(state!=PLAYER_STATE_STOP) { seekSongInPlaylist(stderr,playlist.length-1, time); } } if(!myFgets(buffer,PLAYLIST_BUFFER_SIZE,fp)) { ERROR("error parsing state file \"%s\"\n", playlist_stateFile); exit(EXIT_FAILURE); } } }