[FFmpeg-devel] [PATCH] allow v4l2 to capture mjpeg streams

klchxbec klchxbec
Thu Dec 10 07:40:35 CET 2009


Luca,

Thanks for the comments. Attaching a revised patch.

--- On Wed, 9/12/09, Luca Abeni <lucabe72 at email.it> wrote:

> Ok; after your explanation, I think the patch can be made
> even more
> generic, by introducing an array (similar to
> fmt_conversion_table[]) for
> converting between codec IDs and v4l2 formats.
> This would simplify support for other compressed formats.

I've made the logic completely table driven now.

> > +static int v4l2_format_is_fixed(int frame_format)
> > +{
> > +    switch (frame_format) {
> > +    case V4L2_PIX_FMT_MJPEG:
> > +    case V4L2_PIX_FMT_JPEG:
> > +        return 0;
> > +    }
> > +    return 1;
> > +}
>
> I think this check can be based on the codec ID, can can
> be
> (codec_id == CODEC_ID_RAWVIDEO).

Got rid of this function because we can rely on the fact that
avpicture_get_size() returns -1 for PIX_FMT_NONE.

> Here, you seem to be reverting the check; "s->buf_len[i]

It was invadverent. Fixed.

>>      st->codec->width = width;
>>      st->codec->height = height;
>>      st->codec->time_base.den = ap->time_base.den;
>
>I think the code following these lines will end up by setting a wrong
>st->codec->bit_rate in case of compressed formats.

Ok, mjpegdec.c seems to cope fine with this. I can't notice anything
wrong. Looked at v4l2 api as well as luvcview sources for any clues,
but don't see what should be done here.


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ffmpeg-v4l2-mjpeg-patch-2.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091209/8a7ff174/attachment.txt>



More information about the ffmpeg-devel mailing list