[PATCH] libv4l1: Move VIDIOCSFBUF into libv4l1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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

Signed-Off-by: Huzaifa Sidhpurwala <huzaifas@xxxxxxxxxx>
---
 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux