[MPlayer-dev-eng] MJPEG camera support for v4l2 driver

Vladimir Voroshilov voroshil at gmail.com
Tue May 29 20:02:08 CEST 2007


2007/5/26, Trent Piepho <xyzzy at speakeasy.org>:
> On Sat, 26 May 2007, Vladimir Voroshilov wrote:
> > 2007/5/25, Trent Piepho <xyzzy at speakeasy.org>:
> > > > The patch should be "fixed" now and updated to match with the current SVN-version.
> > >
> > >      int h = priv->format.fmt.pix.height;
> > >      int d = pixfmt2depth(priv->format.fmt.pix.pixelformat);
> > >      int bytesperline = w*d/8;
> > > +    int sizeimage = priv->format.fmt.pix.sizeimage ? priv->format.fmt.pix.sizeimage : (bytesperline * h);
> > >
> > > The existing code to calculate the image size shouldn't even be necessary.
> > > sizeimage is suppose to already contain it.
> > priv->format.fmt.pix.sizeimage will always have nonzero value. Thus
> > sizeimage variable will be always equal to
> > priv->format.fmt.pix.sizeimage. Did i undestand right?
>
> Yes, sizeimage should never be zero, or it's a bug in the driver.
>
> > > For the copy frame function, it's not quite right either.  sizeimage in the
> > > pixel format is the maximum size of a frame.  jpeg compressed frames will
> > > not all be the same size and some will be smaller.  The "bytesused" field
> > > in the v4l2_buffer returned by DQBUF should contain the actual frame size.
> > This will require another ringbuffer to store "bytesused" values for
> > each frame for future return in get_video_frame_size.
>
> Wouldn't it be simpler to just have one ring buffer of v4l2_buffer structs?
I decided to use similar, but smaller struct for video ringbuffer data.

Updated patch is attached.
It was tested with analog capture card (no mjpeg support) with
yuy2,yv12,i420 and uyvy format and no regressions were found.
Please test it with mjpeg capable card.
Any comments are also welcome.

-- 
Regards,
Vladimir Voroshilov     mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mjpeg.diff
Type: application/octet-stream
Size: 9387 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070530/b2f461b0/attachment.obj>


More information about the MPlayer-dev-eng mailing list