mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
gst/playback/: Allow setting -1 as current-audio to mute the current audio stream, similar to what is done for subtit...
Original commit message from CVS: * gst/playback/gstplaybasebin.c: (set_audio_mute), (set_active_source): * gst/playback/gstplaybasebin.h: * gst/playback/gstplaybin.c: (gst_play_bin_class_init), (playbin_set_audio_mute): Allow setting -1 as current-audio to mute the current audio stream, similar to what is done for subtitles. Fixes bug #342294.
This commit is contained in:
parent
b98072f957
commit
de277a5b2a
4 changed files with 43 additions and 0 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2008-05-05 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
* gst/playback/gstplaybasebin.c: (set_audio_mute),
|
||||
(set_active_source):
|
||||
* gst/playback/gstplaybasebin.h:
|
||||
* gst/playback/gstplaybin.c: (gst_play_bin_class_init),
|
||||
(playbin_set_audio_mute):
|
||||
Allow setting -1 as current-audio to mute the current audio stream,
|
||||
similar to what is done for subtitles. Fixes bug #342294.
|
||||
|
||||
2008-05-05 Edward Hervey <edward.hervey at collabora co uk>
|
||||
|
||||
* gst-libs/gst/pbutils/descriptions.c: (formats):
|
||||
|
|
|
@ -2400,6 +2400,17 @@ set_subtitles_visible (GstPlayBaseBin * play_base_bin, gboolean visible)
|
|||
klass->set_subtitles_visible (play_base_bin, visible);
|
||||
}
|
||||
|
||||
static void
|
||||
set_audio_mute (GstPlayBaseBin * play_base_bin, gboolean mute)
|
||||
{
|
||||
GstPlayBaseBinClass *klass = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin);
|
||||
|
||||
/* we use a vfunc for this since we don't have a reference to the
|
||||
* textoverlay element, but playbin does */
|
||||
if (klass != NULL && klass->set_audio_mute != NULL)
|
||||
klass->set_audio_mute (play_base_bin, mute);
|
||||
}
|
||||
|
||||
/*
|
||||
* Caller has group-lock held.
|
||||
*/
|
||||
|
@ -2432,6 +2443,13 @@ set_active_source (GstPlayBaseBin * play_base_bin,
|
|||
set_subtitles_visible (play_base_bin, visible);
|
||||
if (!visible)
|
||||
return;
|
||||
} else if (type == GST_STREAM_TYPE_AUDIO) {
|
||||
gboolean mute = (source_num == -1);
|
||||
|
||||
set_audio_mute (play_base_bin, mute);
|
||||
|
||||
if (mute)
|
||||
return;
|
||||
}
|
||||
|
||||
sel = group->type[type - 1].selector;
|
||||
|
|
|
@ -113,6 +113,8 @@ struct _GstPlayBaseBinClass {
|
|||
|
||||
void (*set_subtitles_visible) (GstPlayBaseBin *play_base_bin,
|
||||
gboolean visible);
|
||||
void (*set_audio_mute) (GstPlayBaseBin *play_base_bin,
|
||||
gboolean mute);
|
||||
};
|
||||
|
||||
GType gst_play_base_bin_get_type (void);
|
||||
|
|
|
@ -326,6 +326,8 @@ static gboolean setup_sinks (GstPlayBaseBin * play_base_bin,
|
|||
static void remove_sinks (GstPlayBin * play_bin);
|
||||
static void playbin_set_subtitles_visible (GstPlayBaseBin * play_base_bin,
|
||||
gboolean visible);
|
||||
static void playbin_set_audio_mute (GstPlayBaseBin * play_base_bin,
|
||||
gboolean mute);
|
||||
|
||||
static void gst_play_bin_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * spec);
|
||||
|
@ -431,6 +433,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
|
|||
|
||||
playbasebin_klass->setup_output_pads = setup_sinks;
|
||||
playbasebin_klass->set_subtitles_visible = playbin_set_subtitles_visible;
|
||||
playbasebin_klass->set_audio_mute = playbin_set_audio_mute;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1642,6 +1645,16 @@ playbin_set_subtitles_visible (GstPlayBaseBin * play_base_bin, gboolean visible)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
playbin_set_audio_mute (GstPlayBaseBin * play_base_bin, gboolean mute)
|
||||
{
|
||||
GstPlayBin *playbin = GST_PLAY_BIN (play_base_bin);
|
||||
|
||||
if (playbin->volume_element) {
|
||||
g_object_set (G_OBJECT (playbin->volume_element), "mute", mute, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send an event to our sinks until one of them works; don't then send to the
|
||||
* remaining sinks (unlike GstBin)
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue