mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-01 12:02:27 +00:00
v4l2: enforce a pixel aspect ratio of 1/1 if no data are available
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6559>
This commit is contained in:
parent
993d8b89bc
commit
88dd91cb30
1 changed files with 18 additions and 4 deletions
|
@ -5002,10 +5002,24 @@ gst_v4l2_object_probe_caps (GstV4l2Object * v4l2object, GstCaps * filter)
|
||||||
|
|
||||||
cropcap.type = v4l2object->type;
|
cropcap.type = v4l2object->type;
|
||||||
if (v4l2object->ioctl (v4l2object->video_fd, VIDIOC_CROPCAP, &cropcap) < 0) {
|
if (v4l2object->ioctl (v4l2object->video_fd, VIDIOC_CROPCAP, &cropcap) < 0) {
|
||||||
if (errno != ENOTTY)
|
|
||||||
GST_WARNING_OBJECT (v4l2object->dbg_obj,
|
switch (errno) {
|
||||||
"Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: %s",
|
case ENODATA:
|
||||||
g_strerror (errno));
|
case ENOTTY:
|
||||||
|
GST_INFO_OBJECT (v4l2object->dbg_obj,
|
||||||
|
"Driver does not support VIDIOC_CROPCAP (%s), assuming pixel aspect ratio 1/1",
|
||||||
|
g_strerror (errno));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
GST_WARNING_OBJECT (v4l2object->dbg_obj,
|
||||||
|
"Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: %s",
|
||||||
|
g_strerror (errno));
|
||||||
|
}
|
||||||
|
v4l2object->par = g_new0 (GValue, 1);
|
||||||
|
g_value_init (v4l2object->par, GST_TYPE_FRACTION);
|
||||||
|
gst_value_set_fraction (v4l2object->par, 1, 1);
|
||||||
|
|
||||||
} else if (cropcap.pixelaspect.numerator && cropcap.pixelaspect.denominator) {
|
} else if (cropcap.pixelaspect.numerator && cropcap.pixelaspect.denominator) {
|
||||||
v4l2object->par = g_new0 (GValue, 1);
|
v4l2object->par = g_new0 (GValue, 1);
|
||||||
g_value_init (v4l2object->par, GST_TYPE_FRACTION);
|
g_value_init (v4l2object->par, GST_TYPE_FRACTION);
|
||||||
|
|
Loading…
Reference in a new issue