From: Good Guy Date: Fri, 19 Aug 2022 23:26:57 +0000 (-0600) Subject: Credit FFmpeg team / Andrew patch / Andrea plugins update for 5.1 X-Git-Tag: 2022-08~5 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=285e7ba4bfd278c090d4c5c9e1d2ec36c3d9dac5;p=goodguy%2Fcinelerra.git Credit FFmpeg team / Andrew patch / Andrea plugins update for 5.1 --- diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac index 7ca543af..ab06ace9 100644 --- a/cinelerra-5.1/configure.ac +++ b/cinelerra-5.1/configure.ac @@ -222,7 +222,7 @@ PKG_3RD([esound],[no], [ . ]) PKG_3RD([ffmpeg],[yes], - [ffmpeg-4.4], + [ffmpeg-5.1], [ libavutil/libavutil.a \ libavcodec/libavcodec.a \ libpostproc/libpostproc.a \ diff --git a/cinelerra-5.1/ffmpeg/plugin.opts b/cinelerra-5.1/ffmpeg/plugin.opts index 9b60b2c4..160d2ae7 100644 --- a/cinelerra-5.1/ffmpeg/plugin.opts +++ b/cinelerra-5.1/ffmpeg/plugin.opts @@ -5,8 +5,11 @@ abench acompressor #acrossfade ###Input/output error acrusher +adecorrelate adelay delays=1 #adrawgraph signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255 ###Input/output error +adynamicequalizer +adynamicsmooth aecho aemphasis aeval exprs=(sin(2*PI*t*440)+sin(2*PI*t*350))/2*mod(floor(2*t),2):channel_layout=1c @@ -15,9 +18,11 @@ afade #afftfilt 1-clip((b/nb)*b,0,1) #afifo ###will not work within cin aformat sample_fmts=u8|s16:channel_layouts=stereo +afwtdn agate #ahistogram dmode=single:r=25:s=hd720:scale=log:ascale=log:slide=replace ###Input/output error #ainterleave +alatency #alimiter allpass allrgb @@ -38,6 +43,7 @@ anoisesrc d=60:c=pink:r=48000:a=0.5 aperms #aphasemeter r=25:s=800x400:rc=2:gc=7:bc=1 ###Operation not permitted aphaser +apsyclip #apulsator arealtime aresample sample_rate=48000 @@ -51,10 +57,12 @@ asetrate r=48000 #ashowinfo ###not part of frame data #asidedata ###Invalid argument #asplit ###Operation not permitted +aspectralstats astats #astreamselect ###Operation not permitted atadenoise atempo +atilt atrim start=1:end=240:start_pts=1:end_pts=2:duration=1:start_sample=1:end_sample=2 #avectorscope ###Input/output error avgblur @@ -67,6 +75,8 @@ biquad blackdetect blackframe #blend ###Input/output error +blockdetect +blurdetect boxblur #buffer size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1 ###Invalid argument #buffersink ###Input/output error @@ -76,14 +86,17 @@ cellauto p=@:s=100x400:full=0:rule=18 #channelsplit ###Operation not permitted chorus in_gain=0.400000:out_gain=0.400000:delays=1|1:decays=1|1:speeds=1|1:depths=1|1 chromakey +chromakey_cuda #codecview color colorbalance colorchannelmixer +colorchart colorkey colorlevels colormatrix src=bt601:dst=bt709 colorspace iall=smpte170m:all=bt709 +colorspectrum compand compensationdelay #concat ###Operation not permitted @@ -142,6 +155,7 @@ fspp gblur #geq ###Invalid argument gradfun +grayworld #haldclut ###not working due to need for multiple video streams ###Input/output error haldclutsrc #hdcd @@ -152,6 +166,8 @@ histogram hqdn3d hqx #hstack ###Operation not permitted +hsvhold +hsvkey hue #hwdownload ###Operation not permitted #hwmap ###Input/output error @@ -165,6 +181,7 @@ inflate #interleave ###Operation not permitted #join kerndeint +latency lenscorrection life ratio=2/3:s=200x200 #loudnorm ###Invalid argument @@ -204,6 +221,7 @@ perms perspective phase #pixdesctest ###not appropriate +pixelize pp pp7 #premultiply ###Operation not permitted @@ -229,6 +247,7 @@ scale 200:100 #scale_cuda ###Operation not implemented when you try to use it #scale_vaapi ###Operation not permitted #scale2ref ###Input/output error +scharr #select ###Operation not permitted selectivecolor greens=.5 0 -.33 0:blues=0 .27 #sendcmd ###Invalid argument @@ -259,6 +278,7 @@ signalstats #silencedetect n=0.001 ###does not appear to work silenceremove sine +siti smartblur smptebars smptehdbars @@ -282,6 +302,7 @@ testsrc2 duration=5.3:size=qcif:rate=10 #thumbnail n=50 #thumbnail_cuda tile layout=3x2:nb_frames=5:padding=7:margin=2 +tiltshelf tinterlace transpose treble @@ -294,6 +315,7 @@ vectorscope vflip vibrato vignette +virtualbass volume volumedetect #vstack ###Operation not permitted @@ -428,3 +450,21 @@ monochrome #frei0r #frei0r_src #libvmaf +; broken in 5.0 +#anlmf ###Input/output error +#asdr ###Input/output error +#asegment ###Operation not permitted +#dnn_classify ###Invalid argument +#dnn_detect ###Invalid argument +#guided ###Operation not permitted +#limitdiff ###Operation not permitted +#morpho ###Input/output error +#overlay_vaapi ###Input/output error +#segment ###Operation not permitted +#varblur ###Input/output error +#xcorrelate ###Input/output error +; broken in 5.1 +#avsynctest ###Input/output error +#colormap ###Input/output error +#feedback ###Input/output error +#multiply ###Input/output error diff --git a/cinelerra-5.1/info/plugins.txt b/cinelerra-5.1/info/plugins.txt index b6c5f087..e1b8ca9c 100644 --- a/cinelerra-5.1/info/plugins.txt +++ b/cinelerra-5.1/info/plugins.txt @@ -265,6 +265,10 @@ F_bilateral: Apply bilateral filter, spatial smoothing while F_bitplanenoise: Measure bit plane noise. F_blackdetect: Detect video intervals that are (almost) black. F_blackframe: Detect frames that are (almost) black. +F_blockdetect: Determines blockiness of frames without altering the + input frames. +F_blurdetect: Determines blurriness of frames without altering the + input frames. F_boxblur: Blurs the input video. Through the settings you are able to change the power and the radius of the boxblur applied to luma, chroma and alpha. @@ -275,12 +279,14 @@ F_cellauto: Create pattern generated by an elementart cellular F_chromahold: Turns a certain color range into gray. F_chromakey: Turns a certain color into transparency. Operates on YUV colors. +F_chromakey_cuda: CUDA accelerated YUV colorspace color/chroma keying. F_chromanr: Reduce chrominance noise. F_chromashift: Shift chroma. F_ciescope: Video CIE scope. F_color: Provide a uniformly colored input. F_colorbalance: Adjusts the color balance. F_colorchannelmixer: Adjusts colors by mixing color channels. +F_colorchart: The colorchart source provides a colors checker chart. F_colorcontrast: Adjust color contrast between RGB components. F_colorcorrect: Adjust color white balance selectivity for blacks and whites. @@ -290,6 +296,7 @@ F_colorlevels: Adjusts the color levels. F_colormatrix: Converts color matrix. F_colorize: Overlay a solid color on the video stream. F_colorspace: Converts color space/range. +F_colorspectrum: Provides a color spectrum input. F_colortemperature: Adjust color temperature of video. F_cover_rect: Find and cover a user specified object. F_crop: Crops the input video. @@ -352,6 +359,8 @@ F_gblur: Apply Gaussian Blur filter. F_gradfun: Debands video quickly using gradients. F_gradients: Draws a transparent gradient. F_graphmonitor: Show various filtergraph stats. +F_grayworld: A color constancy filter that applies color + correction based on the grayworld assumption. F_greyedge: Estimates scene illumination by grey edge assumption. F_haldclutsrc: Provide an identity Hald CLUT. @@ -361,7 +370,11 @@ F_histogram: Computes and draws a histogram. F_hqdn3d: Applies a High Quality 3D Denoiser. F_hqx: Scales the input by 2, 3 or 4 using the hq*x magnification algorithm. +F_hsvhold: Turns a certain HSV range into gray values. +F_hsvkey: Turns a certain HSV range into transparency. F_hue: Adjust the hue and saturation of the input video. +F_huesaturation: Apply hue-saturation-intensity adjustments + to input video stream. F_idet: Interlace detect Filter. F_il: Deinterleaves or interleaves fields. F_inflate: Applies inflate effect. @@ -369,6 +382,7 @@ F_interlace: Convert progressive video into interlaced. F_kerndeint: Applies kernel deinterlacing to the input. F_kirsch: Apply kirsch operator. F_lagfun: Slowly update darker pixels. +F_latency: Measure filtering latency. F_lenscorrection: Rectifies the image by correcting for lens distortion. F_life: Generate a life pattern. F_limiter: Limit pixels components to the specified range. @@ -411,6 +425,7 @@ F_perspective: Corrects the perspective of video. F_phase: Phase shift fields. F_photosensitivity: Filter out photosensitive epilepsy seizure-inducing flashes. +F_pixelize: Apply pixelization to video stream. F_pixscope: Pixel data analysis for checking color and levels. It will display sample values of color channels. F_pp: Filters video using libpostproc. @@ -438,6 +453,7 @@ F_scale: Scale the input video size and/or convert the image format. F_scale_cuda: GPU accelerated video resizer. F_scdet: Detect video scene change. +F_scharr: Apply scharr operator to input video stream. F_scroll: Scroll input video horizontally and/or vertically by constant speed. F_selectivecolor: Apply cmyk adjustments to specific color ranges. @@ -454,6 +470,10 @@ F_shuffleplanes: Shuffles video planes. F_sierpinski: Generate a Sierpinski carpet/triangle fractal, and randomly pan around. F_signalstats: Separates statistics from video analysis. +F_siti: Calculate Spatial Info (SI) and Temporal Info (TI) scores + for a video, as defined in ITU-T P.910: + Subjective video quality assessment methods for + multimedia applications. F_smartblur: Blurs the input video without impacting the outlines. Through the settings you can select the radius, the strength and the threshold of luma and chroma. @@ -513,10 +533,14 @@ F_acontrast: Simple audio dynamic range compression/expansion filter. F_acrusher: Reduces audio bit resolution. F_acue: Delay filtering to match a cue. +F_adecorrelate: Apply decorrelation to input audio stream. F_adelay: Delays one or more audio channels. F_adenorm: Remedy denormals by adding extremely low-level noise. F_aderivative: Compute derivative of input audio. +F_adynamicequalizer: Apply dynamic equalization to input + audio stream. +F_adynamicsmooth: Apply dynamic smoothing to input audio stream. F_aecho: Adds echoing to the audio. F_aemphasis: Audio emphasis. F_aeval: Filters audio signal according to specific expression. @@ -524,10 +548,13 @@ F_aexciter: Enhance high frequency part of audio. F_afade: Fades in/out input audio. F_aformat: Convert the input audio to the specified format. F_afreqshift: Apply frequency shifting to input audio. +F_afwtdn: Reduce broadband noise from input samples using + Wavelets. F_agate: Audio gate. F_aiir: Apply infinite Impulse Response filter with supplied coefficients. F_aintegral: Compute integral of input audio. +F_alatency: Measure filtering latency. F_allpass: Applies a two-pole all-pass filter. F_aloop: Loops audio samples. F_ametadata: Manipulate audio frame metadata. @@ -537,12 +564,18 @@ F_anoisesrc: Generates a noise audio signal. F_aperms: Set permissions for the output audio frame. F_aphaser: Adds a phasing effect to the audio. F_aphaseshift: Apply phase shifting to input audio. +F_apsyclip: Apply Psychoacoustic clipper to input audio + stream. F_arealtime: Slows down filtering to match realtime. F_aresample: Resamples audio data. F_asetrate: Change the sample rate without altering the data. F_asoftclip: Apply audio soft clipping - a type of distortion effect where signal amplitude is saturated along a smooth curve. +F_aspectralstats:Display frequency domain statistical + information about the audio channels. + Statistics are calculated and stored as metadata + for each audio channel and for each audio frame. F_astats: Shows time domain statistics about audio frames. F_asubboost: Boost subwoofer frequencies. F_asubcut: Cut subwoofer frequencies. @@ -550,6 +583,7 @@ F_asupercut: Cut super frequencies. F_asuperpass: Apply high order Butterworth band-pass filter. F_asuperstop: Apply high order Butterworth band-stop filter. F_atempo: Adjusts audio tempo. +F_atilt: Apply spectral tilt filter to audio stream. F_atrim: Pick one continuous section from the input and drop the rest. F_bandpass: Applies a two-pole Butterworth band-pass filter. @@ -616,9 +650,15 @@ F_stereowiden: Applies stereo widening effect. When using this and then right mouse clicking all subsequent audio tracks bringing up a menu. Highlight the effect shown in the middle section and click OK. +F_tiltshelf: Boost or cut the lower frequencies and cut or boost + higher frequencies of the audio using a two-pole + shelving filter with a response similar to that of + a standard hi-fi’s tone-controls. + This is also known as shelving equalisation (EQ). F_treble: Boosts or cuts upper frequencies. F_tremolo: Applies tremolo effect. F_vibrato: Applies vibrato effect. +F_virtualbass: Apply audio Virtual Bass filter. F_volume: Change input volume. F_volumedetect: Detect audio volume. # @@ -678,6 +718,8 @@ L_Crossover distortion: Simulation of the distortion that happens in class Compressor: Lessen the dynamic range between the loudest and quietest parts of an audio signal by boosting the quieter signals and attenuating the louder signals. +Compressor Multi: Compressor that acts on 3 distinct frequency bands + instead of the entire singe sprectrum. DC Offset: Remove DC Offset, which is usually an undesirable characteristic of a recording normally caused by defective equipment. (Has no controls) diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch0 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch0 new file mode 100644 index 00000000..7deb9356 --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch0 @@ -0,0 +1,33 @@ +--- a/libavcodec/aaccoder.c ++++ b/libavcodec/aaccoder.c +@@ -60,6 +60,8 @@ + * replace low energy non zero bands */ + #define NOISE_LAMBDA_REPLACE 1.948f + ++#undef B0 ++ + #include "libavcodec/aaccoder_trellis.h" + + /** +--- a/libavcodec/hevc_mvs.c ++++ b/libavcodec/hevc_mvs.c +@@ -25,6 +25,8 @@ + #include "hevcdec.h" + #include "threadframe.h" + ++#undef B0 ++ + static const uint8_t l0_l1_cand_idx[12][2] = { + { 0, 1, }, + { 1, 0, }, +--- a/libavcodec/opus_pvq.c ++++ b/libavcodec/opus_pvq.c +@@ -31,6 +31,8 @@ + #define CELT_PVQ_U(n, k) (ff_celt_pvq_u_row[FFMIN(n, k)][FFMAX(n, k)]) + #define CELT_PVQ_V(n, k) (CELT_PVQ_U(n, k) + CELT_PVQ_U(n, (k) + 1)) + ++#undef B0 ++ + static inline int16_t celt_cos(int16_t x) + { + x = (MUL16(x, x) + 4096) >> 13; diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch1 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch1 new file mode 100644 index 00000000..e157d3f3 --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch1 @@ -0,0 +1,11 @@ +--- a/fftools/cmdutils.c ++++ b/fftools/cmdutils.c +@@ -59,7 +59,7 @@ + AVDictionary *swr_opts; + AVDictionary *format_opts, *codec_opts; + +-int hide_banner = 0; ++int hide_banner = 1; + + void uninit_opts(void) + { diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch10 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch10 new file mode 100644 index 00000000..c94880d0 --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch10 @@ -0,0 +1,34 @@ +--- a/libavutil/hwcontext_cuda.c ++++ b/libavutil/hwcontext_cuda.c +@@ -286,9 +286,11 @@ + 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; +@@ -338,7 +340,7 @@ + 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)); +@@ -359,7 +361,9 @@ + 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-5.1.patch2 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch2 new file mode 100644 index 00000000..6e1a7fc6 --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch2 @@ -0,0 +1,413 @@ +--- a/libavformat/mpegtsenc.c ++++ b/libavformat/mpegtsenc.c +@@ -84,9 +84,11 @@ + int64_t pat_period; /* PAT/PMT period in PCR time base */ + int64_t nit_period; /* NIT period in PCR time base */ + int nb_services; +- int64_t first_pcr; + int first_dts_checked; +- int64_t next_pcr; ++ int64_t pcr_pos, pcr; ++ int64_t first_pcr, next_pcr; ++ int64_t delay; ++ int pcr_stream_pid; + int mux_rate; ///< set to 1 when VBR + int pes_payload_size; + int64_t total_size; +@@ -252,7 +254,7 @@ + int data_st_warning; + + int64_t pcr_period; /* PCR period in PCR time base */ +- int64_t last_pcr; ++ int64_t pcr_timer; + + /* For Opus */ + int opus_queued_samples; +@@ -945,18 +947,18 @@ + return 0; + } + +-static int64_t get_pcr(const MpegTSWrite *ts) ++static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb) + { +- return av_rescale(ts->total_size + 11, 8 * PCR_TIME_BASE, ts->mux_rate) + +- ts->first_pcr; ++ int64_t pos = avio_tell(pb) + 11; ++ return ts->pcr + (ts->mux_rate == 1 ? (pos - ts->pcr_pos) * 8 : ++ av_rescale(pos - ts->pcr_pos, 8 * PCR_TIME_BASE, ts->mux_rate)); + } + + static void write_packet(AVFormatContext *s, const uint8_t *packet) + { + MpegTSWrite *ts = s->priv_data; + if (ts->m2ts_mode) { +- int64_t pcr = get_pcr(s->priv_data); +- uint32_t tp_extra_header = pcr % 0x3fffffff; ++ uint32_t tp_extra_header = get_pcr(ts, s->pb) % 0x3fffffff; + tp_extra_header = AV_RB32(&tp_extra_header); + avio_write(s->pb, (unsigned char *) &tp_extra_header, + sizeof(tp_extra_header)); +@@ -1042,9 +1044,6 @@ + else + ts_st->pcr_period = 1; + } +- +- // output a PCR as soon as possible +- ts_st->last_pcr = ts->first_pcr - ts_st->pcr_period; + } + + static void select_pcr_streams(AVFormatContext *s) +@@ -1107,6 +1106,7 @@ + + if (s->max_delay < 0) /* Not set by the caller */ + s->max_delay = 0; ++ ts->delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE); + + // round up to a whole number of TS packets + ts->pes_payload_size = (ts->pes_payload_size + 14 + 183) / 184 * 184 - 14; +@@ -1166,7 +1166,9 @@ + /* MPEG pid values < 16 are reserved. Applications which set st->id in + * this range are assigned a calculated pid. */ + if (st->id < 16) { +- if (ts->m2ts_mode) { ++ if (ts->start_pid >= 0) ++ ts_st->pid = ts->start_pid + i; ++ else if (ts->m2ts_mode) { + switch (st->codecpar->codec_type) { + case AVMEDIA_TYPE_VIDEO: + ts_st->pid = ts->m2ts_video_pid++; +@@ -1193,9 +1195,9 @@ + av_log(s, AV_LOG_ERROR, "Cannot automatically assign PID for stream %d\n", st->index); + return AVERROR(EINVAL); + } +- } else { +- ts_st->pid = ts->start_pid + i; + } ++ else ++ ts_st->pid = START_PID + i; + } else { + ts_st->pid = st->id; + } +@@ -1263,9 +1265,14 @@ + ts->last_pat_ts = AV_NOPTS_VALUE; + ts->last_sdt_ts = AV_NOPTS_VALUE; + ts->last_nit_ts = AV_NOPTS_VALUE; +- ts->pat_period = av_rescale(ts->pat_period_us, PCR_TIME_BASE, AV_TIME_BASE); +- ts->sdt_period = av_rescale(ts->sdt_period_us, PCR_TIME_BASE, AV_TIME_BASE); +- ts->nit_period = av_rescale(ts->nit_period_us, PCR_TIME_BASE, AV_TIME_BASE); ++ ts->pat_period = ts->pat_period_us < 0 ? -1 : ++ av_rescale(ts->pat_period_us, PCR_TIME_BASE, AV_TIME_BASE); ++ ts->sdt_period = ts->sdt_period_us < 0 ? -1 : ++ av_rescale(ts->sdt_period_us, PCR_TIME_BASE, AV_TIME_BASE); ++ ts->nit_period = ts->nit_period_us < 0 ? -1 : ++ av_rescale(ts->nit_period_us, PCR_TIME_BASE, AV_TIME_BASE); ++ ts->pcr = 0; ++ ts->pcr_pos = 0; + + /* assign provider name */ + provider = av_dict_get(s->metadata, "service_provider", NULL, 0); +@@ -1281,8 +1288,8 @@ + av_log(s, AV_LOG_VERBOSE, "muxrate %d, ", ts->mux_rate); + av_log(s, AV_LOG_VERBOSE, + "sdt every %"PRId64" ms, pat/pmt every %"PRId64" ms", +- av_rescale(ts->sdt_period, 1000, PCR_TIME_BASE), +- av_rescale(ts->pat_period, 1000, PCR_TIME_BASE)); ++ ts->sdt_period < 0 ? -1 : av_rescale(ts->sdt_period, 1000, PCR_TIME_BASE), ++ ts->pat_period < 0 ? -1 : av_rescale(ts->pat_period, 1000, PCR_TIME_BASE)); + if (ts->flags & MPEGTS_FLAG_NIT) + av_log(s, AV_LOG_VERBOSE, ", nit every %"PRId64" ms", av_rescale(ts->nit_period, 1000, PCR_TIME_BASE)); + av_log(s, AV_LOG_VERBOSE, "\n"); +@@ -1291,36 +1298,40 @@ + } + + /* send SDT, NIT, PAT and PMT tables regularly */ +-static void retransmit_si_info(AVFormatContext *s, int force_pat, int force_sdt, int force_nit, int64_t pcr) ++static void retransmit_si_info(AVFormatContext *s, int force_pat, int force_sdt, int force_nit) + { + MpegTSWrite *ts = s->priv_data; + int i; + +- if ((pcr != AV_NOPTS_VALUE && ts->last_sdt_ts == AV_NOPTS_VALUE) || +- (pcr != AV_NOPTS_VALUE && pcr - ts->last_sdt_ts >= ts->sdt_period) || +- force_sdt +- ) { +- if (pcr != AV_NOPTS_VALUE) +- ts->last_sdt_ts = FFMAX(pcr, ts->last_sdt_ts); +- mpegts_write_sdt(s); +- } +- if ((pcr != AV_NOPTS_VALUE && ts->last_pat_ts == AV_NOPTS_VALUE) || +- (pcr != AV_NOPTS_VALUE && pcr - ts->last_pat_ts >= ts->pat_period) || +- force_pat) { +- if (pcr != AV_NOPTS_VALUE) +- ts->last_pat_ts = FFMAX(pcr, ts->last_pat_ts); +- mpegts_write_pat(s); +- for (i = 0; i < ts->nb_services; i++) +- mpegts_write_pmt(s, ts->services[i]); +- } +- if ((pcr != AV_NOPTS_VALUE && ts->last_nit_ts == AV_NOPTS_VALUE) || +- (pcr != AV_NOPTS_VALUE && pcr - ts->last_nit_ts >= ts->nit_period) || +- force_nit +- ) { +- if (pcr != AV_NOPTS_VALUE) +- ts->last_nit_ts = FFMAX(pcr, ts->last_nit_ts); ++ if (ts->sdt_period >= 0) { ++ int64_t pcr = get_pcr(ts, s->pb); ++ if (ts->last_sdt_ts == AV_NOPTS_VALUE || pcr >= ts->last_sdt_ts + ts->sdt_period) ++ force_sdt = 1; ++ if (force_sdt) { ++ ts->last_sdt_ts = pcr; ++ mpegts_write_sdt(s); ++ } ++ } ++ if (ts->pat_period >= 0) { ++ int64_t pcr = get_pcr(ts, s->pb); ++ if (ts->last_pat_ts == AV_NOPTS_VALUE || pcr >= ts->last_pat_ts + ts->pat_period) ++ force_pat = 1; ++ if (force_pat) { ++ ts->last_pat_ts = pcr; ++ mpegts_write_pat(s); ++ for (i = 0; i < ts->nb_services; i++) ++ mpegts_write_pmt(s, ts->services[i]); ++ } ++ } ++ if (ts->nit_period >= 0) { ++ int64_t pcr = get_pcr(ts, s->pb); ++ if (ts->last_nit_ts == AV_NOPTS_VALUE || pcr >= ts->last_nit_ts + ts->nit_period) ++ force_nit = 1; ++ if (force_nit) { ++ ts->last_nit_ts = pcr; + if (ts->flags & MPEGTS_FLAG_NIT) + mpegts_write_nit(s); ++ } + } + } + +@@ -1357,25 +1368,29 @@ + static void mpegts_insert_pcr_only(AVFormatContext *s, AVStream *st) + { + MpegTSWrite *ts = s->priv_data; +- MpegTSWriteStream *ts_st = st->priv_data; ++ int64_t pcr = get_pcr(ts, s->pb); ++ MpegTSWriteStream *ts_st = st ? st->priv_data : 0; ++ uint32_t pcr_pid = ts_st ? ts_st->pid : ts->pcr_stream_pid; + uint8_t *q; + uint8_t buf[TS_PACKET_SIZE]; + + q = buf; + *q++ = 0x47; +- *q++ = ts_st->pid >> 8; +- *q++ = ts_st->pid; +- *q++ = 0x20 | ts_st->cc; /* Adaptation only */ ++ *q++ = pcr_pid >> 8; ++ *q++ = pcr_pid; ++ uint32_t flags = 0x20; /* Adaptation only */ + /* Continuity Count field does not increment (see 13818-1 section 2.4.3.3) */ ++ if(ts_st) flags |= ts_st->cc; ++ *q++ = flags; + *q++ = TS_PACKET_SIZE - 5; /* Adaptation Field Length */ + *q++ = 0x10; /* Adaptation flags: PCR present */ +- if (ts_st->discontinuity) { ++ if (ts_st && ts_st->discontinuity) { + q[-1] |= 0x80; + ts_st->discontinuity = 0; + } + + /* PCR coded into 6 bytes */ +- q += write_pcr_bits(q, get_pcr(ts)); ++ q += write_pcr_bits(q, pcr); + + /* stuffing bytes */ + memset(q, 0xFF, TS_PACKET_SIZE - (q - buf)); +@@ -1475,9 +1490,9 @@ + int afc_len, stuffing_len; + int is_dvb_subtitle = (st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE); + int is_dvb_teletext = (st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT); +- int64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE); + int force_pat = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && key && !ts_st->prev_payload_key; + int force_sdt = 0; ++ int64_t pcr; + int force_nit = 0; + + av_assert0(ts_st->payload != buf || st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO); +@@ -1494,21 +1509,19 @@ + + is_start = 1; + while (payload_size > 0) { +- int64_t pcr = AV_NOPTS_VALUE; +- if (ts->mux_rate > 1) +- pcr = get_pcr(ts); +- else if (dts != AV_NOPTS_VALUE) +- pcr = (dts - delay) * 300; +- +- retransmit_si_info(s, force_pat, force_sdt, force_nit, pcr); +- force_pat = 0; +- force_sdt = 0; +- force_nit = 0; ++ // add 11, pcr references the last byte of program clock reference base ++ ts->pcr_pos = avio_tell(s->pb) + 11; ++ pcr = ts->pcr = ts->mux_rate != 1 ? ++ av_rescale(ts->pcr_pos, 8 * PCR_TIME_BASE, ts->mux_rate) : ++ (dts == AV_NOPTS_VALUE ? 0 : (dts - ts->delay) * 300); ++ if (force_pat || force_sdt || force_nit) { ++ retransmit_si_info(s, force_pat, force_sdt, force_nit); ++ force_pat = force_sdt = force_nit = 0; ++ } + + write_pcr = 0; + if (ts->mux_rate > 1) { + /* Send PCR packets for all PCR streams if needed */ +- pcr = get_pcr(ts); + if (pcr >= ts->next_pcr) { + int64_t next_pcr = INT64_MAX; + for (int i = 0; i < s->nb_streams; i++) { +@@ -1518,36 +1531,43 @@ + AVStream *st2 = s->streams[st2_index]; + MpegTSWriteStream *ts_st2 = st2->priv_data; + if (ts_st2->pcr_period) { +- if (pcr - ts_st2->last_pcr >= ts_st2->pcr_period) { +- ts_st2->last_pcr = FFMAX(pcr - ts_st2->pcr_period, ts_st2->last_pcr + ts_st2->pcr_period); +- if (st2 != st) { ++ if (pcr >= ts_st2->pcr_timer) { ++ ts_st2->pcr_timer = pcr + ts_st2->pcr_period; ++ if (st2 != st) { + mpegts_insert_pcr_only(s, st2); +- pcr = get_pcr(ts); + } else { + write_pcr = 1; + } + } +- next_pcr = FFMIN(next_pcr, ts_st2->last_pcr + ts_st2->pcr_period); ++ next_pcr = FFMIN(next_pcr, ts_st2->pcr_timer); + } + } + ts->next_pcr = next_pcr; + } +- if (dts != AV_NOPTS_VALUE && (dts - pcr / 300) > delay) { +- /* pcr insert gets priority over null packet insert */ +- if (write_pcr) +- mpegts_insert_pcr_only(s, st); +- else +- mpegts_insert_null_packet(s); +- /* recalculate write_pcr and possibly retransmit si_info */ +- continue; +- } +- } else if (ts_st->pcr_period && pcr != AV_NOPTS_VALUE) { +- if (pcr - ts_st->last_pcr >= ts_st->pcr_period && is_start) { +- ts_st->last_pcr = FFMAX(pcr - ts_st->pcr_period, ts_st->last_pcr + ts_st->pcr_period); ++ } ++ else if (ts_st->pcr_period) { ++ if (pcr >= ts_st->pcr_timer) { ++ ts_st->pcr_timer = pcr + ts_st->pcr_period; + write_pcr = 1; + } + } + ++ if (write_pcr && ts->pcr_stream_pid >= 0) { ++ mpegts_insert_pcr_only(s, 0); ++ continue; ++ } ++ ++ if (ts->mux_rate > 1 && dts != AV_NOPTS_VALUE && ++ (dts - pcr / 300) > ts->delay) { ++ /* pcr insert gets priority over null packet insert */ ++ if (write_pcr) ++ mpegts_insert_pcr_only(s, st); ++ else ++ mpegts_insert_null_packet(s); ++ /* recalculate write_pcr and possibly retransimit si_info */ ++ continue; ++ } ++ + /* prepare packet header */ + q = buf; + *q++ = 0x47; +@@ -1576,7 +1596,6 @@ + if (write_pcr) { + set_af_flag(buf, 0x10); + q = get_ts_payload_start(buf); +- // add 11, pcr references the last byte of program clock reference base + if (dts != AV_NOPTS_VALUE && dts < pcr / 300) + av_log(s, AV_LOG_WARNING, "dts < pcr, TS is invalid\n"); + extend_af(buf, write_pcr_bits(q, pcr)); +@@ -1840,8 +1859,8 @@ + uint8_t *data = NULL; + MpegTSWrite *ts = s->priv_data; + MpegTSWriteStream *ts_st = st->priv_data; +- const int64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE) * 2; +- const int64_t max_audio_delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE) / 2; ++ const int64_t delay_ticks2 = ts->delay * 2; ++ const int64_t max_audio_delay = ts->delay / 2; + int64_t dts = pkt->dts, pts = pkt->pts; + int opus_samples = 0; + size_t side_data_size; +@@ -1861,9 +1880,9 @@ + + if (ts->copyts < 1) { + if (pts != AV_NOPTS_VALUE) +- pts += delay; ++ pts += delay_ticks2; + if (dts != AV_NOPTS_VALUE) +- dts += delay; ++ dts += delay_ticks2; + } + + if (!ts_st->first_timestamp_checked && (pts == AV_NOPTS_VALUE || dts == AV_NOPTS_VALUE)) { +@@ -2262,8 +2281,10 @@ + 0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_SERVICE_TYPE_HEVC_DIGITAL_HDTV }, 0x01, 0xff, ENC, "mpegts_service_type" }, + { "mpegts_pmt_start_pid", "Set the first pid of the PMT.", + OFFSET(pmt_start_pid), AV_OPT_TYPE_INT, { .i64 = 0x1000 }, FIRST_OTHER_PID, LAST_OTHER_PID, ENC }, ++ { "mpegts_pcr_stream_pid", "create seperate PCR stream on this pid.", ++ OFFSET(pcr_stream_pid), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 0x1f00, ENC }, + { "mpegts_start_pid", "Set the first pid.", +- OFFSET(start_pid), AV_OPT_TYPE_INT, { .i64 = 0x0100 }, FIRST_OTHER_PID, LAST_OTHER_PID, ENC }, ++ OFFSET(start_pid), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, LAST_OTHER_PID, ENC }, + { "mpegts_m2ts_mode", "Enable m2ts mode.", OFFSET(m2ts_mode), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, ENC }, + { "muxrate", NULL, OFFSET(mux_rate), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, INT_MAX, ENC }, + { "pes_payload_size", "Minimum PES packet payload in bytes", +@@ -2287,10 +2308,10 @@ + OFFSET(omit_video_pes_length), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, ENC }, + { "pcr_period", "PCR retransmission time in milliseconds", + OFFSET(pcr_period_ms), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, ENC }, +- { "pat_period", "PAT/PMT retransmission time limit in seconds", ++ { "pat_period", "PAT/PMT retransmission time limit in ms, -1 no pat", + OFFSET(pat_period_us), AV_OPT_TYPE_DURATION, { .i64 = PAT_RETRANS_TIME * 1000LL }, 0, INT64_MAX, ENC }, +- { "sdt_period", "SDT retransmission time limit in seconds", +- OFFSET(sdt_period_us), AV_OPT_TYPE_DURATION, { .i64 = SDT_RETRANS_TIME * 1000LL }, 0, INT64_MAX, ENC }, ++ { "sdt_period", "SDT retransmission time limit in ms, -1 no sdt", ++ OFFSET(sdt_period_us), AV_OPT_TYPE_INT64, { .i64 = SDT_RETRANS_TIME * 1000LL }, -1, INT64_MAX, ENC }, + { "nit_period", "NIT retransmission time limit in seconds", + OFFSET(nit_period_us), AV_OPT_TYPE_DURATION, { .i64 = NIT_RETRANS_TIME * 1000LL }, 0, INT64_MAX, ENC }, + { NULL }, +--- a/libavformat/mpegts.h ++++ b/libavformat/mpegts.h +@@ -64,6 +64,7 @@ + /* PID from 0x1FFC to 0x1FFE may be assigned as needed to PMT, elementary + * streams and other data tables */ + #define NULL_PID 0x1FFF /* Null packet (used for fixed bandwidth padding) */ ++#define START_PID 0x0400 + + /* m2ts pids */ + #define M2TS_PMT_PID 0x0100 +--- 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; +--- a/doc/muxers.texi ++++ b/doc/muxers.texi +@@ -1934,7 +1934,8 @@ + Maximum time in seconds between PAT/PMT tables. Default is @code{0.1}. + + @item sdt_period @var{duration} +-Maximum time in seconds between SDT tables. Default is @code{0.5}. ++Maximum time in seconds between SDT tables. Default is @code{0.5}. Regardless ++of this setting no SDT is written in m2ts mode. + + @item nit_period @var{duration} + Maximum time in seconds between NIT tables. Default is @code{0.5}. diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch3 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch3 new file mode 100644 index 00000000..d553a807 --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch3 @@ -0,0 +1,66 @@ +--- a/libavformat/avformat.h ++++ b/libavformat/avformat.h +@@ -499,6 +499,9 @@ + 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 */ + +@@ -670,7 +673,8 @@ + /** + * 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; + +--- a/libavformat/dv.c ++++ b/libavformat/dv.c +@@ -640,6 +640,7 @@ + const 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, +--- a/libavformat/matroskadec.c ++++ b/libavformat/matroskadec.c +@@ -4427,6 +4427,7 @@ + const AVInputFormat ff_webm_dash_manifest_demuxer = { + .name = "webm_dash_manifest", + .long_name = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"), ++ .flags = AVFMT_SEEK_NOSTREAMS, + .priv_class = &webm_dash_class, + .priv_data_size = sizeof(MatroskaDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, +@@ -4439,6 +4440,7 @@ + const 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), + .flags_internal = FF_FMT_INIT_CLEANUP, +--- a/libavformat/seek.c ++++ b/libavformat/seek.c +@@ -600,6 +600,13 @@ + 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-5.1.patch4 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch4 new file mode 100644 index 00000000..722fe2d0 --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch4 @@ -0,0 +1,10 @@ +--- a/libavformat/avidec.c ++++ b/libavformat/avidec.c +@@ -1995,6 +1995,7 @@ + .priv_data_size = sizeof(AVIContext), + .flags_internal = FF_FMT_INIT_CLEANUP, + .extensions = "avi", ++ .flags = AVFMT_SEEK_NOSTREAMS, + .read_probe = avi_probe, + .read_header = avi_read_header, + .read_packet = avi_read_packet, diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch5 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch5 new file mode 100644 index 00000000..64ee262c --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch5 @@ -0,0 +1,25 @@ +--- a/libavfilter/formats.c ++++ b/libavfilter/formats.c +@@ -110,11 +110,13 @@ + 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) ++ if (type == AVMEDIA_TYPE_VIDEO) { + for (i = 0; i < a->nb_formats; i++) { + const AVPixFmtDescriptor *const adesc = av_pix_fmt_desc_get(a->formats[i]); ++ if( !adesc ) continue; + for (j = 0; j < b->nb_formats; j++) { + 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]) { +@@ -123,6 +125,7 @@ + } + } + } ++ } + + // 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-5.1.patch7 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch7 new file mode 100644 index 00000000..17f2f050 --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch7 @@ -0,0 +1,10 @@ +--- a/libavcodec/vdpau_mpeg12.c ++++ a/libavcodec/vdpau_mpeg12.c +@@ -116,6 +116,7 @@ + .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-5.1.patch8 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch8 new file mode 100644 index 00000000..1a9476c7 --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch8 @@ -0,0 +1,11 @@ +--- a/libavcodec/h263dec.c ++++ b/libavcodec/h263dec.c +@@ -685,7 +685,7 @@ + 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-5.1.patch9 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch9 new file mode 100644 index 00000000..40eb4f1a --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch9 @@ -0,0 +1,14 @@ +--- a/libavformat/mpegenc.c ++++ b/libavformat/mpegenc.c +@@ -976,9 +976,9 @@ + 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-5.1.patchB b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchB new file mode 100644 index 00000000..89e99896 --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchB @@ -0,0 +1,22 @@ +--- a/libavutil/hwcontext_vdpau.c ++++ b/libavutil/hwcontext_vdpau.c +@@ -47,6 +47,11 @@ + { 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 }, +@@ -71,6 +76,7 @@ + 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 diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchC b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchC new file mode 100644 index 00000000..bce5202e --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchC @@ -0,0 +1,41 @@ +--- a/libavcodec/encode.c ++++ b/libavcodec/encode.c +@@ -191,7 +191,7 @@ + } + + if (!frame->buf[0]) { +- if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY || ++ if (avci->draining && !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY || + (avci->frame_thread_encoder && avctx->active_thread_type & FF_THREAD_FRAME))) + return AVERROR_EOF; + +@@ -243,8 +243,10 @@ + avpkt->flags |= avci->intra_only_flag; + } + +- if (avci->draining && !got_packet) ++ if (avci->draining && !got_packet) { ++ fflush(stderr); + avci->draining_done = 1; ++ } + + end: + if (ret < 0 || !got_packet) +@@ -365,10 +367,16 @@ + if (avci->draining) + return AVERROR_EOF; + +- if (avci->buffer_frame->buf[0]) ++ if (avci->buffer_frame->buf[0]) { ++ if (!frame) { ++ fflush(stderr); ++ av_frame_unref(avci->buffer_frame); ++ } + return AVERROR(EAGAIN); ++ } + + if (!frame) { ++ fflush(stderr); + avci->draining = 1; + } else { + ret = encode_send_frame_internal(avctx, frame); diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchZ1 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchZ1 new file mode 100644 index 00000000..e6f708da --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchZ1 @@ -0,0 +1,55 @@ +--- a/libavcodec/wrapped_avframe.c ++++ b/libavcodec/wrapped_avframe.c +@@ -33,6 +33,38 @@ + #include "libavutil/buffer.h" + #include "libavutil/pixdesc.h" + ++ ++ ++static const enum AVPixelFormat pix_fmts_all[] = { ++ AV_PIX_FMT_YUV411P, ++ AV_PIX_FMT_YUV420P, ++ AV_PIX_FMT_YUVJ420P, ++ AV_PIX_FMT_YUV422P, ++ AV_PIX_FMT_YUVJ422P, ++ AV_PIX_FMT_YUV444P, ++ AV_PIX_FMT_YUVJ444P, ++ AV_PIX_FMT_YUV420P10, ++ AV_PIX_FMT_YUV422P10, ++ AV_PIX_FMT_YUV444P10, ++ AV_PIX_FMT_YUV420P12, ++ AV_PIX_FMT_YUV422P12, ++ AV_PIX_FMT_YUV444P12, ++ AV_PIX_FMT_YUV420P14, ++ AV_PIX_FMT_YUV422P14, ++ AV_PIX_FMT_YUV444P14, ++ AV_PIX_FMT_YUV420P16, ++ AV_PIX_FMT_YUV422P16, ++ AV_PIX_FMT_YUV444P16, ++ AV_PIX_FMT_GRAY8, ++ AV_PIX_FMT_GRAY9, ++ AV_PIX_FMT_GRAY10, ++ AV_PIX_FMT_GRAY12, ++ AV_PIX_FMT_GRAY16, ++ AV_PIX_FMT_NONE ++}; ++ ++ ++ + static void wrapped_avframe_release_buffer(void *unused, uint8_t *data) + { + AVFrame *frame = (AVFrame *)data; +@@ -109,6 +141,7 @@ + .p.id = AV_CODEC_ID_WRAPPED_AVFRAME, + FF_CODEC_ENCODE_CB(wrapped_avframe_encode), + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, ++ .p.pix_fmts = pix_fmts_all, + }; + + const FFCodec ff_wrapped_avframe_decoder = { +@@ -118,4 +151,5 @@ + .p.id = AV_CODEC_ID_WRAPPED_AVFRAME, + FF_CODEC_DECODE_CB(wrapped_avframe_decode), + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, ++ + }; diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchZ2 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchZ2 new file mode 100644 index 00000000..2d8ede6d --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchZ2 @@ -0,0 +1,11 @@ +--- a/libavformat/yuv4mpegenc.c ++++ b/libavformat/yuv4mpegenc.c +@@ -259,7 +259,7 @@ + av_log(s, AV_LOG_ERROR, "'%s' is not an official yuv4mpegpipe pixel format. " + "Use '-strict -1' to encode to this pixel format.\n", + av_get_pix_fmt_name(s->streams[0]->codecpar->format)); +- return AVERROR(EINVAL); ++ //return AVERROR(EINVAL); + } + av_log(s, AV_LOG_WARNING, "Warning: generating non standard YUV stream. " + "Mjpegtools will not work.\n"); diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.tar.xz b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.tar.xz new file mode 100644 index 00000000..b832184c Binary files /dev/null and b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.tar.xz differ