Opened 6 years ago

Closed 6 years ago

#97 closed defect (fixed)

libcelt_dec.c -- ENOTRECOVERABLE undeclared when compiling on Mac OS X

Reported by: RLeatherwood Owned by:
Priority: normal Component: avcodec
Version: git Keywords: libcelt libcelt_dec.c
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I got the following error while compiling in support for libcelt (git 89451dd) on Mac OS X 10.6:

CC	libavcodec/libcelt_dec.o
libavcodec/libcelt_dec.c: In function ‘ff_celt_error_to_averror’:
libavcodec/libcelt_dec.c:44: error: ‘ENOTRECOVERABLE’ undeclared (first use in this function)
libavcodec/libcelt_dec.c:44: error: (Each undeclared identifier is reported only once
libavcodec/libcelt_dec.c:44: error: for each function it appears in.)
libavcodec/libcelt_dec.c:46: error: ‘AVERROR_UNKNOWN’ undeclared (first use in this function)
make: *** [libavcodec/libcelt_dec.o] Error 1

I dug a little deeper and found that ENOTRECOVERABLE is not defined by Apple in their system headers.

I created two patches to fix the problem. The first patch uses an include guard to detect compilation on Apple's system. It replaces ENOTRECOVERABLE with EINVAL since I could not find a more appropriate error value to use.

The second patch just replaces ENOTRECOVERABLE entirely with EINVAL.

NOTE - It also looks like libcelt_dec.c needs to have AVERROR_UNKNOWN replaced with AVERROR(EINVAL) due to the "big bump". This change is not in my original patches.

Original code:

    switch(err) {
        case CELT_BAD_ARG:          return AVERROR(EINVAL);
#ifdef CELT_BUFFER_TOO_SMALL
        case CELT_BUFFER_TOO_SMALL: return AVERROR(ENOBUFS);
#endif
        case CELT_INTERNAL_ERROR:   return AVERROR(EFAULT);
        case CELT_CORRUPTED_DATA:   return AVERROR_INVALIDDATA;
        case CELT_UNIMPLEMENTED:    return AVERROR(ENOTSUP);
        case CELT_INVALID_STATE:    return AVERROR(ENOTRECOVERABLE);
        case CELT_ALLOC_FAIL:       return AVERROR(ENOMEM);
        default:                    return AVERROR_UNKNOWN;

Attachments (2)

ffmpeg-libcelt-fix-macosx-ENOTRECOVERABLE.patch (628 bytes) - added by RLeatherwood 6 years ago.
ffmpeg-libcelt-redefine_ENOTRECOVERABLE_as_EINVAL.patch (591 bytes) - added by RLeatherwood 6 years ago.

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by RLeatherwood

comment:1 Changed 6 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from unspecified to git

Should be fixed, thank you for the detailed problem description!

Note: See TracTickets for help on using tickets.