public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <j.w.r.degoede@hhs.nl>
To: Jean-Francois Moine <moinejf@free.fr>
Cc: video4linux-list@redhat.com
Subject: PATCH: gspca-add-driver-get_buf_size-method.patch saved
Date: Fri, 04 Jul 2008 09:52:06 +0200	[thread overview]
Message-ID: <486DD6A6.7020209@hhs.nl> (raw)

[-- Attachment #1: Type: text/plain, Size: 847 bytes --]

Hi All,

This patch adds a get_buff_size op to the driver desc struct, and modifies
gspca_get_buff_size to call this (if defined) instead of calculating the
buff_size itself.

This is needed for the pac207 with decoding removed, as the pac207 does
line by line compression prefixing each line with a header indicating wether
or not it is compressed, and only does compression when needed to meet
bandwidth constraints. In half resolution mode, when there are no
bandwidth constraints, the imagesize is actually larger (due to the line
headers) then the raw bayer, so in this case gspca_get_buff_size does the
wrong thing. The best solution in special cases like this is to allow the
driver to provide its own get_buff_size, overriding gspca_get_buff_size's
normal calculations.

Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>

Regards,

Hans

[-- Attachment #2: gspca-add-driver-get_buf_size-method.patch --]
[-- Type: text/plain, Size: 1985 bytes --]

This patch adds a get_buff_size op to the driver desc struct, and modifies
gspca_get_buff_size to call this (if defined) instead of calculating the
buff_size itself.

This is needed for the pac207 with decoding removed, as the pac207 does
line by line compression prefixing each line with a header indicating wether
or not it is compressed, and only does compression when needed to meet
bandwidth constraints. In half resolution mode, when there are no
bandwidth constraints, the imagesize is actually larger (due to the line
headers) then the raw bayer, so in this case gspca_get_buff_size does the
wrong thing. The best solution in special cases like this is to allow the
driver to provide its own get_buff_size, overriding gspca_get_buff_size's
normal calculations.

Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>

diff -r b8dc1b84f3c5 linux/drivers/media/video/gspca/gspca.c
--- a/linux/drivers/media/video/gspca/gspca.c	Fri Jul 04 09:36:32 2008 +0200
+++ b/linux/drivers/media/video/gspca/gspca.c	Fri Jul 04 09:44:31 2008 +0200
@@ -400,6 +400,9 @@
 static int gspca_get_buff_size(struct gspca_dev *gspca_dev, int mode)
 {
 	unsigned int size;
+
+	if (gspca_dev->sd_desc->get_buff_size)
+		return gspca_dev->sd_desc->get_buff_size(gspca_dev, mode);
 
 	size =  gspca_dev->cam.cam_mode[mode].width *
 		gspca_dev->cam.cam_mode[mode].height *
diff -r b8dc1b84f3c5 linux/drivers/media/video/gspca/gspca.h
--- a/linux/drivers/media/video/gspca/gspca.h	Fri Jul 04 09:36:32 2008 +0200
+++ b/linux/drivers/media/video/gspca/gspca.h	Fri Jul 04 09:44:31 2008 +0200
@@ -100,6 +100,7 @@
 				struct gspca_frame *frame,
 				__u8 *data,
 				int len);
+typedef int (*cam_get_buff_size_op) (struct gspca_dev *gspca_dev, int mode);
 
 struct ctrl {
 	struct v4l2_queryctrl qctrl;
@@ -126,6 +127,7 @@
 	cam_jpg_op get_jcomp;
 	cam_jpg_op set_jcomp;
 	cam_qmnu_op querymenu;
+	cam_get_buff_size_op get_buff_size; /* optional */
 };
 
 /* packet types when moving from iso buf to frame buf */

[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

                 reply	other threads:[~2008-07-04  7:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=486DD6A6.7020209@hhs.nl \
    --to=j.w.r.degoede@hhs.nl \
    --cc=moinejf@free.fr \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox