[FFmpeg-devel] [RFC] Seeking in PVA files

Måns Rullgård mans
Sun Jan 6 21:56:39 CET 2008


Ivo <ivop at euronet.nl> writes:

> On Sunday 06 January 2008 19:50, M?ns Rullg?rd wrote:
>> Ivo <ivop at euronet.nl> writes:
>> > Index: libavformat/mpeg.c
>> > ===================================================================
>> > --- libavformat/mpeg.c	(revision 11412)
>> > +++ libavformat/mpeg.c	(working copy)
>> > @@ -120,17 +120,12 @@
>> >
>> >  static int64_t get_pts(ByteIOContext *pb, int c)
>> >  {
>> > -    int64_t pts;
>> > -    int val;
>> > +    uint8_t buf[5];
>> >
>> > -    if (c < 0)
>> > -        c = get_byte(pb);
>> > -    pts = (int64_t)(c & 0x0e) << 29;
>> > -    val = get_be16(pb);
>> > -    pts |= (int64_t)(val >> 1) << 15;
>> > -    val = get_be16(pb);
>> > -    pts |= (int64_t)(val >> 1);
>> > -    return pts;
>> > +    buf[0] = c<0 ? get_byte(pb) : c;
>> > +    AV_WB32(buf+1, get_be32(pb));
>>
>> Why not use get_buffer()?
>
> +    buf[0] = c<0 ? get_byte(pb) : c;
> +    get_buffer(pb, buf+1, 4);
>
> Would that be ok?

Yes.  It looks simpler, don't you agree?

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list