v4l2: Re-enable prepare-format emission

With the port to gstreamer 1.0 the prepare-format signal stopped being
emitted. Start emitting this again for use in uvch264src.  While there
change the emission to include the caps for extra flexibility instead of
fource, width, height.

https://bugzilla.gnome.org/show_bug.cgi?id=692042
This commit is contained in:
Sjoerd Simons 2013-01-08 08:56:45 +01:00 committed by Olivier Crête
parent 3d1496285c
commit 00eed11d6a

View file

@ -163,9 +163,7 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass)
* GstV4l2Src::prepare-format: * GstV4l2Src::prepare-format:
* @v4l2src: the v4l2src instance * @v4l2src: the v4l2src instance
* @fd: the file descriptor of the current device * @fd: the file descriptor of the current device
* @fourcc: the fourcc of the format being set * @caps: the caps of the format being set
* @width: The width of the video
* @height: The height of the video
* *
* This signal gets emitted before calling the v4l2 VIDIOC_S_FMT ioctl * This signal gets emitted before calling the v4l2 VIDIOC_S_FMT ioctl
* (set format). This allows for any custom configuration of the device to * (set format). This allows for any custom configuration of the device to
@ -178,9 +176,7 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass)
gst_v4l2_signals[SIGNAL_PRE_SET_FORMAT] = g_signal_new ("prepare-format", gst_v4l2_signals[SIGNAL_PRE_SET_FORMAT] = g_signal_new ("prepare-format",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0, NULL, NULL, NULL, G_TYPE_NONE, 2, G_TYPE_INT, GST_TYPE_CAPS);
NULL, NULL,
NULL, G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
gst_element_class_set_static_metadata (element_class, gst_element_class_set_static_metadata (element_class,
"Video (video4linux2) Source", "Source/Video", "Video (video4linux2) Source", "Source/Video",
@ -511,6 +507,9 @@ gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps)
if (!gst_v4l2_object_stop (obj)) if (!gst_v4l2_object_stop (obj))
return FALSE; return FALSE;
g_signal_emit (v4l2src, gst_v4l2_signals[SIGNAL_PRE_SET_FORMAT], 0,
v4l2src->v4l2object->video_fd, caps);
if (!gst_v4l2_object_set_format (obj, caps)) if (!gst_v4l2_object_set_format (obj, caps))
/* error already posted */ /* error already posted */
return FALSE; return FALSE;