summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-12-15 14:05:54 -0300
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-12-23 13:24:55 -0300
commit1e6be5ec56210924d09b5b6f8689428f7fa4a613 (patch)
tree6165f3724b6ea5ace7216108d4ef91a58df861de /gst
parentb1a361b566cf0dfc3a188f5a23c13feab9d575a2 (diff)
camerabin2: Use custom renegotiate event
Adds a custom renegotiate event that is pushed to the camerasrc pad that needs renegotiation due to the user selecting a new capture caps for that pad. This is a way of notifying the source that it should update its caps, even if it doesn't use pad allocs.
Diffstat (limited to 'gst')
-rw-r--r--gst/camerabin2/gstcamerabin2.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c
index f155cf24b..d4a0db6c2 100644
--- a/gst/camerabin2/gstcamerabin2.c
+++ b/gst/camerabin2/gstcamerabin2.c
@@ -135,6 +135,13 @@ gst_camera_bin_change_state (GstElement * element, GstStateChange trans);
/* Camerabin functions */
+static GstEvent *
+gst_camera_bin_new_event_renegotiate (void)
+{
+ return gst_event_new_custom (GST_EVENT_CUSTOM_BOTH,
+ gst_structure_new ("renegotiate", NULL));
+}
+
static void
gst_camera_bin_start_capture (GstCameraBin * camerabin)
{
@@ -550,13 +557,43 @@ gst_camera_bin_set_property (GObject * object, guint prop_id,
case PROP_CAMERA_SRC:
gst_camera_bin_set_camera_src (camera, g_value_get_object (value));
break;
- case PROP_IMAGE_CAPTURE_CAPS:
+ case PROP_IMAGE_CAPTURE_CAPS:{
+ GstPad *pad = NULL;
+
+ if (camera->src)
+ pad =
+ gst_element_get_static_pad (camera->src,
+ GST_BASE_CAMERA_SRC_IMAGE_PAD_NAME);
+
+ /* set the capsfilter caps and notify the src to renegotiate */
g_object_set (camera->imagebin_capsfilter, "caps",
gst_value_get_caps (value), NULL);
+ if (pad) {
+ GST_DEBUG_OBJECT (camera, "Pushing renegotiate on %s",
+ GST_PAD_NAME (pad));
+ GST_PAD_EVENTFUNC (pad) (pad, gst_camera_bin_new_event_renegotiate ());
+ gst_object_unref (pad);
+ }
+ }
break;
- case PROP_VIDEO_CAPTURE_CAPS:
+ case PROP_VIDEO_CAPTURE_CAPS:{
+ GstPad *pad = NULL;
+
+ if (camera->src)
+ pad =
+ gst_element_get_static_pad (camera->src,
+ GST_BASE_CAMERA_SRC_VIDEO_PAD_NAME);
+
+ /* set the capsfilter caps and notify the src to renegotiate */
g_object_set (camera->videobin_capsfilter, "caps",
gst_value_get_caps (value), NULL);
+ if (pad) {
+ GST_DEBUG_OBJECT (camera, "Pushing renegotiate on %s",
+ GST_PAD_NAME (pad));
+ gst_pad_push_event (pad, gst_camera_bin_new_event_renegotiate ());
+ gst_object_unref (pad);
+ }
+ }
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);