[FFmpeg-devel] [PATCH] Use AVERROR(ENOSYS) when it makes sense

Michael Niedermayer michaelni
Tue Apr 20 02:28:41 CEST 2010


On Mon, Apr 19, 2010 at 08:10:41PM +0200, Stefano Sabatini wrote:
> On date Monday 2010-04-19 00:44:09 +0200, Michael Niedermayer encoded:
> > On Sun, Apr 18, 2010 at 08:00:46PM +0200, Stefano Sabatini wrote:
> [...]
> > > > >  aviobuf.c |    2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 99a68a52eeec23be59fe671048fcead6fe6c4c9d  0003-Make-url_fseek-return-AVERROR-ENOSYS-rather-than-AVE.patch
> > > > > >From f11131bc3a2e08f46b291e4fa849e7e8c642c757 Mon Sep 17 00:00:00 2001
> > > > > From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> > > > > Date: Tue, 16 Mar 2010 23:08:32 +0100
> > > > > Subject: [PATCH 3/5] Make url_fseek() return AVERROR(ENOSYS) rather than AVERROR(EPIPE) if
> > > > >  the seek operation is not defined in the ByteIOContext.
> > > > > 
> > > > > ---
> > > > >  libavformat/aviobuf.c |    2 +-
> > > > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > > > > 
> > > > > diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> > > > > index 37a6f6d..039b6d3 100644
> > > > > --- a/libavformat/aviobuf.c
> > > > > +++ b/libavformat/aviobuf.c
> > > > > @@ -160,7 +160,7 @@ int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence)
> > > > >              return AVERROR_EOF;
> > > > >          s->buf_ptr = s->buf_end + offset - s->pos;
> > > > >      } else {
> > > > > -        int64_t res = AVERROR(EPIPE);
> > > > > +        int64_t res = AVERROR(ENOSYS);
> > > > >  
> > > > >  #if CONFIG_MUXERS || CONFIG_NETWORK
> > > > >          if (s->write_flag) {
> > > > > -- 
> > > > > 1.7.0
> > > > > 
> > > > 
> > > > this is definitly wrong,seeking can succeed even without underlaying seek()
> > > 
> > > There is exactly one case where url_fseek() fails if the seek callback
> > > is not defined in the ByteIOContext, which is covered by this patch,
> > > please check again.
> > 
> > ENOSYS means it will always fail, this is not the case, it only fails
> > if the seek is outside the available buffer.
> 
> Allright, so patch dropped, maybe EPIPE does make sense in this case.
> 
> But check the first cosmetics patch.
> 
> Regards.
> -- 
> FFmpeg = Fundamental & Foolish Mega Practical Erratic Gadget

>  aviobuf.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 0b2d5b7389f1105a5527eae3161dbeb884d58fee  0001-Do-not-initialize-res-in-url_fseek-in-the-case-s-see.patch
> >From f02ad235d9f1458f3ef5aebd2081072de2f6ca53 Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Sun, 18 Apr 2010 19:29:54 +0200
> Subject: [PATCH 1/3] Do not initialize res in url_fseek(), in the case !s->seek directly
>  return AVERROR(EPIPE) rather than the pre-defined value of res.
> 
> Slightly improve readability.

looks ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100420/a98f6668/attachment.pgp>



More information about the ffmpeg-devel mailing list