From db0739e54f6d1917d5899cf8d2f5c817ab4fb6cf Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Thu, 1 Sep 2011 15:57:50 +0200 Subject: [PATCH] camerabin2: Add a flag to disable image conversion elements If we know that our camera source element produces buffers at the same resolution and appropriate colourspace for the output, we don't need any of the generic conversion elements in encodebin. This reduces caps negotiation overheads among other things. --- gst/camerabin2/gstcamerabin2.c | 7 +++++++ gst/camerabin2/gstcamerabin2.h | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index 3b08927836..1caa164048 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -273,6 +273,8 @@ gst_cam_flags_get_type (void) {C_FLAGS (GST_CAM_FLAG_NO_VIEWFINDER_CONVERSION), "Do not use viewfinder conversion " "elements", "no-viewfinder-conversion"}, + {C_FLAGS (GST_CAM_FLAG_NO_IMAGE_CONVERSION), "Do not use image conversion " + "elements", "no-image-conversion"}, {0, NULL, NULL} }; static volatile GType id = 0; @@ -1423,6 +1425,11 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera) encbin_flags |= (1 << 1); g_object_set (camera->video_encodebin, "flags", encbin_flags, NULL); + /* image encodebin has only video branch so disable its conversion elements + * appropriately */ + if (camera->flags & GST_CAM_FLAG_NO_IMAGE_CONVERSION) + g_object_set (camera->image_encodebin, "flags", (1 << 1), NULL); + g_object_set (camera->viewfinderbin, "disable-converters", camera->flags & GST_CAM_FLAG_NO_VIEWFINDER_CONVERSION ? TRUE : FALSE, NULL); diff --git a/gst/camerabin2/gstcamerabin2.h b/gst/camerabin2/gstcamerabin2.h index b2cf61f6ce..46113d0372 100644 --- a/gst/camerabin2/gstcamerabin2.h +++ b/gst/camerabin2/gstcamerabin2.h @@ -38,7 +38,10 @@ typedef enum /* matches GstEncFlags GST_ENC_FLAG_NO_VIDEO_CONVERSION in encodebin */ GST_CAM_FLAG_NO_VIDEO_CONVERSION = (1 << 1), /* maps to 'disable-converters' property in viewfinderbin */ - GST_CAM_FLAG_NO_VIEWFINDER_CONVERSION = (1 << 2) + GST_CAM_FLAG_NO_VIEWFINDER_CONVERSION = (1 << 2), + /* maps to GstEncFlags GST_ENC_FLAG_NO_VIDEO_CONVERSION in the image bin's + * encodebin */ + GST_CAM_FLAG_NO_IMAGE_CONVERSION = (1 << 3) } GstCamFlags;