[FFmpeg-devel] [PATCH 2/3] lavf: replace all uses of url_fskip with avio_seek

Ronald S. Bultje rsbultje
Wed Mar 2 16:17:14 CET 2011


Hi,

On Wed, Mar 2, 2011 at 8:29 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Wed, Mar 02, 2011 at 08:11:48AM -0500, Ronald S. Bultje wrote:
>> On Wed, Mar 2, 2011 at 8:01 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Mon, Feb 28, 2011 at 02:57:55PM +0100, Anton Khirnov wrote:
>> > [...]
>> >> diff --git a/libavformat/aea.c b/libavformat/aea.c
>> >> index 8316a7e..60b2d38 100644
>> >> --- a/libavformat/aea.c
>> >> +++ b/libavformat/aea.c
>> >> @@ -62,9 +62,9 @@ static int aea_read_header(AVFormatContext *s,
>> >> ? ? ? ? ?return AVERROR(ENOMEM);
>> >>
>> >> ? ? ?/* Parse the amount of channels and skip to pos 2048(0x800) */
>> >> - ? ?url_fskip(s->pb, 264);
>> >> + ? ?avio_seek(s->pb, 264, SEEK_CUR);
>> >> ? ? ?st->codec->channels = avio_r8(s->pb);
>> >> - ? ?url_fskip(s->pb, 1783);
>> >> + ? ?avio_seek(s->pb, 1783, SEEK_CUR);
>> >
>> > another worsening of the API
>>
>> How?
>
> 1 argument more that is always the same
>
>
>>
>> We have two functions (seek(SEEK_CUR) and skip) that do the same
>> thing. Why not merge them together, optimize that correctly for the
>> corner cases where possible (data is in buffer, etc.), and otherwise
>> drop the other?
>
> same reason as printf() vs. fprintf(stdout)
> and ?a+= b vs. a= a+b
>
> the shorter form exists because it is very common and more readable.

I'm fine with a macro that defines avio_skip or ffio_skip to
avio_seek(SEEK_CUR).

Ronald



More information about the ffmpeg-devel mailing list