mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 04:22:27 +00:00
gstcamerabin2: Set encodebin's videorate and audiorate properties
Listen to encodebin's element-added signal to be able to set skip-to-first on both audiorates and videorates.
This commit is contained in:
parent
fc9c9b0f24
commit
ba16894da3
2 changed files with 18 additions and 0 deletions
|
@ -313,6 +313,10 @@ gst_camera_bin_dispose (GObject * object)
|
||||||
if (camerabin->viewfinderbin_capsfilter)
|
if (camerabin->viewfinderbin_capsfilter)
|
||||||
gst_object_unref (camerabin->viewfinderbin_capsfilter);
|
gst_object_unref (camerabin->viewfinderbin_capsfilter);
|
||||||
|
|
||||||
|
if (camerabin->encodebin_signal_id)
|
||||||
|
g_signal_handler_disconnect (camerabin->encodebin,
|
||||||
|
camerabin->encodebin_signal_id);
|
||||||
|
|
||||||
if (camerabin->videosink)
|
if (camerabin->videosink)
|
||||||
gst_object_unref (camerabin->videosink);
|
gst_object_unref (camerabin->videosink);
|
||||||
if (camerabin->encodebin)
|
if (camerabin->encodebin)
|
||||||
|
@ -672,6 +676,16 @@ gst_camera_bin_check_and_replace_filter (GstCameraBin * camera,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
encodebin_element_added (GstElement * encodebin, GstElement * new_element,
|
||||||
|
GstCameraBin * camera)
|
||||||
|
{
|
||||||
|
if (g_str_has_prefix (gst_element_get_name (new_element), "audiorate") ||
|
||||||
|
g_str_has_prefix (gst_element_get_name (new_element), "videorate")) {
|
||||||
|
g_object_set (new_element, "skip-to-first", TRUE, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define VIDEO_PAD 1
|
#define VIDEO_PAD 1
|
||||||
#define AUDIO_PAD 2
|
#define AUDIO_PAD 2
|
||||||
static GstPad *
|
static GstPad *
|
||||||
|
@ -775,6 +789,9 @@ gst_camera_bin_create_elements (GstCameraBin * camera)
|
||||||
if (!camera->elements_created) {
|
if (!camera->elements_created) {
|
||||||
|
|
||||||
camera->encodebin = gst_element_factory_make ("encodebin", NULL);
|
camera->encodebin = gst_element_factory_make ("encodebin", NULL);
|
||||||
|
camera->encodebin_signal_id = g_signal_connect (camera->encodebin,
|
||||||
|
"element-added", (GCallback) encodebin_element_added, camera);
|
||||||
|
|
||||||
camera->videosink =
|
camera->videosink =
|
||||||
gst_element_factory_make ("filesink", "videobin-filesink");
|
gst_element_factory_make ("filesink", "videobin-filesink");
|
||||||
camera->imagebin = gst_element_factory_make ("imagecapturebin", "imagebin");
|
camera->imagebin = gst_element_factory_make ("imagecapturebin", "imagebin");
|
||||||
|
|
|
@ -43,6 +43,7 @@ struct _GstCameraBin
|
||||||
gulong src_capture_notify_id;
|
gulong src_capture_notify_id;
|
||||||
|
|
||||||
GstElement *encodebin;
|
GstElement *encodebin;
|
||||||
|
gulong encodebin_signal_id;
|
||||||
GstElement *videosink;
|
GstElement *videosink;
|
||||||
GstElement *videobin_queue;
|
GstElement *videobin_queue;
|
||||||
GstElement *videobin_capsfilter;
|
GstElement *videobin_capsfilter;
|
||||||
|
|
Loading…
Reference in a new issue