probably not very complete (mjpegtools had their own problems) but should
give you some idea where I am

patch 0001 still not fixed.. (as in, it reintroduced ff->video_probe and
this one still leaks..)

configured with

 $ ./configure  --without-lv2 --without-vdpau --without-vaapi
--without-firewire --without-nv --without-shuttle --without-shuttle_usb
--with-single-user --without-libzmpeg --with-clang --with-booby
--without-dv --without-dvb --without-video4linux2 --disable-dav1d
From c7721ddf60656abd40e1128c762296aeaf7f976f Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Sat, 15 May 2021 17:10:22 +0300
Subject: [PATCH 01/17] constify fileffmpeg.C

---
 cinelerra-5.1/cinelerra/fileffmpeg.C | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/cinelerra-5.1/cinelerra/fileffmpeg.C b/cinelerra-5.1/cinelerra/fileffmpeg.C
index a71d692a..853e5839 100644
--- a/cinelerra-5.1/cinelerra/fileffmpeg.C
+++ b/cinelerra-5.1/cinelerra/fileffmpeg.C
@@ -159,7 +159,7 @@ void FFMpegPixelFormat::update_formats()
 	pixfmts.remove_all_objects();
 	char video_codec[BCSTRLEN]; video_codec[0] = 0;
 	const char *vcodec = vid_config->asset->vcodec;
