[arch-commits] Commit in cinelerra-cv/repos (9 files)

Maxime Gauduin alucryd at archlinux.org
Tue Aug 7 11:33:27 UTC 2018


    Date: Tuesday, August 7, 2018 @ 11:33:27
  Author: alucryd
Revision: 370119

archrelease: copy trunk to community-staging-x86_64

Added:
  cinelerra-cv/repos/community-staging-x86_64/
  cinelerra-cv/repos/community-staging-x86_64/PKGBUILD
    (from rev 370118, cinelerra-cv/trunk/PKGBUILD)
  cinelerra-cv/repos/community-staging-x86_64/cinelerra-cv-ffmpeg3.patch
    (from rev 370118, cinelerra-cv/trunk/cinelerra-cv-ffmpeg3.patch)
  cinelerra-cv/repos/community-staging-x86_64/cinelerra-cv-ffmpeg4.patch
    (from rev 370118, cinelerra-cv/trunk/cinelerra-cv-ffmpeg4.patch)
  cinelerra-cv/repos/community-staging-x86_64/ffmpeg-link.patch
    (from rev 370118, cinelerra-cv/trunk/ffmpeg-link.patch)
  cinelerra-cv/repos/community-staging-x86_64/ffmpeg2.0.patch
    (from rev 370118, cinelerra-cv/trunk/ffmpeg2.0.patch)
  cinelerra-cv/repos/community-staging-x86_64/ffmpeg_api.patch
    (from rev 370118, cinelerra-cv/trunk/ffmpeg_api.patch)
  cinelerra-cv/repos/community-staging-x86_64/gcc5fix.patch
    (from rev 370118, cinelerra-cv/trunk/gcc5fix.patch)
  cinelerra-cv/repos/community-staging-x86_64/v4l1_removal.patch
    (from rev 370118, cinelerra-cv/trunk/v4l1_removal.patch)

----------------------------+
 PKGBUILD                   |   83 +++++
 cinelerra-cv-ffmpeg3.patch |  681 +++++++++++++++++++++++++++++++++++++++++++
 cinelerra-cv-ffmpeg4.patch |   82 +++++
 ffmpeg-link.patch          |   24 +
 ffmpeg2.0.patch            |   98 ++++++
 ffmpeg_api.patch           |  163 ++++++++++
 gcc5fix.patch              |   33 ++
 v4l1_removal.patch         |  125 +++++++
 8 files changed, 1289 insertions(+)

