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.
This commit is contained in:
Robert Swain 2011-09-01 15:57:50 +02:00
parent d663259d4b
commit db0739e54f
2 changed files with 11 additions and 1 deletions

View file

@ -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);

View file

@ -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;