From 02c179665199bb8bd1b057f83c26c070ce618901 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Wed, 4 May 2022 16:58:33 -0600 Subject: [PATCH] additional improvements for freebsd mostly --- cinelerra-5.1/cinelerra/dvdcreate.C | 6 +++++- cinelerra-5.1/cinelerra/file.C | 7 +++++++ cinelerra-5.1/cinelerra/fileexr.C | 16 ++++++++-------- cinelerra-5.1/ffmpeg/plugin.opts | 3 +++ cinelerra-5.1/guicast/bcresources.C | 18 +++++++++++++++++- 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C index 6ecb270b..175ef547 100644 --- a/cinelerra-5.1/cinelerra/dvdcreate.C +++ b/cinelerra-5.1/cinelerra/dvdcreate.C @@ -24,9 +24,13 @@ #include #include #include +#if !defined(__FreeBSD__) #include #include - +#else +#include +#include +#endif #define DVD_PAL_4x3 0 #define DVD_PAL_16x9 1 diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C index 32020574..2a133005 100644 --- a/cinelerra-5.1/cinelerra/file.C +++ b/cinelerra-5.1/cinelerra/file.C @@ -1666,7 +1666,14 @@ int File::record_fd() void File::get_exe_path(char *result, char *bnp) { // Get executable path, basename +#if !defined(__FreeBSD__) int len = readlink("/proc/self/exe", result, BCTEXTLEN-1); +#else + char exe_path[BCTEXTLEN]; + sprintf(exe_path,"/proc/%d/file",getpid()); + int len = readlink(exe_path, result, BCTEXTLEN-1); +#endif + if( len >= 0 ) { result[len] = 0; char *ptr = strrchr(result, '/'); diff --git a/cinelerra-5.1/cinelerra/fileexr.C b/cinelerra-5.1/cinelerra/fileexr.C index 9c782a11..fbc39862 100644 --- a/cinelerra-5.1/cinelerra/fileexr.C +++ b/cinelerra-5.1/cinelerra/fileexr.C @@ -50,8 +50,8 @@ public: ~EXRIStream(); bool read (char c[], int n); - Imf::Int64 tellg (); - void seekg (Imf::Int64 pos); + uint64_t tellg (); + void seekg (uint64_t pos); void clear (); private: @@ -67,8 +67,8 @@ public: ~EXROStream(); virtual void write(const char c[], int n); - virtual Imf::Int64 tellp(); - virtual void seekp(Imf::Int64 pos); + virtual uint64_t tellp(); + virtual void seekp(uint64_t pos); private: VFrame *data; @@ -106,12 +106,12 @@ bool EXRIStream::read(char c[], int n) return position >= size; } -Imf::Int64 EXRIStream::tellg () +uint64_t EXRIStream::tellg () { return position; } -void EXRIStream::seekg(Imf::Int64 pos) +void EXRIStream::seekg(uint64_t pos) { position = pos; } @@ -141,12 +141,12 @@ void EXROStream::write(const char c[], int n) data->set_compressed_size(MAX(position, data->get_compressed_size())); } -Imf::Int64 EXROStream::tellp() +uint64_t EXROStream::tellp() { return position; } -void EXROStream::seekp(Imf::Int64 pos) +void EXROStream::seekp(uint64_t pos) { position = pos; } diff --git a/cinelerra-5.1/ffmpeg/plugin.opts b/cinelerra-5.1/ffmpeg/plugin.opts index 11cb26e2..9b60b2c4 100644 --- a/cinelerra-5.1/ffmpeg/plugin.opts +++ b/cinelerra-5.1/ffmpeg/plugin.opts @@ -425,3 +425,6 @@ monochrome #msad ###Input/output error #setts #vif ###Input/output error +#frei0r +#frei0r_src +#libvmaf diff --git a/cinelerra-5.1/guicast/bcresources.C b/cinelerra-5.1/guicast/bcresources.C index cdac6305..3fa8bed1 100644 --- a/cinelerra-5.1/guicast/bcresources.C +++ b/cinelerra-5.1/guicast/bcresources.C @@ -39,6 +39,9 @@ #include #include #include +#if defined(__FreeBSD__) +#include +#endif #include #include #include @@ -298,6 +301,7 @@ int BC_Resources::machine_cpus = 1; int BC_Resources::get_machine_cpus() { +#if !defined(__FreeBSD__) int cpus = 1; FILE *proc = fopen("/proc/cpuinfo", "r"); if( proc ) { @@ -315,6 +319,14 @@ int BC_Resources::get_machine_cpus() fclose(proc); } return cpus; +#else + int mib[2], ncpu; + size_t len = sizeof(ncpu); + mib[0] = CTL_HW; + mib[1] = HW_NCPU; + if( sysctl(mib, 2, &ncpu, &len, 0, 0) ) ncpu = 1; + return ncpu; +#endif } void BC_Resources::new_vframes(int n, VFrame *vframes[], ...) @@ -367,9 +379,13 @@ BC_Resources::BC_Resources(float x_scale, float y_scale) BC_WindowBase::resources = this; synchronous = 0; vframe_shm = 0; +#if !defined(__FreeBSD__) use_shm = -1; shm_reply = 1; - +#else + use_shm = 0; + shm_reply = 0; +#endif if( x_scale <= 0 ) x_scale = 1; if( y_scale <= 0 ) y_scale = x_scale; this->x_scale = x_scale; -- 2.26.2