[FFmpeg-devel] [PATCH 3/3] lavc: remove Libav ABI compat hacks

Paul B Mahol onemda at gmail.com
Sat Sep 5 20:05:29 CEST 2015


Dana 5. 9. 2015. 19:15 osoba "wm4" <nfxjfg at googlemail.com> napisala je:
>
> ---
> I bet this fixes some bugs, because some code compares codec IDs with
> AV_CODEC_ID_FIRST_AUDIO numerically!
> ---
>  libavcodec/avcodec.h | 150
+++++++++++++++++++++++++--------------------------
>  libavcodec/utils.c   |   6 ---
>  2 files changed, 75 insertions(+), 81 deletions(-)

I'm all for this, even more remove DEPRECATED codec ids.

>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 7d78f60..6eeb06f 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -296,35 +296,35 @@ enum AVCodecID {
>      AV_CODEC_ID_HAP,
>      AV_CODEC_ID_DDS,
>
> -    AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'),
> -    AV_CODEC_ID_Y41P       = MKBETAG('Y','4','1','P'),
> -    AV_CODEC_ID_ESCAPE130  = MKBETAG('E','1','3','0'),
> -    AV_CODEC_ID_EXR        = MKBETAG('0','E','X','R'),
> -    AV_CODEC_ID_AVRP       = MKBETAG('A','V','R','P'),
> -
> -    AV_CODEC_ID_012V       = MKBETAG('0','1','2','V'),
> -    AV_CODEC_ID_G2M        = MKBETAG( 0 ,'G','2','M'),
> -    AV_CODEC_ID_AVUI       = MKBETAG('A','V','U','I'),
> -    AV_CODEC_ID_AYUV       = MKBETAG('A','Y','U','V'),
> -    AV_CODEC_ID_TARGA_Y216 = MKBETAG('T','2','1','6'),
> -    AV_CODEC_ID_V308       = MKBETAG('V','3','0','8'),
> -    AV_CODEC_ID_V408       = MKBETAG('V','4','0','8'),
> -    AV_CODEC_ID_YUV4       = MKBETAG('Y','U','V','4'),
> -    AV_CODEC_ID_SANM       = MKBETAG('S','A','N','M'),
> -    AV_CODEC_ID_PAF_VIDEO  = MKBETAG('P','A','F','V'),
> -    AV_CODEC_ID_AVRN       = MKBETAG('A','V','R','n'),
> -    AV_CODEC_ID_CPIA       = MKBETAG('C','P','I','A'),
> -    AV_CODEC_ID_XFACE      = MKBETAG('X','F','A','C'),
> -    AV_CODEC_ID_SGIRLE     = MKBETAG('S','G','I','R'),
> -    AV_CODEC_ID_MVC1       = MKBETAG('M','V','C','1'),
> -    AV_CODEC_ID_MVC2       = MKBETAG('M','V','C','2'),
> -    AV_CODEC_ID_SNOW       = MKBETAG('S','N','O','W'),
> -    AV_CODEC_ID_WEBP       = MKBETAG('W','E','B','P'),
> -    AV_CODEC_ID_SMVJPEG    = MKBETAG('S','M','V','J'),
> -    AV_CODEC_ID_HEVC       = MKBETAG('H','2','6','5'),
> +    AV_CODEC_ID_BRENDER_PIX,
> +    AV_CODEC_ID_Y41P,
> +    AV_CODEC_ID_ESCAPE130,
> +    AV_CODEC_ID_EXR,
> +    AV_CODEC_ID_AVRP,
> +
> +    AV_CODEC_ID_012V,
> +    AV_CODEC_ID_G2M,
> +    AV_CODEC_ID_AVUI,
> +    AV_CODEC_ID_AYUV,
> +    AV_CODEC_ID_TARGA_Y216,
> +    AV_CODEC_ID_V308,
> +    AV_CODEC_ID_V408,
> +    AV_CODEC_ID_YUV4,
> +    AV_CODEC_ID_SANM,
> +    AV_CODEC_ID_PAF_VIDEO,
> +    AV_CODEC_ID_AVRN,
> +    AV_CODEC_ID_CPIA,
> +    AV_CODEC_ID_XFACE,
> +    AV_CODEC_ID_SGIRLE,
> +    AV_CODEC_ID_MVC1,
> +    AV_CODEC_ID_MVC2,
> +    AV_CODEC_ID_SNOW,
> +    AV_CODEC_ID_WEBP,
> +    AV_CODEC_ID_SMVJPEG,
> +    AV_CODEC_ID_HEVC,
>  #define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
> -    AV_CODEC_ID_VP7        = MKBETAG('V','P','7','0'),
> -    AV_CODEC_ID_APNG       = MKBETAG('A','P','N','G'),
> +    AV_CODEC_ID_VP7,
> +    AV_CODEC_ID_APNG,
>
>      /* various PCM "codecs" */
>      AV_CODEC_ID_FIRST_AUDIO = 0x10000,     ///< A dummy id pointing at
the start of audio codecs
> @@ -359,9 +359,9 @@ enum AVCodecID {
>      AV_CODEC_ID_PCM_S24LE_PLANAR_DEPRECATED,
>      AV_CODEC_ID_PCM_S32LE_PLANAR_DEPRECATED,
>      AV_CODEC_ID_PCM_S16BE_PLANAR_DEPRECATED,
> -    AV_CODEC_ID_PCM_S24LE_PLANAR = MKBETAG(24,'P','S','P'),
> -    AV_CODEC_ID_PCM_S32LE_PLANAR = MKBETAG(32,'P','S','P'),
> -    AV_CODEC_ID_PCM_S16BE_PLANAR = MKBETAG('P','S','P',16),
> +    AV_CODEC_ID_PCM_S24LE_PLANAR,
> +    AV_CODEC_ID_PCM_S32LE_PLANAR,
> +    AV_CODEC_ID_PCM_S16BE_PLANAR,
>
>      /* various ADPCM codecs */
>      AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
> @@ -395,16 +395,16 @@ enum AVCodecID {
>      AV_CODEC_ID_ADPCM_G722,
>      AV_CODEC_ID_ADPCM_IMA_APC,
>      AV_CODEC_ID_ADPCM_VIMA_DEPRECATED,
> -    AV_CODEC_ID_ADPCM_VIMA = MKBETAG('V','I','M','A'),
> +    AV_CODEC_ID_ADPCM_VIMA,
>  #if FF_API_VIMA_DECODER
> -    AV_CODEC_ID_VIMA       = MKBETAG('V','I','M','A'),
> +    AV_CODEC_ID_VIMA,
>  #endif
> -    AV_CODEC_ID_ADPCM_AFC  = MKBETAG('A','F','C',' '),
> -    AV_CODEC_ID_ADPCM_IMA_OKI = MKBETAG('O','K','I',' '),
> -    AV_CODEC_ID_ADPCM_DTK  = MKBETAG('D','T','K',' '),
> -    AV_CODEC_ID_ADPCM_IMA_RAD = MKBETAG('R','A','D',' '),
> -    AV_CODEC_ID_ADPCM_G726LE = MKBETAG('6','2','7','G'),
> -    AV_CODEC_ID_ADPCM_THP_LE = MKBETAG('T','H','P','L'),
> +    AV_CODEC_ID_ADPCM_AFC,
> +    AV_CODEC_ID_ADPCM_IMA_OKI,
> +    AV_CODEC_ID_ADPCM_DTK,
> +    AV_CODEC_ID_ADPCM_IMA_RAD,
> +    AV_CODEC_ID_ADPCM_G726LE,
> +    AV_CODEC_ID_ADPCM_THP_LE,
>
>      /* AMR */
>      AV_CODEC_ID_AMR_NB = 0x12000,
> @@ -491,19 +491,19 @@ enum AVCodecID {
>      AV_CODEC_ID_PAF_AUDIO_DEPRECATED,
>      AV_CODEC_ID_ON2AVC,
>      AV_CODEC_ID_DSS_SP,
> -    AV_CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'),
> -    AV_CODEC_ID_SONIC       = MKBETAG('S','O','N','C'),
> -    AV_CODEC_ID_SONIC_LS    = MKBETAG('S','O','N','L'),
> -    AV_CODEC_ID_PAF_AUDIO   = MKBETAG('P','A','F','A'),
> -    AV_CODEC_ID_OPUS        = MKBETAG('O','P','U','S'),
> -    AV_CODEC_ID_TAK         = MKBETAG('t','B','a','K'),
> -    AV_CODEC_ID_EVRC        = MKBETAG('s','e','v','c'),
> -    AV_CODEC_ID_SMV         = MKBETAG('s','s','m','v'),
> -    AV_CODEC_ID_DSD_LSBF    = MKBETAG('D','S','D','L'),
> -    AV_CODEC_ID_DSD_MSBF    = MKBETAG('D','S','D','M'),
> -    AV_CODEC_ID_DSD_LSBF_PLANAR = MKBETAG('D','S','D','1'),
> -    AV_CODEC_ID_DSD_MSBF_PLANAR = MKBETAG('D','S','D','8'),
> -    AV_CODEC_ID_4GV         = MKBETAG('s','4','g','v'),
> +    AV_CODEC_ID_FFWAVESYNTH,
> +    AV_CODEC_ID_SONIC,
> +    AV_CODEC_ID_SONIC_LS,
> +    AV_CODEC_ID_PAF_AUDIO,
> +    AV_CODEC_ID_OPUS,
> +    AV_CODEC_ID_TAK,
> +    AV_CODEC_ID_EVRC,
> +    AV_CODEC_ID_SMV,
> +    AV_CODEC_ID_DSD_LSBF,
> +    AV_CODEC_ID_DSD_MSBF,
> +    AV_CODEC_ID_DSD_LSBF_PLANAR,
> +    AV_CODEC_ID_DSD_MSBF_PLANAR,
> +    AV_CODEC_ID_4GV,
>
>      /* subtitle codecs */
>      AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,          ///< A dummy ID
pointing at the start of subtitle codecs.
> @@ -516,33 +516,33 @@ enum AVCodecID {
>      AV_CODEC_ID_HDMV_PGS_SUBTITLE,
>      AV_CODEC_ID_DVB_TELETEXT,
>      AV_CODEC_ID_SRT,
> -    AV_CODEC_ID_MICRODVD   = MKBETAG('m','D','V','D'),
> -    AV_CODEC_ID_EIA_608    = MKBETAG('c','6','0','8'),
> -    AV_CODEC_ID_JACOSUB    = MKBETAG('J','S','U','B'),
> -    AV_CODEC_ID_SAMI       = MKBETAG('S','A','M','I'),
> -    AV_CODEC_ID_REALTEXT   = MKBETAG('R','T','X','T'),
> -    AV_CODEC_ID_STL        = MKBETAG('S','p','T','L'),
> -    AV_CODEC_ID_SUBVIEWER1 = MKBETAG('S','b','V','1'),
> -    AV_CODEC_ID_SUBVIEWER  = MKBETAG('S','u','b','V'),
> -    AV_CODEC_ID_SUBRIP     = MKBETAG('S','R','i','p'),
> -    AV_CODEC_ID_WEBVTT     = MKBETAG('W','V','T','T'),
> -    AV_CODEC_ID_MPL2       = MKBETAG('M','P','L','2'),
> -    AV_CODEC_ID_VPLAYER    = MKBETAG('V','P','l','r'),
> -    AV_CODEC_ID_PJS        = MKBETAG('P','h','J','S'),
> -    AV_CODEC_ID_ASS        = MKBETAG('A','S','S',' '),  ///< ASS as
defined in Matroska
> -    AV_CODEC_ID_HDMV_TEXT_SUBTITLE = MKBETAG('B','D','T','X'),
> +    AV_CODEC_ID_MICRODVD,
> +    AV_CODEC_ID_EIA_608,
> +    AV_CODEC_ID_JACOSUB,
> +    AV_CODEC_ID_SAMI,
> +    AV_CODEC_ID_REALTEXT,
> +    AV_CODEC_ID_STL,
> +    AV_CODEC_ID_SUBVIEWER1,
> +    AV_CODEC_ID_SUBVIEWER,
> +    AV_CODEC_ID_SUBRIP,
> +    AV_CODEC_ID_WEBVTT,
> +    AV_CODEC_ID_MPL2,
> +    AV_CODEC_ID_VPLAYER,
> +    AV_CODEC_ID_PJS,
> +    AV_CODEC_ID_ASS,  ///< ASS as defined in Matroska
> +    AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
>
>      /* 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_BINTEXT    = MKBETAG('B','T','X','T'),
> -    AV_CODEC_ID_XBIN       = MKBETAG('X','B','I','N'),
> -    AV_CODEC_ID_IDF        = MKBETAG( 0 ,'I','D','F'),
> -    AV_CODEC_ID_OTF        = MKBETAG( 0 ,'O','T','F'),
> -    AV_CODEC_ID_SMPTE_KLV  = MKBETAG('K','L','V','A'),
> -    AV_CODEC_ID_DVD_NAV    = MKBETAG('D','N','A','V'),
> -    AV_CODEC_ID_TIMED_ID3  = MKBETAG('T','I','D','3'),
> -    AV_CODEC_ID_BIN_DATA   = MKBETAG('D','A','T','A'),
> +    AV_CODEC_ID_BINTEXT,
> +    AV_CODEC_ID_XBIN,
> +    AV_CODEC_ID_IDF,
> +    AV_CODEC_ID_OTF,
> +    AV_CODEC_ID_SMPTE_KLV,
> +    AV_CODEC_ID_DVD_NAV,
> +    AV_CODEC_ID_TIMED_ID3,
> +    AV_CODEC_ID_BIN_DATA,
>
>
>      AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like
AV_CODEC_ID_NONE) but lavf should attempt to identify it
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 242c38a..1381997 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -3042,12 +3042,6 @@ const char *av_get_profile_name(const AVCodec
*codec, 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;
>  }
>
> --
> 2.5.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list