[FFmpeg-devel] [PATCH] avcodec: remove Libav ABI compatibility hacks

James Almer jamrial at gmail.com
Tue Feb 13 06:44:22 EET 2018


On 2/13/2018 1:33 AM, wm4 wrote:
> ---
> If anyone knows of similar still remaining cases in the codebase, please
> tell me, and I'll send patches.
> ---
>  libavcodec/avcodec.h | 49 ++++++++++++++++---------------------------------
>  libavcodec/utils.c   |  5 -----
>  libavcodec/version.h |  2 +-
>  3 files changed, 17 insertions(+), 39 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index bc0eacd66b..b3dad5d614 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -409,8 +409,7 @@ enum AVCodecID {
>      AV_CODEC_ID_DXV,
>      AV_CODEC_ID_SCREENPRESSO,
>      AV_CODEC_ID_RSCC,
> -
> -    AV_CODEC_ID_Y41P = 0x8000,
> +    AV_CODEC_ID_Y41P,
>      AV_CODEC_ID_AVRP,
>      AV_CODEC_ID_012V,
>      AV_CODEC_ID_AVUI,
> @@ -480,14 +479,11 @@ enum AVCodecID {
>      AV_CODEC_ID_PCM_S24LE_PLANAR,
>      AV_CODEC_ID_PCM_S32LE_PLANAR,
>      AV_CODEC_ID_PCM_S16BE_PLANAR,
> -
> -    AV_CODEC_ID_PCM_S64LE = 0x10800,
> +    AV_CODEC_ID_PCM_S64LE,
>      AV_CODEC_ID_PCM_S64BE,
>      AV_CODEC_ID_PCM_F16LE,
>      AV_CODEC_ID_PCM_F24LE,
> -
> -    /* various ADPCM codecs */
> -    AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
> +    AV_CODEC_ID_ADPCM_IMA_QT,

This is not an ABI compat offset. It's to separate PCM from ADPCM
codecs. It's also in libav's avcodec.h

>      AV_CODEC_ID_ADPCM_IMA_WAV,
>      AV_CODEC_ID_ADPCM_IMA_DK3,
>      AV_CODEC_ID_ADPCM_IMA_DK4,
> @@ -518,8 +514,7 @@ enum AVCodecID {
>      AV_CODEC_ID_ADPCM_G722,
>      AV_CODEC_ID_ADPCM_IMA_APC,
>      AV_CODEC_ID_ADPCM_VIMA,
> -
> -    AV_CODEC_ID_ADPCM_AFC = 0x11800,
> +    AV_CODEC_ID_ADPCM_AFC,
>      AV_CODEC_ID_ADPCM_IMA_OKI,
>      AV_CODEC_ID_ADPCM_DTK,
>      AV_CODEC_ID_ADPCM_IMA_RAD,
> @@ -529,26 +524,17 @@ enum AVCodecID {
>      AV_CODEC_ID_ADPCM_AICA,
>      AV_CODEC_ID_ADPCM_IMA_DAT4,
>      AV_CODEC_ID_ADPCM_MTAF,
> -
> -    /* AMR */
> -    AV_CODEC_ID_AMR_NB = 0x12000,
> +    AV_CODEC_ID_AMR_NB,

Same.

>      AV_CODEC_ID_AMR_WB,
> -
> -    /* RealAudio codecs*/
> -    AV_CODEC_ID_RA_144 = 0x13000,
> +    AV_CODEC_ID_RA_144,

Same

>      AV_CODEC_ID_RA_288,
> -
> -    /* various DPCM codecs */
> -    AV_CODEC_ID_ROQ_DPCM = 0x14000,
> +    AV_CODEC_ID_ROQ_DPCM,

Same

>      AV_CODEC_ID_INTERPLAY_DPCM,
>      AV_CODEC_ID_XAN_DPCM,
>      AV_CODEC_ID_SOL_DPCM,
> -
> -    AV_CODEC_ID_SDX2_DPCM = 0x14800,
> +    AV_CODEC_ID_SDX2_DPCM,
>      AV_CODEC_ID_GREMLIN_DPCM,
> -
> -    /* audio codecs */
> -    AV_CODEC_ID_MP2 = 0x15000,
> +    AV_CODEC_ID_MP2,

Same

>      AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
>      AV_CODEC_ID_AAC,
>      AV_CODEC_ID_AC3,
> @@ -615,8 +601,7 @@ enum AVCodecID {
>      AV_CODEC_ID_PAF_AUDIO,
>      AV_CODEC_ID_ON2AVC,
>      AV_CODEC_ID_DSS_SP,
> -
> -    AV_CODEC_ID_FFWAVESYNTH = 0x15800,
> +    AV_CODEC_ID_FFWAVESYNTH,
>      AV_CODEC_ID_SONIC,
>      AV_CODEC_ID_SONIC_LS,
>      AV_CODEC_ID_EVRC,
> @@ -647,8 +632,7 @@ enum AVCodecID {
>      AV_CODEC_ID_HDMV_PGS_SUBTITLE,
>      AV_CODEC_ID_DVB_TELETEXT,
>      AV_CODEC_ID_SRT,
> -
> -    AV_CODEC_ID_MICRODVD   = 0x17800,
> +    AV_CODEC_ID_MICRODVD,
>      AV_CODEC_ID_EIA_608,
>      AV_CODEC_ID_JACOSUB,
>      AV_CODEC_ID_SAMI,
> @@ -667,9 +651,8 @@ enum AVCodecID {
>      /* other specific kind of codecs (generally used for attachments) */
>      AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,           ///< A dummy ID pointing at the start of various fake codecs.
>      AV_CODEC_ID_TTF = 0x18000,
> -
>      AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream.
> -    AV_CODEC_ID_BINTEXT    = 0x18800,
> +    AV_CODEC_ID_BINTEXT,
>      AV_CODEC_ID_XBIN,
>      AV_CODEC_ID_IDF,
>      AV_CODEC_ID_OTF,
> @@ -681,12 +664,12 @@ enum AVCodecID {
>  

>      AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
>  
> -    AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
> +    AV_CODEC_ID_MPEG2TS, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
>                                  * stream (only used by libavformat) */
> -    AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
> +    AV_CODEC_ID_MPEG4SYSTEMS, /**< _FAKE_ codec to indicate a MPEG-4 Systems
>                                  * stream (only used by libavformat) */
> -    AV_CODEC_ID_FFMETADATA = 0x21000,   ///< Dummy codec for streams containing only metadata information.
> -    AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
> +    AV_CODEC_ID_FFMETADATA,   ///< Dummy codec for streams containing only metadata information.
> +    AV_CODEC_ID_WRAPPED_AVFRAME, ///< Passthrough codec, AVFrames wrapped in AVPacket

Same for these four.

>  };
>  
>  /**
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 8c7d056da6..7dcfa0be71 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1386,11 +1386,6 @@ const char *avcodec_profile_name(enum AVCodecID codec_id, int profile)
>  
>  unsigned avcodec_version(void)
>  {
> -//    av_assert0(AV_CODEC_ID_V410==164);
> -    av_assert0(AV_CODEC_ID_PCM_S8_PLANAR==65563);
> -    av_assert0(AV_CODEC_ID_ADPCM_G722==69660);
> -//     av_assert0(AV_CODEC_ID_BMV_AUDIO==86071);
> -    av_assert0(AV_CODEC_ID_SRT==94216);
>      av_assert0(LIBAVCODEC_VERSION_MICRO >= 100);
>  
>      return LIBAVCODEC_VERSION_INT;
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index d13dd41fa3..0ba6e6a164 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>  
>  #define LIBAVCODEC_VERSION_MAJOR  58
>  #define LIBAVCODEC_VERSION_MINOR  11
> -#define LIBAVCODEC_VERSION_MICRO 101
> +#define LIBAVCODEC_VERSION_MICRO 102
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>                                                 LIBAVCODEC_VERSION_MINOR, \
> 



More information about the ffmpeg-devel mailing list