mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
v4l2object: Quirks for dev without initial format
Most M2M have undefined behaviour initially when VIDIOC_G_FMT is called. https://bugzilla.gnome.org/show_bug.cgi?id=720568
This commit is contained in:
parent
080f58166e
commit
4a85f90c79
2 changed files with 14 additions and 5 deletions
|
@ -589,6 +589,8 @@ gst_v4l2_object_new (GstElement * element,
|
|||
*/
|
||||
v4l2object->prefered_non_contiguous = TRUE;
|
||||
|
||||
v4l2object->no_initial_format = FALSE;
|
||||
|
||||
return v4l2object;
|
||||
}
|
||||
|
||||
|
@ -2292,7 +2294,7 @@ gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object,
|
|||
struct v4l2_format fmt, prevfmt;
|
||||
int fd;
|
||||
int r;
|
||||
int prevfmt_valid;
|
||||
int prevfmt_valid = FALSE;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
g_return_val_if_fail (width != NULL, FALSE);
|
||||
|
@ -2307,8 +2309,10 @@ gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object,
|
|||
/* Some drivers are buggy and will modify the currently set format
|
||||
when processing VIDIOC_TRY_FMT, so we remember what is set at the
|
||||
minute, and will reset it when done. */
|
||||
if (!v4l2object->no_initial_format) {
|
||||
prevfmt.type = v4l2object->type;
|
||||
prevfmt_valid = (v4l2_ioctl (fd, VIDIOC_G_FMT, &prevfmt) >= 0);
|
||||
}
|
||||
|
||||
/* get size delimiters */
|
||||
memset (&fmt, 0, sizeof (fmt));
|
||||
|
@ -2545,8 +2549,10 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps)
|
|||
memset (&format, 0x00, sizeof (struct v4l2_format));
|
||||
format.type = v4l2object->type;
|
||||
|
||||
if (!v4l2object->no_initial_format) {
|
||||
if (v4l2_ioctl (fd, VIDIOC_G_FMT, &format) < 0)
|
||||
goto get_fmt_failed;
|
||||
}
|
||||
|
||||
if (V4L2_TYPE_IS_MULTIPLANAR (v4l2object->type)) {
|
||||
/* even in v4l2 multiplanar mode we can work in contiguous mode
|
||||
|
|
|
@ -181,6 +181,9 @@ struct _GstV4l2Object {
|
|||
/* Quirks */
|
||||
/* Skips interlacing probes */
|
||||
gboolean never_interlaced;
|
||||
/* Allow to skip reading initial format through G_FMT. Some devices
|
||||
* just fails if you don't call S_FMT first. (ex: M2M decoders) */
|
||||
gboolean no_initial_format;
|
||||
};
|
||||
|
||||
struct _GstV4l2ObjectClassHelper {
|
||||
|
|
Loading…
Reference in a new issue