From eb9df615719cf3afe2bc08035900e5d3451034e1 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Mon, 15 Nov 2021 14:24:42 -0700 Subject: [PATCH] additional Andrew provided Termux mods + --- cinelerra-5.1/guicast/Makefile | 8 ++++++++ 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 | 2 +- 7 files changed, 56 insertions(+), 7 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..88369959 100644 --- a/cinelerra-5.1/guicast/Makefile +++ b/cinelerra-5.1/guicast/Makefile @@ -12,6 +12,14 @@ 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 + +ifeq ($(OBJDIR), aarch64) +BOOTSTRAPFLAGS := -DBOOTSTRAP="\"objcopy -B arm -I binary -O elf64-littlearm\"" +endif + $(shell mkdir -p $(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 #include #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..0d71afb4 100644 --- a/cinelerra-5.1/guicast/thread.h +++ b/cinelerra-5.1/guicast/thread.h @@ -26,6 +26,8 @@ #include #include +#if !defined(__TERMUX__) + #ifndef NO_TID #include @@ -37,6 +39,8 @@ static inline int gettid() { return syscall(SYS_gettid, 0, 0, 0); } static inline long gettid() { return (long)pthread_self(); } #endif +#endif + // The thread does not autodelete by default. // If autodelete is 1 the thread autodeletes. // If it's synchronous the deletion occurs in join(). 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..dc907821 100644 --- a/cinelerra-5.1/guicast/vframe.h +++ b/cinelerra-5.1/guicast/vframe.h @@ -417,7 +417,7 @@ private: { PRIVATE, SHARED, - SHMGET + SHM_GET }; // Data pointer is pointing to someone else's buffer. -- 2.26.2