it seems to work as in loading media, displaying, seeking to random point, playing fwd/backward, encoding fragment
i include both head of my patch pile as individual patches and whole megapatch rooted at recent monthly git update for termux you need to manually unpack/patch/compile libbthread for linux build you need to comment out androud-only libs in Cinelerra/Makefile (will add ifdefs later)
From c6cec66936a9bd28e6a51990a0227dfd33c86ba8 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Fri, 1 Apr 2022 09:23:16 +0300 Subject: [PATCH 1/6] Attempt at freebsd/netbsd detection in cinelerra/Makefile --- cinelerra-5.1/cinelerra/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile index 1d93305d..1503b6d4 100644 --- a/cinelerra-5.1/cinelerra/Makefile +++ b/cinelerra-5.1/cinelerra/Makefile @@ -435,8 +435,11 @@ LIBS := $(LIBRARIES) ifeq ($(WANT_CIN_3RDPARTY),no) LIBS += -lavcodec -lavdevice -lavfilter -lavformat -lavutil LIBS += -lswresample -lswscale +PLATFORM = $(shell uname -s) +ifeq ($(PLATFORM), FreeBSD) || ($(PLATFORM), NetBSD) LIBS += -lintl -liconv LIBS += -lexecinfo +endif LIBS += `pkg-config --libs OpenEXR` LIBS += $(shared_libs) LIBS += $(system_libs) -- 2.35.1
From 904a646a881087f4205a29a126abdabf3c3f90ac Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Sat, 2 Apr 2022 16:26:36 +0300 Subject: [PATCH 2/6] experimental: switch python in guicast to python3 unconditionally --- cinelerra-5.1/guicast/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cinelerra-5.1/guicast/Makefile b/cinelerra-5.1/guicast/Makefile index 57cfb21f..8bc4633e 100644 --- a/cinelerra-5.1/guicast/Makefile +++ b/cinelerra-5.1/guicast/Makefile @@ -104,7 +104,7 @@ $(shell echo $(OBJS) > $(OBJDIR)/objs) all: $(OUTPUT) $(UTILS) $(BCXFER): bccmdl.py bcxfer.C bcxfer.h - python < ./bccmdl.py + python3 < ./bccmdl.py +$(MAKE) -C xfer $(OUTPUT): $(OBJS) $(BCXFER) -- 2.35.1
From d0bdc181a0e48adb06cb50e839f230ccafe9bbd6 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Sat, 2 Apr 2022 16:28:57 +0300 Subject: [PATCH 3/6] Add android-only hacked Dynamic makefile libs --- cinelerra-5.1/cinelerra/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile index 1503b6d4..9962b681 100644 --- a/cinelerra-5.1/cinelerra/Makefile +++ b/cinelerra-5.1/cinelerra/Makefile @@ -441,6 +441,15 @@ LIBS += -lintl -liconv LIBS += -lexecinfo endif LIBS += `pkg-config --libs OpenEXR` +LIBS += `pkg-config --libs flac` +LIBS += `pkg-config --libs libjpeg` +LIBS += `pkg-config --libs uuid` +LIBS += `pkg-config --libs theora` +LIBS += `pkg-config --libs vorbis` +LIBS += `pkg-config --libs tiff` +LIBS += `pkg-config --libs sndfile` +LIBS += -lgif -l:libtheora.a -l:libvorbis.a -ltiff +LIBS += -landroid-shmem -liconv jpt.a LIBS += $(shared_libs) LIBS += $(system_libs) else -- 2.35.1
From 9eb856af1a0cb37179f5d5eda657e90b68b5bef4 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Sat, 2 Apr 2022 16:32:21 +0300 Subject: [PATCH 6/6] Dynamic termux configure --- cinelerra-5.1/termux_dyn.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 cinelerra-5.1/termux_dyn.sh diff --git a/cinelerra-5.1/termux_dyn.sh b/cinelerra-5.1/termux_dyn.sh new file mode 100755 index 00000000..5e5d35b8 --- /dev/null +++ b/cinelerra-5.1/termux_dyn.sh @@ -0,0 +1,6 @@ +#!/bin/sh +./configure --with-single-user --without-thirdparty \ + --without-dvb --without-video4linux2 --without-dv \ + --without-firewire --without-libzmpeg --without-vaapi \ + --without-vdpau --without-lv2 --without-openexr --without-ogg \ + --without-gl -- 2.35.1
From 8f45463f5d887e425caef12d5d3b7d4a2d0985ea Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Sat, 2 Apr 2022 16:31:28 +0300 Subject: [PATCH 5/6] Make --without-ogg work --- cinelerra-5.1/cinelerra/file.C | 2 ++ cinelerra-5.1/cinelerra/fileogg.C | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C index 33cc7e8b..655d858d 100644 --- a/cinelerra-5.1/cinelerra/file.C +++ b/cinelerra-5.1/cinelerra/file.C @@ -1328,8 +1328,10 @@ const char* File::formattostr(int format) case FILE_TGA_LIST: return _(TGA_LIST_NAME); case FILE_TIFF: return _(TIFF_NAME); case FILE_TIFF_LIST: return _(TIFF_LIST_NAME); +#ifdef HAVE_OGG case FILE_OGG: return _(OGG_NAME); case FILE_VORBIS: return _(VORBIS_NAME); +#endif case FILE_RAWDV: return _(RAWDV_NAME); case FILE_FFMPEG: return _(FFMPEG_NAME); case FILE_DB: return _(DBASE_NAME); diff --git a/cinelerra-5.1/cinelerra/fileogg.C b/cinelerra-5.1/cinelerra/fileogg.C index 63f68098..a44f780c 100644 --- a/cinelerra-5.1/cinelerra/fileogg.C +++ b/cinelerra-5.1/cinelerra/fileogg.C @@ -17,6 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#ifdef HAVE_OGG #include "asset.h" #include "bcsignals.h" @@ -1914,3 +1915,4 @@ int OGGTheoraSharpness::handle_event() } +#endif \ No newline at end of file -- 2.35.1
From 1bbb900418a2334a787e46992bf868a774a8c2c3 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Sat, 2 Apr 2022 16:29:57 +0300 Subject: [PATCH 4/6] Make cin compile with ffmpeg 5 (unconditionally) --- cinelerra-5.1/cinelerra/bdwrite.C | 4 ++-- cinelerra-5.1/cinelerra/ffmpeg.C | 39 ++++++++++++++++++------------- cinelerra-5.1/cinelerra/ffmpeg.h | 7 +++--- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/cinelerra-5.1/cinelerra/bdwrite.C b/cinelerra-5.1/cinelerra/bdwrite.C index 4dd5cc37..57966ead 100644 --- a/cinelerra-5.1/cinelerra/bdwrite.C +++ b/cinelerra-5.1/cinelerra/bdwrite.C @@ -2530,7 +2530,7 @@ static int field_probe(AVFormatContext *fmt_ctx, AVStream *st) AVDictionary *copts = 0; //av_dict_copy(&copts, opts, 0); AVCodecID codec_id = st->codecpar->codec_id; - AVCodec *decoder = avcodec_find_decoder(codec_id); + const AVCodec *decoder = avcodec_find_decoder(codec_id); AVCodecContext *ctx = avcodec_alloc_context3(decoder); if( !ctx ) { fprintf(stderr,"codec alloc failed\n"); @@ -2604,7 +2604,7 @@ int media_info::scan() stream *s = new stream(type, i); s->pid = st->id; AVCodecID codec_id = st->codecpar->codec_id; - AVCodec *decoder = avcodec_find_decoder(codec_id); + const AVCodec *decoder = avcodec_find_decoder(codec_id); s->ctx = avcodec_alloc_context3(decoder); if( !s->ctx ) { fprintf(stderr, "avcodec_alloc_context failed\n"); diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index 3655d643..294343fb 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -381,7 +381,7 @@ AVHWDeviceType FFStream::decode_hw_activate() return AV_HWDEVICE_TYPE_NONE; } -int FFStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type) +int FFStream::decode_hw_format(const AVCodec *decoder, AVHWDeviceType type) { return 0; } @@ -406,7 +406,7 @@ int FFStream::decode_activate() } while( ret >= 0 && st != 0 && !reading ) { AVCodecID codec_id = st->codecpar->codec_id; - AVCodec *decoder = 0; + const AVCodec *decoder = 0; if( is_video() ) { if( ffmpeg->opt_video_decoder ) decoder = avcodec_find_decoder_by_name(ffmpeg->opt_video_decoder); @@ -722,10 +722,11 @@ int FFStream::seek(int64_t no, double rate) double secs = pos < 0 ? 0. : pos / rate; AVRational time_base = st->time_base; int64_t tstmp = time_base.num > 0 ? secs * time_base.den/time_base.num : 0; + int nb_index_entries = avformat_index_get_entries_count(st); if( !tstmp ) { - if( st->nb_index_entries > 0 ) tstmp = st->index_entries[0].timestamp; + if( nb_index_entries > 0 ) tstmp = (avformat_index_get_entry(st, 0))->timestamp; else if( st->start_time != AV_NOPTS_VALUE ) tstmp = st->start_time; - else if( st->first_dts != AV_NOPTS_VALUE ) tstmp = st->first_dts; + /* else if( st->first_dts != AV_NOPTS_VALUE ) tstmp = st->first_dts; */ else tstmp = INT64_MIN+1; } else if( nudge != AV_NOPTS_VALUE ) tstmp += nudge; @@ -1850,7 +1851,7 @@ FFMPEG::~FFMPEG() delete [] opt_hw_dev; } -int FFMPEG::check_sample_rate(AVCodec *codec, int sample_rate) +int FFMPEG::check_sample_rate(const AVCodec *codec, int sample_rate) { const int *p = codec->supported_samplerates; if( !p ) return sample_rate; @@ -2100,7 +2101,7 @@ void FFMPEG::scan_audio_options(Asset *asset, EDL *edl) cin_fmt = (int)av_get_sample_fmt(cin_sample_fmt); if( cin_fmt < 0 ) { char audio_codec[BCSTRLEN]; audio_codec[0] = 0; - AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", asset->acodec) ? + const AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", asset->acodec) ? avcodec_find_encoder_by_name(audio_codec) : 0; if( av_codec && av_codec->sample_fmts ) cin_fmt = find_best_sample_fmt_of_list(av_codec->sample_fmts, AV_SAMPLE_FMT_FLT); @@ -2136,7 +2137,7 @@ void FFMPEG::scan_video_options(Asset *asset, EDL *edl) cin_fmt = (int)av_get_pix_fmt(cin_pix_fmt); if( cin_fmt < 0 ) { char video_codec[BCSTRLEN]; video_codec[0] = 0; - AVCodec *av_codec = !get_codec(video_codec, "video", asset->vcodec) ? + const AVCodec *av_codec = !get_codec(video_codec, "video", asset->vcodec) ? avcodec_find_encoder_by_name(video_codec) : 0; if( av_codec && av_codec->pix_fmts ) { if( 0 && edl ) { // frequently picks a bad answer @@ -2331,9 +2332,9 @@ int FFCodecRemaps::add(const char *val) } -int FFCodecRemaps::update(AVCodecID &codec_id, AVCodec *&decoder) +int FFCodecRemaps::update(AVCodecID &codec_id, const AVCodec *&decoder) { - AVCodec *codec = avcodec_find_decoder(codec_id); + const AVCodec *codec = avcodec_find_decoder(codec_id); if( !codec ) return -1; const char *name = codec->name; FFCodecRemaps &map = *this; @@ -2553,7 +2554,7 @@ int FFMPEG::init_decoder(const char *filename) char *sp = strrchr(bp, '.'); if( !sp ) sp = bp + strlen(bp); FILE *fp = 0; - AVInputFormat *ifmt = 0; + const AVInputFormat *ifmt = 0; if( sp ) { strcpy(sp, ".opts"); fp = fopen(file_opts, "r"); @@ -2774,7 +2775,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec) AVCodecContext *ctx = 0; const AVCodecDescriptor *codec_desc = 0; - AVCodec *codec = avcodec_find_encoder_by_name(codec_name); + const AVCodec *codec = avcodec_find_encoder_by_name(codec_name); if( !codec ) { eprintf(_("cant find codec %s:%s\n"), codec_name, filename); ret = 1; @@ -3027,7 +3028,12 @@ int FFMPEG::open_encoder(const char *type, const char *spec) } if( ret >= 0 ) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") - ret = avcodec_copy_context(st->codec, ctx); + //ret = avcodec_copy_context(st->codec, ctx); + //AVCodecContext *codec_ctx = avcodec_alloc_context3(ctx); + ret = avcodec_parameters_to_context(ctx, st->codecpar); + // if (ret < 0) + // fprintf(stderr, "could not copy codecpar to tmp codec_ctx\n"); + //ret = avcodec_parameters_from_context(codec_ctx, _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"") if( ret < 0 ) fprintf(stderr, "Could not copy the stream context\n"); @@ -3672,7 +3678,7 @@ Preferences *FFMPEG::ff_prefs() double FFVideoStream::get_rotation_angle() { - int size = 0; + size_t size = 0; int *matrix = (int*)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, &size); int len = size/sizeof(*matrix); if( !matrix || len < 5 ) return 0; @@ -3897,7 +3903,7 @@ AVCodecContext *FFMPEG::activate_decoder(AVStream *st) AVDictionary *copts = 0; av_dict_copy(&copts, opts, 0); AVCodecID codec_id = st->codecpar->codec_id; - AVCodec *decoder = 0; + const AVCodec *decoder = 0; switch( st->codecpar->codec_type ) { case AVMEDIA_TYPE_VIDEO: if( opt_video_decoder ) @@ -4089,10 +4095,11 @@ void FFStream::load_markers(IndexMarks &marks, double rate) int in = 0; int64_t sz = marks.size(); int max_entries = fmt_ctx->max_index_size / sizeof(AVIndexEntry) - 1; - int nb_ent = st->nb_index_entries; + int nb_ent = avformat_index_get_entries_count(st); // some formats already have an index if( nb_ent > 0 ) { - AVIndexEntry *ep = &st->index_entries[nb_ent-1]; + // AVIndexEntry *ep = &st->index_entries[nb_ent-1]; + const AVIndexEntry *ep = avformat_index_get_entry(st, nb_ent-1); int64_t tstmp = ep->timestamp; if( nudge != AV_NOPTS_VALUE ) tstmp -= nudge; double secs = ffmpeg->to_secs(tstmp, st->time_base); diff --git a/cinelerra-5.1/cinelerra/ffmpeg.h b/cinelerra-5.1/cinelerra/ffmpeg.h index 4f1624ce..6c7d68e0 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.h +++ b/cinelerra-5.1/cinelerra/ffmpeg.h @@ -25,6 +25,7 @@ #include "vframe.inc" extern "C" { +#include "libavcodec/bsf.h" #include "libavformat/avformat.h" #include "libavformat/avio.h" #include "libavcodec/avcodec.h" @@ -86,7 +87,7 @@ public: virtual int encode_activate(); virtual int decode_activate(); virtual AVHWDeviceType decode_hw_activate(); - virtual int decode_hw_format(AVCodec *decoder, AVHWDeviceType type); + virtual int decode_hw_format(const AVCodec *decoder, AVHWDeviceType type); virtual int write_packet(FFPacket &pkt); int read_packet(); int seek(int64_t no, double rate); @@ -290,7 +291,7 @@ class FFCodecRemaps : public ArrayList<FFCodecRemap> public: FFCodecRemaps() {} int add(const char *val); - int update(AVCodecID &codec_id, AVCodec *&decoder); + int update(AVCodecID &codec_id, const AVCodec *&decoder); }; // for get_initial_timecode auto deletes @@ -331,7 +332,7 @@ public: static void ff_lock(const char *cp=0) { fflock.lock(cp); } static void ff_unlock() { fflock.unlock(); } - int check_sample_rate(AVCodec *codec, int sample_rate); + int check_sample_rate(const AVCodec *codec, int sample_rate); AVRational check_frame_rate(const AVRational *p, double frame_rate); AVRational to_sample_aspect_ratio(Asset *asset); AVRational to_time_base(int sample_rate); -- 2.35.1
megapatch.tar.gz
Description: application/gzip
-- Cin mailing list [email protected] https://lists.cinelerra-gg.org/mailman/listinfo/cin

