[FFmpeg-devel] [PATCH] Implement av_strerror()
Stefano Sabatini
stefano.sabatini-lala
Sun Mar 14 16:44:26 CET 2010
On date Sunday 2010-03-14 14:16:17 +0100, Michael Niedermayer encoded:
> On Sun, Mar 14, 2010 at 01:03:58PM +0100, Stefano Sabatini wrote:
[...]
> > +int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
> > +{
> > + int ret = 0;
> > +
> > + switch (errnum) {
> > +#define HANDLE_ERROR(ERR, ERRSTR) case AVERROR_##ERR: av_strlcpy(errbuf, ERRSTR, errbuf_size); break
> > +
> > +#if LIBAVUTIL_VERSION_MAJOR < 51
> > + HANDLE_ERROR(IO , "I/O error");
> > + HANDLE_ERROR(NOENT , "No such file or directory");
> > + HANDLE_ERROR(NOMEM , "Not enough memory");
> > +#endif
> > + HANDLE_ERROR(EOF , "End of file");
> > + HANDLE_ERROR(INVALIDDATA , "Invalid data found");
> > + HANDLE_ERROR(NOFMT , "Unknown format");
> > + HANDLE_ERROR(NOTSUPP , "Operation not supported");
> > + HANDLE_ERROR(NUMEXPECTED , "Number syntax expected in filename");
> > + HANDLE_ERROR(PATCHWELCOME , "Not yet implemented in FFmpeg, patches welcome");
>
> case X: s= "kjfdkfjhfkjh"; break;
> ...
>
> av_strlcpy(s)
Updated, I have a small preference for keeping the macro but I'll
remove that if you don't like it.
Regards.
--
FFmpeg = Furious and Free Monstrous Peaceless Extended Gigant
More information about the ffmpeg-devel
mailing list