[FFmpeg-devel] [PATCH] split interleave per dts func
Michael Niedermayer
michaelni
Fri Jan 30 21:49:16 CET 2009
On Fri, Jan 30, 2009 at 12:04:32PM -0800, Baptiste Coudurier wrote:
> Michael Niedermayer wrote:
> > On Thu, Jan 29, 2009 at 04:29:50PM -0800, Baptiste Coudurier wrote:
> >> Hi,
> >>
> >> I'd like to factorize the code between oggenc, and interleave_per_dts,
> >> also mxf muxer will soon use a different compare function too.
> >>
> >> How is it ?
> >>
> >> [...]
> >>
> >> +
> >> +int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
> >> +{
> >
> >> + AVStream *st= s->streams[ pkt->stream_index];
> >> + AVStream *st2= s->streams[ next->stream_index];
> >
> > vertical align
>
> Done.
>
> >> + int64_t left= st2->time_base.num * (int64_t)st ->time_base.den;
> >> + int64_t right= st ->time_base.num * (int64_t)st2->time_base.den;
> >> +
> >
> >> + return next->dts * left > pkt->dts * right; //FIXME this can overflow
> >
> > unrelated to your patch but this should use the method described in
> > nut.txt compare_ts()
>
> Like this:
>
> int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
> {
> AVStream *st = s->streams[ pkt ->stream_index];
> AVStream *st2= s->streams[ next->stream_index];
>
> if (av_rescale_q(next->dts, st2->time_base, st ->time_base) < pkt ->dts) return -1;
> if (av_rescale_q(pkt ->dts, st ->time_base, st2->time_base) < next->dts) return 1;
> return 0;
no this doesnt round correctly for our purposes
av_rescale_rnd() could be used though
and patch below looks ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- 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/20090130/6f8aedb8/attachment.pgp>
More information about the ffmpeg-devel
mailing list