* [PATCH] cx18: Fix VIDIOC_TRY_FMT to fill in sizeimage and bytesperline
@ 2015-11-24 18:09 Simon Farnsworth
[not found] ` <CAH-u=81v76v0dYb64RAF-q0fuF2TCor=SKm3h3POpxOO5Fb4YA@mail.gmail.com>
2015-11-27 13:37 ` Hans Verkuil
0 siblings, 2 replies; 3+ messages in thread
From: Simon Farnsworth @ 2015-11-24 18:09 UTC (permalink / raw)
To: linux-media; +Cc: Simon Farnsworth
I was having trouble capturing raw video from GStreamer; turns out that I
now need VIDIOC_TRY_FMT to fill in sizeimage and bytesperline to make it work.
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
---
I'm leaving ONELAN on Friday, so this is a drive-by patch being sent for the
benefit of anyone else trying to use raw capture from a cx18 card. If it's
not suitable for applying as-is, please feel free to just leave it in the
archives so that someone else hitting the same problem can find my fix.
drivers/media/pci/cx18/cx18-ioctl.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c
index 55525af..1c9924a 100644
--- a/drivers/media/pci/cx18/cx18-ioctl.c
+++ b/drivers/media/pci/cx18/cx18-ioctl.c
@@ -234,6 +234,13 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh,
fmt->fmt.pix.width = w;
fmt->fmt.pix.height = h;
+ if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_HM12) {
+ fmt->fmt.pix.sizeimage = h * 720 * 3 / 2;
+ fmt->fmt.pix.bytesperline = 720; /* First plane */
+ } else {
+ fmt->fmt.pix.sizeimage = h * 720 * 2;
+ fmt->fmt.pix.bytesperline = 1440; /* Packed */
+ }
return 0;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <CAH-u=81v76v0dYb64RAF-q0fuF2TCor=SKm3h3POpxOO5Fb4YA@mail.gmail.com>]
* Re: [PATCH] cx18: Fix VIDIOC_TRY_FMT to fill in sizeimage and bytesperline
[not found] ` <CAH-u=81v76v0dYb64RAF-q0fuF2TCor=SKm3h3POpxOO5Fb4YA@mail.gmail.com>
@ 2015-11-25 9:53 ` Simon Farnsworth
0 siblings, 0 replies; 3+ messages in thread
From: Simon Farnsworth @ 2015-11-25 9:53 UTC (permalink / raw)
To: Jean-Michel Hautbois; +Cc: Linux Media Mailing List
On Tuesday 24 November 2015 21:27:33 Jean-Michel Hautbois wrote:
> Hi,
> Le 24 nov. 2015 19:46, "Simon Farnsworth" <simon.farnsworth@onelan.co.uk> a écrit :
> >
> > I was having trouble capturing raw video from GStreamer; turns out that I
> > now need VIDIOC_TRY_FMT to fill in sizeimage and bytesperline to make it work.
>
> You could have used v4l2-compliance tool it would give you at least (I don't have the HW to test) this error. Would save your time :-)
It only took me 2 minutes to find - I'd have spent longer getting
v4l2-compliance running :)
As I'm not going to have access to the hardware after Friday, I'll leave
getting a full v4l2-compliance pass to someone else.
> > Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
> > ---
> >
> > I'm leaving ONELAN on Friday, so this is a drive-by patch being sent for the
> > benefit of anyone else trying to use raw capture from a cx18 card. If it's
> > not suitable for applying as-is, please feel free to just leave it in the
> > archives so that someone else hitting the same problem can find my fix.
> >
<snip>
--
Simon Farnsworth
Software Engineer
ONELAN Ltd
http://www.onelan.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cx18: Fix VIDIOC_TRY_FMT to fill in sizeimage and bytesperline
2015-11-24 18:09 [PATCH] cx18: Fix VIDIOC_TRY_FMT to fill in sizeimage and bytesperline Simon Farnsworth
[not found] ` <CAH-u=81v76v0dYb64RAF-q0fuF2TCor=SKm3h3POpxOO5Fb4YA@mail.gmail.com>
@ 2015-11-27 13:37 ` Hans Verkuil
1 sibling, 0 replies; 3+ messages in thread
From: Hans Verkuil @ 2015-11-27 13:37 UTC (permalink / raw)
To: Simon Farnsworth, linux-media, Andy Walls
On 11/24/2015 07:09 PM, Simon Farnsworth wrote:
> I was having trouble capturing raw video from GStreamer; turns out that I
> now need VIDIOC_TRY_FMT to fill in sizeimage and bytesperline to make it work.
>
> Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
> ---
>
> I'm leaving ONELAN on Friday, so this is a drive-by patch being sent for the
> benefit of anyone else trying to use raw capture from a cx18 card. If it's
> not suitable for applying as-is, please feel free to just leave it in the
> archives so that someone else hitting the same problem can find my fix.
>
> drivers/media/pci/cx18/cx18-ioctl.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c
> index 55525af..1c9924a 100644
> --- a/drivers/media/pci/cx18/cx18-ioctl.c
> +++ b/drivers/media/pci/cx18/cx18-ioctl.c
> @@ -234,6 +234,13 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh,
>
> fmt->fmt.pix.width = w;
> fmt->fmt.pix.height = h;
> + if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_HM12) {
> + fmt->fmt.pix.sizeimage = h * 720 * 3 / 2;
> + fmt->fmt.pix.bytesperline = 720; /* First plane */
> + } else {
> + fmt->fmt.pix.sizeimage = h * 720 * 2;
> + fmt->fmt.pix.bytesperline = 1440; /* Packed */
> + }
This isn't correct: for MPEG formats bytesperline should be 0 and sizeimage is fixed
at 128*1024.
I really have no time to make a proper patch, Andy is this something you can look at?
Hmm, ivtv does it a bit better but it will return the wrong sizeimage.
Regards,
Hans
> return 0;
> }
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-27 13:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-24 18:09 [PATCH] cx18: Fix VIDIOC_TRY_FMT to fill in sizeimage and bytesperline Simon Farnsworth
[not found] ` <CAH-u=81v76v0dYb64RAF-q0fuF2TCor=SKm3h3POpxOO5Fb4YA@mail.gmail.com>
2015-11-25 9:53 ` Simon Farnsworth
2015-11-27 13:37 ` Hans Verkuil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox