diff options
| author | Louis Burda <quent.burda@gmail.com> | 2024-03-10 14:34:07 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2024-03-10 14:34:07 +0100 |
| commit | 7146f1c08cf06c5865181f6e45b70505ca89d7a2 (patch) | |
| tree | 0c207676c61193b116b12de4f7fb215764e7621f | |
| parent | d1bc729d9a527817e505a2d5c40c5b1a745f9eec (diff) | |
| download | tmus-7146f1c08cf06c5865181f6e45b70505ca89d7a2.tar.gz tmus-7146f1c08cf06c5865181f6e45b70505ca89d7a2.zip | |
Update to new mplay status line format
| -rw-r--r-- | src/player_mplay.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/player_mplay.c b/src/player_mplay.c index 6ac9dad..ab55640 100644 --- a/src/player_mplay.c +++ b/src/player_mplay.c @@ -222,9 +222,10 @@ player_update(void) } else if (!strncmp(tok, "pause=", 6)) { player.state = atoi(tok + 6) ? PLAYER_STATE_PAUSED : PLAYER_STATE_PLAYING; - } else if (!strncmp(tok, "time=", 5)) { - player.time_pos = atoi(tok + 5); - player.time_end = MAX(player.time_pos, player.time_end); + } else if (!strncmp(tok, "pos=", 4)) { + player.time_pos = atoi(tok + 4); + } else if (!strncmp(tok, "end=", 4)) { + player.time_end = atoi(tok + 4); } tok = strchr(tok, ','); if (!tok) break; @@ -268,16 +269,21 @@ player_clear_track(void) int player_toggle_pause(void) { - char *line; + char *line, *arg; fputc(MPLAY_ACTION_KEY_PAUSE, mplay.stdin); line = mplay_readline(); - if (!line || strncmp(line, "+PAUSE:", 7)) { + if (!line || !(arg = mplay_info_arg(line, MPLAY_INFO_STR_PAUSE))) { mplay_kill(); MPLAY_STATUS(line); return PLAYER_ERR; } + if (atoi(arg)) + player.state = PLAYER_STATE_PAUSED; + else + player.state = PLAYER_STATE_PLAYING; + return PLAYER_OK; } |
