summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSeungha Yang <seungha@centricular.com>2020-05-27 23:20:25 +0900
committerSeungha Yang <seungha@centricular.com>2020-10-30 01:32:31 +0900
commitd944c27d961d2115aa721b4fa3462410d969caef (patch)
tree5e8a0e02594a4e46e58e55549c713fe69acba159 /tools
parentdb4567152d0cdb86279c0ad7a3cb9f9edaae7174 (diff)
downloadgstreamer-plugins-base-d944c27d961d2115aa721b4fa3462410d969caef.tar.gz
gst-play: Add support for audio mute control
Assign 'm' keyboard input to control audio mute state Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/674>
Diffstat (limited to 'tools')
-rw-r--r--tools/gst-play.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/gst-play.c b/tools/gst-play.c
index 4bd0a2680..12226532b 100644
--- a/tools/gst-play.c
+++ b/tools/gst-play.c
@@ -313,6 +313,23 @@ play_set_relative_volume (GstPlay * play, gdouble volume_step)
gst_print (" \n");
}
+static void
+play_toggle_audio_mute (GstPlay * play)
+{
+ gboolean mute;
+
+ mute = gst_stream_volume_get_mute (GST_STREAM_VOLUME (play->playbin));
+
+ mute = !mute;
+ gst_stream_volume_set_mute (GST_STREAM_VOLUME (play->playbin), mute);
+
+ if (mute)
+ gst_print (_("Mute: on"));
+ else
+ gst_print (_("Mute: off"));
+ gst_print (" \n");
+}
+
/* returns TRUE if something was installed and we should restart playback */
static gboolean
play_install_missing_plugins (GstPlay * play)
@@ -1316,6 +1333,7 @@ print_keyboard_help (void)
"\342\206\220", N_("seek backward")}, {
"\342\206\221", N_("volume up")}, {
"\342\206\223", N_("volume down")}, {
+ "m", N_("toggle audio mute on/off")}, {
"+", N_("increase playback rate")}, {
"-", N_("decrease playback rate")}, {
"d", N_("change playback direction")}, {
@@ -1419,6 +1437,9 @@ keyboard_cb (const gchar * key_input, gpointer user_data)
case '0':
play_do_seek (play, 0, play->rate, play->trick_mode);
break;
+ case 'm':
+ play_toggle_audio_mute (play);
+ break;
default:
if (strcmp (key_input, GST_PLAY_KB_ARROW_RIGHT) == 0) {
relative_seek (play, +0.08);