0003-Replace-deprecated-FFmpeg-API.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From cce6a0378ac319b87d2545d73f593d440bf686f5 Mon Sep 17 00:00:00 2001
  2. From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
  3. Date: Sat, 18 Aug 2018 13:25:23 +0200
  4. Subject: [PATCH] Replace deprecated FFmpeg API
  5. Fixes compilation with ffmpeg >= 2.9.
  6. Downloaded from Debian:
  7. https://sources.debian.org/src/squeezelite/1.8-4.1/debian/patches/ffmpeg_2.9.patch/
  8. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  9. ---
  10. ffmpeg.c | 14 +++++++-------
  11. 1 file changed, 7 insertions(+), 7 deletions(-)
  12. diff --git a/ffmpeg.c b/ffmpeg.c
  13. index 279f31d..bc9136c 100644
  14. --- a/ffmpeg.c
  15. +++ b/ffmpeg.c
  16. @@ -52,8 +52,8 @@ struct ff_s {
  17. unsigned (* avcodec_version)(void);
  18. AVCodec * (* avcodec_find_decoder)(int);
  19. int attribute_align_arg (* avcodec_open2)(AVCodecContext *, const AVCodec *, AVDictionary **);
  20. - AVFrame * (* avcodec_alloc_frame)(void);
  21. - void (* avcodec_free_frame)(AVFrame **);
  22. + AVFrame * (* av_frame_alloc)(void);
  23. + void (* av_frame_free)(AVFrame **);
  24. int attribute_align_arg (* avcodec_decode_audio4)(AVCodecContext *, AVFrame *, int *, const AVPacket *);
  25. // ffmpeg symbols to be dynamically loaded from libavformat
  26. unsigned (* avformat_version)(void);
  27. @@ -324,7 +324,7 @@ static decode_state ff_decode(void) {
  28. AVCODEC(ff, open2, ff->codecC, codec, NULL);
  29. - ff->frame = AVCODEC(ff, alloc_frame);
  30. + ff->frame = AV(ff, frame_alloc);
  31. ff->avpkt = AV(ff, malloc, sizeof(AVPacket));
  32. if (ff->avpkt == NULL) {
  33. @@ -520,9 +520,9 @@ static void _free_ff_data(void) {
  34. if (ff->frame) {
  35. // ffmpeg version dependant free function
  36. #if !LINKALL
  37. - ff->avcodec_free_frame ? AVCODEC(ff, free_frame, &ff->frame) : AV(ff, freep, &ff->frame);
  38. + ff->av_frame_free ? AV(ff, frame_free, &ff->frame) : AV(ff, freep, &ff->frame);
  39. #elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,28,0)
  40. - AVCODEC(ff, free_frame, &ff->frame);
  41. + AV(ff, frame_free, &ff->frame);
  42. #else
  43. AV(ff, freep, &ff->frame);
  44. #endif
  45. @@ -607,8 +607,8 @@ static bool load_ff() {
  46. ff->avcodec_version = dlsym(handle_codec, "avcodec_version");
  47. ff->avcodec_find_decoder = dlsym(handle_codec, "avcodec_find_decoder");
  48. ff->avcodec_open2 = dlsym(handle_codec, "avcodec_open2");
  49. - ff->avcodec_alloc_frame = dlsym(handle_codec, "avcodec_alloc_frame");
  50. - ff->avcodec_free_frame = dlsym(handle_codec, "avcodec_free_frame");
  51. + ff->av_frame_alloc = dlsym(handle_codec, "av_frame_alloc");
  52. + ff->av_frame_free = dlsym(handle_codec, "av_frame_free");
  53. ff->avcodec_decode_audio4 = dlsym(handle_codec, "avcodec_decode_audio4");
  54. ff->av_init_packet = dlsym(handle_codec, "av_init_packet");
  55. ff->av_free_packet = dlsym(handle_codec, "av_free_packet");
  56. --
  57. 2.18.0