]> git.pld-linux.org Git - packages/cinelerra-cv.git/blob - cinelerra-cv-ffmpeg2.patch
- more ffmpeg2 fixes
[packages/cinelerra-cv.git] / cinelerra-cv-ffmpeg2.patch
1 https://bugs.gentoo.org/show_bug.cgi?id=479394
2 By Helmut Jarausch
3
4 --- cinelerra/ffmpeg.h.ORIG     2012-07-06 22:40:26.000000000 +0200
5 +++ cinelerra/ffmpeg.h  2013-08-01 12:58:12.342474136 +0200
6 @@ -26,7 +26,7 @@
7         static int convert_cmodel_transfer(VFrame *frame_in,VFrame *frame_out);
8         static int init_picture_from_frame(AVPicture *picture, VFrame *frame);
9  
10 -       static CodecID codec_id(char *codec_string);
11 +       static AVCodecID codec_id(char *codec_string);
12  
13   private:
14         static PixelFormat color_model_to_pix_fmt(int color_model);
15 --- cinelerra/ffmpeg.C.ORIG     2013-08-01 11:24:43.794419246 +0200
16 +++ cinelerra/ffmpeg.C  2013-08-01 12:57:48.121473899 +0200
17 @@ -25,7 +25,7 @@
18  
19         avcodec_register_all();
20  
21 -       CodecID id = codec_id(codec_string);
22 +       AVCodecID id = codec_id(codec_string);
23         codec = avcodec_find_decoder(id);
24         if (codec == NULL) {
25                 printf("FFMPEG::init no decoder for '%s'", codec_string);
26 @@ -33,9 +33,9 @@ int FFMPEG::init(char *codec_string) {
27                 return 1;
28         }
29  
30 -       context = avcodec_alloc_context();
31 +       context = avcodec_alloc_context3(codec);
32  
33 -       if (avcodec_open(context, codec)) {
34 +       if (avcodec_open2(context, codec,NULL)) {
35                 printf("FFMPEG::init avcodec_open() failed\n");
36         }
37  
38 @@ -51,7 +51,7 @@
39  }
40  
41  
42 -CodecID FFMPEG::codec_id(char *codec_string) {
43 +AVCodecID FFMPEG::codec_id(char *codec_string) {
44  #define CODEC_IS(x) (! strncmp(codec_string, x, 4))
45  
46         if (CODEC_IS(QUICKTIME_DV) ||
47 --- cinelerra/fileac3.C
48 +++ cinelerra/fileac3.C
49 @@ -92,11 +92,11 @@ int FileAC3::open_file(int rd, int wr)
50                         eprintf("codec not found.\n");
51                         return 1;
52                 }
53 -               codec_context = avcodec_alloc_context();
54 +               codec_context = avcodec_alloc_context3(codec);
55                 codec_context->bit_rate = asset->ac3_bitrate * 1000;
56                 codec_context->sample_rate = asset->sample_rate;
57                 codec_context->channels = asset->channels;
58 -               if(avcodec_open(codec_context, codec))
59 +               if(avcodec_open2(codec_context, codec,NULL))
60                 {
61                         eprintf("failed to open codec.\n");
62                         return 1;
63 --- quicktime/mpeg4.c
64 +++ quicktime/mpeg4.c
65 @@ -641,7 +641,7 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track)
66                                 return 1;
67                         }
68  
69 -                       codec->encoder_context[current_field] = avcodec_alloc_context();
70 +                       codec->encoder_context[current_field] = avcodec_alloc_context3(codec->encoder[current_field]);
71                         AVCodecContext *context = codec->encoder_context[current_field];
72  
73                         context->width = width_i;
74 @@ -740,7 +740,7 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track)
75   * codec->fix_bitrate,
76   * codec->quantizer);
77   */
78 -                       avcodec_open(context, codec->encoder[current_field]);
79 +                       avcodec_open2(context, codec->encoder[current_field],NULL);
80  
81                         avcodec_get_frame_defaults(&codec->picture[current_field]);
82  
83 --- quicktime/qtffmpeg.c
84 +++ quicktime/qtffmpeg.c
85 @@ -68,7 +68,9 @@ quicktime_ffmpeg_t* quicktime_new_ffmpeg(int cpus,
86                         return 0;
87                 }
88  
89 -               AVCodecContext *context = ptr->decoder_context[i] = avcodec_alloc_context();
90 +               //AVCodecContext *context = ptr->decoder_context[i] = avcodec_alloc_context();
91 +               AVCodecContext *context = avcodec_alloc_context3(ptr->decoder[i]);
92 +               ptr->decoder_context[i] = context;
93                 static char fake_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
94                 context->width = ptr->width_i;
95                 context->height = ptr->height_i;
96 @@ -96,8 +98,7 @@ quicktime_ffmpeg_t* quicktime_new_ffmpeg(int cpus,
97                         avcodec_thread_init(context, cpus);
98                         context->thread_count = cpus;
99                 }
100 -               if(avcodec_open(context, 
101 -                       ptr->decoder[i]) < 0)
102 +               if(avcodec_open2(context, ptr->decoder[i], NULL) < 0)
103                 {
104                         printf("quicktime_new_ffmpeg: avcodec_open failed.\n");
105                         quicktime_delete_ffmpeg(ptr);
106 --- quicktime/ffmpeg/ffmpeg.c.ORIG      2012-07-06 22:40:26.000000000 +0200
107 +++ quicktime/ffmpeg/ffmpeg.c   2013-08-01 12:57:59.025474005 +0200
108 @@ -2663,7 +2663,7 @@
109      return 0;
110  }
111  
112 -static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
113 +static enum AVCodecID find_codec_or_die(const char *name, int type, int encoder)
114  {
115      const char *codec_string = encoder ? "encoder" : "decoder";
116      AVCodec *codec;
117 --- quicktime/ffmpeg/libavformat/electronicarts.c.ORIG  2012-07-06 22:40:26.000000000 +0200
118 +++ quicktime/ffmpeg/libavformat/electronicarts.c       2013-08-01 13:00:57.855475755 +0200
119 @@ -49,11 +49,11 @@
120  typedef struct EaDemuxContext {
121      int big_endian;
122  
123 -    enum CodecID video_codec;
124 +    enum AVCodecID video_codec;
125      AVRational time_base;
126      int video_stream_index;
127  
128 -    enum CodecID audio_codec;
129 +    enum AVCodecID audio_codec;
130      int audio_stream_index;
131      int audio_frame_counter;
132  
133 --- quicktime/ffmpeg/libavformat/img2.c.ORIG    2012-07-06 22:40:26.000000000 +0200
134 +++ quicktime/ffmpeg/libavformat/img2.c 2013-08-01 12:59:21.408474812 +0200
135 @@ -34,7 +34,7 @@
136  } VideoData;
137  
138  typedef struct {
139 -    enum CodecID id;
140 +    enum AVCodecID id;
141      const char *str;
142  } IdStrMap;
143  
144 @@ -97,7 +97,7 @@
145      }
146      return -1;
147  }
148 -static enum CodecID av_str2id(const IdStrMap *tags, const char *str)
149 +static enum AVCodecID av_str2id(const IdStrMap *tags, const char *str)
150  {
151      str= strrchr(str, '.');
152      if(!str) return CODEC_ID_NONE;
153 @@ -175,7 +175,7 @@
154      return 0;
155  }
156  
157 -enum CodecID av_guess_image2_codec(const char *filename){
158 +enum AVCodecID av_guess_image2_codec(const char *filename){
159      return av_str2id(img_tags, filename);
160  }
161  
162 --- quicktime/ffmpeg/libavformat/matroskadec.c.ORIG     2012-07-06 22:40:26.000000000 +0200
163 +++ quicktime/ffmpeg/libavformat/matroskadec.c  2013-08-01 12:59:57.556475165 +0200
164 @@ -2476,7 +2476,7 @@
165          AVStream *st;
166  
167          for (i = 0; i < matroska->num_tracks; i++) {
168 -            enum CodecID codec_id = CODEC_ID_NONE;
169 +            enum AVCodecID codec_id = CODEC_ID_NONE;
170              uint8_t *extradata = NULL;
171              int extradata_size = 0;
172              int extradata_offset = 0;
173 @@ -2495,7 +2495,7 @@
174                  }
175              }
176  
177 -            /* Set the FourCC from the CodecID. */
178 +            /* Set the FourCC from the AVCodecID. */
179              /* This is the MS compatibility mode which stores a
180               * BITMAPINFOHEADER in the CodecPrivate. */
181              if (!strcmp(track->codec_id,
182 @@ -2600,7 +2600,7 @@
183  
184              if (codec_id == CODEC_ID_NONE) {
185                  av_log(matroska->ctx, AV_LOG_INFO,
186 -                       "Unknown/unsupported CodecID %s.\n",
187 +                       "Unknown/unsupported AVCodecID %s.\n",
188                         track->codec_id);
189              }
190  
191 --- quicktime/ffmpeg/libavformat/matroska.h.ORIG        2012-07-06 22:40:26.000000000 +0200
192 +++ quicktime/ffmpeg/libavformat/matroska.h     2013-08-01 13:00:22.218475407 +0200
193 @@ -220,12 +220,12 @@
194  
195  typedef struct CodecTags{
196      char str[16];
197 -    enum CodecID id;
198 +    enum AVCodecID id;
199  }CodecTags;
200  
201  typedef struct CodecMime{
202      char str[32];
203 -    enum CodecID id;
204 +    enum AVCodecID id;
205  }CodecMime;
206  
207  #define MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC   "V_MS/VFW/FOURCC"
208 --- quicktime/ffmpeg/libavformat/mov.c.ORIG     2012-07-06 22:40:26.000000000 +0200
209 +++ quicktime/ffmpeg/libavformat/mov.c  2013-08-01 12:59:33.935474934 +0200
210 @@ -678,7 +678,7 @@
211  
212      for(pseudo_stream_id=0; pseudo_stream_id<entries; pseudo_stream_id++) {
213          //Parsing Sample description table
214 -        enum CodecID id;
215 +        enum AVCodecID id;
216          int dref_id;
217          MOV_atom_t a = { 0, 0, 0 };
218          offset_t start_pos = url_ftell(pb);
219 --- quicktime/ffmpeg/libavformat/mxf.c.ORIG     2012-07-06 22:40:26.000000000 +0200
220 +++ quicktime/ffmpeg/libavformat/mxf.c  2013-08-01 12:59:12.025474720 +0200
221 @@ -157,7 +157,7 @@
222  typedef struct {
223      UID uid;
224      unsigned matching_len;
225 -    enum CodecID id;
226 +    enum AVCodecID id;
227  } MXFCodecUL;
228  
229  typedef struct {
230 --- quicktime/ffmpeg/libavformat/riff.h.ORIG    2012-07-06 22:40:26.000000000 +0200
231 +++ quicktime/ffmpeg/libavformat/riff.h 2013-08-01 12:59:45.950475052 +0200
232 @@ -48,7 +48,7 @@
233  extern const AVCodecTag codec_wav_tags[];
234  
235  unsigned int codec_get_tag(const AVCodecTag *tags, int id);
236 -enum CodecID codec_get_id(const AVCodecTag *tags, unsigned int tag);
237 +enum AVCodecID codec_get_id(const AVCodecTag *tags, unsigned int tag);
238  void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale);
239  
240  #endif /* FFMPEG_RIFF_H */
241 --- quicktime/ffmpeg/libavformat/rtp.c.ORIG     2012-07-06 22:40:26.000000000 +0200
242 +++ quicktime/ffmpeg/libavformat/rtp.c  2013-08-01 12:59:01.778474619 +0200
243 @@ -40,7 +40,7 @@
244      int pt;
245      const char enc_name[6];
246      enum CodecType codec_type;
247 -    enum CodecID codec_id;
248 +    enum AVCodecID codec_id;
249      int clock_rate;
250      int audio_channels;
251  } AVRtpPayloadTypes[]=
252 @@ -120,7 +120,7 @@
253      return "";
254  }
255  
256 -enum CodecID ff_rtp_codec_id(const char *buf, enum CodecType codec_type)
257 +enum AVCodecID ff_rtp_codec_id(const char *buf, enum CodecType codec_type)
258  {
259      int i;
260  
261 --- quicktime/ffmpeg/libavformat/rtp_internal.h.ORIG    2012-07-06 22:40:26.000000000 +0200
262 +++ quicktime/ffmpeg/libavformat/rtp_internal.h 2013-08-01 13:00:09.147475279 +0200
263 @@ -61,7 +61,7 @@
264      // fields from AVRtpDynamicPayloadType_s
265      const char enc_name[50];    /* XXX: still why 50 ? ;-) */
266      enum CodecType codec_type;
267 -    enum CodecID codec_id;
268 +    enum AVCodecID codec_id;
269  
270      // may be null
271      int (*parse_sdp_a_line) (AVStream * stream,
272 @@ -123,7 +123,7 @@
273  
274  void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m);
275  const char *ff_rtp_enc_name(int payload_type);
276 -enum CodecID ff_rtp_codec_id(const char *buf, enum CodecType codec_type);
277 +enum AVCodecID ff_rtp_codec_id(const char *buf, enum CodecType codec_type);
278  
279  void av_register_rtp_dynamic_payload_handlers(void);
280  
281 --- quicktime/wma.c
282 +++ quicktime/wma.c
283 @@ -77,10 +77,10 @@ static int init_decode(quicktime_audio_map_t *track_map,
284                         printf("init_decode: avcodec_find_decoder returned NULL.\n");
285                         return 1;
286                 }
287 -               codec->decoder_context = avcodec_alloc_context();
288 +               codec->decoder_context = avcodec_alloc_context3(codec->decoder);
289                 codec->decoder_context->sample_rate = trak->mdia.minf.stbl.stsd.table[0].sample_rate;
290                 codec->decoder_context->channels = track_map->channels;
291 -               if(avcodec_open(codec->decoder_context, codec->decoder) < 0)
292 +               if(avcodec_open2(codec->decoder_context, codec->decoder,NULL) < 0)
293                 {
294                         printf("init_decode: avcodec_open failed.\n");
295                         return 1;
296 --- quicktime/wma.h.ORIG        2012-07-06 22:40:26.000000000 +0200
297 +++ quicktime/wma.h     2013-08-01 13:11:46.431482103 +0200
298 @@ -3,5 +3,6 @@
299  
300  extern void quicktime_init_codec_wmav1(quicktime_audio_map_t *);
301  extern void quicktime_init_codec_wmav2(quicktime_audio_map_t *);
302 +#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
303  
304  #endif
This page took 0.068713 seconds and 3 git commands to generate.