From eb9396f68a9a02ae8b31b32a9335d3b163d3413c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Thu, 29 Aug 2013 17:40:17 +0200 Subject: [PATCH] - more ffmpeg2 fixes --- cinelerra-cv-ffmpeg2.patch | 86 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/cinelerra-cv-ffmpeg2.patch b/cinelerra-cv-ffmpeg2.patch index 01680ac..12dfd1b 100644 --- a/cinelerra-cv-ffmpeg2.patch +++ b/cinelerra-cv-ffmpeg2.patch @@ -23,6 +23,18 @@ By Helmut Jarausch codec = avcodec_find_decoder(id); if (codec == NULL) { printf("FFMPEG::init no decoder for '%s'", codec_string); +@@ -33,9 +33,9 @@ int FFMPEG::init(char *codec_string) { + return 1; + } + +- context = avcodec_alloc_context(); ++ context = avcodec_alloc_context3(codec); + +- if (avcodec_open(context, codec)) { ++ if (avcodec_open2(context, codec,NULL)) { + printf("FFMPEG::init avcodec_open() failed\n"); + } + @@ -51,7 +51,7 @@ } @@ -32,6 +44,65 @@ By Helmut Jarausch #define CODEC_IS(x) (! strncmp(codec_string, x, 4)) if (CODEC_IS(QUICKTIME_DV) || +--- cinelerra/fileac3.C ++++ cinelerra/fileac3.C +@@ -92,11 +92,11 @@ int FileAC3::open_file(int rd, int wr) + eprintf("codec not found.\n"); + return 1; + } +- codec_context = avcodec_alloc_context(); ++ codec_context = avcodec_alloc_context3(codec); + codec_context->bit_rate = asset->ac3_bitrate * 1000; + codec_context->sample_rate = asset->sample_rate; + codec_context->channels = asset->channels; +- if(avcodec_open(codec_context, codec)) ++ if(avcodec_open2(codec_context, codec,NULL)) + { + eprintf("failed to open codec.\n"); + return 1; +--- quicktime/mpeg4.c ++++ quicktime/mpeg4.c +@@ -641,7 +641,7 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track) + return 1; + } + +- codec->encoder_context[current_field] = avcodec_alloc_context(); ++ codec->encoder_context[current_field] = avcodec_alloc_context3(codec->encoder[current_field]); + AVCodecContext *context = codec->encoder_context[current_field]; + + context->width = width_i; +@@ -740,7 +740,7 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track) + * codec->fix_bitrate, + * codec->quantizer); + */ +- avcodec_open(context, codec->encoder[current_field]); ++ avcodec_open2(context, codec->encoder[current_field],NULL); + + avcodec_get_frame_defaults(&codec->picture[current_field]); + +--- quicktime/qtffmpeg.c ++++ quicktime/qtffmpeg.c +@@ -68,7 +68,9 @@ quicktime_ffmpeg_t* quicktime_new_ffmpeg(int cpus, + return 0; + } + +- AVCodecContext *context = ptr->decoder_context[i] = avcodec_alloc_context(); ++ //AVCodecContext *context = ptr->decoder_context[i] = avcodec_alloc_context(); ++ AVCodecContext *context = avcodec_alloc_context3(ptr->decoder[i]); ++ ptr->decoder_context[i] = context; + static char fake_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + context->width = ptr->width_i; + context->height = ptr->height_i; +@@ -96,8 +98,7 @@ quicktime_ffmpeg_t* quicktime_new_ffmpeg(int cpus, + avcodec_thread_init(context, cpus); + context->thread_count = cpus; + } +- if(avcodec_open(context, +- ptr->decoder[i]) < 0) ++ if(avcodec_open2(context, ptr->decoder[i], NULL) < 0) + { + printf("quicktime_new_ffmpeg: avcodec_open failed.\n"); + quicktime_delete_ffmpeg(ptr); --- quicktime/ffmpeg/ffmpeg.c.ORIG 2012-07-06 22:40:26.000000000 +0200 +++ quicktime/ffmpeg/ffmpeg.c 2013-08-01 12:57:59.025474005 +0200 @@ -2663,7 +2663,7 @@ @@ -207,6 +278,21 @@ By Helmut Jarausch void av_register_rtp_dynamic_payload_handlers(void); +--- quicktime/wma.c ++++ quicktime/wma.c +@@ -77,10 +77,10 @@ static int init_decode(quicktime_audio_map_t *track_map, + printf("init_decode: avcodec_find_decoder returned NULL.\n"); + return 1; + } +- codec->decoder_context = avcodec_alloc_context(); ++ codec->decoder_context = avcodec_alloc_context3(codec->decoder); + codec->decoder_context->sample_rate = trak->mdia.minf.stbl.stsd.table[0].sample_rate; + codec->decoder_context->channels = track_map->channels; +- if(avcodec_open(codec->decoder_context, codec->decoder) < 0) ++ if(avcodec_open2(codec->decoder_context, codec->decoder,NULL) < 0) + { + printf("init_decode: avcodec_open failed.\n"); + return 1; --- quicktime/wma.h.ORIG 2012-07-06 22:40:26.000000000 +0200 +++ quicktime/wma.h 2013-08-01 13:11:46.431482103 +0200 @@ -3,5 +3,6 @@ -- 2.43.0