mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +00:00
camerabin: fix setting mute when video bin elements haven't been created
This commit is contained in:
parent
8a39d28002
commit
18e7091238
2 changed files with 16 additions and 12 deletions
|
@ -184,6 +184,8 @@ gst_camerabin_video_init (GstCameraBinVideo * vid,
|
|||
|
||||
vid->pending_eos = NULL;
|
||||
|
||||
vid->mute = ARG_DEFAULT_MUTE;
|
||||
|
||||
/* Create src and sink ghost pads */
|
||||
vid->sinkpad = gst_ghost_pad_new_no_target ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (vid), vid->sinkpad);
|
||||
|
@ -629,6 +631,8 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid)
|
|||
GST_WARNING_OBJECT (vid, "unable to add volume element");
|
||||
/* gst_camerabin_try_add_element() destroyed the element */
|
||||
vid->volume = NULL;
|
||||
} else {
|
||||
g_object_set (vid->volume, "mute", vid->mute, NULL);
|
||||
}
|
||||
|
||||
/* Add user set or default audio encoder element */
|
||||
|
@ -732,8 +736,11 @@ gst_camerabin_video_destroy_elements (GstCameraBinVideo * vid)
|
|||
void
|
||||
gst_camerabin_video_set_mute (GstCameraBinVideo * vid, gboolean mute)
|
||||
{
|
||||
if (vid && vid->volume) {
|
||||
GST_DEBUG_OBJECT (vid, "setting mute %s", mute ? "on" : "off");
|
||||
g_return_if_fail (vid != NULL);
|
||||
|
||||
GST_DEBUG_OBJECT (vid, "setting mute %s", mute ? "on" : "off");
|
||||
vid->mute = mute;
|
||||
if (vid->volume) {
|
||||
g_object_set (vid->volume, "mute", mute, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -800,12 +807,13 @@ gst_camerabin_video_set_audio_src (GstCameraBinVideo * vid,
|
|||
gboolean
|
||||
gst_camerabin_video_get_mute (GstCameraBinVideo * vid)
|
||||
{
|
||||
gboolean mute = ARG_DEFAULT_MUTE;
|
||||
g_return_val_if_fail (vid != NULL, FALSE);
|
||||
|
||||
if (vid && vid->volume) {
|
||||
g_object_get (vid->volume, "mute", &mute, NULL);
|
||||
if (vid->volume) {
|
||||
g_object_get (vid->volume, "mute", &vid->mute, NULL);
|
||||
}
|
||||
return mute;
|
||||
|
||||
return vid->mute;
|
||||
}
|
||||
|
||||
GstElement *
|
||||
|
|
|
@ -24,24 +24,19 @@
|
|||
#include <gst/gstbin.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
//#define USE_TIMEOVERLAY 1
|
||||
|
||||
#define ARG_DEFAULT_MUTE FALSE
|
||||
|
||||
#define GST_TYPE_CAMERABIN_VIDEO (gst_camerabin_video_get_type())
|
||||
#define GST_CAMERABIN_VIDEO_CAST(obj) ((GstCameraBinVideo*)(obj))
|
||||
#define GST_CAMERABIN_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CAMERABIN_VIDEO,GstCameraBinVideo))
|
||||
#define GST_CAMERABIN_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CAMERABIN_VIDEO,GstCameraBinVideoClass))
|
||||
#define GST_IS_CAMERABIN_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CAMERABIN_VIDEO))
|
||||
#define GST_IS_CAMERABIN_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CAMERABIN_VIDEO))
|
||||
|
||||
/**
|
||||
* GstCameraBinVideo:
|
||||
*
|
||||
* The opaque #GstCameraBinVideo structure.
|
||||
*/
|
||||
|
||||
typedef struct _GstCameraBinVideo GstCameraBinVideo;
|
||||
typedef struct _GstCameraBinVideoClass GstCameraBinVideoClass;
|
||||
|
||||
|
@ -86,6 +81,8 @@ struct _GstCameraBinVideo
|
|||
GstElement *muxer; /* Muxer */
|
||||
|
||||
GstEvent *pending_eos;
|
||||
|
||||
gboolean mute;
|
||||
};
|
||||
|
||||
struct _GstCameraBinVideoClass
|
||||
|
@ -132,5 +129,4 @@ GstElement *gst_camerabin_video_get_muxer (GstCameraBinVideo * vid);
|
|||
GstElement *gst_camerabin_video_get_audio_src (GstCameraBinVideo * vid);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* #ifndef __CAMERABIN_VIDEO_H__ */
|
||||
|
|
Loading…
Reference in a new issue