From patchwork Tue Jun 1 09:37:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huzaifa Sidhpurwala X-Patchwork-Id: 103441 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o519dP2v025060 for ; Tue, 1 Jun 2010 09:39:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753497Ab0FAJjY (ORCPT ); Tue, 1 Jun 2010 05:39:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33697 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752775Ab0FAJjX (ORCPT ); Tue, 1 Jun 2010 05:39:23 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o519dNGM020747 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 1 Jun 2010 05:39:23 -0400 Received: from localhost.localdomain (shazarik.pnq.redhat.com [10.65.192.171]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o519dKMP021666; Tue, 1 Jun 2010 05:39:21 -0400 From: huzaifas@redhat.com To: linux-media@vger.kernel.org Cc: hdegoede@redhat.com, Huzaifa Sidhpurwala Subject: [PATCH] libv4l1: Move VIDIOCSFBUF into libv4l1 Date: Tue, 1 Jun 2010 15:07:21 +0530 Message-Id: <1275385041-4782-1-git-send-email-huzaifas@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 01 Jun 2010 09:39:25 +0000 (UTC) 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: