[FFmpeg-devel] [PATCH] Replace ENOSYS by ENOTSUP

Ramiro Ribeiro Polla ramiro
Wed Aug 8 01:50:48 CEST 2007


Hello,

Michael Niedermayer wrote:
> Hi
>
> On Mon, Aug 06, 2007 at 11:19:49PM -0300, Ramiro Ribeiro Polla wrote:
>   
>> Michael Niedermayer wrote:
>>     
>>> Hi
>>>
>>> On Fri, Jul 20, 2007 at 03:54:16PM +0200, Panagiotis Issaris wrote:
>>>   
>>>       
>>>> Op 20-jul-07, om 10:10 heeft Panagiotis Issaris het volgende geschreven:
>>>>         
[...]
>>>> On #ffmpeg someone mentioned that Cygwin does not have ENOTSUP. Add a  
>>>> define for it in os_support.h in case cygwin is used?
>>>>     
>>>>         
>>> adding a
>>> #define ENOTSUP blah
>>> is not a solution for systems which lack ENOTSUP as the user app should be
>>> able to test for AVERROR(ENOTSUP) and lavc has no buisness with defining
>>> ENOTSUP in a public header ...
>>>
>>>   
>>>       
>> [1] has the errors and the according strerror() messages supported in 
>> MinGW. It only implements error codes from msvcrt, so it has no business 
>> defining ENOTSUP. And it seems to have no equivalent or similar error.
>>
>> I've looked through where not-implemented/supported stuff return errors. 
>> Some return -1, others ignore it, and some even assert(0). It's a mess the 
>> way it is.
>> I agree with Takis that there should be more error codes. Not one for every 
>> possible parameter, as was being discussed in [2], but rather a few related 
>> to FFmpeg's development.
>>
>> 2 that come to mind would be:
>> AVERROR_NOTSUPP not supported because of limitation in standard/whatever.
>> AVERROR_NOTIMPL or AVERROR_NOTYET, for not yet implemented in FFmpeg. 
>> (patches welcome =)
>>     
>
> why not AVERROR_PATCH_WELCOME ?
>
>
>   
>> To avoid error number clashes, -MKTAG could be used with 4 letters that 
>> indicate the error. It is very unlikely that an error on any system has 
>> such a number. Attached patch is an example for this.
>>     
>
> iam ok with the -MKTAG idea
>
> [...]
>
>   
>> Index: libavcodec/avcodec.h
>> ===================================================================
>> --- libavcodec/avcodec.h	(revision 9973)
>> +++ libavcodec/avcodec.h	(working copy)
>> @@ -2934,6 +2934,7 @@
>>  #define AVERROR_NOMEM       AVERROR(ENOMEM)  /**< not enough memory */
>>  #define AVERROR_NOFMT       AVERROR(EILSEQ)  /**< unknown format */
>>  #define AVERROR_NOTSUPP     AVERROR(ENOSYS)  /**< Operation not supported. */
>> +#define AVERROR_NOTIMPL     -MKTAG('N','I','M','P') /**< Not implemented in FFmpeg */
>>     
>
> i think the description is a little terse ...
>
>   

Patch attached. I removed the underscore between PATCH and WELCOME, 
since errors normally don't have underscores. I also added a slightly 
better description. A grep for "implemented" and "supported" shows there 
are many places this will need to be used =).

A second patch makes use of this in vocenc.c and restores MinGW compilation.

Ramiro Polla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: averror_patchwelcome.diff
Type: text/x-patch
Size: 567 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070807/011a6d2c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vocenc.diff
Type: text/x-patch
Size: 452 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070807/011a6d2c/attachment-0001.bin>



More information about the ffmpeg-devel mailing list