Re: [FFmpeg-devel] [PATCH 6/8] avcodec/jpeglsenc: Avoid allocation of JLSState
On Sat, Sep 05, 2020 at 01:17:14AM +0200, Andreas Rheinhardt wrote: > This state is currently allocated and freed for every packet; but it can > just be moved to the stack instead. > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/jpeglsenc.c | 26 ++ > 1 file changed, 10 insertions(+), 16 deletions(-) > LGTM ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [FFmpeg-user] ffplay.exe leaves fullscreen mode and iconifies when losing focus
Dear all, I could identify the reason for the behaviour. In FFmpeg-master\libavdevice\gdigrab.c, gdigrab_region_wnd_init() *WS_POPUP *is used for CreateWindowEx(), Why? WS_POPUP is not expected for main windows. Is it possible to fix this? Best regards, Norbert /** * Initialize the region outline window. * * @param s1 The format context. * @param gdigrab gdigrab context. * @return 0 success, !0 failure */ static int gdigrab_region_wnd_init(AVFormatContext *s1, struct gdigrab *gdigrab) { HWND hwnd; RECT rect = gdigrab->clip_rect; HRGN region = NULL; HRGN region_interior = NULL; DWORD style = *WS_POPUP *| WS_VISIBLE; DWORD ex = WS_EX_TOOLWINDOW | WS_EX_TOPMOST | WS_EX_TRANSPARENT; rect.left -= REGION_WND_BORDER; rect.top -= REGION_WND_BORDER; rect.right += REGION_WND_BORDER; rect.bottom += REGION_WND_BORDER; AdjustWindowRectEx(&rect, style, FALSE, ex); // Create a window with no owner; use WC_DIALOG instead of writing a custom // window class hwnd = CreateWindowEx(ex, WC_DIALOG, NULL, style, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, NULL, NULL); Am 31.08.2020 um 11:40 schrieb Paul B Mahol: On 8/31/20, Norbert Marouschek wrote: Dear Developers, I would like to use ffplay.exe in may application to play video files and to show live video sources. Thank you for that great application that covers all these possibilities! However as soon as ffplay.exe loses the input focus the fullscreen window of ffplay is iconified. I aloready reviewed the source code (event loop) but was notz abel to identify the handling that causes that behaviour. Is it possible to change the behaviour so that ffplay stays maximised even if the focus is lost or the ffplay windows is covered by an other window? Possibly by using a command line option? I think that depends on underlying SDL library. Best regards, Norbert Marouschek. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 5/8] avcodec/jpeglsenc: Remove redundant av_packet_unref()
On Sat, Sep 05, 2020 at 01:17:13AM +0200, Andreas Rheinhardt wrote: > If encoding fails, the AVPacket that ought to contain the encoded packet > is already unreferenced generically. > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/jpeglsenc.c | 1 - > 1 file changed, 1 deletion(-) > lgtm > diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c > index d05fe4564b..b1e54431e9 100644 > --- a/libavcodec/jpeglsenc.c > +++ b/libavcodec/jpeglsenc.c > @@ -431,7 +431,6 @@ FF_ENABLE_DEPRECATION_WARNINGS > return 0; > > memfail: > -av_packet_unref(pkt); > av_freep(&buf2); > av_freep(&state); > av_freep(&last); > -- > 2.20.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH]lavf/img2dec: Autodetect Photo CD images
Am Do., 20. Dez. 2018 um 01:00 Uhr schrieb Carl Eugen Hoyos : > Attached patch depends on Paul's PhotoCD decoder. Patch applied. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/dashdec: only limit DASH manifest size according to AVBprint limits
On Sat, Sep 5, 2020 at 1:12 AM Steven Liu wrote: > > Jan Ekström 于2020年9月4日周五 上午2:33写道: > > > > Currently the API is internally limited to unsigned integers, so if we > > limit the file size as well as the amount to read to UINT_MAX - 1, we > > do not require additional limiting to be performed on the values. > > > > This change is based on the fact that initially the 8*1024 value added > > in 96d70694aea64616c68db8be306c159c73fb3980 was only for the case where > > the file size was not known. It was not a maximum file size limit. > > > > In 29121188983932f79aef8501652630d322a9974c this was reworked to be > > a maximum manifest file size limit, while its commit message appears > > to only note that it added support for larger manifest file sizes. > > > > This should enable various unfortunately large MPEG-DASH manifests, > > such as Youtube's multi-megabyte live stream archives to load up > > as well as bring back the original intent of the logic. > > --- > > libavformat/dashdec.c | 10 ++ > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c > > index c5a5ff607b..1e9985f32c 100644 > > --- a/libavformat/dashdec.c > > +++ b/libavformat/dashdec.c > > @@ -29,7 +29,7 @@ > > #include "dash.h" > > > > #define INITIAL_BUFFER_SIZE 32768 > > -#define MAX_MANIFEST_SIZE 50 * 1024 > > +#define MAX_BPRINT_READ_SIZE (UINT_MAX - 1) > > #define DEFAULT_MANIFEST_SIZE 8 * 1024 > > > > struct fragment { > > @@ -1256,14 +1256,16 @@ static int parse_manifest(AVFormatContext *s, const > > char *url, AVIOContext *in) > > } > > > > filesize = avio_size(in); > > -if (filesize > MAX_MANIFEST_SIZE) { > > +filesize = filesize > 0 ? filesize : DEFAULT_MANIFEST_SIZE; > > + > > +if (filesize > MAX_BPRINT_READ_SIZE) { > > av_log(s, AV_LOG_ERROR, "Manifest too large: %"PRId64"\n", > > filesize); > > return AVERROR_INVALIDDATA; > > } > > > > -av_bprint_init(&buf, (filesize > 0) ? filesize + 1 : > > DEFAULT_MANIFEST_SIZE, AV_BPRINT_SIZE_UNLIMITED); > > +av_bprint_init(&buf, filesize + 1, AV_BPRINT_SIZE_UNLIMITED); > > > > -if ((ret = avio_read_to_bprint(in, &buf, MAX_MANIFEST_SIZE)) < 0 || > > +if ((ret = avio_read_to_bprint(in, &buf, MAX_BPRINT_READ_SIZE)) < 0 || > > !avio_feof(in) || > > (filesize = buf.len) == 0) { > > av_log(s, AV_LOG_ERROR, "Unable to read to manifest '%s'\n", url); > > -- > > 2.26.2 > > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > > Not proficient in English, but code looks ok. :D > > > Thanks jeeb > > > Steven Thanks, applied as 3249c757aed678780e22e99a1a49f4672851bca9 with the updated commit message. Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/argo_asf: fix handling of v1.1 files
Version 1.1 (FX Fighter) files all have a sample rate of 44100 in the header, but only play back correctly at 22050. Force the sample rate to 22050 when reading, and restrict it when muxing. Signed-off-by: Zane van Iperen --- libavformat/argo_asf.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c index 37ad2bf5e9..bf9b5d0c0a 100644 --- a/libavformat/argo_asf.c +++ b/libavformat/argo_asf.c @@ -187,7 +187,11 @@ static int argo_asf_read_header(AVFormatContext *s) st->codecpar->channels = 1; } -st->codecpar->sample_rate = asf->ckhdr.sample_rate; +/* v1.1 files (FX Fighter) are all marked as 44100, but are actually 22050. */ +if (asf->fhdr.version_major == 1 && asf->fhdr.version_minor == 1) +st->codecpar->sample_rate = 22050; +else +st->codecpar->sample_rate = asf->ckhdr.sample_rate; st->codecpar->bits_per_coded_sample = 4; @@ -264,6 +268,7 @@ AVInputFormat ff_argo_asf_demuxer = { #if CONFIG_ARGO_ASF_MUXER static int argo_asf_write_init(AVFormatContext *s) { +ArgoASFMuxContext *ctx = s->priv_data; const AVCodecParameters *par; if (s->nb_streams != 1) { @@ -279,6 +284,11 @@ static int argo_asf_write_init(AVFormatContext *s) return AVERROR(EINVAL); } +if (ctx->version_major == 1 && ctx->version_minor == 1 && par->sample_rate != 22050) { +av_log(s, AV_LOG_ERROR, "ASF v1.1 files only support a sample rate of 22050\n"); +return AVERROR(EINVAL); +} + if (par->channels > 2) { av_log(s, AV_LOG_ERROR, "ASF files only support up to 2 channels\n"); return AVERROR(EINVAL); @@ -351,7 +361,12 @@ static int argo_asf_write_header(AVFormatContext *s) chdr.num_blocks= 0; chdr.num_samples = ASF_SAMPLE_COUNT; chdr.unk1 = 0; -chdr.sample_rate = par->sample_rate; + +if (ctx->version_major == 1 && ctx->version_minor == 1) +chdr.sample_rate = 44100; +else +chdr.sample_rate = par->sample_rate; + chdr.unk2 = ~0; chdr.flags = ASF_CF_BITS_PER_SAMPLE | ASF_CF_ALWAYS1; -- 2.25.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avformat/avidec: Fix io_fsize overflow
On Mon, Jun 22, 2020 at 12:36:18AM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: 7958120835074169528 * 9 cannot be represented > in type 'long long' > Fixes: > 23382/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6230683226996736 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/avidec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) will apply patchset [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB You can kill me, but you cannot change the truth. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 4/4] avcodec/tdsc: Only reallocate deflatebuffer if its size changed
On Thu, Jun 18, 2020 at 02:20:26PM +0200, Michael Niedermayer wrote: > Fixes: Timeout (47sec -> 35msec) > Fixes: > 23375/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TDSC_fuzzer-5633949497032704 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/tdsc.c | 13 + > 1 file changed, 9 insertions(+), 4 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are best at talking, realize last or never when they are wrong. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 7/8] avcodec/jpeglsenc: Allocate buffers together
On Sat, Sep 05, 2020 at 01:17:15AM +0200, Andreas Rheinhardt wrote: > Having only one allocation that is not automatically freed in particular > means that one does not need to free the already allocated buffers > when allocating another one fails. > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/jpeglsenc.c | 25 +++-- > 1 file changed, 7 insertions(+), 18 deletions(-) > Looks ok. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH]lavc/tiff: Do not fail for an ICC profile with invalid type
Hi! Attached patch fixes ticket 8884. Please comment, Carl Eugen From 0f7a5c6d2c739119ceb50fd8efd570807b8c7eb5 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 5 Sep 2020 19:22:54 +0200 Subject: [PATCH] lavc/tiff: Do not fail for an ICC profile with invalid type. Fixes ticket #8884. --- libavcodec/tiff.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 8a42e677ce..81e9a60bdf 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1682,8 +1682,10 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) } break; case TIFF_ICC_PROFILE: -if (type != TIFF_UNDEFINED) -return AVERROR_INVALIDDATA; +if (type != TIFF_UNDEFINED) { +av_log(s->avctx, AV_LOG_WARNING, "Invalid ICC profile type %d\n", type); +break; +} gb_temp = s->gb; bytestream2_seek(&gb_temp, SEEK_SET, off); -- 2.24.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/8] avutil/timecode: fix av_timecode_get_smpte_from_framenum with 50/60 fps
SMPTE 12M timecode can only count frames up to 39, because the tens-of-frames value is stored in 2 bit. In order to resolve this 50/60 fps SMPTE timecode is using the field bit (which is the same bit as the phase correction bit) to signal the least significant bit of a 50/60 fps timecode. See SMPTE ST 12-1:2014 section 12.1. Therefore we slightly change the format of the return value of av_timecode_get_smpte_from_framenum and AV_FRAME_DATA_S12M_TIMECODE and start using the previously unused Phase Correction bit as Field bit. (As the SMPTE standard suggests) We add 50/60 fps support to av_timecode_get_smpte_from_framenum by calling the recently added av_timecode_get_smpte function in it which already handles this properly. This change affects the decklink indev and the DV and MXF muxers. MXF has no fate test for 50/60fps content, DV does, therefore the changes. MediaInfo (a recent version) confirms that half-frame timecode must be inserted to DV. MXFInspect confirms valid timecode insertion to the System Item of MXF files. For MXF, also see EBU R122. Note that for DV the field flag is not used because in the HDV specs (SMPTE 370M) it is still defined as biphase mark polarity correction flag. So it should not matter that the DV muxer overrides the field bit. Signed-off-by: Marton Balint --- libavutil/timecode.c | 15 +-- libavutil/timecode.h | 7 +++ tests/ref/vsynth/vsynth1-dv-hd | 2 +- tests/ref/vsynth/vsynth2-dv-hd | 2 +- tests/ref/vsynth/vsynth3-dv-hd | 2 +- tests/ref/vsynth/vsynth_lena-dv-hd | 2 +- 6 files changed, 8 insertions(+), 22 deletions(-) diff --git a/libavutil/timecode.c b/libavutil/timecode.c index cca53d73c4..cb916970ef 100644 --- a/libavutil/timecode.c +++ b/libavutil/timecode.c @@ -65,20 +65,7 @@ uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum) ss = framenum / fps % 60; mm = framenum / (fps*60) % 60; hh = framenum / (fps*3600) % 24; -return 0 << 31 | // color frame flag (0: unsync mode, 1: sync mode) - drop << 30 | // drop frame flag (0: non drop,1: drop) - (ff / 10) << 28 | // tens of frames - (ff % 10) << 24 | // units of frames - 0 << 23 | // PC (NTSC) or BGF0 (PAL) - (ss / 10) << 20 | // tens of seconds - (ss % 10) << 16 | // units of seconds - 0 << 15 | // BGF0 (NTSC) or BGF2 (PAL) - (mm / 10) << 12 | // tens of minutes - (mm % 10) << 8 | // units of minutes - 0 << 7 | // BGF2 (NTSC) or PC (PAL) - 0 << 6 | // BGF1 - (hh / 10) << 4 | // tens of hours - (hh % 10);// units of hours +return av_timecode_get_smpte(tc->rate, drop, hh, mm, ss, ff); } uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff) diff --git a/libavutil/timecode.h b/libavutil/timecode.h index 5801330921..e54b116e93 100644 --- a/libavutil/timecode.h +++ b/libavutil/timecode.h @@ -66,11 +66,11 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps); * the format description as follows: * bits 0-5: hours, in BCD(6bits) * bits 6: BGF1 - * bits 7: BGF2 (NTSC) or PC (PAL) + * bits 7: BGF2 (NTSC) or FIELD (PAL) * bits 8-14: minutes, in BCD(7bits) * bits 15:BGF0 (NTSC) or BGF2 (PAL) * bits 16-22: seconds, in BCD(7bits) - * bits 23:PC (NTSC) or BGF0 (PAL) + * bits 23:FIELD (NTSC) or BGF0 (PAL) * bits 24-29: frames, in BCD(6bits) * bits 30:drop frame flag (0: non drop,1: drop) * bits 31:color frame flag (0: unsync mode, 1: sync mode) @@ -78,8 +78,7 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps); * @note Frame number adjustment is automatically done in case of drop timecode, * you do NOT have to call av_timecode_adjust_ntsc_framenum2(). * @note The frame number is relative to tc->start. - * @note Color frame (CF), binary group flags (BGF) and biphase mark polarity - * correction (PC) bits are set to zero. + * @note Color frame (CF) and binary group flags (BGF) bits are set to zero. */ uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum); diff --git a/tests/ref/vsynth/vsynth1-dv-hd b/tests/ref/vsynth/vsynth1-dv-hd index 6b6d6e8159..3f2f9cc843 100644 --- a/tests/ref/vsynth/vsynth1-dv-hd +++ b/tests/ref/vsynth/vsynth1-dv-hd @@ -1,4 +1,4 @@ -22d1d62a834fe8416fe79c51760012c1 *tests/data/fate/vsynth1-dv-hd.dv +b2bcafc74dec5f9ca516cb25dd07459b *tests/data/fate/vsynth1-dv-hd.dv 1440 tests/data/fate/vsynth1-dv-hd.dv 34b78cf725346c7f819c9d6209b8299a *tests/data/fate/vsynth1-dv-hd.out.rawvideo stddev:4.30 PSNR: 35.45 MAXDIFF: 74 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-dv-hd b/tests/ref/vsynth/vsynth2-dv-hd index c6dcb5a953..0a5046e4ec 100644 --- a/tests/ref/vsynth/vsynth2-dv-hd +++ b/tests/ref/vsynth/vsynt
[FFmpeg-devel] [PATCH 4/8] avutil/timecode: add av_timecode_make_smpte_tc_string2
Signed-off-by: Marton Balint --- doc/APIchanges | 3 +++ libavutil/timecode.c | 19 ++- libavutil/timecode.h | 17 + libavutil/version.h | 2 +- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 0054908e1e..e2d7369c83 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2020-09-xx - xx - lavu 56.59.100 - timecode.h + Add av_timecode_make_smpte_tc_string2. + 2020-08-21 - xx - lavu 56.58.100 - avstring.h Deprecate av_d2str(). Use av_asprintf() instead. diff --git a/libavutil/timecode.c b/libavutil/timecode.c index 806638ddfc..f2db21c52c 100644 --- a/libavutil/timecode.c +++ b/libavutil/timecode.c @@ -136,16 +136,33 @@ static unsigned bcd2uint(uint8_t bcd) return low + 10*high; } -char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df) +char *av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field) { unsigned hh = bcd2uint(tcsmpte & 0x3f);// 6-bit hours unsigned mm = bcd2uint(tcsmpte>>8 & 0x7f);// 7-bit minutes unsigned ss = bcd2uint(tcsmpte>>16 & 0x7f);// 7-bit seconds unsigned ff = bcd2uint(tcsmpte>>24 & 0x3f);// 6-bit frames unsigned drop = tcsmpte & 1<<30 && !prevent_df; // 1-bit drop if not arbitrary bit + +if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) { +ff <<= 1; +if (!skip_field) { +if (av_cmp_q(rate, (AVRational) {50, 1}) == 0) +ff += !!(tcsmpte & 1 << 7); +else +ff += !!(tcsmpte & 1 << 23); +} +} + snprintf(buf, AV_TIMECODE_STR_SIZE, "%02u:%02u:%02u%c%02u", hh, mm, ss, drop ? ';' : ':', ff); return buf; + +} + +char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df) +{ +return av_timecode_make_smpte_tc_string2(buf, (AVRational){30, 1}, tcsmpte, prevent_df, 1); } char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit) diff --git a/libavutil/timecode.h b/libavutil/timecode.h index e54b116e93..f9471a6e38 100644 --- a/libavutil/timecode.h +++ b/libavutil/timecode.h @@ -109,6 +109,23 @@ uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss */ char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum); +/** + * Get the timecode string from the SMPTE timecode format. + * + * In contrast to av_timecode_make_smpte_tc_string this function supports 50/60 + * fps timecodes by using the field bit. + * + * @param bufdestination buffer, must be at least AV_TIMECODE_STR_SIZE long + * @param rate frame rate of the timecode + * @param tcsmptethe 32-bit SMPTE timecode + * @param prevent_df prevent the use of a drop flag when it is known the DF bit + * is arbitrary + * @param skip_field prevent the use of a field flag when it is known the field + * bit is arbitrary (e.g. because it is used as PC flag) + * @return the buf parameter + */ +char *av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field); + /** * Get the timecode string from the SMPTE timecode format. * diff --git a/libavutil/version.h b/libavutil/version.h index 3f0a4a8402..7028bd2c88 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 58 +#define LIBAVUTIL_VERSION_MINOR 59 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.26.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/8] avutil/timecode: do not trash bits on invalid av_timecode_get_smpte arguments
The function has no way to return error, so let's clip or calculate modulo. Signed-off-by: Marton Balint --- libavutil/timecode.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavutil/timecode.c b/libavutil/timecode.c index c0956adadb..806638ddfc 100644 --- a/libavutil/timecode.c +++ b/libavutil/timecode.c @@ -84,6 +84,11 @@ uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss ff /= 2; } +hh = hh % 24; +mm = av_clip(mm, 0, 59); +ss = av_clip(ss, 0, 59); +ff = ff % 40; + tc |= drop << 30; tc |= (ff / 10) << 28; tc |= (ff % 10) << 24; -- 2.26.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/8] avutil/timecode: cosmetics on av_timecode_get_smpte
Signed-off-by: Marton Balint --- libavutil/timecode.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavutil/timecode.c b/libavutil/timecode.c index cb916970ef..c0956adadb 100644 --- a/libavutil/timecode.c +++ b/libavutil/timecode.c @@ -71,31 +71,28 @@ uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum) uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff) { uint32_t tc = 0; -uint32_t frames; /* For SMPTE 12-M timecodes, frame count is a special case if > 30 FPS. See SMPTE ST 12-1:2014 Sec 12.1 for more info. */ if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) { -frames = ff / 2; if (ff % 2 == 1) { if (av_cmp_q(rate, (AVRational) {50, 1}) == 0) tc |= (1 << 7); else tc |= (1 << 23); } -} else { -frames = ff; +ff /= 2; } tc |= drop << 30; -tc |= (frames / 10) << 28; -tc |= (frames % 10) << 24; +tc |= (ff / 10) << 28; +tc |= (ff % 10) << 24; tc |= (ss / 10) << 20; tc |= (ss % 10) << 16; tc |= (mm / 10) << 12; tc |= (mm % 10) << 8; tc |= (hh / 10) << 4; -tc |= (hh % 10); +tc |= (hh % 10); return tc; } -- 2.26.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/8] fftools/ffprobe: use av_timecode_make_smpte_tc_string2
Signed-off-by: Marton Balint --- fftools/ffprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index d4e494f11f..86bd23d36d 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2225,7 +2225,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, writer_print_section_header(w, SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST); for (int j = 1; j <= m ; j++) { char tcbuf[AV_TIMECODE_STR_SIZE]; -av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0); +av_timecode_make_smpte_tc_string2(tcbuf, stream->avg_frame_rate, tc[j], 0, 0); writer_print_section_header(w, SECTION_ID_FRAME_SIDE_DATA_TIMECODE); print_str("value", tcbuf); writer_print_section_footer(w); -- 2.26.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 8/8] avformat: use av_timecode_make_smpte_tc_string2
WSD format has no frames stored for playback time. Signed-off-by: Marton Balint --- libavformat/dump.c | 6 +++--- libavformat/dv.c | 2 +- libavformat/wsddec.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/dump.c b/libavformat/dump.c index 6d29d85d1f..fe628010d3 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -408,7 +408,7 @@ static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd) dovi->dv_bl_signal_compatibility_id); } -static void dump_s12m_timecode(void *ctx, const AVPacketSideData *sd) +static void dump_s12m_timecode(void *ctx, const AVStream *st, const AVPacketSideData *sd) { const uint32_t *tc = (const uint32_t *)sd->data; @@ -419,7 +419,7 @@ static void dump_s12m_timecode(void *ctx, const AVPacketSideData *sd) for (int j = 1; j <= tc[0]; j++) { char tcbuf[AV_TIMECODE_STR_SIZE]; -av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0); +av_timecode_make_smpte_tc_string2(tcbuf, st->avg_frame_rate, tc[j], 0, 0); av_log(ctx, AV_LOG_INFO, "timecode - %s%s", tcbuf, j != tc[0] ? ", " : ""); } } @@ -492,7 +492,7 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent) break; case AV_PKT_DATA_S12M_TIMECODE: av_log(ctx, AV_LOG_INFO, "SMPTE ST 12-1:2014: "); -dump_s12m_timecode(ctx, sd); +dump_s12m_timecode(ctx, st, sd); break; default: av_log(ctx, AV_LOG_INFO, diff --git a/libavformat/dv.c b/libavformat/dv.c index d25641daac..3e0d12c0e3 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -315,7 +315,7 @@ static int dv_extract_timecode(DVDemuxContext* c, const uint8_t* frame, char *tc tc_pack = dv_extract_pack(frame, dv_timecode); if (!tc_pack) return 0; -av_timecode_make_smpte_tc_string(tc, AV_RB32(tc_pack + 1), prevent_df); +av_timecode_make_smpte_tc_string2(tc, av_inv_q(c->sys->time_base), AV_RB32(tc_pack + 1), prevent_df, 1); return 1; } diff --git a/libavformat/wsddec.c b/libavformat/wsddec.c index 2313b0ec4b..74db6acdab 100644 --- a/libavformat/wsddec.c +++ b/libavformat/wsddec.c @@ -120,7 +120,7 @@ static int wsd_read_header(AVFormatContext *s) } avio_skip(pb, 4); -av_timecode_make_smpte_tc_string(playback_time, avio_rb32(pb), 0); +av_timecode_make_smpte_tc_string2(playback_time, (AVRational){1,1}, avio_rb32(pb) & 0x00ffU, 1, 1); av_dict_set(&s->metadata, "playback_time", playback_time, 0); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -- 2.26.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 7/8] avfilter/vf_showinfo: use av_timecode_make_smpte_tc_string2
Signed-off-by: Marton Balint --- libavfilter/vf_showinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index 1be939614d..c63e6f075f 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -114,7 +114,7 @@ static void dump_stereo3d(AVFilterContext *ctx, AVFrameSideData *sd) av_log(ctx, AV_LOG_INFO, " (inverted)"); } -static void dump_s12m_timecode(AVFilterContext *ctx, AVFrameSideData *sd) +static void dump_s12m_timecode(AVFilterContext *ctx, AVFilterLink *link, AVFrameSideData *sd) { const uint32_t *tc = (const uint32_t *)sd->data; @@ -125,7 +125,7 @@ static void dump_s12m_timecode(AVFilterContext *ctx, AVFrameSideData *sd) for (int j = 1; j <= tc[0]; j++) { char tcbuf[AV_TIMECODE_STR_SIZE]; -av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0); +av_timecode_make_smpte_tc_string2(tcbuf, link->frame_rate, tc[j], 0, 0); av_log(ctx, AV_LOG_INFO, "timecode - %s%s", tcbuf, j != tc[0] ? ", " : ""); } } @@ -380,7 +380,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) dump_stereo3d(ctx, sd); break; case AV_FRAME_DATA_S12M_TIMECODE: { -dump_s12m_timecode(ctx, sd); +dump_s12m_timecode(ctx, inlink, sd); break; } case AV_FRAME_DATA_DISPLAYMATRIX: -- 2.26.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 6/8] avcodec: use av_timecode_make_smpte_tc_string2 in hevc and h264 decoder
Signed-off-by: Marton Balint --- libavcodec/h264_slice.c | 2 +- libavcodec/hevcdec.c| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index c7b2764270..cfc29e186c 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1325,7 +1325,7 @@ static int h264_export_frame_props(H264Context *h) int ff = h->sei.picture_timing.timecode[i].frame; tc_sd[i + 1] = av_timecode_get_smpte(h->avctx->framerate, drop, hh, mm, ss, ff); -av_timecode_make_smpte_tc_string(tcbuf, tc_sd[i + 1], 0); +av_timecode_make_smpte_tc_string2(tcbuf, h->avctx->framerate, tc_sd[i + 1], 0, 0); av_dict_set(&out->metadata, "timecode", tcbuf, 0); } h->sei.picture_timing.timecode_cnt = 0; diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index b77df8d89f..c1de75abe1 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2843,7 +2843,7 @@ static int set_side_data(HEVCContext *s) int ff = s->sei.timecode.n_frames[i]; tc_sd[i + 1] = av_timecode_get_smpte(s->avctx->framerate, drop, hh, mm, ss, ff); -av_timecode_make_smpte_tc_string(tcbuf, tc_sd[i + 1], 0); +av_timecode_make_smpte_tc_string2(tcbuf, s->avctx->framerate, tc_sd[i + 1], 0, 0); av_dict_set(&out->metadata, "timecode", tcbuf, 0); } -- 2.26.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH]lavfi/vflip: Support Bayer vertical flip
Hi! Attached patch fixes ticket #8819. Please comment, Carl Eugen From 61f4e419cbeae3d0adb726578bc1c8d87fb0c50b Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 5 Sep 2020 21:14:01 +0200 Subject: [PATCH] lavfi/vflip: Support Bayer vertical flip. Fixes ticket #8819. --- libavfilter/vf_vflip.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c index c7c39d3341..fb729142ab 100644 --- a/libavfilter/vf_vflip.c +++ b/libavfilter/vf_vflip.c @@ -33,6 +33,7 @@ typedef struct FlipContext { const AVClass *class; int vsub; ///< vertical chroma subsampling +int bayer; } FlipContext; static const AVOption vflip_options[] = { @@ -47,6 +48,7 @@ static int config_input(AVFilterLink *link) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); flip->vsub = desc->log2_chroma_h; +flip->bayer = !!(desc->flags & AV_PIX_FMT_FLAG_BAYER); return 0; } @@ -74,11 +76,44 @@ static AVFrame *get_video_buffer(AVFilterLink *link, int w, int h) return frame; } +static int flip_bayer(AVFilterLink *link, AVFrame *in) +{ +AVFilterContext *ctx = link->dst; +AVFilterLink *outlink = ctx->outputs[0]; +AVFrame *out; +uint8_t *inrow = in->data[0], *outrow; +int width, i, is16 = av_pix_fmt_desc_get(link->format)->comp[0].step > 1; +if (outlink->h & 1) { +av_log(ctx, AV_LOG_ERROR, "Bayer vertical flip needs even height\n"); +return AVERROR_INVALIDDATA; +} + +width = outlink->w << is16; +out = ff_get_video_buffer(outlink, outlink->w, outlink->h); +if (!out) { +av_frame_free(&in); +return AVERROR(ENOMEM); +} +av_frame_copy_props(out, in); +outrow = out->data[0] + out->linesize[0] * (outlink->h - 2); +for (i = 0; i < outlink->h >> 1; i++) { +memcpy(outrow, inrow, width); +memcpy(outrow + out->linesize[0], inrow + in->linesize[0], width); +inrow += 2 * in->linesize[0]; +outrow -= 2 * out->linesize[0]; +} +av_frame_free(&in); +return ff_filter_frame(outlink, out); +} + static int filter_frame(AVFilterLink *link, AVFrame *frame) { FlipContext *flip = link->dst->priv; int i; +if (flip->bayer) +return flip_bayer(link, frame); + for (i = 0; i < 4; i ++) { int vsub = i == 1 || i == 2 ? flip->vsub : 0; int height = AV_CEIL_RSHIFT(link->h, vsub); -- 2.24.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter/vf_lut3d: support remaping negative values in the prelut
From: Mark Reid --- libavfilter/vf_lut3d.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c index 6730a424ce..988f6c8b55 100644 --- a/libavfilter/vf_lut3d.c +++ b/libavfilter/vf_lut3d.c @@ -878,18 +878,16 @@ static int parse_cinespace(AVFilterContext *ctx, FILE *f) prelut_sizes[i] = npoints; in_min[i] = FLT_MAX; -in_max[i] = FLT_MIN; +in_max[i] = -FLT_MAX; out_min[i] = FLT_MAX; -out_max[i] = FLT_MIN; - -last = FLT_MIN; +out_max[i] = -FLT_MAX; for (int j = 0; j < npoints; j++) { NEXT_FLOAT_OR_GOTO(v, end) in_min[i] = FFMIN(in_min[i], v); in_max[i] = FFMAX(in_max[i], v); in_prelut[i][j] = v; -if (v < last) { +if (j > 0 && v < last) { av_log(ctx, AV_LOG_ERROR, "Invalid file, non increasing prelut.\n"); ret = AVERROR(ENOMEM); goto end; -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avfilter/vf_lut3d: support remaping negative values in the prelut
On Sat, Sep 5, 2020 at 2:13 PM wrote: > From: Mark Reid > > --- > libavfilter/vf_lut3d.c | 8 +++- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c > index 6730a424ce..988f6c8b55 100644 > --- a/libavfilter/vf_lut3d.c > +++ b/libavfilter/vf_lut3d.c > @@ -878,18 +878,16 @@ static int parse_cinespace(AVFilterContext *ctx, > FILE *f) > > prelut_sizes[i] = npoints; > in_min[i] = FLT_MAX; > -in_max[i] = FLT_MIN; > +in_max[i] = -FLT_MAX; > out_min[i] = FLT_MAX; > -out_max[i] = FLT_MIN; > - > -last = FLT_MIN; > +out_max[i] = -FLT_MAX; > > for (int j = 0; j < npoints; j++) { > NEXT_FLOAT_OR_GOTO(v, end) > in_min[i] = FFMIN(in_min[i], v); > in_max[i] = FFMAX(in_max[i], v); > in_prelut[i][j] = v; > -if (v < last) { > +if (j > 0 && v < last) { > av_log(ctx, AV_LOG_ERROR, "Invalid file, non > increasing prelut.\n"); > ret = AVERROR(ENOMEM); > goto end; > -- > 2.27.0 > > Sorry I meant to include this in the email. Here is a sample cinespace lut that remaps negative values in the prelut https://www.dropbox.com/s/7e4j7r264y0bueu/log_prelut.csp ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH]lavc/tiff: Do not fail for an ICC profile with invalid type
Sep 5, 2020, 18:24 by ceffm...@gmail.com: > Hi! > > Attached patch fixes ticket 8884. > > Please comment, Carl Eugen > Just posted a patch which fixes the problem and allows parsing of such files instead. Tested and works on #8884's samples. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] tiff: remove tiff type check for ICC profiles
Although the ICC specifications say to check for this, libtiff doesn't and neither does any other TIFF implementation, and the TIFF specs say that Photoshop has a different way to encapsulate ICC profiles, and are asking for advice on how to deal with it. So basically, photoshop puts a different type than what's specified, no other implementation checks for this, we do because we tried to follow the specs although its harmless to not, and ran into this bug because we didn't know about it. Patch attached. >From fc08aa488c630740f0f7564db3ca39a797b66a8d Mon Sep 17 00:00:00 2001 From: Lynne Date: Sat, 5 Sep 2020 20:07:33 +0100 Subject: [PATCH] tiff: remove tiff type check for ICC profiles Although the ICC specifications say to check for this, libtiff doesn't and neither does any other TIFF implementation, and the TIFF specs say that Photoshop has a different way to encapsulate ICC profiles, and are asking for advice on how to deal with it. So basically, photoshop puts a different type than what's specified, no other implementation checks for this, we do because we tried to follow the specs although its harmless to not, and ran into this bug because we didn't know about it. --- libavcodec/tiff.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 08dbca9d60..451784da84 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1668,9 +1668,6 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) } break; case TIFF_ICC_PROFILE: -if (type != TIFF_UNDEFINED) -return AVERROR_INVALIDDATA; - gb_temp = s->gb; bytestream2_seek(&gb_temp, SEEK_SET, off); -- 2.28.0.297.g1956fa8f8d ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/libopusenc: add option to set inband FEC
--- doc/encoders.texi | 5 + libavcodec/libopusenc.c | 9 + 2 files changed, 14 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 69bf742c2d..a48b15eb1b 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -953,6 +953,11 @@ The default is 20ms. @item packet_loss (@emph{expect-loss}) Set expected packet loss percentage. The default is 0. +@item fec (@emph{n/a}) +Enable inband forward error correction. @option{packet_loss} must be non-zero +to take advantage - frequency of FEC 'side-data' is proportional to expected packet loss. +Default is disabled. + @item application (N.A.) Set intended application type. Valid options are listed below: diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c index 13017ac323..bf2d04b4fb 100644 --- a/libavcodec/libopusenc.c +++ b/libavcodec/libopusenc.c @@ -34,6 +34,7 @@ typedef struct LibopusEncOpts { int vbr; int application; int packet_loss; +int fec; int complexity; float frame_duration; int packet_size; @@ -149,6 +150,13 @@ static int libopus_configure_encoder(AVCodecContext *avctx, OpusMSEncoder *enc, "Unable to set expected packet loss percentage: %s\n", opus_strerror(ret)); +ret = opus_multistream_encoder_ctl(enc, + OPUS_SET_INBAND_FEC(opts->fec)); +if (ret != OPUS_OK) +av_log(avctx, AV_LOG_WARNING, + "Unable to set inband FEC: %s\n", + opus_strerror(ret)); + if (avctx->cutoff) { ret = opus_multistream_encoder_ctl(enc, OPUS_SET_MAX_BANDWIDTH(opts->max_bandwidth)); @@ -544,6 +552,7 @@ static const AVOption libopus_options[] = { { "lowdelay", "Restrict to only the lowest delay modes", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_RESTRICTED_LOWDELAY }, 0, 0, FLAGS, "application" }, { "frame_duration", "Duration of a frame in milliseconds", OFFSET(frame_duration), AV_OPT_TYPE_FLOAT, { .dbl = 20.0 }, 2.5, 120.0, FLAGS }, { "packet_loss","Expected packet loss percentage", OFFSET(packet_loss),AV_OPT_TYPE_INT, { .i64 = 0 },0, 100, FLAGS }, +{ "fec", "Enable inband FEC. Expected packet loss must be non-zero", OFFSET(fec),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { "vbr","Variable bit rate mode", OFFSET(vbr), AV_OPT_TYPE_INT, { .i64 = 1 },0, 2,FLAGS, "vbr" }, { "off","Use constant bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "vbr" }, { "on", "Use variable bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "vbr" }, -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".