[FFmpeg-devel] [PATCH] Frame rate emulation
Michael Niedermayer
michaelni
Mon Jun 18 00:38:10 CEST 2007
Hi
On Sun, Jun 17, 2007 at 06:59:30PM -0300, Ramiro Ribeiro Polla wrote:
[...]
> >
> >[...]
> >
> >>Index: libavformat/utils.c
> >>===================================================================
> >>--- libavformat/utils.c (revision 9347)
> >>+++ libavformat/utils.c (working copy)
> >>@@ -2900,3 +2900,21 @@
> >> }
> >> f->num = num;
> >> }
> >>+
> >>+int av_rate_emu(AVRateEmu *rate_emu)
> >>+{
> >>+ int64_t pts = av_rescale((int64_t) rate_emu->frame *
> >>rate_emu->time_base.num, 1000000, rate_emu->time_base.den);
> >>+ int64_t now = av_gettime() - rate_emu->start;
> >>+ if (pts > now)
> >>+ return AVERROR(EAGAIN);
> >>
> >
> >i think it should return the number of (micro/milli/nano whatever) seconds
> >left
> >
> >
> Done.
>
> Patch attached.
>
> Ramiro Polla
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c (revision 9356)
> +++ ffmpeg.c (working copy)
> @@ -1878,7 +1878,9 @@
>
> /* read a frame from it and output it in the fifo */
> is = input_files[file_index];
> - if (av_read_frame(is, &pkt) < 0) {
> + if ((ret = av_read_frame(is, &pkt)) < 0) {
> + if (ret == AVERROR(EAGAIN))
> + continue;
> file_table[file_index].eof_reached = 1;
> if (opt_shortest) break; else continue; //
> }
ok but please commit this seperately
[...]
> @@ -270,8 +263,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.den = ap->time_base.den;
> + st->codec->time_base.num = ap->time_base.num;
st->codec->time_base= ap->time_base;
except these and a missing minor version increase the patch looks ok
asuming you did test the changes grabing demxuers (AV sync amongth others
should not get worse)
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070618/9ab4a39a/attachment.pgp>
More information about the ffmpeg-devel
mailing list