[FFmpeg-devel] [PATCH] Use AVERROR(ENOSYS) when it makes sense
Howard Chu
hyc
Sun Apr 18 02:05:13 CEST 2010
Michael Niedermayer wrote:
> On Tue, Apr 13, 2010 at 04:41:15PM -0700, Howard Chu wrote:
>> Michael Niedermayer wrote:
>>> On Mon, Apr 12, 2010 at 12:42:05AM +0200, Stefano Sabatini wrote:
>>>> On date Sunday 2010-04-11 23:33:15 +0200, Michael Niedermayer encoded:
>>>>> On Sun, Apr 11, 2010 at 10:13:30PM +0200, Stefano Sabatini wrote:
>>>>>> On date Saturday 2010-04-03 13:46:24 +0200, Stefano Sabatini encoded:
>>>>>>> Hi, as in subject.
>>>>>>> --
>>>>>>> FFmpeg = Fucking and Fabulous Moronic Peaceful Elitarian Genius
>>>>>>
>>>>>>> From e66cec2193ee289f742120f92db17f33e7651fba Mon Sep 17 00:00:00
>>>>>>> 2001
>>>>>>> From: Stefano Sabatini<stefano.sabatini-lala at poste.it>
>>>>>>> Date: Tue, 16 Mar 2010 22:48:37 +0100
>>>>>>> Subject: [PATCH 2/5] Make url_seek() return AVERROR(ENOSYS) rather
>>>>>>> than AVERROR(EPIPE) in
>>>>>>> the case where the seek operation is not defined in the protocol
>>>>>>> handler.
>>>>>>>
>>>>>>> ---
>>>>>>> libavformat/avio.c | 2 +-
>>>>>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>>>>>>
>>>>>>> diff --git a/libavformat/avio.c b/libavformat/avio.c
>>>>>>> index af9e049..3fb64d1 100644
>>>>>>> --- a/libavformat/avio.c
>>>>>>> +++ b/libavformat/avio.c
>>>>>>> @@ -201,7 +201,7 @@ int64_t url_seek(URLContext *h, int64_t pos, int
>>>>>>> whence)
>>>>>>> int64_t ret;
>>>>>>>
>>>>>>> if (!h->prot->url_seek)
>>>>>>> - return AVERROR(EPIPE);
>>>>>>> + return AVERROR(ENOSYS);
>>>>>>> ret = h->prot->url_seek(h, pos, whence& ~AVSEEK_FORCE);
>>>>>>> return ret;
>>>>>>> }
>>>>>>> --
>>>>>>> 1.7.0
>>>>>>>
>> Leaving it EPIPE makes for some other headaches. Most of the code uses
>> ENOSYS for unimplemented functions, so using EPIPE here makes an awkward
>> inconsistency. Callers expect ENOSYS.
>
> what is "here", the code above quotes 3 functions i dont see any immedeate
> relation between any of them and your code
aviobuf.c:
int64_t av_url_read_fseek(ByteIOContext *s, int stream_index,
int64_t timestamp, int flags)
{
URLContext *h = s->opaque;
int64_t ret;
if (!s->read_seek)
return AVERROR(ENOSYS);
ret = s->read_seek(h, stream_index, timestamp, flags);
if(ret >= 0) {
int64_t pos;
s->buf_ptr = s->buf_end; // Flush buffer
pos = s->seek(h, 0, SEEK_CUR);
if (pos >= 0)
s->pos = pos;
else if (pos != AVERROR(ENOSYS))
ret = pos;
}
return ret;
}
s->seek() will point to url_seek(). For the RTMP stream h->prot->url_seek is
not implemented, so s->seek() will return EPIPE. av_url_read_fseek() was
expecting ENOSYS, not EPIPE, so it will pass EPIPE thru to the caller.
flv_read_seek() will return that to its caller. It will get passed on upward
and the read_seek() will be treated as failing instead of succeeding.
Breakpoint 1, av_url_read_fseek (s=0x0, stream_index=0, timestamp=496, flags=0)
at aviobuf.c:739
739 {
(gdb) bt
#0 av_url_read_fseek (s=0x0, stream_index=0, timestamp=496, flags=0)
at aviobuf.c:739
#1 0x0000000000449380 in flv_read_seek (s=0x11ccea0, stream_index=0,
ts=10905, flags=0) at flvdec.c:455
#2 0x00000000004a4897 in av_seek_frame (s=0x11ccea0, stream_index=0,
timestamp=10905, flags=0) at utils.c:1674
#3 0x00000000004a49f2 in avformat_seek_file (s=0x11ccea0, stream_index=-1,
min_ts=905416, ts=10905414, max_ts=9223372036854775807, flags=0)
at utils.c:1704
#4 0x00000000004293e8 in decode_thread (arg=<value optimized out>)
at ffplay.c:2506
#5 0x00007ffff67c57f5 in ?? () from /usr/lib/libSDL-1.2.so.0
#6 0x00007ffff680b3d9 in ?? () from /usr/lib/libSDL-1.2.so.0
#7 0x00007ffff621c9ca in start_thread () from /lib/libpthread.so.0
#8 0x00007ffff65196dd in clone () from /lib/libc.so.6
#9 0x0000000000000000 in ?? ()
(gdb)
>
> [...]
>
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
More information about the ffmpeg-devel
mailing list