obs-ffmpeg-compat.h 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include <libavcodec/avcodec.h>
  3. /* LIBAVCODEC_VERSION_CHECK checks for the right version of libav and FFmpeg
  4. * a is the major version
  5. * b and c the minor and micro versions of libav
  6. * d and e the minor and micro versions of FFmpeg */
  7. #define LIBAVCODEC_VERSION_CHECK( a, b, c, d, e ) \
  8. ( (LIBAVCODEC_VERSION_MICRO < 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
  9. (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
  10. #if !LIBAVCODEC_VERSION_CHECK(54, 28, 0, 59, 100)
  11. # define avcodec_free_frame av_freep
  12. #endif
  13. #if LIBAVCODEC_VERSION_INT < 0x371c01
  14. # define av_frame_alloc avcodec_alloc_frame
  15. # define av_frame_unref avcodec_get_frame_defaults
  16. # define av_frame_free avcodec_free_frame
  17. #endif
  18. #if LIBAVCODEC_VERSION_MAJOR >= 58
  19. #define CODEC_CAP_TRUNC AV_CODEC_CAP_TRUNCATED
  20. #define CODEC_FLAG_TRUNC AV_CODEC_FLAG_TRUNCATED
  21. #define INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE
  22. #else
  23. #define CODEC_CAP_TRUNC CODEC_CAP_TRUNCATED
  24. #define CODEC_FLAG_TRUNC CODEC_FLAG_TRUNCATED
  25. #define INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
  26. #endif