[vlc-devel] [PATCH 9/9] avcodec: cleanup versionchecks after requirement bump

Jean-Baptiste Kempf jb at videolan.org
Sun Sep 4 21:48:53 CEST 2016


OK.

On 04 Sep, ileoo at videolan.org wrote :
> From: Ilkka Ollakka <ileoo at videolan.org>
> 
> ---
>  modules/codec/avcodec/avcommon_compat.h | 19 -------------------
>  modules/codec/avcodec/d3d11va.c         | 10 ----------
>  modules/codec/avcodec/fourcc.c          | 30 ------------------------------
>  modules/codec/avcodec/video.c           |  5 -----
>  4 files changed, 64 deletions(-)
> 
> diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
> index 5c2ffbc..ffe7fbb 100644
> --- a/modules/codec/avcodec/avcommon_compat.h
> +++ b/modules/codec/avcodec/avcommon_compat.h
> @@ -36,25 +36,6 @@
>      ( (LIBAVCODEC_VERSION_MICRO <  100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
>        (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
>  
> -#if !LIBAVCODEC_VERSION_CHECK( 55, 52, 0, 63, 100 )
> -
> -#include <libavutil/mem.h>
> -
> -static inline void avcodec_free_context( AVCodecContext **ctx )
> -{
> -    if( !*ctx )
> -        return;
> -
> -    av_free( (*ctx)->extradata );
> -    av_free( *ctx );
> -    *ctx = NULL;
> -}
> -#endif
> -
> -#if !LIBAVCODEC_VERSION_CHECK( 55, 28, 1, 45, 101 )
> -# define av_frame_alloc avcodec_alloc_frame
> -# define av_frame_free avcodec_free_frame
> -#endif
>  
>  #endif /* HAVE_LIBAVCODEC_AVCODEC_H */
>  
> diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
> index f2393d3..5d36830 100644
> --- a/modules/codec/avcodec/d3d11va.c
> +++ b/modules/codec/avcodec/d3d11va.c
> @@ -116,9 +116,7 @@ struct vlc_va_sys_t
>      DXGI_FORMAT                  render;
>  
>      ID3D11DeviceContext          *d3dctx;
> -#if LIBAVCODEC_VERSION_CHECK(57, 2, 0, 3, 100)
>      HANDLE                       context_mutex;
> -#endif
>  
>      /* Video decoder */
>      D3D11_VIDEO_DECODER_CONFIG   cfg;
> @@ -181,9 +179,7 @@ void SetupAVCodecContext(vlc_va_t *va)
>      sys->hw.cfg = &sys->cfg;
>      sys->hw.surface_count = dx_sys->surface_count;
>      sys->hw.surface = (ID3D11VideoDecoderOutputView**) dx_sys->hw_surface;
> -#if LIBAVCODEC_VERSION_CHECK(57, 2, 0, 3, 100)
>      sys->hw.context_mutex = sys->context_mutex;
> -#endif
>  
>      if (IsEqualGUID(&dx_sys->input, &DXVA_Intel_H264_NoFGT_ClearVideo))
>          sys->hw.workaround |= FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO;
> @@ -261,11 +257,9 @@ static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
>          assert(p_sys_out->texture != NULL);
>          assert(p_sys_in->decoder == src);
>  
> -#if LIBAVCODEC_VERSION_CHECK(57, 2, 0, 3, 100)
>          if( sys->context_mutex != INVALID_HANDLE_VALUE ) {
>              WaitForSingleObjectEx( sys->context_mutex, INFINITE, FALSE );
>          }
> -#endif
>  
>  #ifdef ID3D11VideoContext_VideoProcessorBlt
>          if (sys->videoProcessor)
> @@ -340,11 +334,9 @@ static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
>  
>  
>  done:
> -#if LIBAVCODEC_VERSION_CHECK(57, 2, 0, 3, 100)
>      if( sys->context_mutex  != INVALID_HANDLE_VALUE ) {
>          ReleaseMutex( sys->context_mutex );
>      }
> -#endif
>  
>      return ret;
>  }
> @@ -452,14 +444,12 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
>             msg_Err(va, "Could not Query ID3D11VideoDevice Interface from the picture. (hr=0x%lX)", hr);
>          } else {
>              ID3D11DeviceContext_GetDevice( p_sys->context, (ID3D11Device**) &dx_sys->d3ddev );
> -#if LIBAVCODEC_VERSION_CHECK(57, 2, 0, 3, 100)
>              HANDLE context_lock = INVALID_HANDLE_VALUE;
>              UINT dataSize = sizeof(context_lock);
>              hr = ID3D11Device_GetPrivateData((ID3D11Device*)dx_sys->d3ddev, &GUID_CONTEXT_MUTEX, &dataSize, &context_lock);
>              if (FAILED(hr))
>                  msg_Warn(va, "No mutex found to lock the decoder");
>              sys->context_mutex = context_lock;
> -#endif
>  
>              sys->d3dctx = p_sys->context;
>              sys->d3dvidctx = d3dvidctx;
> diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
> index 3c845e6..1e97185 100644
> --- a/modules/codec/avcodec/fourcc.c
> +++ b/modules/codec/avcodec/fourcc.c
> @@ -225,61 +225,37 @@ static const struct
>      { VLC_CODEC_CLLC, AV_CODEC_ID_CLLC, VIDEO_ES },
>      { VLC_CODEC_MSS2, AV_CODEC_ID_MSS2, VIDEO_ES },
>      { VLC_CODEC_VP9, AV_CODEC_ID_VP9, VIDEO_ES },
> -#if LIBAVCODEC_VERSION_CHECK( 55, 5, 0, 10, 100 )
>      { VLC_CODEC_ICOD, AV_CODEC_ID_AIC, VIDEO_ES },
> -#endif
>      /* AV_CODEC_ID_ESCAPE130 */
> -#if LIBAVCODEC_VERSION_CHECK( 55, 8, 0, 15, 100 )
>      { VLC_CODEC_G2M4, AV_CODEC_ID_G2M, VIDEO_ES },
> -#endif
>      /* AV_CODEC_ID_WEBP */
> -#if LIBAVCODEC_VERSION_CHECK( 55, 8, 0, 40, 100 )
>      { VLC_CODEC_HNM4_VIDEO, AV_CODEC_ID_HNM4_VIDEO, VIDEO_ES },
> -#endif
> -#if LIBAVCODEC_VERSION_CHECK( 55, 24, 0, 37, 100 )
>      { VLC_CODEC_HEVC, AV_CODEC_ID_HEVC, VIDEO_ES },
> -#endif
>  
> -#if LIBAVCODEC_VERSION_CHECK( 55, 33, 0, 50, 100 )
>      { VLC_CODEC_FIC , AV_CODEC_ID_FIC, VIDEO_ES },
> -#endif
>      /* AV_CODEC_ID_ALIAS_PIX */
>      /* AV_CODEC_ID_BRENDER_PIX */
>      /* AV_CODEC_ID_PAF_VIDEO */
>      /* AV_CODEC_ID_EXR */
>  
> -#if LIBAVCODEC_VERSION_CHECK( 55, 43, 0, 56, 108 )
>      { VLC_CODEC_VP7 , AV_CODEC_ID_VP7, VIDEO_ES },
> -#endif
>      /* AV_CODEC_ID_SANM */
>      /* AV_CODEC_ID_SGIRLE */
>      /* AV_CODEC_ID_MVC1 */
>      /* AV_CODEC_ID_MVC2 */
> -#if LIBAVCODEC_VERSION_CHECK( 56, 17, 0, 26, 100 )
>      { VLC_CODEC_HQX, AV_CODEC_ID_HQX, VIDEO_ES },
> -#endif
>  
> -#if LIBAVCODEC_VERSION_CHECK( 56, 18, 0, 27, 100 )
>      { VLC_CODEC_TDSC, AV_CODEC_ID_TDSC, VIDEO_ES },
> -#endif
>  
> -#if LIBAVCODEC_VERSION_CHECK( 56, 23, 0, 35, 100 )
>      { VLC_CODEC_HQ_HQA, AV_CODEC_ID_HQ_HQA, VIDEO_ES },
> -#endif
>  
> -#if LIBAVCODEC_VERSION_CHECK( 57, 9, 0, 13, 100 )
>      { VLC_CODEC_HAP, AV_CODEC_ID_HAP, VIDEO_ES },
> -#endif
>      /* AV_CODEC_ID_DDS */
>  
> -#if LIBAVCODEC_VERSION_CHECK( 57, 1, 0, 2, 100 )
>      { VLC_CODEC_DXV, AV_CODEC_ID_DXV, VIDEO_ES },
> -#endif
>  
> -#if LIBAVCODEC_VERSION_CHECK( 56, 31, 0, 46, 100 )
>      { VLC_CODEC_G2M2, AV_CODEC_ID_G2M, VIDEO_ES },
>      { VLC_CODEC_G2M3, AV_CODEC_ID_G2M, VIDEO_ES },
> -#endif
>  
>      /* ffmpeg only: AV_CODEC_ID_BRENDER_PIX */
>      /* ffmpeg only: AV_CODEC_ID_Y41P */
> @@ -434,9 +410,7 @@ static const struct
>      { VLC_CODEC_WMAS, AV_CODEC_ID_WMAVOICE, AUDIO_ES },
>      { VLC_CODEC_WMAP, AV_CODEC_ID_WMAPRO, AUDIO_ES },
>      { VLC_CODEC_WMAL, AV_CODEC_ID_WMALOSSLESS, AUDIO_ES },
> -#if LIBAVCODEC_VERSION_CHECK( 55, 32, 0, 47, 100 )
>      { VLC_CODEC_ATRAC3P, AV_CODEC_ID_ATRAC3P, AUDIO_ES },
> -#endif
>      { VLC_CODEC_EAC3, AV_CODEC_ID_EAC3, AUDIO_ES },
>      { VLC_CODEC_SIPR, AV_CODEC_ID_SIPR, AUDIO_ES },
>      /* AV_CODEC_ID_MP1 */
> @@ -460,13 +434,9 @@ static const struct
>      { VLC_CODEC_OPUS, AV_CODEC_ID_OPUS, AUDIO_ES },
>      /* AV_CODEC_ID_COMFORT_NOISE */
>      { VLC_CODEC_TAK, AV_CODEC_ID_TAK, AUDIO_ES },
> -#if LIBAVCODEC_VERSION_CHECK( 55, 15, 0, 24, 100 )
>      { VLC_CODEC_METASOUND, AV_CODEC_ID_METASOUND, AUDIO_ES },
> -#endif
>      /* AV_CODEC_ID_PAF_AUDIO */
> -#if LIBAVCODEC_VERSION_CHECK( 55, 49, 0, 59, 100 )
>      { VLC_CODEC_ON2AVC, AV_CODEC_ID_ON2AVC, AUDIO_ES },
> -#endif
>  
>      /* ffmpeg only: AV_CODEC_ID_FFWAVESYNTH */
>      /* ffmpeg only: AV_CODEC_ID_SONIC */
> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
> index b59e7fa..1cd328a 100644
> --- a/modules/codec/avcodec/video.c
> +++ b/modules/codec/avcodec/video.c
> @@ -175,7 +175,6 @@ static int lavc_GetVideoFormat(decoder_t *dec, video_format_t *restrict fmt,
>          fmt->i_frame_rate = dec->fmt_in.video.i_frame_rate;
>          fmt->i_frame_rate_base = dec->fmt_in.video.i_frame_rate_base;
>      }
> -#if LIBAVCODEC_VERSION_CHECK( 56, 5, 0, 7, 100 )
>      else if (ctx->framerate.num > 0 && ctx->framerate.den > 0)
>      {
>          fmt->i_frame_rate = ctx->framerate.num;
> @@ -185,7 +184,6 @@ static int lavc_GetVideoFormat(decoder_t *dec, video_format_t *restrict fmt,
>          fmt->i_frame_rate_base *= __MAX(ctx->ticks_per_frame, 1);
>  # endif
>      }
> -#endif
>      else if (ctx->time_base.num > 0 && ctx->time_base.den > 0)
>      {
>          fmt->i_frame_rate = ctx->time_base.den;
> @@ -465,9 +463,6 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
>          p_sys->b_direct_rendering = true;
>      }
>  
> -#if !LIBAVCODEC_VERSION_CHECK(55, 32, 1, 48, 102)
> -    p_context->flags |= CODEC_FLAG_EMU_EDGE;
> -#endif
>      p_context->get_format = ffmpeg_GetFormat;
>      /* Always use our get_buffer wrapper so we can calculate the
>       * PTS correctly */
> -- 
> 2.6.6
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the vlc-devel mailing list