[FFmpeg-devel] [PATCH] Simplify v4l.c:grab_read_header frame_rate management

Michael Niedermayer michaelni
Wed Nov 26 01:24:11 CET 2008


On Tue, Oct 28, 2008 at 12:07:13AM +0100, Stefano Sabatini wrote:
> Hi, first of a series of patch, I'd like to implement size autodetect
> in the v4l indev.
> 
> frame_rate and framerate_base are not a very intuitive way to denote
> the framerate, I think it's better to use a rational and use the
> time_base term since this term is used both in the AP and in the
> stream.
> 
> It also slightly simplifies the code.

[...]
> @@ -91,8 +91,8 @@
>  
>      width = ap->width;
>      height = ap->height;
> -    frame_rate      = ap->time_base.den;
> -    frame_rate_base = ap->time_base.num;
> +    s->time_base.num = ap->time_base.num;
> +    s->time_base.den = ap->time_base.den;
>  
>      if((unsigned)width > 32767 || (unsigned)height > 32767) {
>          av_log(s1, AV_LOG_ERROR, "Capture size is out of range: %dx%d\n",
> @@ -108,8 +108,6 @@
>  
>      s->width = width;
>      s->height = height;
> -    s->frame_rate      = frame_rate;
> -    s->frame_rate_base = frame_rate_base;

id prefer if the time_base init is left were the s->frame_rate is


[...]
> @@ -254,8 +252,8 @@
>      st->codec->codec_id = CODEC_ID_RAWVIDEO;
>      st->codec->width = width;
>      st->codec->height = height;
> -    st->codec->time_base.den      = frame_rate;
> -    st->codec->time_base.num = frame_rate_base;
> +    st->codec->time_base.num = s->time_base.num;
> +    st->codec->time_base.den = s->time_base.den;

st->codec->time_base= s->time_base

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081126/92c8c93d/attachment.pgp>



More information about the ffmpeg-devel mailing list