diff options
| author | Andre Bezerra <amelco.herman@gmail.com> | 2026-10-28 17:23:48 -0300 |
|---|---|---|
| committer | Andre Bezerra <amelco.herman@gmail.com> | 2026-11-17 11:59:21 -0300 |
| commit | d995bad0ea725d779710cac221bf9558a1ab57b3 (patch) | |
| tree | b928fe543e980867202e457605b925d57aa7fbac | |
| parent | 186196a1ad7d2170208dbc3a7548a3159fe4a171 (diff) | |
show shortcuts on playback
| -rw-r--r-- | README.md | 5 | ||||
| -rw-r--r-- | playback.c | 21 |
2 files changed, 25 insertions, 1 deletions
@@ -76,6 +76,11 @@ binds to these four characters by default and means the user's own `input.conf` is not loaded during stem playback. Pitch control uses mpv's `pitch` property and requires mpv 0.40 or newer. +The same list is printed above the player, and mpv's console output is reduced +to the playback position line (`00:01:23 / 00:04:46 (29%)`). mpv errors are +still shown, and `PIPEWIRE_DEBUG=0` is set for mpv unless it is already set, so +libpipewire's probing messages do not appear. + With missing parameters, a wrong flag, or incompatible modes, the program prints an error followed by: @@ -38,6 +38,20 @@ static const char PLAYBACK_INPUT_CONFIGURATION[] = "} multiply pitch 1.0594630943592953\n" "{ multiply pitch 0.9438743126816935\n"; +static const char PLAYBACK_MESSAGE_LEVELS[] = + "--msg-level=cplayer=warn,ao=warn"; + +static const char PLAYBACK_STATUS_MESSAGE[] = + "--term-status-msg=${time-pos} / ${duration} (${percent-pos}%)"; + +static const char PLAYBACK_SHORTCUTS[] = + " keys action\n" + " > playback speed +0.1\n" + " < playback speed -0.1\n" + " } pitch up one semitone\n" + " { pitch down one semitone\n" + " q quit\n"; + static void write_message(char *message, size_t message_size, const char *format, ...) { @@ -233,7 +247,7 @@ int playback_run(const char *identifier, const char *selection) char *external_arguments[PLAYBACK_STEM_COUNT - 1] = {NULL}; char filter[128]; char filter_argument[sizeof(filter) + sizeof("--lavfi-complex=")]; - char *arguments[5 + PLAYBACK_STEM_COUNT] = {NULL}; + char *arguments[7 + PLAYBACK_STEM_COUNT] = {NULL}; char *input_configuration = NULL; size_t selected_count = 0U; size_t argument_count = 0U; @@ -269,6 +283,8 @@ int playback_run(const char *identifier, const char *selection) arguments[argument_count++] = (char *)"mpv"; arguments[argument_count++] = (char *)"--no-video"; + arguments[argument_count++] = (char *)PLAYBACK_MESSAGE_LEVELS; + arguments[argument_count++] = (char *)PLAYBACK_STATUS_MESSAGE; input_configuration = input_configuration_argument(); if (input_configuration == NULL) { fprintf(stderr, "warning: cannot write mpv key bindings: %s\n", @@ -305,6 +321,9 @@ int playback_run(const char *identifier, const char *selection) } arguments[argument_count] = NULL; + fputs(PLAYBACK_SHORTCUTS, stdout); + (void)fflush(stdout); + (void)setenv("PIPEWIRE_DEBUG", "0", 0); execvp("mpv", arguments); saved_errno = errno; fprintf(stderr, "error: cannot execute mpv: %s\n", strerror(saved_errno)); |
