debian/patches: new FFmpeg-5.0-compatibility.patch
[libam7xxx.git] / debian / patches / FFmpeg-5.0-compatibility.patch
1 Description: Fix build against FFmpeg 5.0
2 Author: Nicholas Guriev <guriev-ns@ya.ru>
3 Bug-Debian: https://bugs.debian.org/1004821
4 Last-Update: Tue, 28 Jun 2022 23:33:19 +0300
5
6 --- a/examples/am7xxx-play.c
7 +++ b/examples/am7xxx-play.c
8 @@ -29,6 +29,7 @@
9  #include <signal.h>
10  #include <getopt.h>
11  
12 +#include <libavcodec/avcodec.h>
13  #include <libavdevice/avdevice.h>
14  #include <libavformat/avformat.h>
15  #include <libavutil/imgutils.h>
16 @@ -49,17 +50,19 @@ static int video_input_init(struct video
17                             const char *input_path,
18                             AVDictionary **input_options)
19  {
20 -       AVInputFormat *input_format = NULL;
21 +       AVInputFormat const *input_format = NULL;
22         AVFormatContext *input_format_ctx;
23         AVCodecParameters *input_codec_params;
24         AVCodecContext *input_codec_ctx;
25 -       AVCodec *input_codec;
26 +       AVCodec const *input_codec;
27         int video_index;
28         int ret;
29  
30         avdevice_register_all();
31 +#if LIBAVCODEC_VERSION_MAJOR < 59
32         avcodec_register_all();
33         av_register_all();
34 +#endif
35  
36         if (input_format_string) {
37                 /* find the desired input format */
38 @@ -158,7 +161,7 @@ static int video_output_init(struct vide
39                              am7xxx_device *dev)
40  {
41         AVCodecContext *output_codec_ctx;
42 -       AVCodec *output_codec;
43 +       AVCodec const *output_codec;
44         unsigned int new_output_width;
45         unsigned int new_output_height;
46         int ret;