Copied: cinelerra-cv/repos/community-staging-x86_64/PKGBUILD (from rev 370118, cinelerra-cv/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD	                        (rev 0)
+++ community-staging-x86_64/PKGBUILD	2018-08-07 11:33:27 UTC (rev 370119)
@@ -0,0 +1,83 @@
+# $Id$
+# Maintainer: Ray Rashif <schiv at archlinux.org>
+# Contributor: Daniel J Griffiths <ghost1227 at archlinux.us>
+# Contributor: Jaroslaw Swierczynski <swiergot at aur.archlinux.org>
+# Contributor: Alexander Rødseth <rodseth at gmail.com>
+
+_name=CinelerraCV
+pkgname=cinelerra-cv
+pkgver=2.3
+pkgrel=5
+epoch=1
+pkgdesc="Professional video editing and compositing environment"
+arch=('x86_64')
+url="https://cinelerra-cv.org/"
+license=('GPL')
+depends=('e2fsprogs' 'libavc1394' 'libiec61883' 'libxv'
+         'libtiff' 'mjpegtools' 'fftw' 'a52dec' 'glu'
+         'ffmpeg' 'faad2' 'faac' 'openexr>=2.0.0' 'libxft')
+makedepends=('git' 'nasm' 'mesa')
+source=("https://${pkgname}.org/releases/${_name}-${pkgver}.tar.xz"
+        'v4l1_removal.patch'
+        'ffmpeg_api.patch'
+        'ffmpeg2.0.patch'
+        'gcc5fix.patch'
+        'cinelerra-cv-ffmpeg3.patch'
+        'ffmpeg-link.patch'
+        'cinelerra-cv-ffmpeg4.patch')
+sha512sums=('908dc097af8507e3b60b4787e0350500b8ba8c4340bbbdbf3716e61d74074e5f0617500b94ed1d450e030f88f3821f948cfa37c247ec2c2571fd76974374868e'
+            '0295d71dd4b17051288778f54c57babd4fbfab5be29b71c47caf2bbac614898a7c2c7cb6cb1d093e6237f929f4e765a2fbed363cc34a3481d628ccdda19fe83e'
+            '0882e87b3d8bd99de6c08d61a2569dd4595a90066ee6f697fddedb9f863f4ba3bcfb2b986e7ffeef369151cebf326a128f322d86c3c84602f7b35252f91a9bdb'
+            '5313820d0030c216710654cb4ba17d33478e7f1d644c668d64e74c0d580d04ba658e68302a85311b2d2792c05a943a546b620ec680847d0324d335b168ba69c7'
+            'b81bc1c5794003486f0ca1f8e5172ed4b0d1b06d2b3c00d5fc665a00b921e128d83e321fd0c41f9508f9f3726908b1f3876b45d4ecc4a32e7ec5e95ede564495'
+            'e7f7c4058e4ea5cd21ed9abcb8383828aef181474b373051a23cbf31e6a68ba728c392fda93c301fd299facfe13e398ad1ccb990fc9ab3a3e4f4fd6238fea905'
+            'bc3729d9a61b9734356162acdcf3c055b2a3fdb162686db9267da97a7e8b28f39637abd8524a6b2e286fbe99bd89d45e1df857048125286fbe6262e470ba6124'
+            '39af2d3b1e1ce0faaef63db23bebc5466b7ac15a75da58c7119f443ec6c4b06ec9118cea21fa2d5ff98031b7399f24e0a5d2280ebd01dea534377f685e0492de')
+
+prepare() {
+  mv -v "${_name}-${pkgver}" "${pkgname}-${pkgver}"
+  cd "${pkgname}-${pkgver}"
+
+  ## Patches (oldest first) ##
+  # v4l1 removal patch
+  patch -Np1 -i "$srcdir/v4l1_removal.patch"
+  # ffmpeg api patch update for 0.11
+  patch -Np1 -i "$srcdir/ffmpeg_api.patch"
+  # fix avcodec_alloc_context and alloc_open
+  patch -Np1 -i "$srcdir/ffmpeg2.0.patch"
+  # gcc 5.x fix
+  patch -Np1 -i "$srcdir/gcc5fix.patch"
+  # fix build with ffmpeg 3.0
+  patch -p1 -i ../cinelerra-cv-ffmpeg3.patch
+  patch -p0 -i ../ffmpeg-link.patch
+  # fix build with ffmpeg 4.0 (Gentoo)
+  patch -p1 -i ../cinelerra-cv-ffmpeg4.patch
+  # gcc 4.6 workaround
+  export CFLAGS+=" -Wwrite-strings -D__STDC_CONSTANT_MACROS"
+  export CPPFLAGS="$CFLAGS"
+  # remove executable stack
+  export LDFLAGS+=" -Wl,-z,noexecstack"
+  autoreconf -vfi
+}
+
+build() {
+  cd "${pkgname}-${pkgver}"
+  # disable mmx due to improper use of registers in asm
+  # - possibly a new problem since gcc 4.9
+  ./configure --prefix=/usr \
+              --with-buildinfo=git/recompile \
+              --with-external-ffmpeg \
+              --enable-opengl \
+              --disable-mmx \
+              --disable-esd
+  make
+}
+
+package() {
+  cd "${pkgname}-${pkgver}"
+  make DESTDIR="$pkgdir" install
+  install -t "${pkgdir}/usr/share/doc/${pkgname}" \
+    -vDm644 {AUTHORS,ChangeLog,NEWS,README.BUILD,TODO}
+}
+
+# vim:set ts=2 sw=2 et:

Copied: cinelerra-cv/repos/community-staging-x86_64/cinelerra-cv-ffmpeg3.patch (from rev 370118, cinelerra-cv/trunk/cinelerra-cv-ffmpeg3.patch)
===================================================================
--- community-staging-x86_64/cinelerra-cv-ffmpeg3.patch	                        (rev 0)
+++ community-staging-x86_64/cinelerra-cv-ffmpeg3.patch	2018-08-07 11:33:27 UTC (rev 370119)
@@ -0,0 +1,681 @@
+Index: cinelerra-20140710/cinelerra/ffmpeg.C
+===================================================================
+--- ffmpeg.C.orig	2016-02-19 19:37:33.634278174 +0000
++++ ffmpeg.C	2016-02-19 19:39:37.540403052 +0000
+@@ -25,20 +25,20 @@
+ 
+ 	avcodec_register_all();
+ 
+-	CodecID id = codec_id(codec_string);
++	AVCodecID id = codec_id(codec_string);
+ 	codec = avcodec_find_decoder(id);
+ 	if (codec == NULL) {
+ 		printf("FFMPEG::init no decoder for '%s'", codec_string);
+ 		return 1;
+ 	}
+ 
+	context = avcodec_alloc_context3(codec);
+ 
+	if (avcodec_open2(context, codec,NULL)) {
+ 		printf("FFMPEG::init avcodec_open() failed\n");
+ 	}
+ 
+-	picture = avcodec_alloc_frame();
++	picture = av_frame_alloc();
+ 
+ 
+ 	return 0;
+@@ -51,66 +51,66 @@
+ }
+ 
+ 
+-CodecID FFMPEG::codec_id(char *codec_string) {
++AVCodecID FFMPEG::codec_id(char *codec_string) {
+ #define CODEC_IS(x) (! strncmp(codec_string, x, 4))
+ 
+ 	if (CODEC_IS(QUICKTIME_DV) ||
+-	    CODEC_IS(QUICKTIME_DVSD)) return CODEC_ID_DVVIDEO;
++	    CODEC_IS(QUICKTIME_DVSD)) return AV_CODEC_ID_DVVIDEO;
+ 	
+ 	if (CODEC_IS(QUICKTIME_MP4V) ||
+-	    CODEC_IS(QUICKTIME_DIVX)) return CODEC_ID_MPEG4;
++	    CODEC_IS(QUICKTIME_DIVX)) return AV_CODEC_ID_MPEG4;
+ 
+-	return CODEC_ID_NONE;
++	return AV_CODEC_ID_NONE;
+ 
+ #undef CODEC_IS
+ }
+ 
+-PixelFormat FFMPEG::color_model_to_pix_fmt(int color_model) {
++AVPixelFormat FFMPEG::color_model_to_pix_fmt(int color_model) {
+ 	switch (color_model) 
+ 		{ 
+ 		case BC_YUV422: 
+-			  return PIX_FMT_YUYV422;
++			  return AV_PIX_FMT_YUYV422;
+ 		case BC_RGB888:
+-			return PIX_FMT_RGB24;
++			return AV_PIX_FMT_RGB24;
+ 		case BC_BGR8888:  // NOTE: order flipped
+-			return PIX_FMT_RGB32;
++			return AV_PIX_FMT_RGB32;
+ 		case BC_BGR888:
+-			return PIX_FMT_BGR24;
++			return AV_PIX_FMT_BGR24;
+ 		case BC_YUV420P: 
+-			return PIX_FMT_YUV420P;
++			return AV_PIX_FMT_YUV420P;
+ 		case BC_YUV422P:
+-			return PIX_FMT_YUV422P;
++			return AV_PIX_FMT_YUV422P;
+ 		case BC_YUV444P:
+-			return PIX_FMT_YUV444P;
++			return AV_PIX_FMT_YUV444P;
+ 		case BC_YUV411P:
+-			return PIX_FMT_YUV411P;
++			return AV_PIX_FMT_YUV411P;
+ 		case BC_RGB565:
+-			return PIX_FMT_RGB565;
++			return AV_PIX_FMT_RGB565;
+ 		};
+ 
+-	return PIX_FMT_NB;
++	return AV_PIX_FMT_NB;
+ }
+ 
+-int FFMPEG::pix_fmt_to_color_model(PixelFormat pix_fmt) {
++int FFMPEG::pix_fmt_to_color_model(AVPixelFormat pix_fmt) {
+ 	switch (pix_fmt) 
+ 		{ 
+-		case PIX_FMT_YUYV422:
++		case AV_PIX_FMT_YUYV422:
+ 			return BC_YUV422;
+-		case PIX_FMT_RGB24:
++		case AV_PIX_FMT_RGB24:
+ 			return BC_RGB888;
+-		case PIX_FMT_RGB32:
++		case AV_PIX_FMT_RGB32:
+ 			return BC_BGR8888;
+-		case PIX_FMT_BGR24:
++		case AV_PIX_FMT_BGR24:
+ 			return BC_BGR888;
+-		case PIX_FMT_YUV420P:
++		case AV_PIX_FMT_YUV420P:
+ 			return BC_YUV420P;
+-		case PIX_FMT_YUV422P:
++		case AV_PIX_FMT_YUV422P:
+ 			return BC_YUV422P;
+-		case PIX_FMT_YUV444P:
++		case AV_PIX_FMT_YUV444P:
+ 			return BC_YUV444P;
+-		case PIX_FMT_YUV411P:
++		case AV_PIX_FMT_YUV411P:
+ 			return BC_YUV411P;
+-		case PIX_FMT_RGB565:
++		case AV_PIX_FMT_RGB565:
+ 			return BC_RGB565;
+ 		};
+ 
+@@ -119,7 +119,7 @@
+ 
+ int FFMPEG::init_picture_from_frame(AVPicture *picture, VFrame *frame) {
+ 	int cmodel = frame->get_color_model();
+-	PixelFormat pix_fmt = color_model_to_pix_fmt(cmodel);
++	AVPixelFormat pix_fmt = color_model_to_pix_fmt(cmodel);
+ 
+ 	int size = avpicture_fill(picture, frame->get_data(), pix_fmt, 
+ 				  frame->get_w(), frame->get_h());
+@@ -142,16 +142,16 @@
+ 
+ int FFMPEG::convert_cmodel(VFrame *frame_in,  VFrame *frame_out) {
+   
+-	PixelFormat pix_fmt_in = 
++	AVPixelFormat pix_fmt_in = 
+ 		color_model_to_pix_fmt(frame_in->get_color_model());
+-	PixelFormat pix_fmt_out = 
++	AVPixelFormat pix_fmt_out = 
+ 		color_model_to_pix_fmt(frame_out->get_color_model());
+ #ifdef HAVE_SWSCALER
+ 	// We need a context for swscale
+ 	struct SwsContext *convert_ctx;
+ #endif
+ 	// do conversion within libavcodec if possible
+-	if (pix_fmt_in != PIX_FMT_NB && pix_fmt_out != PIX_FMT_NB) {
++	if (pix_fmt_in != AV_PIX_FMT_NB && pix_fmt_out != AV_PIX_FMT_NB) {
+ 		// set up a temporary pictures from frame_in and frame_out
+ 		AVPicture picture_in, picture_out;
+ 		init_picture_from_frame(&picture_in, frame_in);
+@@ -226,14 +226,14 @@
+ }
+ 
+ 
+-int FFMPEG::convert_cmodel(AVPicture *picture_in, PixelFormat pix_fmt_in,
++int FFMPEG::convert_cmodel(AVPicture *picture_in, AVPixelFormat pix_fmt_in,
+ 			  int width_in, int height_in, VFrame *frame_out) {
+ 
+ 	// set up a temporary picture_out from frame_out
+ 	AVPicture picture_out;
+ 	init_picture_from_frame(&picture_out, frame_out);
+ 	int cmodel_out = frame_out->get_color_model();
+-	PixelFormat pix_fmt_out = color_model_to_pix_fmt(cmodel_out);
++	AVPixelFormat pix_fmt_out = color_model_to_pix_fmt(cmodel_out);
+ 
+ #ifdef HAVE_SWSCALER
+ 	// We need a context for swscale
+@@ -242,7 +242,7 @@
+ 	int result;
+ #ifndef HAVE_SWSCALER
+ 	// do conversion within libavcodec if possible
+-	if (pix_fmt_out != PIX_FMT_NB) {
++	if (pix_fmt_out != AV_PIX_FMT_NB) {
+ 		result = img_convert(&picture_out,
+ 				     pix_fmt_out,
+ 				     picture_in,
+@@ -280,7 +280,7 @@
+ 	// make an intermediate temp frame only if necessary
+ 	int cmodel_in = pix_fmt_to_color_model(pix_fmt_in);
+ 	if (cmodel_in == BC_TRANSPARENCY) {
+-		if (pix_fmt_in == PIX_FMT_RGB32) {
++		if (pix_fmt_in == AV_PIX_FMT_RGB32) {
+ 			// avoid infinite recursion if things are broken
+ 			printf("FFMPEG::convert_cmodel pix_fmt_in broken!\n");
+ 			return 1;
+Index: cinelerra-20140710/cinelerra/ffmpeg.h
+===================================================================
+--- cinelerra-20140710.orig/cinelerra/ffmpeg.h
++++ cinelerra-20140710/cinelerra/ffmpeg.h
+@@ -18,7 +18,7 @@
+ 	int init(char *codec_string);
+ 	int decode(uint8_t *data, long data_size, VFrame *frame_out);
+ 
+-	static int convert_cmodel(AVPicture *picture_in, PixelFormat pix_fmt,
++	static int convert_cmodel(AVPicture *picture_in, AVPixelFormat pix_fmt,
+ 				  int width_in, int height_in, 
+ 				  VFrame *frame_out);
+ 	static int convert_cmodel(VFrame *frame_in, VFrame *frame_out);
+@@ -26,11 +26,11 @@
+ 	static int convert_cmodel_transfer(VFrame *frame_in,VFrame *frame_out);
+ 	static int init_picture_from_frame(AVPicture *picture, VFrame *frame);
+ 
+-	static CodecID codec_id(char *codec_string);
++	static AVCodecID codec_id(char *codec_string);
+ 
+  private:
+-	static PixelFormat color_model_to_pix_fmt(int color_model);
+-	static int pix_fmt_to_color_model(PixelFormat pix_fmt);
++	static AVPixelFormat color_model_to_pix_fmt(int color_model);
++	static int pix_fmt_to_color_model(AVPixelFormat pix_fmt);
+ 
+ 	int got_picture;
+ 	Asset *asset;
+Index: cinelerra-20140710/cinelerra/fileac3.C
+===================================================================
+--- cinelerra-20140710.orig/cinelerra/fileac3.C
++++ cinelerra-20140710/cinelerra/fileac3.C
+@@ -85,7 +85,7 @@ int FileAC3::open_file(int rd, int wr)
+ 	if(wr)
+ 	{
+ 		avcodec_register_all();
+-		codec = avcodec_find_encoder(CODEC_ID_AC3);
++		codec = avcodec_find_encoder(AV_CODEC_ID_AC3);
+ 		if(!codec)
+ 		{
+ 			eprintf("codec not found.\n");
+@@ -211,12 +211,56 @@ int FileAC3::write_samples(double **buff
+ 		current_sample + frame_size <= temp_raw_size; 
+ 		current_sample += frame_size)
+ 	{
+-		int compressed_size = avcodec_encode_audio(
+-			codec_context, 
+-			temp_compressed + output_size, 
+-			compressed_allocated - output_size, 
+-            temp_raw + current_sample * asset->channels);
+-		output_size += compressed_size;
++		AVPacket pkt;
++		AVFrame *frame;
++		int ret, samples_size, got_packet;
++		av_init_packet(&pkt);
++		pkt.data = temp_compressed + output_size;
++		pkt.size = compressed_allocated - output_size;
++		frame = av_frame_alloc();
++		if(!frame) return AVERROR(ENOMEM);
++		if(codec_context->frame_size) {
++			frame->nb_samples = codec_context->frame_size;
++		} else {
++			/* if frame_size is not set, the number of samples must be
++			 *              * calculated from the buffer size */
++			int64_t nb_samples;
++			if (!av_get_bits_per_sample(codec_context->codec_id)) {
++				av_frame_free(&frame);
++				return AVERROR(EINVAL);
++			}
++			nb_samples = (int64_t)(compressed_allocated - output_size) * 8 /
++				(av_get_bits_per_sample(codec_context->codec_id) *
++				 codec_context->channels);
++			if (nb_samples >= INT_MAX) {
++				av_frame_free(&frame);
++				return AVERROR(EINVAL);
++			}
++			frame->nb_samples = nb_samples;
++		}
++
++		/* it is assumed that the samples buffer is large enough based on the
++		 *          * relevant parameters */
++		samples_size = av_samples_get_buffer_size(NULL, codec_context->channels,
++				frame->nb_samples,
++				codec_context->sample_fmt, 1);
++		if ((ret = avcodec_fill_audio_frame(frame, codec_context->channels,
++						codec_context->sample_fmt,
++						(const uint8_t *)(temp_raw + current_sample * asset->channels),
++						samples_size, 1)) < 0) {
++			av_frame_free(&frame);
++			return ret;
++		}
++
++		ret = avcodec_encode_audio2(codec_context, &pkt, frame, &got_packet);
++		output_size += pkt.size;
++		/* free any side data since we cannot return it */
++		av_packet_free_side_data(&pkt);
++
++		if (frame && frame->extended_data != frame->data)
++			av_freep(&frame->extended_data);
++
++		av_frame_free(&frame);
+ 	}
+ 
+ // Shift buffer back
+Index: cinelerra-20140710/quicktime/mpeg4.c
+===================================================================
+--- cinelerra-20140710.orig/quicktime/mpeg4.c
++++ cinelerra-20140710/quicktime/mpeg4.c
+@@ -595,7 +595,7 @@ static int encode(quicktime_t *file, uns
+ 	if(!codec->encode_initialized[current_field])
+ 	{
+ // Encore section
+-		if(codec->ffmpeg_id == CODEC_ID_MPEG4 && codec->use_encore)
++		if(codec->ffmpeg_id == AV_CODEC_ID_MPEG4 && codec->use_encore)
+ 		{
+ 			codec->encode_initialized[current_field] = 1;
+ 			codec->encode_handle[current_field] = encode_handle++;
+@@ -647,7 +647,7 @@ static int encode(quicktime_t *file, uns
+ 			context->width = width_i;
+ 			context->height = height_i;
+ 			context->gop_size = codec->gop_size;
+-			context->pix_fmt = PIX_FMT_YUV420P;
++			context->pix_fmt = AV_PIX_FMT_YUV420P;
+ 			context->bit_rate = codec->bitrate / codec->total_fields;
+ 			context->bit_rate_tolerance = codec->bitrate_tolerance;
+ 			context->rc_eq = video_rc_eq;
+@@ -703,19 +703,19 @@
+ // All the forbidden settings can be extracted from libavcodec/mpegvideo.c of ffmpeg...
+  			
+ // Copyed from ffmpeg's mpegvideo.c... set 4MV only where it is supported
+-			if(codec->ffmpeg_id == CODEC_ID_MPEG4 ||
+-			   codec->ffmpeg_id == CODEC_ID_H263 ||
+-			   codec->ffmpeg_id == CODEC_ID_H263P ||
+-			   codec->ffmpeg_id == CODEC_ID_FLV1)
++			if(codec->ffmpeg_id == AV_CODEC_ID_MPEG4 ||
++			   codec->ffmpeg_id == AV_CODEC_ID_H263 ||
++			   codec->ffmpeg_id == AV_CODEC_ID_H263P ||
++			   codec->ffmpeg_id == AV_CODEC_ID_FLV1)
+ 				context->flags |= CODEC_FLAG_4MV;
+ // Not compatible with Win
+ //			context->flags |= CODEC_FLAG_QPEL;
+ 
+ 			if(file->cpus > 1 && 
+-				(codec->ffmpeg_id == CODEC_ID_MPEG4 ||
+-			         codec->ffmpeg_id == CODEC_ID_MPEG1VIDEO ||
+-			         codec->ffmpeg_id == CODEC_ID_MPEG2VIDEO ||
+-			         codec->ffmpeg_id == CODEC_ID_H263P))
++				(codec->ffmpeg_id == AV_CODEC_ID_MPEG4 ||
++			         codec->ffmpeg_id == AV_CODEC_ID_MPEG1VIDEO ||
++			         codec->ffmpeg_id == AV_CODEC_ID_MPEG2VIDEO ||
++			         codec->ffmpeg_id == AV_CODEC_ID_H263P))
+ 			{
+ 				context->thread_count = file->cpus;
+ 			}
+@@ -740,7 +740,7 @@ static int encode(quicktime_t *file, uns
+  */
+ 			avcodec_open2(context, codec->encoder[current_field], opts);
+ 
+-   			avcodec_get_frame_defaults(&codec->picture[current_field]);
++   			av_frame_unref(&codec->picture[current_field]);
+ 
+ 		}
+ 	}
+@@ -891,10 +891,18 @@ static int encode(quicktime_t *file, uns
+ 		picture->quality = 0;
+ 		picture->pts = vtrack->current_position * quicktime_frame_rate_d(file, track);
+ 		picture->key_frame = 0;
+-		bytes = avcodec_encode_video(context, 
+-			codec->work_buffer, 
+-        	codec->buffer_size, 
+-        	picture);
++
++		AVPacket pkt;
++		int ret, got_pkt;
++		av_init_packet(&pkt);
++		pkt.data = codec->work_buffer;
++		pkt.size = codec->buffer_size;
++		ret = avcodec_encode_video2(context, 
++			&pkt,
++	        	picture, &got_pkt);
++		bytes = pkt.size;
++		if(ret < 0 || !got_pkt) return 1;
++
+ 		is_keyframe = context->coded_frame && context->coded_frame->key_frame;
+ /*
+  * printf("encode current_position=%d is_keyframe=%d\n", 
+@@ -1161,7 +1169,7 @@ void quicktime_init_codec_div3(quicktime
+ 		QUICKTIME_DIV3,
+ 		"DIVX",
+ 		"Mike Row Soft MPEG4 Version 3");
+-	result->ffmpeg_id = CODEC_ID_MSMPEG4V3;
++	result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V3;
+ }
+ 
+ void quicktime_init_codec_div5(quicktime_video_map_t *vtrack)
+@@ -1170,7 +1178,7 @@ void quicktime_init_codec_div5(quicktime
+ 		QUICKTIME_DX50,
+ 		"DIVX",
+ 		"Mike Row Soft MPEG4 Version 5");
+-	result->ffmpeg_id = CODEC_ID_MPEG4;
++	result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+ }
+ 
+ // Mike Rowe Soft MPEG-4
+@@ -1180,7 +1188,7 @@ void quicktime_init_codec_div3lower(quic
+ 		QUICKTIME_DIV3_LOWER,
+ 		"DIVX",
+ 		"Mike Row Soft MPEG4 Version 3");
+-	result->ffmpeg_id = CODEC_ID_MSMPEG4V3;
++	result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V3;
+ }
+ 
+ void quicktime_init_codec_div3v2(quicktime_video_map_t *vtrack)
+@@ -1189,7 +1197,7 @@ void quicktime_init_codec_div3v2(quickti
+ 		QUICKTIME_MP42,
+ 		"MP42",
+ 		"Mike Row Soft MPEG4 Version 2");
+-	result->ffmpeg_id = CODEC_ID_MSMPEG4V2;
++	result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V2;
+ }
+ 
+ // Generic MPEG-4
+@@ -1199,7 +1207,7 @@ void quicktime_init_codec_divx(quicktime
+ 		QUICKTIME_DIVX,
+ 		"MPEG-4",
+ 		"Generic MPEG Four");
+-	result->ffmpeg_id = CODEC_ID_MPEG4;
++	result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+ 	result->use_encore = 1;
+ }
+ 
+@@ -1209,7 +1217,7 @@ void quicktime_init_codec_mpg4(quicktime
+ 		QUICKTIME_MPG4,
+ 		"MPEG-4",
+ 		"FFMPEG (msmpeg4)");
+-	result->ffmpeg_id = CODEC_ID_MSMPEG4V1;
++	result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V1;
+ }
+ 
+ void quicktime_init_codec_dx50(quicktime_video_map_t *vtrack)
+@@ -1218,7 +1226,7 @@ void quicktime_init_codec_dx50(quicktime
+ 		QUICKTIME_DX50,
+ 		"MPEG-4",
+ 		"FFMPEG (mpeg4)");
+-	result->ffmpeg_id = CODEC_ID_MPEG4;
++	result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+ }
+ 
+ // Generic MPEG-4
+@@ -1228,7 +1236,7 @@ void quicktime_init_codec_mp4v(quicktime
+ 		QUICKTIME_MP4V,
+ 		"MPEG4",
+ 		"Generic MPEG Four");
+-	result->ffmpeg_id = CODEC_ID_MPEG4;
++	result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+ //	result->use_encore = 1;
+ }
+ 
+@@ -1240,7 +1248,7 @@ void quicktime_init_codec_svq1(quicktime
+ 		QUICKTIME_SVQ1,
+ 		"Sorenson Version 1",
+ 		"From the chearch of codecs of yesterday's sights");
+-	result->ffmpeg_id = CODEC_ID_SVQ1;
++	result->ffmpeg_id = AV_CODEC_ID_SVQ1;
+ }
+ 
+ void quicktime_init_codec_svq3(quicktime_video_map_t *vtrack)
+@@ -1249,7 +1257,7 @@ void quicktime_init_codec_svq3(quicktime
+ 		QUICKTIME_SVQ3,
+ 		"Sorenson Version 3",
+ 		"From the chearch of codecs of yesterday's sights");
+-	result->ffmpeg_id = CODEC_ID_SVQ3;
++	result->ffmpeg_id = AV_CODEC_ID_SVQ3;
+ }
+ 
+ void quicktime_init_codec_h263(quicktime_video_map_t *vtrack)
+@@ -1258,7 +1266,7 @@ void quicktime_init_codec_h263(quicktime
+         QUICKTIME_H263,
+         "H.263",
+         "H.263");
+-    result->ffmpeg_id = CODEC_ID_H263;
++    result->ffmpeg_id = AV_CODEC_ID_H263;
+ }
+ 
+ void quicktime_init_codec_xvid(quicktime_video_map_t *vtrack)
+@@ -1267,7 +1275,7 @@ void quicktime_init_codec_xvid(quicktime
+         QUICKTIME_XVID,
+         "XVID",
+         "FFmpeg MPEG-4");
+-    result->ffmpeg_id = CODEC_ID_MPEG4;
++    result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+ }
+ 
+ void quicktime_init_codec_dnxhd(quicktime_video_map_t *vtrack)
+@@ -1276,7 +1284,7 @@ void quicktime_init_codec_dnxhd(quicktim
+         QUICKTIME_DNXHD,
+         "DNXHD",
+         "DNXHD");
+-    result->ffmpeg_id = CODEC_ID_DNXHD;
++    result->ffmpeg_id = AV_CODEC_ID_DNXHD;
+ }
+ 
+ // field based MPEG-4
+@@ -1287,7 +1295,7 @@ void quicktime_init_codec_hv60(quicktime
+ 		"Dual MPEG-4",
+ 		"MPEG 4 with alternating streams every other frame.  (Not standardized)");
+ 	result->total_fields = 2;
+-	result->ffmpeg_id = CODEC_ID_MPEG4;
++	result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+ }
+ 
+ 
+Index: cinelerra-20140710/quicktime/qtffmpeg.c
+===================================================================
+--- cinelerra-20140710.orig/quicktime/qtffmpeg.c
++++ cinelerra-20140710/quicktime/qtffmpeg.c
+@@ -39,7 +39,7 @@ quicktime_ffmpeg_t* quicktime_new_ffmpeg
+ 	ptr->height = h;
+ 	ptr->ffmpeg_id = ffmpeg_id;
+ //printf("quicktime_new_ffmpeg 1 %d\n", ptr->ffmpeg_id);
+-	if(ffmpeg_id == CODEC_ID_SVQ1)
++	if(ffmpeg_id == AV_CODEC_ID_SVQ1)
+ 	{
+ 		ptr->width_i = quicktime_quantize32(ptr->width);
+ 		ptr->height_i = quicktime_quantize32(ptr->height);
+@@ -88,10 +88,10 @@
+ 			context->extradata_size = avcc->data_size;
+ 		}
+ 		if(cpus > 1 && 
+-				(ffmpeg_id == CODEC_ID_MPEG4 ||
+-			         ffmpeg_id == CODEC_ID_MPEG1VIDEO ||
+-			         ffmpeg_id == CODEC_ID_MPEG2VIDEO ||
+-			         ffmpeg_id == CODEC_ID_H263P))
++				(ffmpeg_id == AV_CODEC_ID_MPEG4 ||
++			         ffmpeg_id == AV_CODEC_ID_MPEG1VIDEO ||
++			         ffmpeg_id == AV_CODEC_ID_MPEG2VIDEO ||
++			         ffmpeg_id == AV_CODEC_ID_H263P))
+ 		{
+ 			context->thread_count = cpus;
+ 		}
+@@ -224,16 +224,16 @@ static int get_chroma_factor(quicktime_f
+ {
+ 	switch(ffmpeg->decoder_context[current_field]->pix_fmt)
+ 	{
+-		case PIX_FMT_YUV420P:
++		case AV_PIX_FMT_YUV420P:
+ 			return 4;
+ 			break;
+-		case PIX_FMT_YUYV422:
++		case AV_PIX_FMT_YUYV422:
+ 			return 2;
+ 			break;
+-		case PIX_FMT_YUV422P:
++		case AV_PIX_FMT_YUV422P:
+ 			return 2;
+ 			break;
+-		case PIX_FMT_YUV410P:
++		case AV_PIX_FMT_YUV410P:
+ 			return 9;
+ 			break;
+ 		default:
+@@ -277,7 +277,7 @@ int quicktime_ffmpeg_decode(quicktime_ff
+ //printf("quicktime_ffmpeg_decode 1 %d\n", ffmpeg->last_frame[current_field]);
+ 
+ 		if(ffmpeg->last_frame[current_field] == -1 &&
+-			ffmpeg->ffmpeg_id != CODEC_ID_H264)
++			ffmpeg->ffmpeg_id != AV_CODEC_ID_H264)
+ 		{
+ 			int current_frame = vtrack->current_position;
+ // For certain codecs,
+@@ -328,7 +328,7 @@ int quicktime_ffmpeg_decode(quicktime_ff
+ // For MPEG-4, get another keyframe before first keyframe.
+ // The Sanyo tends to glitch with only 1 keyframe.
+ // Not enough memory.
+-			if( 0 /* frame1 > 0 && ffmpeg->ffmpeg_id == CODEC_ID_MPEG4 */)
++			if( 0 /* frame1 > 0 && ffmpeg->ffmpeg_id == AV_CODEC_ID_MPEG4 */)
+ 			{
+ 				do
+ 				{
+@@ -423,16 +423,16 @@ int quicktime_ffmpeg_decode(quicktime_ff
+ // Hopefully this setting will be left over if the cache was used.
+ 	switch(ffmpeg->decoder_context[current_field]->pix_fmt)
+ 	{
+-		case PIX_FMT_YUV420P:
++		case AV_PIX_FMT_YUV420P:
+ 			input_cmodel = BC_YUV420P;
+ 			break;
+-		case PIX_FMT_YUYV422:
++		case AV_PIX_FMT_YUYV422:
+ 			input_cmodel = BC_YUV422;
+ 			break;
+-		case PIX_FMT_YUV422P:
++		case AV_PIX_FMT_YUV422P:
+ 			input_cmodel = BC_YUV422P;
+ 			break;
+-		case PIX_FMT_YUV410P:
++		case AV_PIX_FMT_YUV410P:
+ 			input_cmodel = BC_YUV9P;
+ 			break;
+ 		default:
+Index: cinelerra-20140710/quicktime/qth264.c
+===================================================================
+--- cinelerra-20140710.orig/quicktime/qth264.c
++++ cinelerra-20140710/quicktime/qth264.c
+@@ -370,7 +370,7 @@ static int decode(quicktime_t *file, uns
+ 	if(!codec->decoder) codec->decoder = quicktime_new_ffmpeg(
+ 		file->cpus,
+ 		codec->total_fields,
+-		CODEC_ID_H264,
++		AV_CODEC_ID_H264,
+ 		width,
+ 		height,
+ 		stsd_table);
+Index: cinelerra-20140710/quicktime/wma.c
+===================================================================
+--- cinelerra-20140710.orig/quicktime/wma.c
++++ cinelerra-20140710/quicktime/wma.c
+@@ -193,15 +193,38 @@ printf("decode 2 %x %llx %llx\n", chunk_
+ 			codec->packet_buffer,
+ 			chunk_size);
+ #else
+-		bytes_decoded = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+ 		AVPacket pkt;
+ 		av_init_packet( &pkt );
+ 		pkt.data = codec->packet_buffer;
+ 		pkt.size = chunk_size;
+-		result = avcodec_decode_audio3(codec->decoder_context,
+-			(int16_t*)(codec->work_buffer + codec->output_size * sample_size),
+-			&bytes_decoded,
++		AVFrame *frame = av_frame_alloc();
++		int got_frame = 0;
++
++		result = avcodec_decode_audio4(codec->decoder_context,
++			frame, &got_frame, 
+ 			&pkt);
++
++		if(result >= 0 && got_frame)
++		{
++			int ch, plane_size;
++			int planar    = av_sample_fmt_is_planar(codec->decoder_context->sample_fmt);
++			int data_size = av_samples_get_buffer_size(&plane_size, codec->decoder_context->channels,
++					frame->nb_samples,
++					codec->decoder_context->sample_fmt, 1);
++			memcpy(codec->work_buffer + codec->output_size * sample_size, frame->extended_data[0], plane_size);
++
++			if (planar && codec->decoder_context->channels > 1) {
++				uint8_t *out = ((uint8_t *)(codec->work_buffer + codec->output_size * sample_size)) + plane_size;
++				for (ch = 1; ch < codec->decoder_context->channels; ch++) {
++					memcpy(out, frame->extended_data[ch], plane_size);
++					out += plane_size;
++				}
++			}
++			bytes_decoded = data_size;
++		} else {
++			bytes_decoded = 0;
++		}
++		av_frame_free(&frame);
+ #endif
+ 
+ 		pthread_mutex_unlock(&ffmpeg_lock);
+@@ -298,7 +321,7 @@ void quicktime_init_codec_wmav1(quicktim
+ 	codec_base->title = "Win Media Audio 1";
+ 	codec_base->desc = "Win Media Audio 1";
+ 	codec_base->wav_id = 0x160;
+-	codec->ffmpeg_id = CODEC_ID_WMAV1;
++	codec->ffmpeg_id = AV_CODEC_ID_WMAV1;
+ }
+ 
+ 
+@@ -313,5 +336,5 @@ void quicktime_init_codec_wmav2(quicktim
+ 	codec_base->title = "Win Media Audio 2";
+ 	codec_base->desc = "Win Media Audio 2";
+ 	codec_base->wav_id = 0x161;
+-	codec->ffmpeg_id = CODEC_ID_WMAV2;
++	codec->ffmpeg_id = AV_CODEC_ID_WMAV2;
+ }
+Index: cinelerra-20140710/cinelerra/fileyuv.C
+===================================================================
+--- cinelerra-20140710.orig/cinelerra/fileyuv.C
++++ cinelerra-20140710/cinelerra/fileyuv.C
+@@ -196,7 +196,7 @@ int FileYUV::write_frames(VFrame ***laye
+ 				return stream->write_frame_raw(frame->get_data(), frame_size);
+ 
+ 			// decode and write an encoded frame
+-			if (FFMPEG::codec_id(incoming_asset->vcodec) != CODEC_ID_NONE) 
++			if (FFMPEG::codec_id(incoming_asset->vcodec) != AV_CODEC_ID_NONE) 
+ 			{
+ 				if (! ffmpeg) 
+ 				{
+@@ -306,7 +306,7 @@ int FileYUV::can_copy_from(Edit *edit, i
+ 	if (edit->asset->format == FILE_YUV) return 1;
+ 
+ 	// if FFMPEG can decode it, we'll accept it
+-	if (FFMPEG::codec_id(edit->asset->vcodec) != CODEC_ID_NONE) return 1;
++	if (FFMPEG::codec_id(edit->asset->vcodec) != AV_CODEC_ID_NONE) return 1;
+ 
+ 	incoming_asset = 0;
+ 

Copied: cinelerra-cv/repos/community-staging-x86_64/cinelerra-cv-ffmpeg4.patch (from rev 370118, cinelerra-cv/trunk/cinelerra-cv-ffmpeg4.patch)
===================================================================
--- community-staging-x86_64/cinelerra-cv-ffmpeg4.patch	                        (rev 0)
+++ community-staging-x86_64/cinelerra-cv-ffmpeg4.patch	2018-08-07 11:33:27 UTC (rev 370119)
@@ -0,0 +1,82 @@
+Index: CinelerraCV-2.3/quicktime/mpeg4.c
+===================================================================
+--- CinelerraCV-2.3.orig/quicktime/mpeg4.c
++++ CinelerraCV-2.3/quicktime/mpeg4.c
+@@ -625,7 +625,6 @@ static int encode(quicktime_t *file, uns
+ 		else
+ // ffmpeg section
+ 		{
+-			static char *video_rc_eq="tex^qComp";
+ 			codec->encode_initialized[current_field] = 1;
+ 			if(!ffmpeg_initialized)
+ 			{
+@@ -650,7 +649,6 @@ static int encode(quicktime_t *file, uns
+ 			context->pix_fmt = AV_PIX_FMT_YUV420P;
+ 			context->bit_rate = codec->bitrate / codec->total_fields;
+ 			context->bit_rate_tolerance = codec->bitrate_tolerance;
+-			context->rc_eq = video_rc_eq;
+         	context->rc_max_rate = 0;
+         	context->rc_min_rate = 0;
+         	context->rc_buffer_size = 0;
+@@ -658,8 +656,6 @@ static int encode(quicktime_t *file, uns
+ 				(!codec->fix_bitrate ? codec->quantizer : 2);
+ 			context->qmax = 
+ 				(!codec->fix_bitrate ? codec->quantizer : 31);
+-			context->lmin = 2 * FF_QP2LAMBDA;
+-			context->lmax = 31 * FF_QP2LAMBDA;
+ 			context->mb_lmin = 2 * FF_QP2LAMBDA;
+ 			context->mb_lmax = 31 * FF_QP2LAMBDA;
+ 			context->max_qdiff = 3;
+@@ -680,8 +676,6 @@ static int encode(quicktime_t *file, uns
+ 			context->frame_skip_cmp = FF_CMP_DCTMAX;
+ 			context->ildct_cmp = FF_CMP_VSAD;
+ 			context->intra_dc_precision = 0;
+-        	context->intra_quant_bias = FF_DEFAULT_QUANT_BIAS;
+-        	context->inter_quant_bias = FF_DEFAULT_QUANT_BIAS;
+         	context->i_quant_factor = -0.8;
+         	context->i_quant_offset = 0.0;
+ 			context->mb_decision = FF_MB_DECISION_SIMPLE;
+@@ -689,17 +683,13 @@ static int encode(quicktime_t *file, uns
+ 			context->me_sub_cmp = FF_CMP_SAD;
+ 			context->me_cmp = FF_CMP_SAD;
+ 			context->me_pre_cmp = FF_CMP_SAD;
+-			context->me_method = ME_EPZS;
+ 			context->me_subpel_quality = 8;
+ 			context->me_penalty_compensation = 256;
+ 			context->me_range = 0;
+-			context->me_threshold = 0;
+-			context->mb_threshold = 0;
+ 			context->nsse_weight= 8;
+         	context->profile= FF_PROFILE_UNKNOWN;
+-			context->rc_buffer_aggressivity = 1.0;
+         	context->level= FF_LEVEL_UNKNOWN;
+-			context->flags |= CODEC_FLAG_AC_PRED;
++			context->flags |= AV_CODEC_FLAG_AC_PRED;
+ 
+ // All the forbidden settings can be extracted from libavcodec/mpegvideo.c of ffmpeg...
+  			
+@@ -709,7 +699,7 @@ static int encode(quicktime_t *file, uns
+ 			   codec->ffmpeg_id == AV_CODEC_ID_H263 ||
+ 			   codec->ffmpeg_id == AV_CODEC_ID_H263P ||
+ 			   codec->ffmpeg_id == AV_CODEC_ID_FLV1)
+-				context->flags |= CODEC_FLAG_4MV;
++				context->flags |= AV_CODEC_FLAG_4MV;
+ // Not compatible with Win
+ //			context->flags |= CODEC_FLAG_QPEL;
+ 
+@@ -723,12 +713,12 @@ static int encode(quicktime_t *file, uns
+ 			}
+ 
+ 			if(!codec->fix_bitrate)
+-				context->flags |= CODEC_FLAG_QSCALE;
++				context->flags |= AV_CODEC_FLAG_QSCALE;
+ 
+ 			if(codec->interlaced)
+ 			{
+-				context->flags |= CODEC_FLAG_INTERLACED_DCT;
+-				context->flags |= CODEC_FLAG_INTERLACED_ME;
++				context->flags |= AV_CODEC_FLAG_INTERLACED_DCT;
++				context->flags |= AV_CODEC_FLAG_INTERLACED_ME;
+ 			}
+ 
+ 

Copied: cinelerra-cv/repos/community-staging-x86_64/ffmpeg-link.patch (from rev 370118, cinelerra-cv/trunk/ffmpeg-link.patch)
===================================================================
--- community-staging-x86_64/ffmpeg-link.patch	                        (rev 0)
+++ community-staging-x86_64/ffmpeg-link.patch	2018-08-07 11:33:27 UTC (rev 370119)
@@ -0,0 +1,24 @@
+--- configure.ac
++++ configure.ac
+@@ -497,7 +497,7 @@
+ AC_ARG_WITH([external-ffmpeg], AC_HELP_STRING([--with-external-ffmpeg], [use external ffmpeg library]))
+ 
+ if test "x$with_external_ffmpeg" = "xyes"; then
+-     PKG_CHECK_MODULES([FFMPEG_TEMP], [libavcodec libpostproc])
++     PKG_CHECK_MODULES([FFMPEG_TEMP], [libavcodec libpostproc libavutil])
+      FFMPEG_FOLDER=""
+      FFMPEG_EXTERNALTEXT="External ffmpeg"
+ 		   
+@@ -515,10 +515,10 @@
+      AC_MSG_RESULT($enable_ffmpeg_swscale)
+      if test x"$enable_ffmpeg_swscale" = xyes; then
+ 	     dnl AC_DEFINE(HAVE_SWSCALER)
+-	     PKG_CHECK_MODULES([FFMPEG], [libavcodec libpostproc libswscale])
++	     PKG_CHECK_MODULES([FFMPEG], [libavcodec libpostproc libswscale libavutil])
+ 	     FFMPEG_CFLAGS="$FFMPEG_CFLAGS -I/usr/include/libavcodec -I/usr/include/libswscale -DHAVE_SWSCALER"
+      else
+-	     PKG_CHECK_MODULES([FFMPEG], [libavcodec libpostproc])
++	     PKG_CHECK_MODULES([FFMPEG], [libavcodec libpostproc libavutil])
+      fi
+      FFMPEG_EXTERNALTEXT="External ffmpeg"
+ else

Copied: cinelerra-cv/repos/community-staging-x86_64/ffmpeg2.0.patch (from rev 370118, cinelerra-cv/trunk/ffmpeg2.0.patch)
===================================================================
--- community-staging-x86_64/ffmpeg2.0.patch	                        (rev 0)
+++ community-staging-x86_64/ffmpeg2.0.patch	2018-08-07 11:33:27 UTC (rev 370119)
@@ -0,0 +1,98 @@
+diff --git a/cinelerra/ffmpeg.C b/cinelerra/ffmpeg.C
+index 6ab6047..f1cd308 100644
+--- a/cinelerra/ffmpeg.C
++++ b/cinelerra/ffmpeg.C
+@@ -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");
+ 	}
+ 
+diff --git a/cinelerra/fileac3.C b/cinelerra/fileac3.C
+index a1ef61e..383f377 100644
+--- a/cinelerra/fileac3.C
++++ b/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;
+diff --git a/quicktime/mpeg4.c b/quicktime/mpeg4.c
+index 81cb72b..02c4a92 100644
+--- a/quicktime/mpeg4.c
++++ b/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]);
+ 
+diff --git a/quicktime/qtffmpeg.c b/quicktime/qtffmpeg.c
+index 8c532c2..4f0bacb 100644
+--- a/quicktime/qtffmpeg.c
++++ b/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);
+diff --git a/quicktime/wma.c b/quicktime/wma.c
+index c045741..6a6588b 100644
+--- a/quicktime/wma.c
++++ b/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;

Copied: cinelerra-cv/repos/community-staging-x86_64/ffmpeg_api.patch (from rev 370118, cinelerra-cv/trunk/ffmpeg_api.patch)
===================================================================
--- community-staging-x86_64/ffmpeg_api.patch	                        (rev 0)
+++ community-staging-x86_64/ffmpeg_api.patch	2018-08-07 11:33:27 UTC (rev 370119)
@@ -0,0 +1,163 @@
+diff --git a/cinelerra/ffmpeg.C b/cinelerra/ffmpeg.C
+index 6ab6047..7cde503 100644
+--- a/cinelerra/ffmpeg.C
++++ b/cinelerra/ffmpeg.C
+@@ -23,7 +23,6 @@ FFMPEG::FFMPEG(Asset *asset) {
+ 
+ int FFMPEG::init(char *codec_string) {
+ 
+-	avcodec_init();
+ 	avcodec_register_all();
+ 
+ 	CodecID id = codec_id(codec_string);
+@@ -364,12 +363,15 @@ int FFMPEG::decode(uint8_t *data, long data_size, VFrame *frame_out) {
+ 
+ 	// NOTE: frame must already have data space allocated
+ 	
++	AVPacket pkt;
+ 	got_picture = 0;
+-	int length = avcodec_decode_video(context,
++	av_init_packet( &pkt );
++	pkt.data = data;
++	pkt.size = data_size;
++	int length = avcodec_decode_video2(context,
+ 					  picture,
+ 					  &got_picture,
+-					  data,
+-					  data_size);
++					  &pkt);
+ 	
+ 	if (length < 0) {
+ 		printf("FFMPEG::decode error decoding frame\n");
+diff --git a/cinelerra/fileac3.C b/cinelerra/fileac3.C
+index a1ef61e..e56705f 100644
+--- a/cinelerra/fileac3.C
++++ b/cinelerra/fileac3.C
+@@ -84,7 +84,6 @@ int FileAC3::open_file(int rd, int wr)
+ 
+ 	if(wr)
+ 	{
+-  		avcodec_init();
+ 		avcodec_register_all();
+ 		codec = avcodec_find_encoder(CODEC_ID_AC3);
+ 		if(!codec)
+diff --git a/quicktime/mpeg4.c b/quicktime/mpeg4.c
+index 81cb72b..67bcab8 100644
+--- a/quicktime/mpeg4.c
++++ b/quicktime/mpeg4.c
+@@ -629,7 +629,6 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track)
+ 			if(!ffmpeg_initialized)
+ 			{
+ 				ffmpeg_initialized = 1;
+-  				avcodec_init();
+ 				avcodec_register_all();
+ 			}
+ 
+@@ -674,7 +673,7 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track)
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+ 			context->error_resilience = FF_ER_CAREFUL;
+ #else
+-			context->error_recognition = FF_ER_CAREFUL;
++			context->err_recognition = AV_EF_CRCCHECK;
+ #endif
+ 			context->error_concealment = 3;
+ 			context->frame_skip_cmp = FF_CMP_DCTMAX;
+@@ -699,7 +698,6 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track)
+         	context->profile= FF_PROFILE_UNKNOWN;
+ 			context->rc_buffer_aggressivity = 1.0;
+         	context->level= FF_LEVEL_UNKNOWN;
+-			context->flags |= CODEC_FLAG_H263P_UMV;
+ 			context->flags |= CODEC_FLAG_AC_PRED;
+ 
+ // All the forbidden settings can be extracted from libavcodec/mpegvideo.c of ffmpeg...
+@@ -717,10 +715,8 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track)
+ 				(codec->ffmpeg_id == CODEC_ID_MPEG4 ||
+ 			         codec->ffmpeg_id == CODEC_ID_MPEG1VIDEO ||
+ 			         codec->ffmpeg_id == CODEC_ID_MPEG2VIDEO ||
+-			         codec->ffmpeg_id == CODEC_ID_H263P || 
+-			         codec->ffmpeg_id == CODEC_FLAG_H263P_SLICE_STRUCT))
++			         codec->ffmpeg_id == CODEC_ID_H263P))
+ 			{
+-				avcodec_thread_init(context, file->cpus);
+ 				context->thread_count = file->cpus;
+ 			}
+ 
+diff --git a/quicktime/qtffmpeg.c b/quicktime/qtffmpeg.c
+index 8c532c2..a2b51e9 100644
+--- a/quicktime/qtffmpeg.c
++++ b/quicktime/qtffmpeg.c
+@@ -54,7 +54,6 @@ quicktime_ffmpeg_t* quicktime_new_ffmpeg(int cpus,
+ 	if(!ffmpeg_initialized)
+ 	{
+ 		ffmpeg_initialized = 1;
+-  		avcodec_init();
+ 		avcodec_register_all();
+ 	}
+ 
+@@ -90,10 +89,8 @@ quicktime_ffmpeg_t* quicktime_new_ffmpeg(int cpus,
+ 				(ffmpeg_id == CODEC_ID_MPEG4 ||
+ 			         ffmpeg_id == CODEC_ID_MPEG1VIDEO ||
+ 			         ffmpeg_id == CODEC_ID_MPEG2VIDEO ||
+-			         ffmpeg_id == CODEC_ID_H263P || 
+-			         ffmpeg_id == CODEC_FLAG_H263P_SLICE_STRUCT))
++			         ffmpeg_id == CODEC_ID_H263P))
+ 		{
+-			avcodec_thread_init(context, cpus);
+ 			context->thread_count = cpus;
+ 		}
+ 		if(avcodec_open(context, 
+@@ -181,6 +178,7 @@ static int decode_wrapper(quicktime_t *file,
+  
+ 	if(!result) 
+ 	{ 
++		AVPacket pkt;
+ 
+ 
+ // No way to determine if there was an error based on nonzero status.
+@@ -189,11 +187,13 @@ static int decode_wrapper(quicktime_t *file,
+ 			ffmpeg->decoder_context[current_field]->skip_frame = AVDISCARD_NONREF /* AVDISCARD_BIDIR */;
+ 		else
+ 			ffmpeg->decoder_context[current_field]->skip_frame = AVDISCARD_DEFAULT;
+-		result = avcodec_decode_video(ffmpeg->decoder_context[current_field], 
++		av_init_packet( &pkt );
++		pkt.data = ffmpeg->work_buffer;
++		pkt.size = bytes + header_bytes;
++		result = avcodec_decode_video2(ffmpeg->decoder_context[current_field], 
+ 			&ffmpeg->picture[current_field], 
+ 			&got_picture, 
+-			ffmpeg->work_buffer, 
+-			bytes + header_bytes);
++			&pkt);
+ 
+ 
+ 
+diff --git a/quicktime/wma.c b/quicktime/wma.c
+index c045741..abc2dc8 100644
+--- a/quicktime/wma.c
++++ b/quicktime/wma.c
+@@ -67,7 +67,6 @@ static int init_decode(quicktime_audio_map_t *track_map,
+ 		if(!ffmpeg_initialized)
+ 		{
+ 			ffmpeg_initialized = 1;
+-			avcodec_init();
+ 			avcodec_register_all();
+ 		}
+ 
+@@ -195,11 +194,14 @@ printf("decode 2 %x %llx %llx\n", chunk_size, chunk_offset, chunk_offset + chunk
+ 			chunk_size);
+ #else
+ 		bytes_decoded = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+-		result = avcodec_decode_audio2(codec->decoder_context,
++		AVPacket pkt;
++		av_init_packet( &pkt );
++		pkt.data = codec->packet_buffer;
++		pkt.size = chunk_size;
++		result = avcodec_decode_audio3(codec->decoder_context,
+ 			(int16_t*)(codec->work_buffer + codec->output_size * sample_size),
+ 			&bytes_decoded,
+-			codec->packet_buffer,
+-			chunk_size);
++			&pkt);
+ #endif
+ 
+ 		pthread_mutex_unlock(&ffmpeg_lock);

Copied: cinelerra-cv/repos/community-staging-x86_64/gcc5fix.patch (from rev 370118, cinelerra-cv/trunk/gcc5fix.patch)
===================================================================
--- community-staging-x86_64/gcc5fix.patch	                        (rev 0)
+++ community-staging-x86_64/gcc5fix.patch	2018-08-07 11:33:27 UTC (rev 370119)
@@ -0,0 +1,33 @@
+From e534e852308abaa667c2579bc0025b0c89689b6f Mon Sep 17 00:00:00 2001
+From: Rashif Rahman (Ray) <schiv at archlinux.org>
+Date: Wed, 10 Jun 2015 02:06:36 +0000
+Subject: [PATCH] GCC 5.x inline function semantics fix
+
+The compiler will warn and the linker will fail if an inline
+function is declared but not defined in the same translation
+unit. This fixes the problem by prepending 'extern' to the
+declaration in the header file.
+
+For a proper explanation see:
+https://gcc.gnu.org/gcc-5/porting_to.html
+
+---
+ toolame-02l/bitstream.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/toolame-02l/bitstream.h b/toolame-02l/bitstream.h
+index 66f8ae4..db67ac5 100644
+--- a/toolame-02l/bitstream.h
++++ b/toolame-02l/bitstream.h
+@@ -9,7 +9,7 @@ unsigned int get1bit (Bit_stream_struc *);
+ void put1bit (Bit_stream_struc *, int);
+ unsigned long look_ahead (Bit_stream_struc *, int);
+ unsigned long getbits (Bit_stream_struc *, int);
+-INLINE void putbits (Bit_stream_struc *, unsigned int, int);
++extern INLINE void putbits (Bit_stream_struc *, unsigned int, int);
+ void byte_ali_putbits (Bit_stream_struc *, unsigned int, int);
+ unsigned long byte_ali_getbits (Bit_stream_struc *, int);
+ unsigned long sstell (Bit_stream_struc *);
+--
+2.4.2
+

Copied: cinelerra-cv/repos/community-staging-x86_64/v4l1_removal.patch (from rev 370118, cinelerra-cv/trunk/v4l1_removal.patch)
===================================================================
--- community-staging-x86_64/v4l1_removal.patch	                        (rev 0)
+++ community-staging-x86_64/v4l1_removal.patch	2018-08-07 11:33:27 UTC (rev 370119)
@@ -0,0 +1,125 @@
+http://bugs.cinelerra.org/ticket/949
+https://bugs.gentoo.org/show_bug.cgi?id=361709
+
+diff -Nru cinelerra.orig//cinelerra/channelpicker.C cinelerra/cinelerra/channelpicker.C
+--- cinelerra.orig//cinelerra/channelpicker.C	2010-11-24 18:18:03.000000000 -0500
++++ cinelerra/cinelerra/channelpicker.C	2011-02-17 13:31:30.147880002 -0500
+@@ -39,7 +39,7 @@
+ #include "recordgui.h"
+ #include "recordmonitor.h"
+ #include "theme.h"
+-#include "vdevicebuz.h"
++//#include "vdevicebuz.h"
+ #include "vdeviceprefs.h"
+ #include "videodevice.h"
+ 
+@@ -280,7 +280,7 @@
+ //	printf("PrefsChannelPicker::PrefsChannelPicker 1\n");
+ 	this->mwindow = mwindow;
+ 	this->prefs = prefs;
+-	VDeviceBUZ::get_inputs(&input_sources);
++//	VDeviceBUZ::get_inputs(&input_sources);
+ }
+ 
+ PrefsChannelPicker::~PrefsChannelPicker()
+diff -Nru cinelerra.orig//cinelerra/Makefile.am cinelerra/cinelerra/Makefile.am
+--- cinelerra.orig//cinelerra/Makefile.am	2010-11-24 18:18:03.000000000 -0500
++++ cinelerra/cinelerra/Makefile.am	2011-02-17 13:31:30.147880002 -0500
+@@ -305,10 +305,8 @@
+ 		    vattachmentpoint.C \
+ 		    vautomation.C \
+ 		    vdevicebase.C \
+-		    vdevicebuz.C \
+ 		    vdevicedvb.C \
+ 		    vdeviceprefs.C \
+-		    vdevicev4l.C \
+ 		    vdevicev4l2.C \
+ 		    vdevicev4l2jpeg.C \
+ 		    vdevicex11.C \
+diff -Nru cinelerra.orig//cinelerra/reversemake cinelerra/cinelerra/reversemake
+--- cinelerra.orig//cinelerra/reversemake	2010-11-24 18:18:03.000000000 -0500
++++ cinelerra/cinelerra/reversemake	2011-02-17 13:31:30.151880002 -0500
+@@ -32,10 +32,8 @@
+ make $OBJDIR/vedits.o
+ make $OBJDIR/vedit.o
+ make $OBJDIR/vdevicex11.o
+-make $OBJDIR/vdevicev4l.o
+ make $OBJDIR/vdeviceprefs.o
+ make $OBJDIR/vdevicelml.o
+-make $OBJDIR/vdevicebuz.o
+ make $OBJDIR/vdevicebase.o
+ make $OBJDIR/vdevice1394.o
+ make $OBJDIR/vautomation.o
+diff -Nru cinelerra.orig//cinelerra/videodevice.C cinelerra/cinelerra/videodevice.C
+--- cinelerra.orig//cinelerra/videodevice.C	2010-11-24 18:18:03.000000000 -0500
++++ cinelerra/cinelerra/videodevice.C	2011-02-17 13:41:53.239880001 -0500
+@@ -39,9 +39,9 @@
+ #ifdef HAVE_FIREWIRE
+ #include "vdevice1394.h"
+ #endif
+-#include "vdevicebuz.h"
++//#include "vdevicebuz.h"
+ #include "vdevicedvb.h"
+-#include "vdevicev4l.h"
++//#include "vdevicev4l.h"
+ #include "vdevicev4l2.h"
+ #include "vdevicev4l2jpeg.h"
+ #include "vdevicex11.h"
+@@ -203,7 +203,6 @@
+ 			result = input_base->open_input();
+ 			break;
+ 
+-
+ #ifdef HAVE_VIDEO4LINUX2
+ 		case VIDEO4LINUX2:
+ 			new_device_base();
+@@ -250,8 +249,8 @@
+ {
+ 	switch(in_config->driver)
+ 	{
+-		case VIDEO4LINUX:
+-			return input_base = new VDeviceV4L(this);
++		//case VIDEO4LINUX:
++		//	return input_base = new VDeviceV4L(this);
+ 
+ #ifdef HAVE_VIDEO4LINUX2
+ 		case VIDEO4LINUX2:
+@@ -264,8 +263,8 @@
+ 		case SCREENCAPTURE:
+ 			return input_base = new VDeviceX11(this, 0);
+ 
+-		case CAPTURE_BUZ:
+-			return input_base = new VDeviceBUZ(this);
++		//case CAPTURE_BUZ:
++		//	return input_base = new VDeviceBUZ(this);
+ 
+ #ifdef HAVE_FIREWIRE
+ 		case CAPTURE_FIREWIRE:
+@@ -662,9 +661,9 @@
+ //printf("VideoDevice::open_output 1 %d\n", out_config->driver);
+ 	switch(out_config->driver)
+ 	{
+-		case PLAYBACK_BUZ:
+-			output_base = new VDeviceBUZ(this);
+-			break;
++		//case PLAYBACK_BUZ:
++		//	output_base = new VDeviceBUZ(this);
++		//	break;
+ 		case PLAYBACK_X11:
+ 		case PLAYBACK_X11_XV:
+ 		case PLAYBACK_X11_GL:
+diff -Nru cinelerra.orig//cinelerra/videodevice.h cinelerra/cinelerra/videodevice.h
+--- cinelerra.orig//cinelerra/videodevice.h	2010-11-24 18:18:03.000000000 -0500
++++ cinelerra/cinelerra/videodevice.h	2011-02-17 13:31:30.167880002 -0500
+@@ -40,9 +40,9 @@
+ #include "thread.h"
+ #include "picture.inc"
+ #include "vdevicebase.inc"
+-#include "vdevicebuz.inc"
++//#include "vdevicebuz.inc"
+ #include "vdevicelml.inc"
+-#include "vdevicev4l.inc"
++//#include "vdevicev4l.inc"
+ #include "vdevicex11.inc"
+ #include "videoconfig.inc"
+ #include "videowindow.inc"



More information about the arch-commits mailing list