[FFmpeg-devel] [PATCH 1/2] avio: add avio_skip macro
Ronald S. Bultje
rsbultje
Thu Mar 3 16:07:40 CET 2011
Hi,
On Thu, Mar 3, 2011 at 9:16 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Thu, Mar 03, 2011 at 08:26:50AM -0500, Ronald S. Bultje wrote:
>> Hi,
>>
>> On Thu, Mar 3, 2011 at 6:37 AM, Peter Ross <pross at xvid.org> wrote:
>> > This is a substitute for the url_fskip function that was deprecated by
>> > commit 0300db8ad778a194b4a8ec98f6da3de5b41c46ee. avio_fskip is provided to
>> > improve demuxer code readability. It distinguishes the act of skipping over
>> > unknown or irrelevant bytes from the standard avio_seek operation.
>> > ---
>> > ?libavformat/avio.h | ? ?6 ++++++
>> > ?1 files changed, 6 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/libavformat/avio.h b/libavformat/avio.h
>> > index cc46ad7..fc9f618 100644
>> > --- a/libavformat/avio.h
>> > +++ b/libavformat/avio.h
>> > @@ -470,6 +470,12 @@ int avio_put_str16le(AVIOContext *s, const char *str);
>> > ?int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
>> >
>> > ?/**
>> > + * Skip given number of bytes forward
>> > + * @return new position or AVERROR.
>> > + */
>> > +#define avio_skip(s, offset) avio_seek(s, offset, SEEK_CUR)
>> > +
>> > +/**
>>
>> OK with me.
>
> for the record id like to repeat that a function is better for this
int url_fskip(ByteIOContext *s, int64_t offset)
{
int64_t ret = url_fseek(s, offset, SEEK_CUR);
return ret < 0 ? ret : 0;
}
No it is not.
Dump of assembler code for function url_fskip:
0x00000001000304c0 <url_fskip+0>: sub $0x8,%rsp
0x00000001000304c4 <url_fskip+4>: mov $0x1,%edx
0x00000001000304c9 <url_fskip+9>: callq 0x100030290 <url_fseek>
0x00000001000304ce <url_fskip+14>: mov %rax,%rdx
0x00000001000304d1 <url_fskip+17>: xor %eax,%eax
0x00000001000304d3 <url_fskip+19>: test %rdx,%rdx
0x00000001000304d6 <url_fskip+22>: cmovle %rdx,%rax
0x00000001000304da <url_fskip+26>: add $0x8,%rsp
0x00000001000304de <url_fskip+30>: retq
0x00000001000304df <url_fskip+31>: nop
End of assembler dump.
And no it is not inlined.
Ronald
More information about the ffmpeg-devel
mailing list