From: Huzaifa Sidhpurwala <huzai...@fedora-12.(none)>

Move VIDIOCSFBUF into libv4l1 and correct a missing
break with the last commit

Signed-Off-by: Huzaifa Sidhpurwala <huzai...@redhat.com>
---
 lib/libv4l1/libv4l1.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/lib/libv4l1/libv4l1.c b/lib/libv4l1/libv4l1.c
index ac3c2d9..877508c 100644
--- a/lib/libv4l1/libv4l1.c
+++ b/lib/libv4l1/libv4l1.c
@@ -847,6 +847,38 @@ int v4l1_ioctl(int fd, unsigned long int request, ...)
                                (buffer->width * buffer->depth + 7) & 7;
                        buffer->bytesperline >>= 3;
                }
+               break;
+       }
+
+       case VIDIOCSFBUF: {
+               struct video_buffer *buffer = arg;
+               struct v4l2_framebuffer fbuf = { 0, };
+
+               fbuf.base = buffer->base;
+               fbuf.fmt.height = buffer->height;
+               fbuf.fmt.width = buffer->width;
+
+               switch (buffer->depth) {
+               case 8:
+                       fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB332;
+                       break;
+               case 15:
+                       fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB555;
+                       break;
+               case 16:
+                       fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB565;
+                       break;
+               case 24:
+                       fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR24;
+                       break;
+               case 32:
+                       fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR32;
+                       break;
+               }
+
+               fbuf.fmt.bytesperline = buffer->bytesperline;
+               result = v4l2_ioctl(fd, VIDIOC_G_FBUF, buffer);
+               break;
        }
 
        default:
-- 
1.6.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to