[FFmpeg-devel] [RFC] The meaning of AVERROR_NOTSUPP
Stefano Sabatini
stefano.sabatini-lala
Sat Mar 27 16:34:42 CET 2010
On date Saturday 2010-03-27 12:58:31 +0100, Michael Niedermayer encoded:
> On Sat, Mar 27, 2010 at 11:57:51AM +0100, Stefano Sabatini wrote:
> > On date Saturday 2010-03-27 02:17:04 +0100, Michael Niedermayer encoded:
> > > On Sat, Mar 27, 2010 at 12:51:13AM +0100, Stefano Sabatini wrote:
> > [...]
> > > > Currently we have just one use of AVERROR_NOTSUPP:
> > > >
> > > > in libavformat/file.c:
> > > > static int64_t file_seek(URLContext *h, int64_t pos, int whence)
> > > > {
> > > > int fd = (intptr_t) h->priv_data;
> > > > if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END)
> > > > return AVERROR_NOTSUPP;
> > > > return lseek(fd, pos, whence);
> > > > }
> > > >
> > > > This suggests the interpretation of AVERROR_NOTSUPP as "Operation
> > > > non-valid or illegal".
> > >
> > > no, this interpretation is wrong
> > > the 4th case for getting the filesize is surely not an invalid or illegal
> > > operation for a file.
> >
> > I believe in this case it is just better to let lseek manages the
> > error for that parameter, see patch.
>
> are you sure this does not revert a bugfix?
Ugh:
commit 41c1f3333c0c2f1fdafb11fdecfa25063266b862
Author: mru <mru at 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Sat Feb 13 16:56:37 2010 +0000
Do not call lseek() with invalid whence value
git-svn-id: svn://svn.ffmpeg.org/ffmpeg/trunk at 21795 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
According to this logic the value to return should be
AVERROR_PATCHWELCOME, even better we could just return the size, which
should be quite easy to compute.
And BTW I see another problem here, whence can be ored with
AVSEEK_FORCE, from avio.h:
/**
* Oring this flag as into the "whence" parameter to a seek function causes it to
* seek by any means (like reopening and linear reading) or other normally unreasonble
* means that can be extreemly slow.
* This may be ignored by the seek code.
*/
#define AVSEEK_FORCE 0x20000
If that flag is set the function will fail, while it should simply
ignore the flag.
Regards.
--
FFmpeg = Fiendish and Frightening Multimedia Philosophical Ermetic Guide
More information about the ffmpeg-devel
mailing list