0001-Fix-build-errors-with-FFmpeg-4.0.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From 9b93a417e37e1f0fef58d1582a7e98e4c05d3b42 Mon Sep 17 00:00:00 2001
  2. From: James Cowgill <jcowgill@users.noreply.github.com>
  3. Date: Sun, 25 Feb 2018 20:13:57 +0000
  4. Subject: [PATCH] Fix build errors with FFmpeg 4.0
  5. Backported from upstream commit
  6. https://github.com/Motion-Project/motion/commit/9b93a417e37e1f0fef58d1582a7e98e4c05d3b42
  7. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  8. ---
  9. ffmpeg.c | 19 ++++++++++++++++---
  10. 1 file changed, 16 insertions(+), 3 deletions(-)
  11. diff --git a/ffmpeg.c b/ffmpeg.c
  12. index 1e6cdf6..4299ba3 100644
  13. --- a/ffmpeg.c
  14. +++ b/ffmpeg.c
  15. @@ -67,6 +67,19 @@
  16. #endif
  17. +/*********************************************/
  18. +#if (LIBAVCODEC_VERSION_MAJOR >= 57)
  19. +
  20. +#define MY_CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
  21. +#define MY_CODEC_FLAG_QSCALE AV_CODEC_FLAG_QSCALE
  22. +
  23. +#else
  24. +
  25. +#define MY_CODEC_FLAG_GLOBAL_HEADER CODEC_FLAG_GLOBAL_HEADER
  26. +#define MY_CODEC_FLAG_QSCALE CODEC_FLAG_QSCALE
  27. +
  28. +#endif
  29. +
  30. /*********************************************/
  31. AVFrame *my_frame_alloc(void){
  32. AVFrame *pic;
  33. @@ -548,7 +561,7 @@ static int ffmpeg_set_quality(struct ffmpeg *ffmpeg){
  34. /* The selection of 8000 is a subjective number based upon viewing output files */
  35. if (ffmpeg->vbr > 0){
  36. ffmpeg->vbr =(int)(((100-ffmpeg->vbr)*(100-ffmpeg->vbr)*(100-ffmpeg->vbr) * 8000) / 1000000) + 1;
  37. - ffmpeg->ctx_codec->flags |= CODEC_FLAG_QSCALE;
  38. + ffmpeg->ctx_codec->flags |= MY_CODEC_FLAG_QSCALE;
  39. ffmpeg->ctx_codec->global_quality=ffmpeg->vbr;
  40. }
  41. }
  42. @@ -673,7 +686,7 @@ static int ffmpeg_set_codec(struct ffmpeg *ffmpeg){
  43. ffmpeg->ctx_codec->strict_std_compliance = -2;
  44. ffmpeg->ctx_codec->level = 3;
  45. }
  46. - ffmpeg->ctx_codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
  47. + ffmpeg->ctx_codec->flags |= MY_CODEC_FLAG_GLOBAL_HEADER;
  48. retcd = ffmpeg_set_quality(ffmpeg);
  49. if (retcd < 0){
  50. --
  51. 2.18.0