[FFmpeg-devel] [PATCH] split interleave per dts func

Baptiste Coudurier baptiste.coudurier
Fri Jan 30 21:04:32 CET 2009


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;
}

[...]

        if(compare(s, &(*next_point)->pkt, pkt) > 0)
            break;

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
checking for life_signs in -lkenny... no
FFmpeg maintainer                                  http://www.ffmpeg.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: split_interleave_per_dts.patch
Type: text/x-diff
Size: 2710 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090130/d7cf541d/attachment.patch>



More information about the ffmpeg-devel mailing list