mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
uvcsink: set cur_caps to upstream selected caps
If the UVC gadget announces multiple formats in the descriptors the uvcsink doesn't select the actual format but let's the UVC hosts select the format. If the GStreamer pipeline is started before a UVC host selected the format, upstream decides on a format until the UVC host has decided. In this case, the current format needs to be set based on the caps from the caps event to be able to detect if the format selection by the UVC host requires a format change on the GStreamer pipeline. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7473>
This commit is contained in:
parent
f82a716009
commit
76d753f1c5
1 changed files with 16 additions and 0 deletions
|
@ -248,6 +248,22 @@ gst_uvc_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
case GST_EVENT_CAPS:
|
||||
GST_DEBUG_OBJECT (self, "Handling %" GST_PTR_FORMAT, event);
|
||||
|
||||
/* If the UVC host did not yet commit a format, the cur_caps may contain
|
||||
* all probed caps. In this case, the element is not able to detect, if
|
||||
* the caps have changed when the stream is enabled. Take the caps from
|
||||
* upstream to be able to detect a change.
|
||||
*/
|
||||
if (!GST_CAPS_IS_SIMPLE (self->cur_caps)) {
|
||||
GstCaps *caps;
|
||||
|
||||
gst_event_parse_caps (event, &caps);
|
||||
gst_caps_replace (&self->cur_caps, caps);
|
||||
|
||||
GST_DEBUG_OBJECT (self,
|
||||
"UVC host didn't select a format, yet. Using upstream %"
|
||||
GST_PTR_FORMAT, self->cur_caps);
|
||||
}
|
||||
|
||||
/* EVENT CAPS signals that the buffers after the event will use new caps.
|
||||
* If the UVC host requested a new format, we now must start the stream.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue