mplay.mp3

Controllable music player (mp3)
git clone https://git.sinitax.com/sinitax/mplay.mp3
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

commit efcae40ec202ba66d0641495d3d52e3ccc272f5b
parent 6186d0ce71e31407f23359411619dbe19236d577
Author: Louis Burda <quent.burda@gmail.com>
Date:   Sat,  9 Mar 2024 22:54:51 +0100

Update mplay

Diffstat:
Mmplay.mp3.c | 28++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/mplay.mp3.c b/mplay.mp3.c @@ -243,7 +243,7 @@ decoder_seek(size_t sample_pos) while (mp3d.sample_next < sample_pos) { cnt = decode_next_frame(NULL, &size); if (!size) { - mplay_status(MPLAY_STATUS_EXIT, "from seek"); + mplay_status(MPLAY_INFO_EXIT, "from seek"); exit(0); } } @@ -253,7 +253,7 @@ decoder_seek(size_t sample_pos) static void pa_stream_drain_callback(pa_stream *stream, int success, void *data) { - mplay_status(MPLAY_STATUS_EXIT, NULL); + mplay_status(MPLAY_INFO_EXIT, NULL); exit(0); } @@ -391,7 +391,7 @@ cmd_setvol(double vol) &pa_strm_sink.volume, NULL, NULL); pa_operation_unref(op); - mplay_status(MPLAY_ACTION_STATUS_VOL, "%02.2f", (double) pa_cvolume_avg(&pa_strm_sink.volume) + mplay_status(MPLAY_INFO_VOLUME, "%02.2f", (double) pa_cvolume_avg(&pa_strm_sink.volume) * 100.f / (double) PA_VOLUME_NORM); } @@ -409,7 +409,7 @@ cmd_seek(double time_sec) pa_operation_unref(op); mp3d.seek = true; - mplay_status(MPLAY_ACTION_STATUS_SEEK, "%02.2f", user_time()); + mplay_status(MPLAY_INFO_SEEK, "%02.2f", user_time()); } static void @@ -421,7 +421,7 @@ cmd_playpause(void) op = pa_stream_cork(pa_strm, mp3d.pause, NULL, NULL); pa_operation_unref(op); - mplay_status(MPLAY_ACTION_STATUS_PLAYPAUSE, "%i", mp3d.pause); + mplay_status(MPLAY_INFO_PAUSE, "%i", mp3d.pause); } static void @@ -429,7 +429,7 @@ cmd_status(void) { update_sink_input_info(); - mplay_status(MPLAY_ACTION_STATUS_STATUS, + mplay_status(MPLAY_INFO_STATUS, "volume=%02.2f,time=%02.2f,pause=%i", user_vol(), user_time(), mp3d.pause); } @@ -446,26 +446,26 @@ key_input(void) pa_threaded_mainloop_lock(pa_mloop); switch (mplay_action(key)) { - case MPLAY_ACTION_VOL: + case MPLAY_ACTION_VOLUME: get_line(linebuf, sizeof(linebuf)); fval = strtof(linebuf, &end); if (!end || *end) { - mplay_status(MPLAY_ACTION_STATUS_VOL, "fail:bad float"); + mplay_status(MPLAY_INFO_VOLUME, "fail:bad float"); break; } cmd_setvol(fval); break; - case MPLAY_ACTION_VOL_UP: + case MPLAY_ACTION_VOLUME_UP: cmd_setvol(user_vol() + 5); break; - case MPLAY_ACTION_VOL_DOWN: + case MPLAY_ACTION_VOLUME_DOWN: cmd_setvol(user_vol() - 5); break; case MPLAY_ACTION_SEEK: get_line(linebuf, sizeof(linebuf)); fval = strtof(linebuf, &end); if (!end || *end) { - mplay_status(MPLAY_ACTION_STATUS_SEEK, "fail:bad float"); + mplay_status(MPLAY_INFO_SEEK, "fail:bad float"); break; } cmd_seek(fval); @@ -476,14 +476,14 @@ key_input(void) case MPLAY_ACTION_SEEK_FWD: cmd_seek(user_time() + 5); break; - case MPLAY_ACTION_PLAYPAUSE: + case MPLAY_ACTION_PAUSE: cmd_playpause(); break; case MPLAY_ACTION_STATUS: cmd_status(); break; default: - mplay_status(MPLAY_STATUS_INPUT, "fail"); + mplay_status(MPLAY_INFO_INPUT, "fail"); break; } @@ -511,7 +511,7 @@ input_worker(void *arg) term_set_raw(); } - mplay_status(MPLAY_STATUS_READY, NULL); + mplay_status(MPLAY_INFO_READY, NULL); while (key_input());