From 8c4241427a9b104ccdd460bea68ad665fe739701 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 26 Jul 2011 16:15:05 +0200 Subject: [PATCH] v4l2: rename a variable Rename the size variable to sizeimage and fill it with the size that has been given to use by the v4l2 driver instead of making something up.. --- sys/v4l2/gstv4l2object.c | 6 ++++-- sys/v4l2/gstv4l2object.h | 2 +- sys/v4l2/gstv4l2src.c | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 8dd9cc2b30..f84f5528f3 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2260,9 +2260,11 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps) if (format.fmt.pix.pixelformat != pixelformat) goto invalid_pixelformat; } + + /* figure out the frame layout */ v4l2object->bytesperline = format.fmt.pix.bytesperline; - /* FIXME, size for only one plane */ - v4l2object->size = v4l2object->bytesperline * height; + v4l2object->sizeimage = format.fmt.pix.sizeimage; + /* Is there a reason we require the caller to always specify a framerate? */ GST_DEBUG_OBJECT (v4l2object->element, "Desired framerate: %u/%u", fps_n, diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h index 8689e8f7e9..5120a93a2c 100644 --- a/sys/v4l2/gstv4l2object.h +++ b/sys/v4l2/gstv4l2object.h @@ -118,7 +118,7 @@ struct _GstV4l2Object { GstVideoInfo info; guint32 bytesperline; - guint size; + guint32 sizeimage; GstClockTime duration; /* wanted mode */ diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index a9511ab22e..6e66a40377 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -562,7 +562,7 @@ gst_v4l2src_setup_allocation (GstBaseSrc * bsrc, GstQuery * query) GST_DEBUG_OBJECT (src, "read/write mode: no downstream pool, using our own"); pool = obj->pool; - size = obj->size; + size = obj->sizeimage; } else { /* in READ/WRITE mode, prefer a downstream pool because our own pool * doesn't help much, we have to write to it as well */ @@ -570,14 +570,14 @@ gst_v4l2src_setup_allocation (GstBaseSrc * bsrc, GstQuery * query) /* use the bigest size, when we use our own pool we can't really do any * other size than what the hardware gives us but for downstream pools * we can try */ - size = MAX (size, obj->size); + size = MAX (size, obj->sizeimage); } break; case GST_V4L2_IO_MMAP: case GST_V4L2_IO_USERPTR: /* in streaming mode, prefer our own pool */ pool = obj->pool; - size = obj->size; + size = obj->sizeimage; GST_DEBUG_OBJECT (src, "streaming mode: using our own pool %" GST_PTR_FORMAT, pool); break;