-	AVCodec *av_codec = !FFMPEG::get_codec(video_codec, "video", vcodec) ?
+	const AVCodec *av_codec = !FFMPEG::get_codec(video_codec, "video", vcodec) ?
 		avcodec_find_encoder_by_name(video_codec) : 0;
 	const AVPixelFormat *pix_fmts = av_codec ? av_codec->pix_fmts : 0;
 	if( pix_fmts ) {
@@ -190,7 +190,7 @@ void FFMpegSampleFormat::update_formats()
 	samplefmts.remove_all_objects();
 	char audio_codec[BCSTRLEN]; audio_codec[0] = 0;
 	const char *acodec = aud_config->asset->acodec;
-	AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", acodec) ?
+	const AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", acodec) ?
 		avcodec_find_encoder_by_name(audio_codec) : 0;
 	const AVSampleFormat *sample_fmts = av_codec ? av_codec->sample_fmts : 0;
 	if( sample_fmts ) {
@@ -345,7 +345,7 @@ int FileFFMPEG::open_file(int rd, int wr)
 				asset->aspect_ratio = ff->ff_aspect_ratio(0);
 				if (!asset->interlace_mode) asset->interlace_mode = ff->ff_interlace(0);
 				if ( ff->ff_video_frames(0) > 1 ) {
-//				ff->video_probe(1);
+				ff->video_probe(1);
 				 if (!asset->interlace_mode && (ff->interlace_from_codec) ) asset->interlace_mode = ff->video_probe(1); 
 				}
 				if( !asset->layers ) asset->layers = video_layers;
@@ -1844,7 +1844,7 @@ int FFOptionsViewAudio::handle_event()
 	const char *name = asset->acodec;
 	char audio_format[BCSTRLEN];  audio_format[0] = 0;
 	char audio_codec[BCSTRLEN];   audio_codec[0] = 0;
-	AVCodec *codec = !ret &&
+	const AVCodec *codec = !ret &&
 	    !FFMPEG::get_format(audio_format, "audio", name) &&
 	    !FFMPEG::get_codec(audio_codec, "audio", name) ?
 		avcodec_find_encoder_by_name(audio_codec) : 0;
@@ -1882,7 +1882,7 @@ int FFOptionsViewVideo::handle_event()
 	const char *name = asset->vcodec;
 	char video_format[BCSTRLEN];  video_format[0] = 0;
 	char video_codec[BCSTRLEN];   video_codec[0] = 0;
-	AVCodec *codec = !ret &&
+	const AVCodec *codec = !ret &&
 	    !FFMPEG::get_format(video_format, "video", name) &&
 	    !FFMPEG::get_codec(video_codec, "video", name) ?
 		avcodec_find_encoder_by_name(video_codec) : 0;
-- 
2.31.1

From 794d3a552090aca0aab92834635afc6cb4329568 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Sat, 15 May 2021 20:14:27 +0300
Subject: [PATCH 03/17] TERMUX ifdefs in guicast

---
 cinelerra-5.1/guicast/Makefile     |  7 +++++++
 cinelerra-5.1/guicast/bthread.h    | 31 ++++++++++++++++++++++++++++++
 cinelerra-5.1/guicast/filesystem.C |  3 ++-
 cinelerra-5.1/guicast/thread.C     |  5 +++++
 cinelerra-5.1/guicast/thread.h     |  4 +++-
 cinelerra-5.1/guicast/vframe.C     | 10 +++++-----
 cinelerra-5.1/guicast/vframe.h     |  3 ++-
 7 files changed, 55 insertions(+), 8 deletions(-)
 create mode 100644 cinelerra-5.1/guicast/bthread.h

diff --git a/cinelerra-5.1/guicast/Makefile b/cinelerra-5.1/guicast/Makefile
index cf189dea..fc086f92 100644
--- a/cinelerra-5.1/guicast/Makefile
+++ b/cinelerra-5.1/guicast/Makefile
@@ -12,6 +12,11 @@ ifeq ($(OBJDIR), amd64)
 BOOTSTRAPFLAGS := -DBOOTSTRAP="\"objcopy -B i386 -I binary -O elf64-x86-64\""
 endif
 
+ifeq ($(OBJDIR), armv8l)
+BOOTSTRAPFLAGS := -DBOOTSTRAP="\"objcopy -B arm -I binary -O elf32-littlearm\""
+endif
+
+
 $(shell mkdir -p $(OBJDIR) )
 
 OBJS = \
@@ -83,6 +88,7 @@ OBJS = \
 	$(OBJDIR)/vicon.o \
 	$(OBJDIR)/workarounds.o
 
+
 OUTPUT = $(OBJDIR)/libguicast.a
 
 UTILS = $(OBJDIR)/bootstrap $(OBJDIR)/pngtoh $(OBJDIR)/pngtoraw
@@ -90,6 +96,7 @@ BCXFER = xfer/$(OBJDIR)/xfer.stamp
 
 CFLAGS += $(static_incs)
 
+
 $(shell echo $(CFLAGS) > $(OBJDIR)/c_flags)
 $(shell echo $(OBJS) > $(OBJDIR)/objs)
 
diff --git a/cinelerra-5.1/guicast/bthread.h b/cinelerra-5.1/guicast/bthread.h
new file mode 100644
index 00000000..57a0c492
--- /dev/null
+++ b/cinelerra-5.1/guicast/bthread.h
@@ -0,0 +1,31 @@
+/* BThread main header
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+# define PTHREAD_CANCEL_ENABLE    	 0x00000010
+# define PTHREAD_CANCEL_DISABLE   	 0x00000000
+
+# define PTHREAD_CANCEL_ASYNCHRONOUS 0x00000020
+# define PTHREAD_CANCEL_DEFERRED     0x00000000
+
+#define PTHREAD_CANCELED ((void *) -1)
+
+int pthread_setcancelstate (int , int *);
+int pthread_setcanceltype (int , int *);
+void pthread_testcancel (void);
+int pthread_cancel (pthread_t t);
diff --git a/cinelerra-5.1/guicast/filesystem.C b/cinelerra-5.1/guicast/filesystem.C
index 6017f6ea..b1ace6fd 100644
--- a/cinelerra-5.1/guicast/filesystem.C
+++ b/cinelerra-5.1/guicast/filesystem.C
@@ -536,7 +536,7 @@ int FileSystem::parse_tildas(char *new_dir)
 				new_user[j] = new_dir[i];
 			}
 			new_user[j] = 0;
-
+#if !defined(__TERMUX__)
 			setpwent();
 			while( (pw = getpwent()) != 0 )
 			{
@@ -550,6 +550,7 @@ int FileSystem::parse_tildas(char *new_dir)
       			}
 			}
 			endpwent();
+#endif
 			return 0;
 		}
 	}
diff --git a/cinelerra-5.1/guicast/thread.C b/cinelerra-5.1/guicast/thread.C
index 50b52a47..9908a628 100644
--- a/cinelerra-5.1/guicast/thread.C
+++ b/cinelerra-5.1/guicast/thread.C
@@ -28,6 +28,9 @@
 #include <string.h>
 #include <typeinfo>
 #include "thread.h"
+#if defined(__TERMUX__)
+#include "bthread.h"
+#endif
 
 
 Thread::Thread(int synchronous, int realtime, int autodelete)
@@ -102,8 +105,10 @@ void Thread::start()
 			perror("Thread::start pthread_attr_setschedparam");
 	}
 	else {
+#if !defined(__TERMUX__)
 		if(pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED) < 0)
 			perror("Thread::start pthread_attr_setinheritsched");
+#endif
 	}
 
 // autodelete may delete this immediately after create
diff --git a/cinelerra-5.1/guicast/thread.h b/cinelerra-5.1/guicast/thread.h
index 79f3e713..e701a8f4 100644
--- a/cinelerra-5.1/guicast/thread.h
+++ b/cinelerra-5.1/guicast/thread.h
@@ -29,13 +29,15 @@
 #ifndef NO_TID
 #include <sys/syscall.h>
 
+#if !defined(__TERMUX__)
 // glibc >= 2.30 provides gettid() in unistd
 #if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 30)
 static inline int gettid() { return syscall(SYS_gettid, 0, 0, 0); }
-#endif
 #else
 static inline long gettid() { return (long)pthread_self(); }
 #endif
+#endif // TERMUX
+#endif //no_tid
 
 // The thread does not autodelete by default.
 // If autodelete is 1 the thread autodeletes.
diff --git a/cinelerra-5.1/guicast/vframe.C b/cinelerra-5.1/guicast/vframe.C
index af0e52a8..44d7f97e 100644
--- a/cinelerra-5.1/guicast/vframe.C
+++ b/cinelerra-5.1/guicast/vframe.C
@@ -334,7 +334,7 @@ if( memory_type != VFrame::SHARED )
 			shmid = -1;
 			break;
 
-		case VFrame::SHMGET:
+		case VFrame::SHM_GET:
 			if(data)
 				shmdt(data);
 			data = 0;
@@ -510,7 +510,7 @@ int VFrame::allocate_data(unsigned char *data, int shmid,
 		this->v_offset = v_offset;
 	}
 	else if( shmid >= 0 ) {
-		memory_type = VFrame::SHMGET;
+		memory_type = VFrame::SHM_GET;
 		this->data = (unsigned char*)shmat(shmid, NULL, 0);
 		if( this->data == (unsigned char*)-1 ) {
 			printf("VFrame::allocate_data %d could not attach"
@@ -593,7 +593,7 @@ void VFrame::set_memory(unsigned char *data,
 	else
 	if(shmid >= 0)
 	{
-		memory_type = VFrame::SHMGET;
+		memory_type = VFrame::SHM_GET;
 		this->data = (unsigned char*)shmat(shmid, NULL, 0);
 		this->shmid = shmid;
 	}
@@ -635,7 +635,7 @@ void VFrame::set_compressed_memory(unsigned char *data,
 	else
 	if(shmid >= 0)
 	{
-		memory_type = VFrame::SHMGET;
+		memory_type = VFrame::SHM_GET;
 		this->data = (unsigned char*)shmat(shmid, NULL, 0);
 		this->shmid = shmid;
 	}
@@ -713,7 +713,7 @@ UNBUFFER(data);
 			else
 				free(data);
 		}
-		else if( memory_type == VFrame::SHMGET ) {
+		else if( memory_type == VFrame::SHM_GET ) {
 			if( data ) shmdt(data);
 		}
 
diff --git a/cinelerra-5.1/guicast/vframe.h b/cinelerra-5.1/guicast/vframe.h
index 589fce1c..55590bda 100644
--- a/cinelerra-5.1/guicast/vframe.h
+++ b/cinelerra-5.1/guicast/vframe.h
@@ -31,6 +31,7 @@
 #include "bccmodels.h"
 #include "vframe.inc"
 
+
 // Maximum number of prev or next effects to be pushed onto the stacks.
 #define MAX_STACK_ELEMENTS 255
 #define SHM_MIN_SIZE 2048
@@ -417,7 +418,7 @@ private:
 	{
 		PRIVATE,
 		SHARED,
-		SHMGET
+		SHM_GET
 	};
 
 // Data pointer is pointing to someone else's buffer.
-- 
2.31.1

From 9dbb2ac0d94e8a13f6c4c01f42045db3035b05e4 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Sat, 15 May 2021 18:00:21 +0300
Subject: [PATCH 02/17] ifdef for DV

---
 cinelerra-5.1/cinelerra/ffmpeg.C | 2 ++
 cinelerra-5.1/cinelerra/record.C | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index df39763c..55fa668e 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -29,7 +29,9 @@
 #include "ffmpeg.h"
 #include "indexfile.h"
 #include "interlacemodes.h"
+#ifdef HAVE_DV
 #include "libdv.h"
+#endif
 #include "libmjpeg.h"
 #include "mainerror.h"
 #include "mwindow.h"
diff --git a/cinelerra-5.1/cinelerra/record.C b/cinelerra-5.1/cinelerra/record.C
index ad293f7b..f42fe9e1 100644
--- a/cinelerra-5.1/cinelerra/record.C
+++ b/cinelerra-5.1/cinelerra/record.C
@@ -46,7 +46,9 @@
 #include "keys.h"
 #include "language.h"
 #include "localsession.h"
+#ifdef HAVE_DV
 #include "libdv.h"
+#endif
 #include "libmjpeg.h"
 #include "libzmpeg3.h"
 #include "mainmenu.h"
@@ -215,10 +217,12 @@ int Record::load_defaults()
 	case VIDEO4LINUX2JPEG:
 		vcodec = CODEC_TAG_MJPEG;
 		break;
+#ifdef HAVE_DV
 	case CAPTURE_FIREWIRE:
 	case CAPTURE_IEC61883:
 		vcodec = CODEC_TAG_DVSD;
 		break;
+#endif
 	}
 	if( vcodec )
 		strcpy(default_asset->vcodec, vcodec);
-- 
2.31.1

From 4ead9a1bd5b84aadc0805975b3daa5fe2fd83495 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Sat, 15 May 2021 20:27:37 +0300
Subject: [PATCH 04/17] libzmpeg TERMUX ifdefs

---
 cinelerra-5.1/libzmpeg3/bthread.h   | 31 +++++++++++++++++++++++++++++
 cinelerra-5.1/libzmpeg3/libzmpeg3.h |  2 ++
 cinelerra-5.1/libzmpeg3/zio.C       |  3 +++
 3 files changed, 36 insertions(+)
 create mode 100644 cinelerra-5.1/libzmpeg3/bthread.h

diff --git a/cinelerra-5.1/libzmpeg3/bthread.h b/cinelerra-5.1/libzmpeg3/bthread.h
new file mode 100644
index 00000000..57a0c492
--- /dev/null
+++ b/cinelerra-5.1/libzmpeg3/bthread.h
@@ -0,0 +1,31 @@
+/* BThread main header
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+# define PTHREAD_CANCEL_ENABLE    	 0x00000010
+# define PTHREAD_CANCEL_DISABLE   	 0x00000000
+
+# define PTHREAD_CANCEL_ASYNCHRONOUS 0x00000020
+# define PTHREAD_CANCEL_DEFERRED     0x00000000
+
+#define PTHREAD_CANCELED ((void *) -1)
+
+int pthread_setcancelstate (int , int *);
+int pthread_setcanceltype (int , int *);
+void pthread_testcancel (void);
+int pthread_cancel (pthread_t t);
diff --git a/cinelerra-5.1/libzmpeg3/libzmpeg3.h b/cinelerra-5.1/libzmpeg3/libzmpeg3.h
index 430ebb4d..8993aed4 100644
--- a/cinelerra-5.1/libzmpeg3/libzmpeg3.h
+++ b/cinelerra-5.1/libzmpeg3/libzmpeg3.h
@@ -5,7 +5,9 @@
 /* for quicktime build */
 #define MAXFRAMESAMPLES 65536
 #define ZDVB
+#if defined(__i386__) || defined(__x86-64__)
 #define USE_FUTEX
+#endif
 
 #ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS
diff --git a/cinelerra-5.1/libzmpeg3/zio.C b/cinelerra-5.1/libzmpeg3/zio.C
index cb6ce15d..2f6f6c58 100644
--- a/cinelerra-5.1/libzmpeg3/zio.C
+++ b/cinelerra-5.1/libzmpeg3/zio.C
@@ -1,4 +1,7 @@
 #include "libzmpeg3.h"
+#if defined(__TERMUX__)
+#include "bthread.h"
+#endif
 
 #ifdef USE_FUTEX
 typedef zmpeg3_t::zloc_t zzloc_t;
-- 
2.31.1

From 3b6a576bc6a02d064b2746659808777938909fe2 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Sat, 15 May 2021 21:14:35 +0300
Subject: [PATCH 06/17] more ifdefs for file.C (ac3 demand libzmpeg)

---
 cinelerra-5.1/cinelerra/file.C | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C
index 9828d6ec..b8a5ed3d 100644
--- a/cinelerra-5.1/cinelerra/file.C
+++ b/cinelerra-5.1/cinelerra/file.C
@@ -173,10 +173,12 @@ int File::get_options(FormatTools *format,
 	format_completion->lock("File::get_options");
 	switch( asset->format ) {
 #ifdef HAVE_CIN_3RDPARTY
+#ifdef HAVE_LIBZMPEG
 	case FILE_AC3: FileAC3::get_parameters(parent_window, asset, format_window,
 			audio_options, video_options, edl);
 		break;
 #endif
+#endif
 #ifdef HAVE_DV
 	case FILE_RAWDV:
 		FileDV::get_parameters(parent_window, asset, format_window,
@@ -542,9 +544,11 @@ int File::open_file(Preferences *preferences,
 		break; }
 // format already determined
 #ifdef HAVE_CIN_3RDPARTY
+#ifdef HAVE_LIBZMPEG
 	case FILE_AC3:
 		file = new FileAC3(this->asset, this);
 		break;
+#endif
 #endif
 	case FILE_SCENE:
 		file = new FileScene(this->asset, this);
-- 
2.31.1

From 4131ef4f95f4dceb1684d67335f4eda35b77f99c Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Sat, 15 May 2021 21:05:21 +0300
Subject: [PATCH 05/17] Add libzmpeg ifdef in fileac3, move fireware objects
 into their own group in Makefile in cinelerra/

---
 cinelerra-5.1/cinelerra/Makefile  | 22 ++++++++++++++--------
 cinelerra-5.1/cinelerra/fileac3.C |  3 ++-
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile
index 81d1acee..d5145d7d 100644
--- a/cinelerra-5.1/cinelerra/Makefile
+++ b/cinelerra-5.1/cinelerra/Makefile
@@ -56,7 +56,6 @@ OBJS := $(OVERLAYS) \
 	$(OBJDIR)/assets.o \
 	$(OBJDIR)/atrack.o \
 	$(OBJDIR)/attachmentpoint.o \
-	$(OBJDIR)/audio1394.o \
 	$(OBJDIR)/audioalsa.o \
 	$(OBJDIR)/audiodevice.o \
 	$(OBJDIR)/audiodvb.o \
@@ -70,8 +69,6 @@ OBJS := $(OVERLAYS) \
 	$(OBJDIR)/automation.o \
 	$(OBJDIR)/auto.o \
 	$(OBJDIR)/autos.o \
-	$(OBJDIR)/avc1394control.o \
-	$(OBJDIR)/avc1394transport.o \
 	$(OBJDIR)/awindowgui.o \
 	$(OBJDIR)/awindow.o \
 	$(OBJDIR)/batch.o \
@@ -112,8 +109,6 @@ OBJS := $(OVERLAYS) \
 	$(OBJDIR)/cwindowtool.o \
 	$(OBJDIR)/dcoffset.o \
 	$(OBJDIR)/deleteallindexes.o \
-	$(OBJDIR)/device1394input.o \
-	$(OBJDIR)/device1394output.o \
 	$(OBJDIR)/devicedvbinput.o \
 	$(OBJDIR)/devicev4l2base.o \
 	$(OBJDIR)/devicev4l2input.o \
@@ -170,8 +165,6 @@ OBJS := $(OVERLAYS) \
 	$(OBJDIR)/garbage.o \
 	$(OBJDIR)/gwindowgui.o \
 	$(OBJDIR)/gwindow.o \
-	$(OBJDIR)/iec61883input.o \
-	$(OBJDIR)/iec61883output.o \
 	$(OBJDIR)/indexable.o \
 	$(OBJDIR)/indexfile.o \
 	$(OBJDIR)/indexstate.o \
@@ -339,7 +332,6 @@ OBJS := $(OVERLAYS) \
 	$(OBJDIR)/undostack.o \
 	$(OBJDIR)/vattachmentpoint.o \
 	$(OBJDIR)/vautomation.o \
-	$(OBJDIR)/vdevice1394.o \
 	$(OBJDIR)/vdevicebase.o \
 	$(OBJDIR)/vdevicedvb.o \
 	$(OBJDIR)/vdeviceprefs.o \
@@ -378,6 +370,19 @@ OBJS := $(OVERLAYS) \
 	$(OBJDIR)/zwindow.o \
 	$(OBJDIR)/zwindowgui.o \
 
+ifneq ($(WANT_FIREWARE),no)
+OBJ += \
+	$(OBJDIR)/audio1394.o \
+	$(OBJDIR)/avc1394control.o \
+	$(OBJDIR)/avc1394transport.o \
+	$(OBJDIR)/vdevice1394.o \
+	$(OBJDIR)/device1394input.o \
+	$(OBJDIR)/device1394output.o \
+	$(OBJDIR)/iec61883input.o \
+	$(OBJDIR)/iec61883output.o \
+
+endif
+
 ifneq ($(WANT_LIBZMPEG),no)
 OBJS += \
 	$(OBJDIR)/audiompeg.o \
@@ -426,6 +431,7 @@ LIBRARIES += \
 
 endif
 
+
 LIBS := $(LIBRARIES)
 
 ifeq ($(WANT_CIN_3RDPARTY),no)
diff --git a/cinelerra-5.1/cinelerra/fileac3.C b/cinelerra-5.1/cinelerra/fileac3.C
index c6a94161..be62f2b7 100644
--- a/cinelerra-5.1/cinelerra/fileac3.C
+++ b/cinelerra-5.1/cinelerra/fileac3.C
@@ -18,7 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
+#if HAVE_LIBZMPEG
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -421,3 +421,4 @@ int AC3ConfigAudioBitrate::handle_event()
 }
 
 #endif
+#endif //libzmpeg
\ No newline at end of file
-- 
2.31.1

From e9afc7199f2701f293428203f05b526fe8ad4814 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 19 May 2021 12:19:49 +0300
Subject: [PATCH 07/17] configure.ac update for libaom 3.1.0

---
 cinelerra-5.1/configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac
index ceddac2a..f9362edf 100644
--- a/cinelerra-5.1/configure.ac
+++ b/cinelerra-5.1/configure.ac
@@ -409,7 +409,7 @@ PKG_3RD([suil],[auto],
   [ usr/local/include ])
 
 PKG_3RD([libaom],[auto],
-  [libaom-v3.0.0],
+  [libaom-v3.1.0],
   [ usr/local/lib*/libaom*.a ],
   [ usr/local/include ])
 
-- 
2.31.1

From 4b9ef303d65b5c8da480738efffe6aed792f8185 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 19 May 2021 12:21:26 +0300
Subject: [PATCH 08/17] configure.ac update for ffmpeg-4.4

---
 cinelerra-5.1/configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac
index f9362edf..8e910529 100644
--- a/cinelerra-5.1/configure.ac
+++ b/cinelerra-5.1/configure.ac
@@ -189,7 +189,7 @@ PKG_3RD([esound],[no],
   [ . ])
 
 PKG_3RD([ffmpeg],[yes],
-  [ffmpeg-4.3],
+  [ffmpeg-4.4],
   [ libavutil/libavutil.a \
     libavcodec/libavcodec.a \
     libpostproc/libpostproc.a \
-- 
2.31.1

From b2e5bfdf7ebdccca73e81cc1ef34524b5408edb6 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 19 May 2021 13:00:24 +0300
Subject: [PATCH 10/17] libaom 3.1.0 and libwebp 1.1.0 patches for thirdparty

---
 .../thirdparty/src/libaom-v3.1.0.patch1       | 21 +++++++++++++++++
 .../thirdparty/src/libwebp-1.1.0.patch1       | 23 +++++++++++++++++++
 .../thirdparty/src/libwebp-1.1.0.patch2       | 18 +++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 cinelerra-5.1/thirdparty/src/libaom-v3.1.0.patch1
 create mode 100644 cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch1
 create mode 100644 cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch2

diff --git a/cinelerra-5.1/thirdparty/src/libaom-v3.1.0.patch1 b/cinelerra-5.1/thirdparty/src/libaom-v3.1.0.patch1
new file mode 100644
index 00000000..befe1c14
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/libaom-v3.1.0.patch1
@@ -0,0 +1,21 @@
+--- libaom-v3.0.0/aom_ports/arm_cpudetect.c	2020-07-10 02:32:42.000000000 +0300
++++ libaom-v3.0.0_1/aom_ports/arm_cpudetect.c	2021-05-08 05:18:23.404156362 +0300
+@@ -87,7 +87,7 @@
+   return flags & mask;
+ }
+ 
+-#elif defined(__ANDROID__) /* end _MSC_VER */
++#elif (defined(__ANDROID__) && !defined(__TERMUX__))/* end _MSC_VER */
+ #include <cpu-features.h>
+ 
+ int aom_arm_cpu_caps(void) {
+@@ -106,8 +106,7 @@
+   return flags & mask;
+ }
+ 
+-#elif defined(__linux__) /* end __ANDROID__ */
+-
++#elif defined(__LINUX__) || defined(__TERMUX__)/* end __ANDROID__ */
+ #include <stdio.h>
+ 
+ int aom_arm_cpu_caps(void) {
diff --git a/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch1 b/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch1
new file mode 100644
index 00000000..9cab9ed5
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch1
@@ -0,0 +1,23 @@
+--- libwebp-1.1.0/CMakeLists.txt	2019-12-21 16:37:43.000000000 +0300
++++ libwebp-1.1.0/CMakeLists.txt	2021-05-08 09:02:20.884388273 +0300
+@@ -75,20 +75,6 @@
+ 
+ # ##############################################################################
+ # Android only.
+-if(ANDROID)
+-  include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
+-  add_library(cpufeatures STATIC
+-              ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
+-  list(APPEND INSTALLED_LIBRARIES cpufeatures)
+-  target_link_libraries(cpufeatures dl)
+-  set(WEBP_DEP_LIBRARIES ${WEBP_DEP_LIBRARIES} cpufeatures)
+-  set(WEBP_DEP_INCLUDE_DIRS ${WEBP_DEP_INCLUDE_DIRS}
+-      ${ANDROID_NDK}/sources/android/cpufeatures)
+-  add_definitions(-DHAVE_CPU_FEATURES_H=1)
+-  set(HAVE_CPU_FEATURES_H 1)
+-else()
+-  set(HAVE_CPU_FEATURES_H 0)
+-endif()
+ 
+ function(configure_pkg_config FILE)
+   configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.in"
diff --git a/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch2 b/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch2
new file mode 100644
index 00000000..47bb0f18
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch2
@@ -0,0 +1,18 @@
+--- libwebp-1.1.0/cmake/cpu.cmake	2019-12-21 16:37:43.000000000 +0300
++++ _libwebp-1.1.0/cmake/cpu.cmake	2021-05-08 10:55:09.056074195 +0300
+@@ -46,14 +46,7 @@
+ set(WEBP_SIMD_FILES_TO_INCLUDE)
+ set(WEBP_SIMD_FLAGS_TO_INCLUDE)
+ 
+-if(${ANDROID})
+-  if(${ANDROID_ABI} STREQUAL "armeabi-v7a")
+-    # This is because Android studio uses the configuration "-march=armv7-a
+-    # -mfloat-abi=softfp -mfpu=vfpv3-d16" that does not trigger neon
+-    # optimizations but should (as this configuration does not exist anymore).
+-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon ")
+-  endif()
+-endif()
++
+ 
+ list(LENGTH WEBP_SIMD_FLAGS WEBP_SIMD_FLAGS_LENGTH)
+ math(EXPR WEBP_SIMD_FLAGS_RANGE "${WEBP_SIMD_FLAGS_LENGTH} - 1")
-- 
2.31.1

From 6ae426c3352821e49bfe7c4565d110e6390e5dd9 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 19 May 2021 14:08:01 +0300
Subject: [PATCH 15/17] fixed x86 ifdefs

---
 cinelerra-5.1/cinelerra/commercials.h | 2 +-
 cinelerra-5.1/cinelerra/dbwindow.h    | 2 +-
 cinelerra-5.1/cinelerra/mediadb.h     | 2 +-
 cinelerra-5.1/db/tdb.h                | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cinelerra-5.1/cinelerra/commercials.h b/cinelerra-5.1/cinelerra/commercials.h
index 123ce480..7869c3c3 100644
--- a/cinelerra-5.1/cinelerra/commercials.h
+++ b/cinelerra-5.1/cinelerra/commercials.h
@@ -1,4 +1,4 @@
-#ifdef (__I386__) || (__x86-64__)
+#ifdef __I386__ || __x86-64__
 #ifndef _COMMERCIALS_H_
 #define _COMMERCIALS_H_
 
diff --git a/cinelerra-5.1/cinelerra/dbwindow.h b/cinelerra-5.1/cinelerra/dbwindow.h
index e2507945..c8a12f66 100644
--- a/cinelerra-5.1/cinelerra/dbwindow.h
+++ b/cinelerra-5.1/cinelerra/dbwindow.h
@@ -1,4 +1,4 @@
-#ifdef (__I386__) || (__x86-64__)
+#ifdef __I386__ || __x86-64__
 #ifndef _DBWINDOW_H_
 #define _DBWINDOW_H_
 
diff --git a/cinelerra-5.1/cinelerra/mediadb.h b/cinelerra-5.1/cinelerra/mediadb.h
index 04d1d2aa..71e96bfb 100644
--- a/cinelerra-5.1/cinelerra/mediadb.h
+++ b/cinelerra-5.1/cinelerra/mediadb.h
@@ -1,4 +1,4 @@
-#ifdef (__I386__) || (__x86-64__)
+#ifdef __I386__ || __x86-64__
 #ifndef _MEDIA_DB_H_
 #define _MEDIA_DB_H_
 
diff --git a/cinelerra-5.1/db/tdb.h b/cinelerra-5.1/db/tdb.h
index 4e9d25a5..e4a08565 100644
--- a/cinelerra-5.1/db/tdb.h
+++ b/cinelerra-5.1/db/tdb.h
@@ -1,4 +1,4 @@
-#ifdef (__I386__) || (__x86-64__)
+#ifdef __I386__ || __x86-64__
 #ifndef __DB_H__
 #define __DB_H__
 #include <cstring>
-- 
2.31.1

From 2d32b503f581a7cad1d741d95ce66e6f7477c677 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 19 May 2021 13:03:38 +0300
Subject: [PATCH 11/17] add ffmpeg-4.4 patches into thirdparty/src

---
 .../thirdparty/src/ffmpeg-4.4.patch0          | 12 +++
 .../thirdparty/src/ffmpeg-4.4.patch1          | 13 ++++
 .../thirdparty/src/ffmpeg-4.4.patch3          | 74 +++++++++++++++++++
 .../thirdparty/src/ffmpeg-4.4.patch5          | 30 ++++++++
 .../thirdparty/src/ffmpeg-4.4.patch6          | 12 +++
 .../thirdparty/src/ffmpeg-4.4.patch7          | 13 ++++
 .../thirdparty/src/ffmpeg-4.4.patch8          | 16 ++++
 .../thirdparty/src/ffmpeg-4.4.patch9          | 36 +++++++++
 .../thirdparty/src/ffmpeg-4.4.patchA          | 24 ++++++
 9 files changed, 230 insertions(+)
 create mode 100644 cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch0
 create mode 100644 cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch1
 create mode 100644 cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch3
 create mode 100644 cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch5
 create mode 100644 cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch6
 create mode 100644 cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch7
 create mode 100644 cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch8
 create mode 100644 cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch9
 create mode 100644 cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patchA

diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch0 b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch0
new file mode 100644
index 00000000..f9760935
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch0
@@ -0,0 +1,12 @@
+diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
+index 88fdbeaf1e..f39d2e7cc4 100644
+--- a/fftools/cmdutils.c
++++ b/fftools/cmdutils.c
+@@ -1184,6 +1184,7 @@ static void print_buildconf(int flags, int level)
+ 
+ void show_banner(int argc, char **argv, const OptionDef *options)
+ {
++    return;
+     int idx = locate_option(argc, argv, options, "version");
+     if (hide_banner || idx)
+         return;
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch1 b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch1
new file mode 100644
index 00000000..88631302
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch1
@@ -0,0 +1,13 @@
+diff --git a/libavformat/bluray.c b/libavformat/bluray.c
+index 635c4f1b87..80a2e2c3d2 100644
+--- a/libavformat/bluray.c
++++ b/libavformat/bluray.c
+@@ -28,7 +28,7 @@
+ #include "libavutil/opt.h"
+ 
+ #define BLURAY_PROTO_PREFIX     "bluray:"
+-#define MIN_PLAYLIST_LENGTH     180     /* 3 min */
++#define MIN_PLAYLIST_LENGTH     0
+ 
+ typedef struct {
+     const AVClass *class;
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch3 b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch3
new file mode 100644
index 00000000..28d3876f
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch3
@@ -0,0 +1,74 @@
+diff --git a/libavformat/avformat.h b/libavformat/avformat.h
+index e91e7f1d33..0f9b26a6d3 100644
+--- a/libavformat/avformat.h
++++ b/libavformat/avformat.h
+@@ -480,6 +480,9 @@ typedef struct AVProbeData {
+                                         The user or muxer can override this through
+                                         AVFormatContext.avoid_negative_ts
+                                         */
++#define AVFMT_SEEK_NOSTREAMS  0x80000 /**< Stream index ignored by seek,
++                                           or some streams fail to seek
++                                           */
+ 
+ #define AVFMT_SEEK_TO_PTS   0x4000000 /**< Seeking is based on PTS */
+ 
+@@ -650,7 +653,8 @@ typedef struct AVInputFormat {
+     /**
+      * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
+      * AVFMT_NOTIMESTAMPS, AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
+-     * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS.
++     * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS,
++     * AVFMT_SEEK_NOSTREAMS
+      */
+     int flags;
+ 
+diff --git a/libavformat/dv.c b/libavformat/dv.c
+index e99422d4b5..58ce1bbb5f 100644
+--- a/libavformat/dv.c
++++ b/libavformat/dv.c
+@@ -642,6 +642,7 @@ static int dv_probe(const AVProbeData *p)
+ AVInputFormat ff_dv_demuxer = {
+     .name           = "dv",
+     .long_name      = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
++    .flags          = AVFMT_SEEK_NOSTREAMS,
+     .priv_data_size = sizeof(RawDVContext),
+     .read_probe     = dv_probe,
+     .read_header    = dv_read_header,
+diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
+index cff7f0cb54..8b6d22aff2 100644
+--- a/libavformat/matroskadec.c
++++ b/libavformat/matroskadec.c
+@@ -4251,6 +4251,7 @@ static const AVClass webm_dash_class = {
+ AVInputFormat ff_matroska_demuxer = {
+     .name           = "matroska,webm",
+     .long_name      = NULL_IF_CONFIG_SMALL("Matroska / WebM"),
++    .flags          = AVFMT_SEEK_NOSTREAMS,
+     .extensions     = "mkv,mk3d,mka,mks,webm",
+     .priv_data_size = sizeof(MatroskaDemuxContext),
+     .read_probe     = matroska_probe,
+@@ -4264,6 +4265,7 @@ AVInputFormat ff_matroska_demuxer = {
+ AVInputFormat ff_webm_dash_manifest_demuxer = {
+     .name           = "webm_dash_manifest",
+     .long_name      = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"),
++    .flags          = AVFMT_SEEK_NOSTREAMS,
+     .priv_data_size = sizeof(MatroskaDemuxContext),
+     .read_header    = webm_dash_manifest_read_header,
+     .read_packet    = webm_dash_manifest_read_packet,
+diff --git a/libavformat/utils.c b/libavformat/utils.c
+index 807d9f10cb..55a444e7b6 100644
+--- a/libavformat/utils.c
++++ b/libavformat/utils.c
+@@ -2486,6 +2486,13 @@ static int seek_frame_internal(AVFormatContext *s, int stream_index,
+         return seek_frame_byte(s, stream_index, timestamp, flags);
+     }
+ 
++    if (stream_index != -1 && (s->iformat->flags & AVFMT_SEEK_NOSTREAMS)) {
++            timestamp = av_rescale_q(timestamp,
++                    s->streams[stream_index]->time_base,
++                    AV_TIME_BASE_Q);
++            stream_index = -1;
++    }
++
+     if (stream_index < 0) {
+         stream_index = av_find_default_stream_index(s);
+         if (stream_index < 0)
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch5 b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch5
new file mode 100644
index 00000000..32e7fe11
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch5
@@ -0,0 +1,30 @@
+diff --git a/libavfilter/formats.c b/libavfilter/formats.c
+index de4315369d..f430908343 100644
+--- a/libavfilter/formats.c
++++ b/libavfilter/formats.c
+@@ -107,11 +107,13 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b,
+        possibly causing a lossy conversion elsewhere in the graph.
+        To avoid that, pretend that there are no common formats to force the
+        insertion of a conversion filter. */
+-    if (type == AVMEDIA_TYPE_VIDEO)
+-        for (i = 0; i < a->nb_formats; i++)
++    if (type == AVMEDIA_TYPE_VIDEO) {
++        for (i = 0; i < a->nb_formats; i++) {
++            const AVPixFmtDescriptor *adesc = av_pix_fmt_desc_get(a->formats[i]);
++            if( !adesc ) continue;
+             for (j = 0; j < b->nb_formats; j++) {
+-                const AVPixFmtDescriptor *adesc = av_pix_fmt_desc_get(a->formats[i]);
+                 const AVPixFmtDescriptor *bdesc = av_pix_fmt_desc_get(b->formats[j]);
++                if( !bdesc ) continue;
+                 alpha2 |= adesc->flags & bdesc->flags & AV_PIX_FMT_FLAG_ALPHA;
+                 chroma2|= adesc->nb_components > 1 && bdesc->nb_components > 1;
+                 if (a->formats[i] == b->formats[j]) {
+@@ -119,6 +121,8 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b,
+                     chroma1|= adesc->nb_components > 1;
+                 }
+             }
++        }
++    }
+ 
+     // If chroma or alpha can be lost through merging then do not merge
+     if (alpha2 > alpha1 || chroma2 > chroma1)
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch6 b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch6
new file mode 100644
index 00000000..e59a17cc
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch6
@@ -0,0 +1,12 @@
+diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c
+index 72220ffb4e..5687c416c9 100644
+--- a/libavcodec/vdpau_mpeg12.c
++++ b/libavcodec/vdpau_mpeg12.c
+@@ -114,6 +114,7 @@ const AVHWAccel ff_mpeg1_vdpau_hwaccel = {
+     .frame_priv_data_size = sizeof(struct vdpau_picture_context),
+     .init           = vdpau_mpeg1_init,
+     .uninit         = ff_vdpau_common_uninit,
++    .frame_params   = ff_vdpau_common_frame_params,
+     .priv_data_size = sizeof(VDPAUContext),
+     .caps_internal  = HWACCEL_CAP_ASYNC_SAFE,
+ };
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch7 b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch7
new file mode 100644
index 00000000..05d3b1d0
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch7
@@ -0,0 +1,13 @@
+diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
+index 3b29a189e9..681a4187c5 100644
+--- a/libavcodec/h263dec.c
++++ b/libavcodec/h263dec.c
+@@ -684,7 +684,7 @@ frame_end:
+     if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4)
+         ff_mpeg4_frame_end(avctx, buf, buf_size);
+ 
+-    if (!s->divx_packed && avctx->hwaccel)
++    if (s->divx_packed && avctx->hwaccel)
+         ff_thread_finish_setup(avctx);
+ 
+     av_assert1(s->current_picture.f->pict_type == s->current_picture_ptr->f->pict_type);
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch8 b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch8
new file mode 100644
index 00000000..51bc09e3
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch8
@@ -0,0 +1,16 @@
+diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
+index 9bd0a555d4..111a9f3a46 100644
+--- a/libavformat/mpegenc.c
++++ b/libavformat/mpegenc.c
+@@ -976,9 +976,9 @@ static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr)
+         PacketDesc *pkt_desc;
+ 
+         while ((pkt_desc = stream->predecode_packet) &&
++               pkt_desc != stream->premux_packet &&
+                scr > pkt_desc->dts) { // FIXME: > vs >=
+-            if (stream->buffer_index < pkt_desc->size ||
+-                stream->predecode_packet == stream->premux_packet) {
++            if (stream->buffer_index < pkt_desc->size) {
+                 av_log(ctx, AV_LOG_ERROR,
+                        "buffer underflow st=%d bufi=%d size=%d\n",
+                        i, stream->buffer_index, pkt_desc->size);
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch9 b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch9
new file mode 100644
index 00000000..0cf24e74
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patch9
@@ -0,0 +1,36 @@
+diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
+index 718a449b6e..84685fe1d9 100644
+--- a/libavutil/hwcontext_cuda.c
++++ b/libavutil/hwcontext_cuda.c
+@@ -269,9 +269,11 @@ static void cuda_device_uninit(AVHWDeviceContext *device_ctx)
+         CudaFunctions *cu = hwctx->internal->cuda_dl;
+ 
+         if (hwctx->internal->is_allocated && hwctx->cuda_ctx) {
++#ifdef CUDA_PRIMARY_CTX
+             if (hwctx->internal->flags & AV_CUDA_USE_PRIMARY_CONTEXT)
+                 CHECK_CU(cu->cuDevicePrimaryCtxRelease(hwctx->internal->cuda_device));
+             else
++#endif
+                 CHECK_CU(cu->cuCtxDestroy(hwctx->cuda_ctx));
+ 
+             hwctx->cuda_ctx = NULL;
+@@ -321,7 +323,7 @@ static int cuda_context_init(AVHWDeviceContext *device_ctx, int flags) {
+     cu = hwctx->internal->cuda_dl;
+ 
+     hwctx->internal->flags = flags;
+-
++#ifdef CUDA_PRIMARY_CTX
+     if (flags & AV_CUDA_USE_PRIMARY_CONTEXT) {
+         ret = CHECK_CU(cu->cuDevicePrimaryCtxGetState(hwctx->internal->cuda_device,
+                        &dev_flags, &dev_active));
+@@ -342,7 +344,9 @@ static int cuda_context_init(AVHWDeviceContext *device_ctx, int flags) {
+                                                     hwctx->internal->cuda_device));
+         if (ret < 0)
+             return ret;
+-    } else {
++    } else
++#endif
++    {
+         ret = CHECK_CU(cu->cuCtxCreate(&hwctx->cuda_ctx, desired_flags,
+                                        hwctx->internal->cuda_device));
+         if (ret < 0)
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patchA b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patchA
new file mode 100644
index 00000000..6d181e3c
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/ffmpeg-4.4.patchA
@@ -0,0 +1,24 @@
+diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c
+index dbef5495af..fba06d8ccf 100644
+--- a/libavutil/hwcontext_vdpau.c
++++ b/libavutil/hwcontext_vdpau.c
+@@ -68,6 +68,11 @@ static const VDPAUPixFmtMap pix_fmts_420[] = {
+     { 0,                     AV_PIX_FMT_NONE,   },
+ };
+ 
++static const VDPAUPixFmtMap pix_fmts_420j[] = {
++    { VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUVJ420P },
++    { 0,                     AV_PIX_FMT_NONE,   },
++};
++
+ static const VDPAUPixFmtMap pix_fmts_422[] = {
+     { VDP_YCBCR_FORMAT_NV12, AV_PIX_FMT_NV16    },
+     { VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV422P },
+@@ -92,6 +97,7 @@ static const struct {
+     const VDPAUPixFmtMap *map;
+ } vdpau_pix_fmts[] = {
+     { VDP_CHROMA_TYPE_420, AV_PIX_FMT_YUV420P, pix_fmts_420 },
++    { VDP_CHROMA_TYPE_420, AV_PIX_FMT_YUVJ420P, pix_fmts_420j },
+     { VDP_CHROMA_TYPE_422, AV_PIX_FMT_YUV422P, pix_fmts_422 },
+     { VDP_CHROMA_TYPE_444, AV_PIX_FMT_YUV444P, pix_fmts_444 },
+ #ifdef VDP_YCBCR_FORMAT_P016
-- 
2.31.1

From 9980d156ce85a7b312f509c5be46c778c291a701 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 19 May 2021 13:18:59 +0300
Subject: [PATCH 13/17] configure.ac ifdef for mjpegtools on non-x86

---
 cinelerra-5.1/configure.ac | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac
index f3fe0297..cab8d509 100644
--- a/cinelerra-5.1/configure.ac
+++ b/cinelerra-5.1/configure.ac
@@ -317,6 +317,13 @@ PKG_3RD([libvorbis],[auto],
     lib/.libs/libvorbisfile.a ],
   [ include . ])
 
+## arch dep tests
+ARCH=[`uname -m`]
+I86=[`expr "x$ARCH" : 'xi[346]86.*'`]
+X86=[`expr "x$ARCH" : 'x..._64*'`]
+
+if test "x$I86$X86" != "x00" ; then
+
 PKG_3RD([mjpegtools],[yes],
   [mjpegtools-2.1.0],
   [ utils/mmxsse/.libs/libmmxsse.a \
@@ -328,6 +335,20 @@ PKG_3RD([mjpegtools],[yes],
     mpeg2enc/.libs/libmpeg2encpp.a ],
   [ .  lavtools utils ])
 
+else
+
+PKG_3RD([mjpegtools],[yes],
+  [mjpegtools-2.1.0],
+  [ utils/.libs/libmjpegutils.a \
+    lavtools/.libs/liblavfile.a \
+    lavtools/.libs/liblavjpeg.a \
+    mplex/.libs/libmplex2.a \
+    yuvfilters/.libs/libyuvfilters.a \
+    mpeg2enc/.libs/libmpeg2encpp.a ],
+  [ .  lavtools utils ])
+
+fi
+
 PKG_3RD([openexr],[auto],
   [openexr-2.4.1],
   [ usr/local/lib/libHalf.a \
-- 
2.31.1

From bf4d26eaa6bc1be9a6cc4a4cbda10b22318b8e8e Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 19 May 2021 12:44:22 +0300
Subject: [PATCH 09/17] configure.ac change for non-x86 cflags

---
 cinelerra-5.1/configure.ac | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac
index 8e910529..f3fe0297 100644
--- a/cinelerra-5.1/configure.ac
+++ b/cinelerra-5.1/configure.ac
@@ -476,6 +476,10 @@ if test "x$I86$X86" != "x00" ; then
   REQUIRE_PROG(YASM, [yasm])
 fi
 
+if test "x$I86$X86" == "x00"; then
+   CFG_CFLAGS+=" -DNO_CTX -DNO_GDB -DNO_BTRACE"
+fi
+
 ## end arch dep tests
 
 REQUIRE_PROG(OBJCOPY, [objcopy])
-- 
2.31.1

From 8c6c700209b3cf42202b2b38b6713a765494c89f Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 19 May 2021 13:07:44 +0300
Subject: [PATCH 12/17] libaom and libopus cfg fixes for termux/arm

---
 cinelerra-5.1/thirdparty/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cinelerra-5.1/thirdparty/Makefile b/cinelerra-5.1/thirdparty/Makefile
index 27f13c65..2dd2867e 100644
--- a/cinelerra-5.1/thirdparty/Makefile
+++ b/cinelerra-5.1/thirdparty/Makefile
@@ -199,7 +199,7 @@ lame.cfg_vars?= CFLAGS+=" -O"
 lame.cfg_params?=--enable-shared=no
 lame.mak_params?= ; cd $(call bld_path,lame,include); ln -sf . lame
 libaom.cfg_vars?= mkdir aom.build && cd aom.build && $(call cmake_config,..)
-libaom.cfg_params?= -DENABLE_SHARED=no -DCMAKE_INSTALL_LIBDIR=lib \
+libaom.cfg_params?= -DENABLE_DOCS=no -DENABLE_SHARED=no -DCMAKE_INSTALL_LIBDIR=lib \
  -DCMAKE_INSTALL_PREFIX=$(call bld_path,libaom)/usr/local
 libaom.mak_params?= ; $(MAKE) -C libaom*/aom.build install
 dav1d.cfg_vars?=echo "echo dav1d custom make" >> configure; chmod +x ./configure;
@@ -242,6 +242,7 @@ opencv.cfg_vars?=$(call cmake_config,.)
 opencv.cfg_params?= -DBUILD_SHARED_LIBS:BOOL=OFF
 openexr.cfg_vars?=true; \#
 openexr.mak_vars?=true; \#
+opus.cfg_vars?= --disable-extra-programs
 speech_tools.mak_params?=-j1
 tiff.cfg_vars+=LIBS+=" -lpthread"
 tiff.cfg_params+= --enable-shared=no --disable-zstd $(call if_pkg,libwebp,\
-- 
2.31.1

From a812c03413dacacaaa08cbcb8a9f9f24fec44413 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 19 May 2021 13:36:16 +0300
Subject: [PATCH 14/17] ifdef commercials db only for x86

---
 cinelerra-5.1/cinelerra/commercials.h | 2 ++
 cinelerra-5.1/cinelerra/dbwindow.h    | 2 ++
 cinelerra-5.1/cinelerra/mediadb.h     | 2 ++
 cinelerra-5.1/cinelerra/mwindow.C     | 2 ++
 cinelerra-5.1/db/tdb.h                | 2 ++
 5 files changed, 10 insertions(+)

diff --git a/cinelerra-5.1/cinelerra/commercials.h b/cinelerra-5.1/cinelerra/commercials.h
index b7b815c4..123ce480 100644
--- a/cinelerra-5.1/cinelerra/commercials.h
+++ b/cinelerra-5.1/cinelerra/commercials.h
@@ -1,3 +1,4 @@
+#ifdef (__I386__) || (__x86-64__)
 #ifndef _COMMERCIALS_H_
 #define _COMMERCIALS_H_
 
@@ -202,3 +203,4 @@ public:
 
 
 #endif
+#endif /* x86 */
\ No newline at end of file
diff --git a/cinelerra-5.1/cinelerra/dbwindow.h b/cinelerra-5.1/cinelerra/dbwindow.h
index 24a40df8..e2507945 100644
--- a/cinelerra-5.1/cinelerra/dbwindow.h
+++ b/cinelerra-5.1/cinelerra/dbwindow.h
@@ -1,3 +1,4 @@
+#ifdef (__I386__) || (__x86-64__)
 #ifndef _DBWINDOW_H_
 #define _DBWINDOW_H_
 
@@ -296,3 +297,4 @@ public:
 
 
 #endif
+#endif /* x86 */
\ No newline at end of file
diff --git a/cinelerra-5.1/cinelerra/mediadb.h b/cinelerra-5.1/cinelerra/mediadb.h
index 9bb970ee..04d1d2aa 100644
--- a/cinelerra-5.1/cinelerra/mediadb.h
+++ b/cinelerra-5.1/cinelerra/mediadb.h
@@ -1,3 +1,4 @@
+#ifdef (__I386__) || (__x86-64__)
 #ifndef _MEDIA_DB_H_
 #define _MEDIA_DB_H_
 
@@ -239,3 +240,4 @@ public:
 };
 
 #endif
+#endif /* x86 */
\ No newline at end of file
diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C
index e5d4bc69..c4371646 100644
--- a/cinelerra-5.1/cinelerra/mwindow.C
+++ b/cinelerra-5.1/cinelerra/mwindow.C
@@ -283,8 +283,10 @@ MWindow::~MWindow()
 	delete convert_render;  convert_render = 0;
 	delete render;          render = 0;
 	delete mixers_align;    mixers_align = 0;
+#ifdef HAVE_COMMERCIALS
 	commit_commercial();
 	if( commercials && !commercials->remove_user() ) commercials = 0;
+#endif
 	close_mixers();
 	if( speed_edl ) { speed_edl->remove_user();  speed_edl = 0; }
 // Save defaults for open plugins
diff --git a/cinelerra-5.1/db/tdb.h b/cinelerra-5.1/db/tdb.h
index 8ee88002..4e9d25a5 100644
--- a/cinelerra-5.1/db/tdb.h
+++ b/cinelerra-5.1/db/tdb.h
@@ -1,3 +1,4 @@
+#ifdef (__I386__) || (__x86-64__)
 #ifndef __DB_H__
 #define __DB_H__
 #include <cstring>
@@ -1514,3 +1515,4 @@ public:
 };
 
 #endif
+#endif /* x86 */
\ No newline at end of file
-- 
2.31.1

From e4ec33bbf002c3f4c56ef2d797102d2a8b237574 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 19 May 2021 14:08:57 +0300
Subject: [PATCH 16/17] add termux-specific include path

---
 cinelerra-5.1/configure.ac | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac
index cab8d509..534f444d 100644
--- a/cinelerra-5.1/configure.ac
+++ b/cinelerra-5.1/configure.ac
@@ -26,7 +26,9 @@ CFG_CFLAGS+=" -DPNG_SKIP_SETJMP_CHECK=1"
 CFG_CFLAGS+=" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
 CFG_CFLAGS+=" -I/usr/include -I/usr/local/include"
 CFG_CFLAGS+=" -I/usr/include/freetype2 -I/usr/local/include/freetype2"
+CFG_CFLAGS+=" -I/data/data/com.termux/files/usr/include/freetype2"
 CFG_CFLAGS+=" -I/usr/include/uuid -I/usr/local/include/uuid"
+CFG_CFLAGS+=" -I/data/data/com.termux/files/usr/include/uuid -I/usr/local/include/uuid"
 CFG_CFLAGS+=" -I/usr/include/mjpegtools -I/usr/local/include/mjpegtools"
 
 AC_DEFUN([CHECK_WITH], [
-- 
2.31.1

From 11a8a15f0cdbda794ff545883070ba278828528a Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 19 May 2021 14:21:05 +0300
Subject: [PATCH 17/17] configure.ac - add -liconv for termux

---
 cinelerra-5.1/configure.ac | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac
index 534f444d..be18c243 100644
--- a/cinelerra-5.1/configure.ac
+++ b/cinelerra-5.1/configure.ac
@@ -1042,6 +1042,9 @@ if test "x$WANT_BOOBY" != "xno"; then
   CFG_CFLAGS+=" -DBOOBY"
 fi
 
+# termux
+EXTRA_LIBS+=' -liconv'
+
 # intel lock elision bugs
 if test "x$WANT_NOELISION" != "xno"; then
   CFG_RPATH=`ls -1fd 2> /dev/null \
-- 
2.31.1

-- 
Cin mailing list
[email protected]
https://lists.cinelerra-gg.org/mailman/listinfo/cin

Reply via email to