Re: [FFmpeg-devel] [PATCH v2] lavf/mpegenc: fix memory leak in the fifo since the new API
>You mean an ever-growing buffer when talking about a "memory leak"? >Because I actually don't see any ordinary memory leak. >- Andreas Yes, that's it, the fifo grows at every write. I will fix the commit msg in the next version. Nicolas ___ 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: Added siti filter
Am 18.03.22 um 15:04 schrieb Paul B Mahol: On 3/18/22, Thilo Borgmann wrote: On 12 Mar 2022, at 10:06, Thilo Borgmann wrote: Am 09.03.22 um 18:31 schrieb Paul B Mahol: On 3/8/22, Thilo Borgmann wrote: Am 07.03.22 um 20:06 schrieb Paul B Mahol: On 3/7/22, Thilo Borgmann wrote: Am 06.03.22 um 22:25 schrieb Paul B Mahol: On 3/6/22, Thilo Borgmann wrote: Am 22.02.22 um 12:30 schrieb Thilo Borgmann: Am 18.02.22 um 17:08 schrieb Paul B Mahol: On Sat, Feb 12, 2022 at 11:55 AM Thilo Borgmann wrote: Am 31.01.22 um 12:55 schrieb James Almer: On 1/31/2022 8:53 AM, Anton Khirnov wrote: Quoting Thilo Borgmann (2022-01-18 14:58:07) Violations of code style. Enhanced. Not enough. There are still many remaining, e.g. * opening brace of a function definition should be on its own line * the context should generally be the first argument * unsigned char* should be uint8_t* * mixed declarations and code (the compiler should warn about that) I think someone said that clang (or some versions) is apparently not warning about this, hence why so many of these end up being missed in reviews or even by the patch author. This and all of Anton's comments in v3. Also removed some more obviously useless doubles. Why it uses doubles in so many places? Is there any real benefit in that, except extra slowdown? I guess because it's originating in some c&p Matlab code. I did %s#double#float#g for v4, loosing some precision we can ignore IMHO. v3: Total frames: 2 Spatial Information: Average: 165.451985 Max: 165.817542 Min: 165.086427 Temporal Information: Average: 1.007263 Max: 2.014525 Min: 0.00 v4: Total frames: 2 Spatial Information: Average: 164.385895 Max: 164.742325 Min: 164.029480 Temporal Information: Average: 1.007241 Max: 2.014483 Min: 0.00 Ping. Into wrong section of changelog added entry. Useless cast of allocation results. Does filter changes pixels? If not, add metadata flag to appropriate place. All addressed in v5, thx! Changelog entry is still in wrong, 5.0, section. Fixed in v6. Also added a FATE test for it. Could use fminf/ float functions instead of double variants. v7. Going to push soon if there are no more comments. Check that returned values are correct for bigger w/h, and that not values reach too high values for floats which may cause loss of precision in best case, eg. maybe you need to normalize pixel values from 0-255 to 0.f-1.f so mean/stddev does not get bad results. Did the accumulators as doubles then, good? Also found another missing fmaxf(). V8 attached. Thanks, ThiloFrom 8d5a4e0e38d46041cc587bc8badb44ac8d7090c6 Mon Sep 17 00:00:00 2001 From: Boris Baracaldo Date: Tue, 22 Mar 2022 09:34:02 +0100 Subject: [PATCH v8] lavfilter: Add SITI filter 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. --- Changelog | 1 + doc/filters.texi | 23 ++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/version.h | 2 +- libavfilter/vf_siti.c | 349 ++ tests/fate-run.sh | 9 + tests/fate/filter-video.mak | 3 + tests/ref/fate/filter-refcmp-siti-yuv | 15 ++ 9 files changed, 403 insertions(+), 1 deletion(-) create mode 100644 libavfilter/vf_siti.c create mode 100644 tests/ref/fate/filter-refcmp-siti-yuv diff --git a/Changelog b/Changelog index 3af8aa032b..200bd82680 100644 --- a/Changelog +++ b/Changelog @@ -5,6 +5,7 @@ version 5.1: - dialogue enhance audio filter - dropped obsolete XvMC hwaccel - pcm-bluray encoder +- SITI filter version 5.0: diff --git a/doc/filters.texi b/doc/filters.texi index 26c5b4db48..9f50fd899f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -19944,6 +19944,29 @@ ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inpu @end itemize +@anchor{siti} +@section 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. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }. + +It accepts the following option: + +@table @option +@item print_summary +If set to 1, Summary statistics will be printed to the console. Default 0. +@end table + +@subsection Examples +@itemize +@item +To calculate SI/TI metrics and print summary: +@example +ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null - +@end example +@end itemize + @anchor{smartblur} @section smartblur diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 56d33e6480..43653597d8 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -456,6 +456,7 @@ OBJS-$(CONFIG_SMARTBLUR_FILTER) += vf_smartblur.o OBJS-$(CONFIG_SOBEL_FILTE
Re: [FFmpeg-devel] [PATCH] libavcodec/hevc_mp4toannexb_bsf: insert extradata before non-AUD unit
Xiang, Haihao: > From: Haihao Xiang > > It is possible that an IRAP frame in input AVPacket contains VPS, SPS > and PPS, and these headers should take effect. However the prepended > extradata might override these headers. This patch inserts extradata > before non-AUD unit, hence VPS, SPS and PPS from the input AVPacket will > take effect if they are present. > > This should fix #7799 > > Signed-off-by: Haihao Xiang > --- > libavcodec/hevc_mp4toannexb_bsf.c | 12 ++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/hevc_mp4toannexb_bsf.c > b/libavcodec/hevc_mp4toannexb_bsf.c > index 790dfb0394..77551ba221 100644 > --- a/libavcodec/hevc_mp4toannexb_bsf.c > +++ b/libavcodec/hevc_mp4toannexb_bsf.c > @@ -124,6 +124,7 @@ static int hevc_mp4toannexb_filter(AVBSFContext *ctx, > AVPacket *out) > > int got_irap = 0; > int i, ret = 0; > +int prev_nalu_is_aud = 0, extradata_offset = 0; > > ret = ff_bsf_get_packet(ctx, &in); > if (ret < 0) > @@ -169,14 +170,21 @@ static int hevc_mp4toannexb_filter(AVBSFContext *ctx, > AVPacket *out) > > prev_size = out->size; > > +if (prev_nalu_is_aud) > +extradata_offset = prev_size; > + > ret = av_grow_packet(out, 4 + nalu_size + extra_size); > if (ret < 0) > goto fail; > > -if (extra_size) > -memcpy(out->data + prev_size, ctx->par_out->extradata, > extra_size); > +if (extra_size) { > +memmove(out->data + extradata_offset + extra_size, out->data + > extradata_offset, prev_size - extradata_offset); > +memcpy(out->data + extradata_offset, ctx->par_out->extradata, > extra_size); > +} > + > AV_WB32(out->data + prev_size + extra_size, 1); > bytestream2_get_buffer(&gb, out->data + prev_size + 4 + extra_size, > nalu_size); > +prev_nalu_is_aud = nalu_type == HEVC_NAL_AUD; > } > > ret = av_packet_copy_props(out, in); 1. prev_nalu_is_aud is unnecessary: You can just use "if (nalu_type == HEVC_NAL_AUD) extradata_offset = out->size;" at the end of the loop. 2. This only mitigates a certain case of wrongly inserted extradata; it does not fix the underlying issue which is that this BSF does not track the current state of extradata and therefore inserts parameter sets that have already been superseded by new in-band extradata. Your patch ensures that the extradata parameter sets will be prepended to the in-band extradata. Yet the already deactivated parameter sets will still be inserted. The output can still be invalid, because 7.4.2.4.2 of the HEVC spec requires the following: "Any SPS NAL unit with nuh_layer_id equal to 0 containing the value of sps_seq_parameter_set_id for the active SPS RBSP for the base layer for a CVS shall have the same content as that of the active SPS RBSP for the base layer for the CVS, unless it follows the last access unit of the CVS and precedes the first VCL NAL unit and the first SEI NAL unit containing an active parameter sets SEI message (when present) of another CVS." Furthermore in case a preceding packet contained updated parameter sets that (perhaps partially) overwrite parameter sets from extradata and the current packet does not contain/repeat these parameter sets, then the above code will still insert the outdated and incorrect parameter set and these parameter sets will not be overwritten before being used. 3. Andriy Gelman once proposed a patchset that tracked the parameter sets and inserted only the needed ones. See https://patchwork.ffmpeg.org/project/ffmpeg/patch/20191016025040.31273-2-andriy.gel...@gmail.com/ The problem with this patchset was the complexity emanating from HEVC's layers. 4. Lacking proper tracking of parameter sets we should probably err on the side of caution and stop inserting parameter sets if the input contained in-band parameter sets (similar to h264_mp4toannexb). I can write a patch for this. - Andreas ___ 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] fate: add crystalizer test
will apply soon ___ 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/5] avcodec/exr: Avoid signed overflow in displayWindow
probably 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".
Re: [FFmpeg-devel] [PATCH] avcodec/dfa: don't check for the bitstream version on every copied line
On 3/17/2022 11:13 PM, James Almer wrote: And use av_image_copy_plane() while at it to simplify things for version != 0x100. Signed-off-by: James Almer --- libavcodec/dfa.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index ab78d66763..c29eb76de5 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -385,8 +385,8 @@ static int dfa_decode_frame(AVCodecContext *avctx, buf = s->frame_buf; dst = frame->data[0]; -for (i = 0; i < avctx->height; i++) { -if(version == 0x100) { +if (version == 0x100) { +for (i = 0; i < avctx->height; i++) { int j; const uint8_t *buf1 = buf + (i&3)*(avctx->width/4) + (i/4)*avctx->width; int stride = (avctx->height/4)*avctx->width; @@ -400,12 +400,12 @@ static int dfa_decode_frame(AVCodecContext *avctx, for(; j < avctx->width; j++) { dst[j] = buf1[(j/4) + (j&3)*stride]; } -} else { -memcpy(dst, buf, avctx->width); -buf += avctx->width; +dst += frame->linesize[0]; } -dst += frame->linesize[0]; -} +} else +av_image_copy_plane(dst, frame->linesize[0], buf, avctx->width, +avctx->width, avctx->height); + memcpy(frame->data[1], s->pal, sizeof(s->pal)); *got_frame = 1; Will apply. ___ 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/6] avcodec/internal, avfilter/qp_table: Remove unused FF_QSCALE_TYPEs
Signed-off-by: Andreas Rheinhardt --- libavcodec/internal.h | 2 -- libavfilter/qp_table.h | 4 2 files changed, 6 deletions(-) diff --git a/libavcodec/internal.h b/libavcodec/internal.h index badca4c9dd..f9809926b8 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -37,8 +37,6 @@ #define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG2 1 -#define FF_QSCALE_TYPE_H264 2 -#define FF_QSCALE_TYPE_VP56 3 #define FF_SANE_NB_CHANNELS 512U diff --git a/libavfilter/qp_table.h b/libavfilter/qp_table.h index 4758ee8538..169a7a7fea 100644 --- a/libavfilter/qp_table.h +++ b/libavfilter/qp_table.h @@ -33,16 +33,12 @@ int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table /** * Normalize the qscale factor - * FIXME the H264 qscale is a log based scale, mpeg1/2 is not, the code below - * cannot be optimal */ static inline int ff_norm_qscale(int qscale, int type) { switch (type) { case FF_QSCALE_TYPE_MPEG1: return qscale; case FF_QSCALE_TYPE_MPEG2: return qscale >> 1; -case FF_QSCALE_TYPE_H264: return qscale >> 2; -case FF_QSCALE_TYPE_VP56: return (63 - qscale + 2) >> 2; } return qscale; } -- 2.32.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".
[FFmpeg-devel] [PATCH] avfilter/vf_showinfo: fix unknown side data type for DOVI_RPU_BUFFER
From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/vf_showinfo.c | 4 1 file changed, 4 insertions(+) diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index 12d3931..aa95341 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -812,6 +812,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) case AV_FRAME_DATA_DOVI_METADATA: dump_dovi_metadata(ctx, sd); break; +case AV_FRAME_DATA_DOVI_RPU_BUFFER: +av_log(ctx, AV_LOG_INFO, "DOVI RPU raw data " + "(%"SIZE_SPECIFIER" bytes)", sd->size); +break; default: av_log(ctx, AV_LOG_WARNING, "unknown side data type %d " "(%"SIZE_SPECIFIER" bytes)\n", sd->type, sd->size); -- 1.8.3.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 2/6] avfilter/qp_table: Stop using FF_QSCALE_TYPE_*
All FF_QSCALE_TYPE values used by libavfilter originate from libavfilter (namely from ff_qp_table_extract()); no value is exchanged between libavcodec and libavutil. The values that are exchanged (and used in libavfilter) are of type enum AVVideoEncParamsType. Therefore this patch stops using said FF_QSCALE_TYPE_* in libavfilter and uses enum AVVideoEncParamsType directly. Signed-off-by: Andreas Rheinhardt --- libavfilter/qp_table.c | 7 ++- libavfilter/qp_table.h | 11 ++- libavfilter/vf_codecview.c | 3 ++- libavfilter/vf_fspp.h | 3 ++- libavfilter/vf_pp7.h | 3 ++- libavfilter/vf_spp.h | 3 ++- libavfilter/vf_uspp.c | 3 ++- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/libavfilter/qp_table.c b/libavfilter/qp_table.c index 33812b708d..8137dc019f 100644 --- a/libavfilter/qp_table.c +++ b/libavfilter/qp_table.c @@ -18,9 +18,6 @@ #include -// for FF_QSCALE_TYPE_* -#include "libavcodec/internal.h" - #include "libavutil/frame.h" #include "libavutil/mem.h" #include "libavutil/video_enc_params.h" @@ -28,7 +25,7 @@ #include "qp_table.h" int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h, -int *qscale_type) +enum AVVideoEncParamsType *qscale_type) { AVFrameSideData *sd; AVVideoEncParams *par; @@ -55,7 +52,7 @@ int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table if (table_h) *table_h = mb_h; if (qscale_type) -*qscale_type = FF_QSCALE_TYPE_MPEG2; +*qscale_type = par->type; if (par->nb_blocks == 0) { memset(*table, par->qp, nb_mb); diff --git a/libavfilter/qp_table.h b/libavfilter/qp_table.h index 169a7a7fea..4407bacb0e 100644 --- a/libavfilter/qp_table.h +++ b/libavfilter/qp_table.h @@ -22,23 +22,24 @@ #include #include "libavutil/frame.h" -#include "libavcodec/internal.h" +#include "libavutil/video_enc_params.h" /** * Extract a libpostproc-compatible QP table - an 8-bit QP value per 16x16 * macroblock, stored in raster order - from AVVideoEncParams side data. */ int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h, -int *qscale_type); +enum AVVideoEncParamsType *qscale_type); /** * Normalize the qscale factor + * FIXME Add support for other values of enum AVVideoEncParamsType + * besides AV_VIDEO_ENC_PARAMS_MPEG2. */ -static inline int ff_norm_qscale(int qscale, int type) +static inline int ff_norm_qscale(int qscale, enum AVVideoEncParamsType type) { switch (type) { -case FF_QSCALE_TYPE_MPEG1: return qscale; -case FF_QSCALE_TYPE_MPEG2: return qscale >> 1; +case AV_VIDEO_ENC_PARAMS_MPEG2: return qscale >> 1; } return qscale; } diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c index aac038edef..cddb3e5368 100644 --- a/libavfilter/vf_codecview.c +++ b/libavfilter/vf_codecview.c @@ -227,7 +227,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) AVFilterLink *outlink = ctx->outputs[0]; if (s->qp) { -int qstride, qp_type, ret; +enum AVVideoEncParamsType qp_type; +int qstride, ret; int8_t *qp_table; ret = ff_qp_table_extract(frame, &qp_table, &qstride, NULL, &qp_type); diff --git a/libavfilter/vf_fspp.h b/libavfilter/vf_fspp.h index 6623af450c..ee7de3ffef 100644 --- a/libavfilter/vf_fspp.h +++ b/libavfilter/vf_fspp.h @@ -23,6 +23,7 @@ #ifndef AVFILTER_FSPP_H #define AVFILTER_FSPP_H +#include "libavutil/video_enc_params.h" #include "avfilter.h" #define BLOCKSZ 12 @@ -61,7 +62,7 @@ typedef struct FSPPContext { int vsub; int temp_stride; int qp; -int qscale_type; +enum AVVideoEncParamsType qscale_type; int prev_q; uint8_t *src; int16_t *temp; diff --git a/libavfilter/vf_pp7.h b/libavfilter/vf_pp7.h index 9aa8d732c1..b7cbb020bb 100644 --- a/libavfilter/vf_pp7.h +++ b/libavfilter/vf_pp7.h @@ -22,6 +22,7 @@ #ifndef AVFILTER_PP7_H #define AVFILTER_PP7_H +#include "libavutil/video_enc_params.h" #include "avfilter.h" typedef struct PP7Context { @@ -30,7 +31,7 @@ typedef struct PP7Context { int qp; int mode; -int qscale_type; +enum AVVideoEncParamsType qscale_type; int hsub; int vsub; int temp_stride; diff --git a/libavfilter/vf_spp.h b/libavfilter/vf_spp.h index 76c0c34ab2..0a8b2b512e 100644 --- a/libavfilter/vf_spp.h +++ b/libavfilter/vf_spp.h @@ -22,6 +22,7 @@ #ifndef AVFILTER_SPP_H #define AVFILTER_SPP_H +#include "libavutil/video_enc_params.h" #include "libavcodec/avdct.h" #include "avfilter.h" @@ -33,7 +34,7 @@ typedef struct SPPContext { int log2_count; int qp; int mode; -int qscale_type; +enum AVVideoEncParamsType qscale_type; int temp_linesize; uint8_t *src; uint16_t *temp; diff --git a/libavfilter/vf_uspp.c b/libavfil
[FFmpeg-devel] [PATCH 3/6] avcodec/internal: Move FF_QSCALE_TYPE_* to mpegvideodec.h
These values are only used by mpegvideo-based decoders. Signed-off-by: Andreas Rheinhardt --- libavcodec/h263dec.c | 4 ++-- libavcodec/internal.h | 3 --- libavcodec/mpeg12dec.c | 4 ++-- libavcodec/mpegvideo_dec.c | 2 +- libavcodec/mpegvideodec.h | 3 +++ libavcodec/rv10.c | 4 ++-- libavcodec/rv34.c | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 886fbee8c8..965a7d30c4 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -695,12 +695,12 @@ frame_end: if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); -ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1); +ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG1); } else if (s->last_picture_ptr) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr, pict); -ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1); +ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG1); } if (s->last_picture_ptr || s->low_delay) { diff --git a/libavcodec/internal.h b/libavcodec/internal.h index f9809926b8..f9d08fcb60 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -35,9 +35,6 @@ #include "bsf.h" #include "config.h" -#define FF_QSCALE_TYPE_MPEG1 0 -#define FF_QSCALE_TYPE_MPEG2 1 - #define FF_SANE_NB_CHANNELS 512U #if HAVE_SIMD_ALIGN_64 diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 6b6cadeb05..887b8036f8 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2040,7 +2040,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) if (ret < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); -ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG2); +ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG2); } else { /* latency of 1 frame for I- and P-frames */ if (s->last_picture_ptr) { @@ -2048,7 +2048,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) if (ret < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr, pict); -ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG2); +ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG2); } } diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 28e4e5b781..7caaf0596d 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -513,7 +513,7 @@ void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict) int ff_mpv_export_qp_table(MpegEncContext *s, AVFrame *f, Picture *p, int qp_type) { AVVideoEncParams *par; -int mult = (qp_type == FF_QSCALE_TYPE_MPEG1) ? 2 : 1; +int mult = (qp_type == FF_MPV_QSCALE_TYPE_MPEG1) ? 2 : 1; unsigned int nb_mb = p->alloc_mb_height * p->alloc_mb_width; if (!(s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS)) diff --git a/libavcodec/mpegvideodec.h b/libavcodec/mpegvideodec.h index 0cda0af733..1af8ebac36 100644 --- a/libavcodec/mpegvideodec.h +++ b/libavcodec/mpegvideodec.h @@ -35,6 +35,9 @@ #include "mpegvideo.h" #include "mpegvideodata.h" +#define FF_MPV_QSCALE_TYPE_MPEG1 0 +#define FF_MPV_QSCALE_TYPE_MPEG2 1 + /** * Initialize the given MpegEncContext for decoding. * the changed fields will not depend upon diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index bd707a391b..23d0ea8516 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -663,12 +663,12 @@ static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); -ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1); +ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG1); } else if (s->last_picture_ptr) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr, pict); -ff_mpv_export_qp_table(s, pict,s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1); +ff_mpv_export_qp_table(s, pict,s->last_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG1); } if (s->last_picture_ptr || s->low_delay) { diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 1fb17ddb90..fb5b19c913 100644 --- a/l
[FFmpeg-devel] [PATCH 4/6] avfilter/vf_vpp_qsv: Remove unnecessary lavc and lavf headers
Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_vpp_qsv.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 5c96703fd3..cfe343822b 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -34,8 +34,6 @@ #include "internal.h" #include "avfilter.h" #include "filters.h" -#include "libavcodec/avcodec.h" -#include "libavformat/avformat.h" #include "qsvvpp.h" #include "transpose.h" -- 2.32.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".
[FFmpeg-devel] [PATCH 5/6] avcodec, avformat: Remove unnecessary inclusions of lavc/internal.h
Signed-off-by: Andreas Rheinhardt --- libavcodec/parser.c | 1 - libavcodec/v4l2_buffers.c | 1 - libavcodec/v4l2_m2m.c | 1 - libavformat/chromaprint.c | 1 - libavformat/genh.c| 1 - libavformat/tls_openssl.c | 1 - 6 files changed, 6 deletions(-) diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 24fe44eb30..49de7e6a57 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -27,7 +27,6 @@ #include "libavutil/avassert.h" #include "libavutil/mem.h" -#include "internal.h" #include "parser.h" AVCodecParserContext *av_parser_init(int codec_id) diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c index 4b2679eb38..3f5471067a 100644 --- a/libavcodec/v4l2_buffers.c +++ b/libavcodec/v4l2_buffers.c @@ -28,7 +28,6 @@ #include #include #include "libavcodec/avcodec.h" -#include "libavcodec/internal.h" #include "libavutil/pixdesc.h" #include "v4l2_context.h" #include "v4l2_buffers.h" diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c index cdfd579810..3178ef06b8 100644 --- a/libavcodec/v4l2_m2m.c +++ b/libavcodec/v4l2_m2m.c @@ -28,7 +28,6 @@ #include #include #include "libavcodec/avcodec.h" -#include "libavcodec/internal.h" #include "libavutil/pixdesc.h" #include "libavutil/imgutils.h" #include "libavutil/pixfmt.h" diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c index bcb8315159..3953a5ced3 100644 --- a/libavformat/chromaprint.c +++ b/libavformat/chromaprint.c @@ -22,7 +22,6 @@ #include "avformat.h" #include "internal.h" #include "libavutil/opt.h" -#include "libavcodec/internal.h" #include #define CPR_VERSION_INT AV_VERSION_INT(CHROMAPRINT_VERSION_MAJOR, \ diff --git a/libavformat/genh.c b/libavformat/genh.c index a85d38dd31..b1c20718f6 100644 --- a/libavformat/genh.c +++ b/libavformat/genh.c @@ -21,7 +21,6 @@ #include "libavutil/channel_layout.h" #include "libavutil/intreadwrite.h" -#include "libavcodec/internal.h" #include "avformat.h" #include "internal.h" diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index 1d813cbbb5..8bf766c01f 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -25,7 +25,6 @@ #include "os_support.h" #include "url.h" #include "tls.h" -#include "libavcodec/internal.h" #include "libavutil/avstring.h" #include "libavutil/avutil.h" #include "libavutil/opt.h" -- 2.32.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".
[FFmpeg-devel] [PATCH 6/6] avformat: Remove unnecessary inclusions from libavcodec
Also improve the other headers a bit while at it. Signed-off-by: Andreas Rheinhardt --- libavformat/a64.c | 2 +- libavformat/act.c | 3 ++- libavformat/apngenc.c | 2 -- libavformat/av1.c | 2 +- libavformat/flacenc.h | 5 ++--- libavformat/flvdec.c| 5 ++--- libavformat/frmdec.c| 1 - libavformat/gxf.c | 1 - libavformat/h261dec.c | 2 +- libavformat/hls.c | 1 + libavformat/hls_sample_encryption.c | 1 + libavformat/hls_sample_encryption.h | 5 +++-- libavformat/icodec.c| 1 - libavformat/oggparseskeleton.c | 2 +- libavformat/oggparsespeex.c | 7 +-- libavformat/rsd.c | 1 - libavformat/rtpdec_dv.c | 4 +--- libavformat/rtpdec_hevc.c | 2 -- libavformat/rtpdec_vp8.c| 4 ++-- 19 files changed, 19 insertions(+), 32 deletions(-) diff --git a/libavformat/a64.c b/libavformat/a64.c index 6e19162fe2..a66f2542b7 100644 --- a/libavformat/a64.c +++ b/libavformat/a64.c @@ -19,9 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/intreadwrite.h" #include "libavcodec/codec_id.h" #include "libavcodec/codec_par.h" -#include "libavcodec/bytestream.h" #include "avformat.h" #include "rawenc.h" diff --git a/libavformat/act.c b/libavformat/act.c index fba106c520..6dd9f62a87 100644 --- a/libavformat/act.c +++ b/libavformat/act.c @@ -18,11 +18,12 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include "libavutil/intreadwrite.h" #include "avformat.h" #include "avio_internal.h" #include "riff.h" #include "internal.h" -#include "libavcodec/get_bits.h" #define CHUNK_SIZE 512 #define RIFF_TAG MKTAG('R','I','F','F') diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c index 767074ecf3..88d4a41462 100644 --- a/libavformat/apngenc.c +++ b/libavformat/apngenc.c @@ -22,14 +22,12 @@ */ #include "avformat.h" -#include "internal.h" #include "libavutil/avassert.h" #include "libavutil/crc.h" #include "libavutil/intreadwrite.h" #include "libavutil/log.h" #include "libavutil/opt.h" #include "libavcodec/png.h" -#include "libavcodec/apng.h" typedef struct APNGMuxContext { AVClass *class; diff --git a/libavformat/av1.c b/libavformat/av1.c index 7caea0c377..79065d0c9f 100644 --- a/libavformat/av1.c +++ b/libavformat/av1.c @@ -23,7 +23,7 @@ #include "libavutil/mem.h" #include "libavcodec/av1.h" #include "libavcodec/av1_parse.h" -#include "libavcodec/profiles.h" +#include "libavcodec/avcodec.h" #include "libavcodec/put_bits.h" #include "av1.h" #include "avio.h" diff --git a/libavformat/flacenc.h b/libavformat/flacenc.h index b308d0d021..02937b240d 100644 --- a/libavformat/flacenc.h +++ b/libavformat/flacenc.h @@ -22,9 +22,8 @@ #ifndef AVFORMAT_FLACENC_H #define AVFORMAT_FLACENC_H -#include "libavcodec/flac.h" -#include "libavcodec/bytestream.h" -#include "avformat.h" +#include +#include "avio.h" int ff_flac_write_header(AVIOContext *pb, const uint8_t *extradata, int extradata_size, int last_block); diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index cb24b1cc26..0c90748422 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -24,18 +24,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/channel_layout.h" #include "libavutil/dict.h" #include "libavutil/opt.h" #include "libavutil/internal.h" #include "libavutil/intfloat.h" +#include "libavutil/intreadwrite.h" #include "libavutil/mathematics.h" -#include "libavutil/time_internal.h" -#include "libavcodec/bytestream.h" #include "avformat.h" #include "internal.h" -#include "avio_internal.h" #include "flv.h" #define VALIDATE_INDEX_TS_THRESH 2500 diff --git a/libavformat/frmdec.c b/libavformat/frmdec.c index 478656b037..e6c1179dcd 100644 --- a/libavformat/frmdec.c +++ b/libavformat/frmdec.c @@ -24,7 +24,6 @@ * Megalux Frame demuxer */ -#include "libavcodec/raw.h" #include "libavutil/imgutils.h" #include "libavutil/intreadwrite.h" #include "avformat.h" diff --git a/libavformat/gxf.c b/libavformat/gxf.c index d96e0796f4..e61291382a 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -26,7 +26,6 @@ #include "avformat.h" #include "internal.h" #include "gxf.h" -#include "libavcodec/mpeg12data.h" struct gxf_stream_info { int64_t first_field; diff --git a/libavformat/h261dec.c b/libavformat/h261dec.c index b5161ff57d..0fca1a340a 100644 --- a/libavformat/h261dec.c +++ b/libavformat/h261dec.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcodec/get_bits.h"
Re: [FFmpeg-devel] [PATCH 1/2] avformat/movenc: initialize pts/dts/duration of timecode packet
On Fri, Mar 11, 2022 at 05:16:09PM +0100, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > On Fri, Mar 11, 2022 at 03:04:32PM +0100, Andreas Rheinhardt wrote: > >> lance.lmw...@gmail.com: > >>> On Wed, Mar 02, 2022 at 09:58:31PM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang > > Fix below error message when timecode packet is written. > "Application provided duration: -9223372036854775808 / timestamp: > -9223372036854775808 is out of range for mov/mp4 format" > > try to reproduce by: > ffmpeg -y -f lavfi -i color -metadata "timecode=00:00:00:00" -t 1 > test.mov > > Note although error message is printed, the timecode packet will be > written anyway. So > the patch 2/2 will try to change the log level to warning. > > The first two test case of fate-lavf-ismv have timecode setting, so the > crc of ref data is different. > Fixes ticket #9488 > > Signed-off-by: Limin Wang > --- > libavformat/movenc.c | 2 ++ > tests/ref/lavf/ismv | 4 ++-- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c > index 4c86891..74b94cd 100644 > --- a/libavformat/movenc.c > +++ b/libavformat/movenc.c > @@ -6383,6 +6383,8 @@ static int > mov_create_timecode_track(AVFormatContext *s, int index, int src_inde > pkt->data = data; > pkt->stream_index = index; > pkt->flags = AV_PKT_FLAG_KEY; > +pkt->pts = pkt->dts = av_rescale_q(tc.start, av_inv_q(rate), > (AVRational){1,mov->movie_timescale}); > +pkt->duration = av_rescale_q(1, av_inv_q(rate), > (AVRational){1,mov->movie_timescale}); > pkt->size = 4; > AV_WB32(pkt->data, tc.start); > ret = ff_mov_write_packet(s, pkt); > diff --git a/tests/ref/lavf/ismv b/tests/ref/lavf/ismv > index ac7f72b..723b432 100644 > --- a/tests/ref/lavf/ismv > +++ b/tests/ref/lavf/ismv > @@ -1,7 +1,7 @@ > -48fb8d7a5d19bd60f3a49ccf4b7d6593 *tests/data/lavf/lavf.ismv > +7a24b73c096ec0f13f0f7a2d9101c4c1 *tests/data/lavf/lavf.ismv > 313169 tests/data/lavf/lavf.ismv > tests/data/lavf/lavf.ismv CRC=0x9d9a638a > -d19cd8e310a2e94fe0a0d11c5dc29217 *tests/data/lavf/lavf.ismv > +79646383fd099d45ad0d0c2791c601dd *tests/data/lavf/lavf.ismv > 322075 tests/data/lavf/lavf.ismv > tests/data/lavf/lavf.ismv CRC=0xe8130120 > 3b6023766845b51b075aed474c00f73c *tests/data/lavf/lavf.ismv > -- > 1.8.3.1 > > >>> > >>> will apply the patch set tomorrow unless there are any objections. > >>> > >> > >> You have not really answered whether the current files or the new files > >> are spec-incompliant; you have just reported that one byte is different. > > > > Sorry, I think I have said both current and new file is spec-compliant in > > the last > > email. > > > > You stated that you think that both files are valid, but you also said > that you don't even know what this byte that is different actually means. > > > By Quicktime file format specs: > > Section Timecode Sample Description, all tmcd field isn't used pts/dts. > > > > As for where is the different for one byte, it's caused by pkt->duration. > > The > > old is 0(uninitialized), after the patch it's 33(1 frame duration). > > > > The text about Timecode Sample Description reads as follows: "Frame > duration: A 32-bit integer that indicates how long each frame lasts in > real time." This implies that only one of the two files can be > spec-compliant. I am not a mov/ISOBMFF expert, but it seems to me that > the current way of doing things is wrong. But I wonder about whether > your patch is correct for vfr content. Doesn't the property of being vfr > need to be reflected in the timecodes somehow (with different durations > for different packets)? Andreas, I have updated the patch and remove the fate difference which is caused by duration, do you have any other comments for v2 patch? > > - Andreas > ___ > 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". -- Thanks, Limin Wang ___ 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/movenc: initialize pts/dts/duration of timecode packet
lance.lmw...@gmail.com: > On Fri, Mar 11, 2022 at 05:16:09PM +0100, Andreas Rheinhardt wrote: >> lance.lmw...@gmail.com: >>> On Fri, Mar 11, 2022 at 03:04:32PM +0100, Andreas Rheinhardt wrote: lance.lmw...@gmail.com: > On Wed, Mar 02, 2022 at 09:58:31PM +0800, lance.lmw...@gmail.com wrote: >> From: Limin Wang >> >> Fix below error message when timecode packet is written. >> "Application provided duration: -9223372036854775808 / timestamp: >> -9223372036854775808 is out of range for mov/mp4 format" >> >> try to reproduce by: >> ffmpeg -y -f lavfi -i color -metadata "timecode=00:00:00:00" -t 1 >> test.mov >> >> Note although error message is printed, the timecode packet will be >> written anyway. So >> the patch 2/2 will try to change the log level to warning. >> >> The first two test case of fate-lavf-ismv have timecode setting, so the >> crc of ref data is different. >> Fixes ticket #9488 >> >> Signed-off-by: Limin Wang >> --- >> libavformat/movenc.c | 2 ++ >> tests/ref/lavf/ismv | 4 ++-- >> 2 files changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/libavformat/movenc.c b/libavformat/movenc.c >> index 4c86891..74b94cd 100644 >> --- a/libavformat/movenc.c >> +++ b/libavformat/movenc.c >> @@ -6383,6 +6383,8 @@ static int >> mov_create_timecode_track(AVFormatContext *s, int index, int src_inde >> pkt->data = data; >> pkt->stream_index = index; >> pkt->flags = AV_PKT_FLAG_KEY; >> +pkt->pts = pkt->dts = av_rescale_q(tc.start, av_inv_q(rate), >> (AVRational){1,mov->movie_timescale}); >> +pkt->duration = av_rescale_q(1, av_inv_q(rate), >> (AVRational){1,mov->movie_timescale}); >> pkt->size = 4; >> AV_WB32(pkt->data, tc.start); >> ret = ff_mov_write_packet(s, pkt); >> diff --git a/tests/ref/lavf/ismv b/tests/ref/lavf/ismv >> index ac7f72b..723b432 100644 >> --- a/tests/ref/lavf/ismv >> +++ b/tests/ref/lavf/ismv >> @@ -1,7 +1,7 @@ >> -48fb8d7a5d19bd60f3a49ccf4b7d6593 *tests/data/lavf/lavf.ismv >> +7a24b73c096ec0f13f0f7a2d9101c4c1 *tests/data/lavf/lavf.ismv >> 313169 tests/data/lavf/lavf.ismv >> tests/data/lavf/lavf.ismv CRC=0x9d9a638a >> -d19cd8e310a2e94fe0a0d11c5dc29217 *tests/data/lavf/lavf.ismv >> +79646383fd099d45ad0d0c2791c601dd *tests/data/lavf/lavf.ismv >> 322075 tests/data/lavf/lavf.ismv >> tests/data/lavf/lavf.ismv CRC=0xe8130120 >> 3b6023766845b51b075aed474c00f73c *tests/data/lavf/lavf.ismv >> -- >> 1.8.3.1 >> > > will apply the patch set tomorrow unless there are any objections. > You have not really answered whether the current files or the new files are spec-incompliant; you have just reported that one byte is different. >>> >>> Sorry, I think I have said both current and new file is spec-compliant in >>> the last >>> email. >>> >> >> You stated that you think that both files are valid, but you also said >> that you don't even know what this byte that is different actually means. >> >>> By Quicktime file format specs: >>> Section Timecode Sample Description, all tmcd field isn't used pts/dts. >>> >>> As for where is the different for one byte, it's caused by pkt->duration. >>> The >>> old is 0(uninitialized), after the patch it's 33(1 frame duration). >>> >> >> The text about Timecode Sample Description reads as follows: "Frame >> duration: A 32-bit integer that indicates how long each frame lasts in >> real time." This implies that only one of the two files can be >> spec-compliant. I am not a mov/ISOBMFF expert, but it seems to me that >> the current way of doing things is wrong. But I wonder about whether >> your patch is correct for vfr content. Doesn't the property of being vfr >> need to be reflected in the timecodes somehow (with different durations >> for different packets)? > > Andreas, I have updated the patch and remove the fate difference which is > caused by duration, do you have any other comments for v2 patch? > No. - Andreas ___ 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 2/2] avcodec/av1dec: Check tile_cols
On Mon, Mar 21, 2022 at 06:03:12PM -0300, James Almer wrote: > On 2/1/2022 3:52 PM, Michael Niedermayer wrote: > > Fixes: division by zero > > Fixes: > > 43769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5392562205097984 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/av1dec.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c > > index 62d459cded..581f22a849 100644 > > --- a/libavcodec/av1dec.c > > +++ b/libavcodec/av1dec.c > > @@ -394,6 +394,9 @@ static int get_tiles_info(AVCodecContext *avctx, const > > AV1RawTileGroup *tile_gro > > s->tg_start = tile_group->tg_start; > > s->tg_end = tile_group->tg_end; > > +if (s->raw_frame_header->tile_cols == 0) > > This should not happen. CBS should have returned an error instead or setting > tile_cols to 0. > The bug should probably be fixed there. I didnt see your mail in time :( If you want, i can revert it? The issue seems that cbs av1 and av1dec disagree on how they handle redundant frames. I can "fix" it by --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -1066,8 +1066,8 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame, } break; case AV1_OBU_REDUNDANT_FRAME_HEADER: -if (s->raw_frame_header) -break; +// Unsupported +break; // fall-through case AV1_OBU_FRAME: case AV1_OBU_FRAME_HEADER: cbs leaves tile_cols untouched (and 0) for the redundant frame I didnt really look further, this probably should be looked at by someone who knows the av1dec/cbs code better. I can provide the sample file if someone wants to or also test any suggested fixes I think this split logic where cbs and the decoder have to be kept in sync is a bit fragile. Or at least it looks fragile Thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. 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".
[FFmpeg-devel] [PATCH 0/6] Various libavdevice cleanup & enhancements
From: Romain Beauxis This is a series of patches that fix and enhances libavdevice & have been submitted multiple times in the past 6 months. In the series, the most straightforward patches have been placed first in the list. While I have a lot of appreciation for all the solid work done in this project, seeing the difficulty in getting them included makes one wonder what is the status of libavdevice and if it is still actively maintained. Typically, in the first patch, we fix the name/machine readable ID of dshow devices. If the API has any significant use or maintenance, this should have been caught and fixed much sooner. Next, the patches fixing the avfoundation device audio format and concurrency models are absolutely required to get any use of this operator as audio input and, quite likely, as video input as well. This is a lot of changes to make the library usable for a cross-platform project and, with the lack of traction with the changes, this makes the developer wonder if the library is ready for production use and if it wouldn't be easier to implement hardware handling separately and plug into FFmpeg after retreiving media data. There are more that I have noticed with the API, in particular the fact that audio/video devices are labelled as video. I would love to submit changes to enhance that aspect but, not with all these patches already pending.. Thanks for y'all consideration. -- Romain Romain Beauxis (6): Fix dshow device name/description Use appropriate method for device discovery, fix crash with bogus device index. libavdevice/avfoundation.m: Allow to select devices by unique ID libavdevice/avfoundation.m: use setAudioSettings, extend supported formats libavdevice/avfoundation.m: Replace mutex-based concurrency handling in avfoundation.m by a thread-safe fifo queue with maximum length Add AudioToolbox audio input device. configure | 5 + doc/indevs.texi| 41 ++- libavdevice/Makefile | 1 + libavdevice/alldevices.c | 1 + libavdevice/audiotoolbox.m | 8 +- libavdevice/audiotoolbox_dec.m | 530 libavdevice/avfoundation.m | 547 - libavdevice/dshow.c| 4 +- 8 files changed, 843 insertions(+), 294 deletions(-) create mode 100644 libavdevice/audiotoolbox_dec.m -- 2.32.0 (Apple Git-132) ___ 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/6] Fix dshow device name/description
From: Romain Beauxis diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 6039578ff9..4ee3f6e194 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -552,8 +552,8 @@ dshow_cycle_devices(AVFormatContext *avctx, ICreateDevEnum *devenum, if (!device) goto fail; -device->device_name = av_strdup(friendly_name); -device->device_description = av_strdup(unique_name); +device->device_name = av_strdup(unique_name); +device->device_description = av_strdup(friendly_name); if (!device->device_name || !device->device_description) goto fail; -- 2.32.0 (Apple Git-132) ___ 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/6] Use appropriate method for device discovery, fix crash with bogus device index.
From: Romain Beauxis diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index c9de93f774..719276cabf 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -27,6 +27,7 @@ #import #include +#include #include "libavutil/channel_layout.h" #include "libavutil/pixdesc.h" @@ -771,8 +772,34 @@ static int avf_read_header(AVFormatContext *s) AVCaptureDevice *video_device = nil; AVCaptureDevice *audio_device = nil; // Find capture device -NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; -NSArray *devices_muxed = [AVCaptureDevice devicesWithMediaType:AVMediaTypeMuxed]; +#if defined(__MAC_10_15) || (TARGET_OS_IPHONE && defined(__IPHONE_10_0)) + AVCaptureDeviceDiscoverySession *discoverySession = +[AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[ +#if TARGET_OS_IPHONE + AVCaptureDeviceTypeBuiltInDualCamera, + AVCaptureDeviceTypeBuiltInDualWideCamera, + AVCaptureDeviceTypeBuiltInUltraWideCamera, + AVCaptureDeviceTypeBuiltInTrueDepthCamera, + AVCaptureDeviceTypeBuiltInTelephotoCamera, +#endif + AVCaptureDeviceTypeBuiltInWideAngleCamera, + AVCaptureDeviceTypeExternalUnknown + ] + mediaType:NULL + position:AVCaptureDevicePositionUnspecified]; + + NSMutableArray *devices = [NSMutableArray array]; + NSMutableArray *devices_muxed = [NSMutableArray array]; + for (AVCaptureDevice *device in [discoverySession devices]) { + if ([device hasMediaType:AVMediaTypeVideo]) + [devices addObject:device]; + else if ([device hasMediaType:AVMediaTypeMuxed]) + [devices_muxed addObject:device]; + } +#else + NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; + NSArray *devices_muxed = [AVCaptureDevice devicesWithMediaType:AVMediaTypeMuxed]; +#endif ctx->num_video_devices = [devices count] + [devices_muxed count]; @@ -782,6 +809,21 @@ static int avf_read_header(AVFormatContext *s) CGGetActiveDisplayList(0, NULL, &num_screens); #endif +NSArray *audio_devices; +#if defined(__MAC_10_15) || (TARGET_OS_IPHONE && defined(__IPHONE_10_0)) +discoverySession = +[AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[ + AVCaptureDeviceTypeBuiltInMicrophone, + AVCaptureDeviceTypeExternalUnknown + ] + mediaType:AVMediaTypeAudio + position:AVCaptureDevicePositionUnspecified]; + +audio_devices = [discoverySession devices]; +#else +audio_devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio]; +#endif + // List devices if requested if (ctx->list_devices) { int index = 0; @@ -807,8 +849,7 @@ static int avf_read_header(AVFormatContext *s) #endif av_log(ctx, AV_LOG_INFO, "AVFoundation audio devices:\n"); -devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio]; -for (AVCaptureDevice *device in devices) { +for (AVCaptureDevice *device in audio_devices) { const char *name = [[device localizedName] UTF8String]; int index = [devices indexOfObject:device]; av_log(ctx, AV_LOG_INFO, "[%d] %s\n", index, name); @@ -833,9 +874,12 @@ static int avf_read_header(AVFormatContext *s) if (ctx->video_device_index < ctx->num_video_devices) { if (ctx->video_device_index < [devices count]) { video_device = [devices objectAtIndex:ctx->video_device_index]; -} else { +} else if (ctx->video_device_index - [devices count] < [devices_muxed count]) { video_device = [devices_muxed objectAtIndex:(ctx->video_device_index - [devices count])]; ctx->video_is_muxed = 1; +} else { +av_log(ctx, AV_LOG_ERROR, "Invalid video device index\n"); +goto fail; } } else if (ctx->video_device_index < ctx->num_video_devices + num_screens) { #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @@ -931,9 +975,7 @@ static int avf_read_header(AVFormatContext *s) // get audio device if (ctx->audio_device_index >= 0) { -NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio]; - -if (ctx->audio_device_inde
[FFmpeg-devel] [PATCH 3/6] libavdevice/avfoundation.m: Allow to select devices by unique ID
From: Romain Beauxis diff --git a/doc/indevs.texi b/doc/indevs.texi index 9d8020311a..858c0fa4e4 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -114,7 +114,7 @@ The input filename has to be given in the following syntax: -i "[[VIDEO]:[AUDIO]]" @end example The first entry selects the video input while the latter selects the audio input. -The stream has to be specified by the device name or the device index as shown by the device list. +The stream has to be specified by the device name, index or ID as shown by the device list. Alternatively, the video and/or audio input device can be chosen by index using the @option{ -video_device_index @@ -127,7 +127,9 @@ and/or device name or index given in the input filename. All available devices can be enumerated by using @option{-list_devices true}, listing -all device names and corresponding indices. +all device names, corresponding indices and IDs, when available. Device name can be +tricky to use when localized and device index can change when devices are plugged or unplugged. A device +hash, when available, uniquely identifies a device and should not change over time. There are two device name aliases: @table @code diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index 719276cabf..af52246bf3 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -40,6 +40,8 @@ #include "libavutil/imgutils.h" #include "avdevice.h" +#define CLEANUP_DEVICE_ID(s) [[s stringByReplacingOccurrencesOfString:@":" withString:@"."] UTF8String] + static const int avf_time_base = 100; static const AVRational avf_time_base_q = { @@ -829,21 +831,23 @@ static int avf_read_header(AVFormatContext *s) int index = 0; av_log(ctx, AV_LOG_INFO, "AVFoundation video devices:\n"); for (AVCaptureDevice *device in devices) { -const char *name = [[device localizedName] UTF8String]; -index= [devices indexOfObject:device]; -av_log(ctx, AV_LOG_INFO, "[%d] %s\n", index, name); +const char *name = [[device localizedName] UTF8String]; +const char *uniqueId = CLEANUP_DEVICE_ID([device uniqueID]); +index= [devices indexOfObject:device]; +av_log(ctx, AV_LOG_INFO, "[%d] %s (ID: %s)\n", index, name, uniqueId); } for (AVCaptureDevice *device in devices_muxed) { -const char *name = [[device localizedName] UTF8String]; -index= [devices count] + [devices_muxed indexOfObject:device]; -av_log(ctx, AV_LOG_INFO, "[%d] %s\n", index, name); +const char *name = [[device localizedName] UTF8String]; +const char *uniqueId = CLEANUP_DEVICE_ID([device uniqueID]); +index= [devices count] + [devices_muxed indexOfObject:device]; +av_log(ctx, AV_LOG_INFO, "[%d] %s (ID: %s)\n", index, name, uniqueId); } #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (num_screens > 0) { CGDirectDisplayID screens[num_screens]; CGGetActiveDisplayList(num_screens, screens, &num_screens); for (int i = 0; i < num_screens; i++) { -av_log(ctx, AV_LOG_INFO, "[%d] Capture screen %d\n", ctx->num_video_devices + i, i); +av_log(ctx, AV_LOG_INFO, "[%d] Capture screen %d (ID: AvfilterAvfoundationCaptureScreen%d)\n", ctx->num_video_devices + i, i, screens[i]); } } #endif @@ -851,7 +855,9 @@ static int avf_read_header(AVFormatContext *s) av_log(ctx, AV_LOG_INFO, "AVFoundation audio devices:\n"); for (AVCaptureDevice *device in audio_devices) { const char *name = [[device localizedName] UTF8String]; +const char *uniqueId = CLEANUP_DEVICE_ID([device uniqueID]); int index = [devices indexOfObject:device]; +av_log(ctx, AV_LOG_INFO, "[%d] %s (ID: %s)\n", index, name, uniqueId); av_log(ctx, AV_LOG_INFO, "[%d] %s\n", index, name); } goto fail; @@ -919,14 +925,29 @@ static int avf_read_header(AVFormatContext *s) } else { // looking for video inputs for (AVCaptureDevice *device in devices) { -if (!strncmp(ctx->video_filename, [[device localizedName] UTF8String], strlen(ctx->video_filename))) { +const char *name = [[device localizedName] UTF8String]; +if (!strncmp(ctx->video_filename, name, strlen(ctx->video_filename))) { +video_device = device; +break; +} + +const char *uniqueId = CLEANUP_DEVICE_ID([device uniqueID]); +if (!strncmp(ctx->video_filename, uniqueId, strlen(ctx->video_filename))) { video_device = device; break; } } // looking for muxed inputs for (AVCaptureDevice *de
[FFmpeg-devel] [PATCH 4/6] libavdevice/avfoundation.m: use setAudioSettings, extend supported formats
From: Romain Beauxis Previous version of these changes used the AudioConverter API to perform audio conversion explicitly however, it was found to be bug prone with issues seemingly coming from the underlying OS. This fixes: https://trac.ffmpeg.org/ticket/9502 --- libavdevice/avfoundation.m | 200 - 1 file changed, 63 insertions(+), 137 deletions(-) diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index af52246bf3..055e8f62e4 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -96,6 +96,11 @@ AVRational framerate; int width, height; +int channels; +int big_endian; +int sample_rate; +enum AVSampleFormat sample_format; + int capture_cursor; int capture_mouse_clicks; int capture_raw_data; @@ -115,17 +120,6 @@ int num_video_devices; -int audio_channels; -int audio_bits_per_sample; -int audio_float; -int audio_be; -int audio_signed_integer; -int audio_packed; -int audio_non_interleaved; - -int32_t *audio_buffer; -int audio_buffer_size; - enum AVPixelFormat pixel_format; AVCaptureSession *capture_session; @@ -304,7 +298,6 @@ static void destroy_context(AVFContext* ctx) ctx->avf_audio_delegate = NULL; av_freep(&ctx->url); -av_freep(&ctx->audio_buffer); pthread_mutex_destroy(&ctx->frame_lock); @@ -680,88 +673,61 @@ static int get_video_config(AVFormatContext *s) static int get_audio_config(AVFormatContext *s) { AVFContext *ctx = (AVFContext*)s->priv_data; -CMFormatDescriptionRef format_desc; -AVStream* stream = avformat_new_stream(s, NULL); +AVStream* stream; +int bits_per_sample, is_float; -if (!stream) { -return 1; -} +enum AVCodecID codec_id = av_get_pcm_codec(ctx->sample_format, ctx->big_endian); -// Take stream info from the first frame. -while (ctx->audio_frames_captured < 1) { -CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, YES); +if (codec_id == AV_CODEC_ID_NONE) { + av_log(ctx, AV_LOG_ERROR, "Error: invalid sample format!\n"); + return AVERROR(EINVAL); } -lock_frames(ctx); - -ctx->audio_stream_index = stream->index; - -avpriv_set_pts_info(stream, 64, 1, avf_time_base); - -format_desc = CMSampleBufferGetFormatDescription(ctx->current_audio_frame); -const AudioStreamBasicDescription *basic_desc = CMAudioFormatDescriptionGetStreamBasicDescription(format_desc); - -if (!basic_desc) { -unlock_frames(ctx); -av_log(s, AV_LOG_ERROR, "audio format not available\n"); -return 1; +switch (ctx->sample_format) { +case AV_SAMPLE_FMT_S16: +bits_per_sample = 16; +is_float = 0; +break; +case AV_SAMPLE_FMT_S32: +bits_per_sample = 32; +is_float = 0; +break; +case AV_SAMPLE_FMT_FLT: +bits_per_sample = 32; +is_float = 1; +break; +default: +av_log(ctx, AV_LOG_ERROR, "Error: invalid sample format!\n"); +unlock_frames(ctx); +return AVERROR(EINVAL); } -stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -stream->codecpar->sample_rate= basic_desc->mSampleRate; -stream->codecpar->channels = basic_desc->mChannelsPerFrame; -stream->codecpar->channel_layout = av_get_default_channel_layout(stream->codecpar->channels); - -ctx->audio_channels= basic_desc->mChannelsPerFrame; -ctx->audio_bits_per_sample = basic_desc->mBitsPerChannel; -ctx->audio_float = basic_desc->mFormatFlags & kAudioFormatFlagIsFloat; -ctx->audio_be = basic_desc->mFormatFlags & kAudioFormatFlagIsBigEndian; -ctx->audio_signed_integer = basic_desc->mFormatFlags & kAudioFormatFlagIsSignedInteger; -ctx->audio_packed = basic_desc->mFormatFlags & kAudioFormatFlagIsPacked; -ctx->audio_non_interleaved = basic_desc->mFormatFlags & kAudioFormatFlagIsNonInterleaved; - -if (basic_desc->mFormatID == kAudioFormatLinearPCM && -ctx->audio_float && -ctx->audio_bits_per_sample == 32 && -ctx->audio_packed) { -stream->codecpar->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_F32BE : AV_CODEC_ID_PCM_F32LE; -} else if (basic_desc->mFormatID == kAudioFormatLinearPCM && -ctx->audio_signed_integer && -ctx->audio_bits_per_sample == 16 && -ctx->audio_packed) { -stream->codecpar->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S16BE : AV_CODEC_ID_PCM_S16LE; -} else if (basic_desc->mFormatID == kAudioFormatLinearPCM && -ctx->audio_signed_integer && -ctx->audio_bits_per_sample == 24
[FFmpeg-devel] [PATCH 5/6] libavdevice/avfoundation.m: Replace mutex-based concurrency handling in avfoundation.m by a thread-safe fifo queue with maximum length
From: Romain Beauxis This issue was particularly noticeable when working with audio input. --- libavdevice/avfoundation.m | 232 - 1 file changed, 100 insertions(+), 132 deletions(-) diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index 055e8f62e4..1825b9787a 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -26,8 +26,8 @@ */ #import -#include #include +#import #include "libavutil/channel_layout.h" #include "libavutil/pixdesc.h" @@ -42,6 +42,13 @@ #define CLEANUP_DEVICE_ID(s) [[s stringByReplacingOccurrencesOfString:@":" withString:@"."] UTF8String] +static void av_log_avfoundation(void *s, int lvl, const char *str, OSStatus err) { +NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +av_log(s, lvl, "AVFoundation: %s, %s\n", str, +[[[NSError errorWithDomain:NSOSStatusErrorDomain code:err userInfo:nil] localizedDescription] UTF8String]); +[pool release]; +} + static const int avf_time_base = 100; static const AVRational avf_time_base_q = { @@ -87,9 +94,6 @@ { AVClass*class; -int frames_captured; -int audio_frames_captured; -pthread_mutex_t frame_lock; id avf_delegate; id avf_audio_delegate; @@ -125,8 +129,9 @@ AVCaptureSession *capture_session; AVCaptureVideoDataOutput *video_output; AVCaptureAudioDataOutput *audio_output; -CMSampleBufferRef current_frame; -CMSampleBufferRef current_audio_frame; + +CMSimpleQueueRef frames_queue; +int max_frames; AVCaptureDevice *observed_device; #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @@ -135,16 +140,6 @@ int observed_quit; } AVFContext; -static void lock_frames(AVFContext* ctx) -{ -pthread_mutex_lock(&ctx->frame_lock); -} - -static void unlock_frames(AVFContext* ctx) -{ -pthread_mutex_unlock(&ctx->frame_lock); -} - /** FrameReciever class - delegate for AVCaptureSession */ @interface AVFFrameReceiver : NSObject @@ -222,17 +217,13 @@ - (void) captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)videoFrame fromConnection:(AVCaptureConnection *)connection { -lock_frames(_context); +OSStatus ret = CMSimpleQueueEnqueue(_context->frames_queue, videoFrame); -if (_context->current_frame != nil) { -CFRelease(_context->current_frame); +if (ret != noErr) { + av_log_avfoundation(_context, AV_LOG_DEBUG, "Error while queueing video frame", ret); } -_context->current_frame = (CMSampleBufferRef)CFRetain(videoFrame); - -unlock_frames(_context); - -++_context->frames_captured; +CFRetain(videoFrame); } @end @@ -266,17 +257,13 @@ - (void) captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)audioFrame fromConnection:(AVCaptureConnection *)connection { -lock_frames(_context); +OSStatus ret = CMSimpleQueueEnqueue(_context->frames_queue, audioFrame); -if (_context->current_audio_frame != nil) { -CFRelease(_context->current_audio_frame); +if (ret != noErr) { + av_log_avfoundation(_context, AV_LOG_DEBUG, "Error while queueing audio frame", ret); } -_context->current_audio_frame = (CMSampleBufferRef)CFRetain(audioFrame); - -unlock_frames(_context); - -++_context->audio_frames_captured; +CFRetain(audioFrame); } @end @@ -291,6 +278,19 @@ static void destroy_context(AVFContext* ctx) [ctx->avf_delegaterelease]; [ctx->avf_audio_delegate release]; +CMSampleBufferRef frame; + +if (ctx->frames_queue) { +frame = (CMSampleBufferRef)CMSimpleQueueDequeue(ctx->frames_queue); +while (frame) { + CFRelease(frame); + frame = (CMSampleBufferRef)CMSimpleQueueDequeue(ctx->frames_queue); +} + +CFRelease(ctx->frames_queue); +ctx->frames_queue = NULL; +} + ctx->capture_session = NULL; ctx->video_output= NULL; ctx->audio_output= NULL; @@ -298,12 +298,6 @@ static void destroy_context(AVFContext* ctx) ctx->avf_audio_delegate = NULL; av_freep(&ctx->url); - -pthread_mutex_destroy(&ctx->frame_lock); - -if (ctx->current_frame) { -CFRelease(ctx->current_frame); -} } static int parse_device_name(AVFormatContext *s) @@ -343,15 +337,14 @@ static int configure_video_device(AVFormatContext *s, AVCaptureDevice *video_dev NSObject *format = nil; NSObject *selected_range = nil; NSObject *selected_format = nil; +CMFormatDescriptionRef formatDescription; +CMVideoDimensions dimensions; // try to configure format by formats list // might raise an exception if no format list is given // (then fallback to default, no configuration) @try {
[FFmpeg-devel] [PATCH 6/6] Add AudioToolbox audio input device.
From: Romain Beauxis diff --git a/configure b/configure index a7953ffc16..37f9f7b80a 100755 --- a/configure +++ b/configure @@ -203,6 +203,7 @@ External library support: --disable-avfoundation disable Apple AVFoundation framework [autodetect] --enable-avisynthenable reading of AviSynth script files [no] --disable-bzlib disable bzlib [autodetect] + --disable-coremedia disable Apple CoreMedia framework [autodetect] --disable-coreimage disable Apple CoreImage framework [autodetect] --enable-chromaprint enable audio fingerprinting with chromaprint [no] --enable-frei0r enable frei0r video filtering [no] @@ -1751,6 +1752,7 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST=" appkit avfoundation bzlib +coremedia coreimage iconv libxcb @@ -3488,6 +3490,8 @@ alsa_outdev_deps="alsa" avfoundation_indev_deps="avfoundation corevideo coremedia pthreads" avfoundation_indev_suggest="coregraphics applicationservices" avfoundation_indev_extralibs="-framework Foundation" +audiotoolbox_indev_deps="coremedia audiotoolbox" +audiotoolbox_indev_extralibs="-framework CoreMedia -framework AudioToolbox" audiotoolbox_outdev_deps="audiotoolbox pthreads" audiotoolbox_outdev_extralibs="-framework AudioToolbox -framework CoreAudio" bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h" @@ -6330,6 +6334,7 @@ check_lib camera2ndk "stdbool.h stdint.h camera/NdkCameraManager.h" ACameraManag enabled appkit && check_apple_framework AppKit enabled audiotoolbox && check_apple_framework AudioToolbox enabled avfoundation && check_apple_framework AVFoundation +enabled coremedia&& check_apple_framework CoreMedia enabled coreimage&& check_apple_framework CoreImage enabled metal&& check_apple_framework Metal enabled videotoolbox && check_apple_framework VideoToolbox diff --git a/doc/indevs.texi b/doc/indevs.texi index 858c0fa4e4..8d57a26a5f 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -103,6 +103,41 @@ Set the maximum number of frames to buffer. Default is 5. @end table +@section AudioToolbox + +AudioToolbox input device. + +Allows native input from CoreAudio devices on OSX. + +@subsection Options + +AudioToolbox supports the following options: + +@table @option + +@item channels +Set the number of channels. Default is device's default. + +@item frames_queue_length +Maximum of buffers in the input queue + +@item buffer_frame_size +Buffer frame size, gouverning internal latency + +@item big_endian +Return big endian samples + +@item sample_format +Sample format + +@end table + +@subsection Examples + +@itemize + +@end itemize + @section avfoundation AVFoundation input device. diff --git a/libavdevice/Makefile b/libavdevice/Makefile index 99fea7133a..78d4168521 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -15,6 +15,7 @@ OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o OBJS-$(CONFIG_ALSA_INDEV)+= alsa_dec.o alsa.o timefilter.o OBJS-$(CONFIG_ALSA_OUTDEV) += alsa_enc.o alsa.o OBJS-$(CONFIG_ANDROID_CAMERA_INDEV) += android_camera.o +OBJS-$(CONFIG_AUDIOTOOLBOX_INDEV)+= audiotoolbox_dec.o OBJS-$(CONFIG_AUDIOTOOLBOX_OUTDEV) += audiotoolbox.o OBJS-$(CONFIG_AVFOUNDATION_INDEV)+= avfoundation.o OBJS-$(CONFIG_BKTR_INDEV)+= bktr.o diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index 22323a0a44..fbecdbb0b2 100644 --- a/libavdevice/alldevices.c +++ b/libavdevice/alldevices.c @@ -26,6 +26,7 @@ extern const AVInputFormat ff_alsa_demuxer; extern const AVOutputFormat ff_alsa_muxer; extern const AVInputFormat ff_android_camera_demuxer; extern const AVOutputFormat ff_audiotoolbox_muxer; +extern const AVInputFormat ff_audiotoolbox_demuxer; extern const AVInputFormat ff_avfoundation_demuxer; extern const AVInputFormat ff_bktr_demuxer; extern const AVOutputFormat ff_caca_muxer; diff --git a/libavdevice/audiotoolbox.m b/libavdevice/audiotoolbox.m index 0cb97b5e46..3216f14607 100644 --- a/libavdevice/audiotoolbox.m +++ b/libavdevice/audiotoolbox.m @@ -84,7 +84,7 @@ static av_cold int at_write_header(AVFormatContext *avctx) AudioObjectPropertyAddress prop; prop.mSelector = kAudioHardwarePropertyDevices; prop.mScope= kAudioObjectPropertyScopeGlobal; -prop.mElement = kAudioObjectPropertyElementMaster; +prop.mElement = 0; err = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, NULL, &data_size); if (check_status(avctx, &err, "AudioObjectGetPropertyDataSize devices")) return AVERROR(EINVAL); @@ -173,7 +173,7 @@ static av_cold int at_write_header(AVFormatContext *avctx) device_format.mFormatFlags |= (codecpar->codec_id == AV_CODEC_ID_PCM_S16BE) ? kAudioFormatFlagIsBigEndian : 0; device_format.mFormatFlags |= (codecpar->codec_id == AV_CODEC_ID_PCM_S24BE) ? kAudioFormatFlagIsBigE
Re: [FFmpeg-devel] [PATCH 1/6] Fix dshow device name/description
On Tue, Mar 22, 2022 at 7:40 AM wrote: > > From: Romain Beauxis > > diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c > index 6039578ff9..4ee3f6e194 100644 > --- a/libavdevice/dshow.c > +++ b/libavdevice/dshow.c > @@ -552,8 +552,8 @@ dshow_cycle_devices(AVFormatContext *avctx, > ICreateDevEnum *devenum, > if (!device) > goto fail; > > -device->device_name = av_strdup(friendly_name); > -device->device_description = av_strdup(unique_name); > +device->device_name = av_strdup(unique_name); > +device->device_description = av_strdup(friendly_name); > if (!device->device_name || !device->device_description) > goto fail; > LGTM. The device enumeration API was added only recently to dshow, guess a bug crept in. Thanks! ___ 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 0/6] Various libavdevice cleanup & enhancements
On Tue, Mar 22, 2022 at 7:40 AM wrote: > > From: Romain Beauxis > > This is a series of patches that fix and enhances libavdevice & have been > submitted multiple times in the past 6 months. In the series, the most > straightforward patches have been placed first in the list. > > While I have a lot of appreciation for all the solid work done in this > project, seeing the difficulty in getting them included makes one wonder what > is the status of libavdevice and if it is still actively maintained. dshow gets used in windows land. Maintained, well... :) > > Typically, in the first patch, we fix the name/machine readable ID of dshow > devices. If the API has any significant use or maintenance, this should have > been caught and fixed much sooner. > > Next, the patches fixing the avfoundation device audio format and concurrency > models are absolutely required to get any use of this operator as audio input > and, quite likely, as video input as well. > > This is a lot of changes to make the library usable for a cross-platform > project and, with the lack of traction with the changes, this makes the > developer wonder if the library is ready for production use and if it > wouldn't be easier to implement hardware handling separately and plug into > FFmpeg after retreiving media data. > > There are more that I have noticed with the API, in particular the fact that > audio/video devices are labelled as video. I would love to submit changes to > enhance that aspect but, not with all these patches already pending.. > > Thanks for y'all consideration. > -- Romain > > Romain Beauxis (6): > Fix dshow device name/description > Use appropriate method for device discovery, fix crash with bogus > device index. > libavdevice/avfoundation.m: Allow to select devices by unique ID > libavdevice/avfoundation.m: use setAudioSettings, extend supported > formats > libavdevice/avfoundation.m: Replace mutex-based concurrency handling > in avfoundation.m by a thread-safe fifo queue with maximum length > Add AudioToolbox audio input device. > > configure | 5 + > doc/indevs.texi| 41 ++- > libavdevice/Makefile | 1 + > libavdevice/alldevices.c | 1 + > libavdevice/audiotoolbox.m | 8 +- > libavdevice/audiotoolbox_dec.m | 530 > libavdevice/avfoundation.m | 547 - > libavdevice/dshow.c| 4 +- > 8 files changed, 843 insertions(+), 294 deletions(-) > create mode 100644 libavdevice/audiotoolbox_dec.m > > -- > 2.32.0 (Apple Git-132) > > ___ > 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] [PATCH v4 1/2] lavc/vaapi_encode: add support for maxframesize
From: Linjie Fu Add support for max frame size: - max_frame_size (bytes) to indicate the max allowed size for frame. If the frame size exceeds the limitation, encoder will to control the frame size by adjusting QP value. - MFS_NUM_PASSES to indicate number of passes for QP adjust. - MFS_DELTA_QP to indicate adjust qp value per pass. To simplify the usage, default QP adjust is set to delta_qp[4] = {1, 1, 1, 1}. Use new_qp for encoder if frame size exceeds the limitation: new_qp = base_qp + delta_qp[0] + delta_qp[1] + ... ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -f rawvideo \ -v verbose -s:v 352x288 -i ./input.yuv -vf format=nv12,hwupload \ -c:v h264_vaapi -profile:v main -g 30 -bf 3 -max_frame_size 4 \ -vframes 100 -y ./max_frame_size.h264 Max frame size was enabled since VA-API version (1, 3, 0), but query is available since (1, 5, 0). It will be passed as a parameter in picParam and should be set for each frame. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- 1. re-send the 2 legacy patch: https://patchwork.ffmpeg.org/project/ffmpeg/patch/20190715105936.4860-1-linjie...@intel.com/ https://patchwork.ffmpeg.org/project/ffmpeg/patch/2019071511.5069-1-linjie...@intel.com/ libavcodec/vaapi_encode.c | 67 +++ libavcodec/vaapi_encode.h | 19 +-- 2 files changed, 84 insertions(+), 2 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index ffd6cb1c25..b2782e6f9e 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -365,6 +365,17 @@ static int vaapi_encode_issue(AVCodecContext *avctx, goto fail; } +#if VA_CHECK_VERSION(1, 5, 0) +if (ctx->max_frame_size) { +err = vaapi_encode_make_misc_param_buffer(avctx, pic, + VAEncMiscParameterTypeMultiPassFrameSize, +&ctx->mfs_params, +sizeof(ctx->mfs_params)); +if (err < 0) +goto fail; +} +#endif + if (pic->type == PICTURE_TYPE_IDR) { if (ctx->va_packed_headers & VA_ENC_PACKED_HEADER_SEQUENCE && ctx->codec->write_sequence_header) { @@ -1869,6 +1880,54 @@ rc_mode_found: return 0; } +static av_cold int vaapi_encode_init_max_frame_size(AVCodecContext *avctx) +{ +#if VA_CHECK_VERSION(1, 5, 0) +VAAPIEncodeContext *ctx = avctx->priv_data; +VAConfigAttrib attr = { VAConfigAttribMaxFrameSize }; +VAStatus vas; +int i; + +vas = vaGetConfigAttributes(ctx->hwctx->display, +ctx->va_profile, +ctx->va_entrypoint, +&attr, 1); +if (vas != VA_STATUS_SUCCESS) { +ctx->max_frame_size = 0; +av_log(avctx, AV_LOG_ERROR, "Failed to query max frame size " + "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); +return AVERROR_EXTERNAL; +} + +if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { +ctx->max_frame_size = 0; +av_log(avctx, AV_LOG_WARNING, "Max frame size attribute " + "is not supported.\n"); +} else { +ctx->delta_qp = av_calloc(MFS_NUM_PASSES, sizeof(uint8_t)); +if (!ctx->delta_qp) { +return AVERROR(ENOMEM); +} +for (i = 0; i delta_qp[i] = MFS_DELTA_QP; + +ctx->mfs_params = (VAEncMiscParameterBufferMultiPassFrameSize){ +.max_frame_size = ctx->max_frame_size, +.num_passes = MFS_NUM_PASSES, +.delta_qp = ctx->delta_qp, +}; + +av_log(avctx, AV_LOG_VERBOSE, "Max Frame Size: %d bytes.\n ", + ctx->max_frame_size); +} +#else +av_log(avctx, AV_LOG_WARNING, "Max Frame Size is " +"not supported with this VA version.\n"); +#endif + +return 0; +} + static av_cold int vaapi_encode_init_gop_structure(AVCodecContext *avctx) { VAAPIEncodeContext *ctx = avctx->priv_data; @@ -2475,6 +2534,12 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) goto fail; } +if (ctx->max_frame_size) { +err = vaapi_encode_init_max_frame_size(avctx); +if (err < 0) +goto fail; +} + vas = vaCreateConfig(ctx->hwctx->display, ctx->va_profile, ctx->va_entrypoint, ctx->config_attributes, ctx->nb_config_attributes, @@ -2618,6 +2683,8 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx) av_frame_free(&ctx->frame); +if (ctx->delta_qp) +av_freep(&ctx->delta_qp); av_freep(&ctx->codec_sequence_params); av_freep(&ctx->codec_picture_params); av_fifo_freep2(&ctx->encode_fifo); diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h index 1b40819c69..72f9256a8e 100644 --- a/libavcodec/vaapi_encode.h
[FFmpeg-devel] [PATCH v4 2/2] doc/vaapi_encode: add documentations for max_frame_size
From: Linjie Fu Add docs for max_frame_size option. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- doc/encoders.texi | 6 ++ 1 file changed, 6 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 1bd38671ca..93fb535e98 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3602,6 +3602,12 @@ performance. This option doesn't work if driver doesn't implement vaSyncBuffer function. Please make sure there are enough hw_frames allocated if a large number of async_depth is used. +@item max_frame_size +Set the allowed max size in bytes for each frame. If the frame size exceeds +the limitation, encoder will adjust the QP value by adding delta_qp for each +pass to control the frame size. To simplify the usage, delta_qp is set to +default. + @item rc_mode Set the rate control mode to use. A given driver may only support a subset of modes. -- 2.25.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".
Re: [FFmpeg-devel] [PATCH 1/2] avformat/movenc: initialize pts/dts/duration of timecode packet
On Tue, Mar 22, 2022 at 02:28:10PM +0100, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > On Fri, Mar 11, 2022 at 05:16:09PM +0100, Andreas Rheinhardt wrote: > >> lance.lmw...@gmail.com: > >>> On Fri, Mar 11, 2022 at 03:04:32PM +0100, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > On Wed, Mar 02, 2022 at 09:58:31PM +0800, lance.lmw...@gmail.com wrote: > >> From: Limin Wang > >> > >> Fix below error message when timecode packet is written. > >> "Application provided duration: -9223372036854775808 / timestamp: > >> -9223372036854775808 is out of range for mov/mp4 format" > >> > >> try to reproduce by: > >> ffmpeg -y -f lavfi -i color -metadata "timecode=00:00:00:00" -t 1 > >> test.mov > >> > >> Note although error message is printed, the timecode packet will be > >> written anyway. So > >> the patch 2/2 will try to change the log level to warning. > >> > >> The first two test case of fate-lavf-ismv have timecode setting, so > >> the crc of ref data is different. > >> Fixes ticket #9488 > >> > >> Signed-off-by: Limin Wang > >> --- > >> libavformat/movenc.c | 2 ++ > >> tests/ref/lavf/ismv | 4 ++-- > >> 2 files changed, 4 insertions(+), 2 deletions(-) > >> > >> diff --git a/libavformat/movenc.c b/libavformat/movenc.c > >> index 4c86891..74b94cd 100644 > >> --- a/libavformat/movenc.c > >> +++ b/libavformat/movenc.c > >> @@ -6383,6 +6383,8 @@ static int > >> mov_create_timecode_track(AVFormatContext *s, int index, int src_inde > >> pkt->data = data; > >> pkt->stream_index = index; > >> pkt->flags = AV_PKT_FLAG_KEY; > >> +pkt->pts = pkt->dts = av_rescale_q(tc.start, av_inv_q(rate), > >> (AVRational){1,mov->movie_timescale}); > >> +pkt->duration = av_rescale_q(1, av_inv_q(rate), > >> (AVRational){1,mov->movie_timescale}); > >> pkt->size = 4; > >> AV_WB32(pkt->data, tc.start); > >> ret = ff_mov_write_packet(s, pkt); > >> diff --git a/tests/ref/lavf/ismv b/tests/ref/lavf/ismv > >> index ac7f72b..723b432 100644 > >> --- a/tests/ref/lavf/ismv > >> +++ b/tests/ref/lavf/ismv > >> @@ -1,7 +1,7 @@ > >> -48fb8d7a5d19bd60f3a49ccf4b7d6593 *tests/data/lavf/lavf.ismv > >> +7a24b73c096ec0f13f0f7a2d9101c4c1 *tests/data/lavf/lavf.ismv > >> 313169 tests/data/lavf/lavf.ismv > >> tests/data/lavf/lavf.ismv CRC=0x9d9a638a > >> -d19cd8e310a2e94fe0a0d11c5dc29217 *tests/data/lavf/lavf.ismv > >> +79646383fd099d45ad0d0c2791c601dd *tests/data/lavf/lavf.ismv > >> 322075 tests/data/lavf/lavf.ismv > >> tests/data/lavf/lavf.ismv CRC=0xe8130120 > >> 3b6023766845b51b075aed474c00f73c *tests/data/lavf/lavf.ismv > >> -- > >> 1.8.3.1 > >> > > > > will apply the patch set tomorrow unless there are any objections. > > > > You have not really answered whether the current files or the new files > are spec-incompliant; you have just reported that one byte is different. > >>> > >>> Sorry, I think I have said both current and new file is spec-compliant in > >>> the last > >>> email. > >>> > >> > >> You stated that you think that both files are valid, but you also said > >> that you don't even know what this byte that is different actually means. > >> > >>> By Quicktime file format specs: > >>> Section Timecode Sample Description, all tmcd field isn't used pts/dts. > >>> > >>> As for where is the different for one byte, it's caused by pkt->duration. > >>> The > >>> old is 0(uninitialized), after the patch it's 33(1 frame duration). > >>> > >> > >> The text about Timecode Sample Description reads as follows: "Frame > >> duration: A 32-bit integer that indicates how long each frame lasts in > >> real time." This implies that only one of the two files can be > >> spec-compliant. I am not a mov/ISOBMFF expert, but it seems to me that > >> the current way of doing things is wrong. But I wonder about whether > >> your patch is correct for vfr content. Doesn't the property of being vfr > >> need to be reflected in the timecodes somehow (with different durations > >> for different packets)? > > > > Andreas, I have updated the patch and remove the fate difference which is > > caused by duration, do you have any other comments for v2 patch? > > > > No. Thanks, then will apply the v2 patchsetet. > > - Andreas > ___ > 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". -- Thanks, Limin Wang ___ 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 "un
Re: [FFmpeg-devel] [PATCH v7 3/5] avcodec/libjxl: add Jpeg XL encoding via libjxl
19 Mar 2022, 18:26 by leo.i...@gmail.com: > This commit adds encoding support to libavcodec > for Jpeg XL images via the external library libjxl. > --- > configure | 3 +- > libavcodec/Makefile| 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/libjxlenc.c | 386 + > 4 files changed, 390 insertions(+), 1 deletion(-) > create mode 100644 libavcodec/libjxlenc.c > I can't accept this as-is, so NAK. The coding style needs to be fixed. And you must remove the sneaky MAINTAINERS change to get yourself push access. We made that against the rules, which you've clearly read before submitting the patchset, right? Then I'll spare time to look at it and merge it myself. ___ 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 v7 3/5] avcodec/libjxl: add Jpeg XL encoding via libjxl
On 22 Mar 2022, at 16:35, Lynne wrote: > 19 Mar 2022, 18:26 by leo.i...@gmail.com: > >> This commit adds encoding support to libavcodec >> for Jpeg XL images via the external library libjxl. >> --- >> configure | 3 +- >> libavcodec/Makefile| 1 + >> libavcodec/allcodecs.c | 1 + >> libavcodec/libjxlenc.c | 386 + >> 4 files changed, 390 insertions(+), 1 deletion(-) >> create mode 100644 libavcodec/libjxlenc.c >> > > I can't accept this as-is, so NAK. > > The coding style needs to be fixed. > And you must remove the sneaky MAINTAINERS change to get yourself > push access. We made that against the rules, which you've clearly read > before submitting the patchset, right? Since when do people in MAINTAINERS automatically get push access? Back then when I contributed the Icecast module I was specifically asked to add me to the MAINTAINERS file for it and I do not have commit access. As far as I can see there is nothing in the rules stating what you said? The only relevant entry I found is: Check your entries in MAINTAINERS. Make sure that no parts of the codebase that you maintain are missing from the MAINTAINERS file. If something that you want to maintain is missing add it with your name after it. If at some point you no longer want to maintain some code, then please help in finding a new maintainer and also don’t forget to update the MAINTAINERS file. which seems to imply that what was done here is actually what is supposed to be done. If that's not true, it would probably help to reword this to clarify things… > > Then I'll spare time to look at it and merge it myself. > ___ > 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] avfilter/vf_subtitles: pass storage size to libass
On Mon, Mar 14, 2022 at 20:06:39 +0100, Oneric wrote: > Due to a quirk of the ASS format some tags depend on the exact storage > resolution of the video, so tell libass via ass_set_storage_size. > [...] On Mon, Mar 14, 2022 at 20:21:47 +, Soft Works wrote: > [...] > > Ah, alright, the blur setting goes deeper. Thanks for the explanation. > > LGTM, then! ping ___ 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 v3 1/2] lavf/mpegenc: fix ever-growing fifo size since the new API
The older av_fifo_realloc2 implemented an auto grow that should be ported as such in the new API. This patch introduces a limitation in the fifo buffer size. The default is set to 128MB and may be overriden by a new user option. The amount of memory allocated depends on multiple factors, including the number of audio streams. A worst case scenario is where an out-of-spec high video bitrate is combined with numerous low bitrate audios. Fix regressing since ea511196a6c85eb433e10cdbecb0b2c722faf20d Signed-off-by: Nicolas Gaullier --- libavformat/mpegenc.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index cc47a43288..5d755e3bdd 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -84,6 +84,7 @@ typedef struct MpegMuxContext { int64_t vcd_padding_bytes_written; int preload; +uint32_t fifo_size_limit; } MpegMuxContext; extern const AVOutputFormat ff_mpeg1vcd_muxer; @@ -461,9 +462,10 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) av_get_media_type_string(st->codecpar->codec_type), i); return AVERROR(EINVAL); } -stream->fifo = av_fifo_alloc2(16, 1, 0); +stream->fifo = av_fifo_alloc2(16, 1, AV_FIFO_FLAG_AUTO_GROW); if (!stream->fifo) return AVERROR(ENOMEM); +av_fifo_auto_grow_limit(stream->fifo, s->fifo_size_limit); } bitrate = 0; audio_bitrate = 0; @@ -1151,7 +1153,7 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) StreamInfo *stream = st->priv_data; int64_t pts, dts; PacketDesc *pkt_desc; -int preload, ret; +int preload; const int is_iframe = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && (pkt->flags & AV_PKT_FLAG_KEY); @@ -1207,10 +1209,6 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) pkt_desc->unwritten_size = pkt_desc->size = size; -ret = av_fifo_grow2(stream->fifo, size); -if (ret < 0) -return ret; - if (s->is_dvd) { // min VOBU length 0.4 seconds (mpucoder) if (is_iframe && @@ -1277,6 +1275,7 @@ static void mpeg_mux_deinit(AVFormatContext *ctx) static const AVOption options[] = { { "muxrate", NULL, OFFSET(user_mux_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, ((1<<22) - 1) * (8 * 50), E }, { "preload", "Initial demux-decode delay in microseconds.", OFFSET(preload), AV_OPT_TYPE_INT, { .i64 = 50 }, 0, INT_MAX, E }, +{ "fifo_size_limit", "Maximum allowed memory for buffering an input stream in bytes", OFFSET(fifo_size_limit), AV_OPT_TYPE_INT, {.i64 = 128 * 1024 * 1024 }, 0, UINT_MAX, E}, { NULL }, }; -- 2.34.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".
[FFmpeg-devel] [PATCH v3 2/2] lavf/mpegenc: fix termination following a fifo overrun
Avoid an infinite 'retry' loop in output_packet when flushing. A fatal error mentions the availability of fifo_size_limit option. Signed-off-by: Nicolas Gaullier --- libavformat/mpegenc.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 5d755e3bdd..eff4531037 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -85,6 +85,7 @@ typedef struct MpegMuxContext { int preload; uint32_t fifo_size_limit; +int fifo_size_exceeded; } MpegMuxContext; extern const AVOutputFormat ff_mpeg1vcd_muxer; @@ -1153,7 +1154,7 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) StreamInfo *stream = st->priv_data; int64_t pts, dts; PacketDesc *pkt_desc; -int preload; +int preload, ret; const int is_iframe = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && (pkt->flags & AV_PKT_FLAG_KEY); @@ -1220,10 +1221,17 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) } } -av_fifo_write(stream->fifo, buf, size); +ret = av_fifo_write(stream->fifo, buf, size); +if (ret == AVERROR(ENOSPC)) { +s->fifo_size_exceeded = 1; +av_log(s, AV_LOG_FATAL, "Input stream buffer overrun. " +"To avoid, increase fifo_size_limit option.\n"); +} +if (ret < 0) +return ret; for (;;) { -int ret = output_packet(ctx, 0); +ret = output_packet(ctx, 0); if (ret <= 0) return ret; } @@ -1231,9 +1239,13 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) static int mpeg_mux_end(AVFormatContext *ctx) { +MpegMuxContext *s = ctx->priv_data; StreamInfo *stream; int i; +if (s->fifo_size_exceeded) +return 0; + for (;;) { int ret = output_packet(ctx, 1); if (ret < 0) -- 2.34.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_subtitles: pass storage size to libass
> -Original Message- > From: ffmpeg-devel On Behalf Of > Oneric > Sent: Tuesday, March 22, 2022 5:28 PM > To: FFmpeg development discussions and patches de...@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH] avfilter/vf_subtitles: pass > storage size to libass > > On Mon, Mar 14, 2022 at 20:06:39 +0100, Oneric wrote: > > Due to a quirk of the ASS format some tags depend on the exact > storage > > resolution of the video, so tell libass via ass_set_storage_size. > > [...] > > On Mon, Mar 14, 2022 at 20:21:47 +, Soft Works wrote: > > [...] > > > > Ah, alright, the blur setting goes deeper. Thanks for the > explanation. > > > > LGTM, then! > > > ping It's not on me. I would have merged it, but I don't have push permissions. softworkz ___ 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_subtitles: pass storage size to libass
On 3/22/2022 1:42 PM, Soft Works wrote: -Original Message- From: ffmpeg-devel On Behalf Of Oneric Sent: Tuesday, March 22, 2022 5:28 PM To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH] avfilter/vf_subtitles: pass storage size to libass On Mon, Mar 14, 2022 at 20:06:39 +0100, Oneric wrote: Due to a quirk of the ASS format some tags depend on the exact storage resolution of the video, so tell libass via ass_set_storage_size. [...] On Mon, Mar 14, 2022 at 20:21:47 +, Soft Works wrote: [...] Ah, alright, the blur setting goes deeper. Thanks for the explanation. LGTM, then! ping It's not on me. I would have merged it, but I don't have push permissions. softworkz Will apply it unless someone is against it. ___ 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 3/3] avformat/movenc: Add support for AVIF muxing
On Mon, Mar 21, 2022 at 1:46 PM Andreas Rheinhardt wrote: > > Vignesh Venkatasubramanian: > > Add an AVIF muxer by re-using the existing the mov/mp4 muxer. > > > > AVIF Specifiation: https://aomediacodec.github.io/av1-avif > > > > Sample usage for still image: > > ffmpeg -i image.png -c:v libaom-av1 -avif-image 1 image.avif > > > > Sample usage for animated AVIF image: > > ffmpeg -i video.mp4 animated.avif > > > > We can re-use any of the AV1 encoding options that will make > > sense for image encoding (like bitrate, tiles, encoding speed, > > etc). > > > > The files generated by this muxer has been verified to be valid > > AVIF files by the following: > > 1) Displays on Chrome (both still and animated images). > > 2) Displays on Firefox (only still images, firefox does not support > >animated AVIF yet). > > 3) Verfied to be valid by Compliance Warden: > >https://github.com/gpac/ComplianceWarden > > > > Fixes the encoder/muxer part of Trac Ticket #7621 > > > > Signed-off-by: Vignesh Venkatasubramanian > > --- > > configure| 1 + > > libavformat/allformats.c | 1 + > > libavformat/movenc.c | 341 --- > > libavformat/movenc.h | 5 + > > 4 files changed, 322 insertions(+), 26 deletions(-) > > > > diff --git a/configure b/configure > > index 8c69ab0c86..6d7020e96b 100755 > > --- a/configure > > +++ b/configure > > @@ -3390,6 +3390,7 @@ asf_stream_muxer_select="asf_muxer" > > av1_demuxer_select="av1_frame_merge_bsf av1_parser" > > avi_demuxer_select="riffdec exif" > > avi_muxer_select="riffenc" > > +avif_muxer_select="mov_muxer" > > caf_demuxer_select="iso_media" > > caf_muxer_select="iso_media" > > dash_muxer_select="mp4_muxer" > > diff --git a/libavformat/allformats.c b/libavformat/allformats.c > > index d066a7745b..400c17afbd 100644 > > --- a/libavformat/allformats.c > > +++ b/libavformat/allformats.c > > @@ -81,6 +81,7 @@ extern const AVOutputFormat ff_au_muxer; > > extern const AVInputFormat ff_av1_demuxer; > > extern const AVInputFormat ff_avi_demuxer; > > extern const AVOutputFormat ff_avi_muxer; > > +extern const AVOutputFormat ff_avif_muxer; > > extern const AVInputFormat ff_avisynth_demuxer; > > extern const AVOutputFormat ff_avm2_muxer; > > extern const AVInputFormat ff_avr_demuxer; > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c > > index 1a746a67fd..ff41579300 100644 > > --- a/libavformat/movenc.c > > +++ b/libavformat/movenc.c > > @@ -1303,7 +1303,7 @@ static int mov_write_av1c_tag(AVIOContext *pb, > > MOVTrack *track) > > > > avio_wb32(pb, 0); > > ffio_wfourcc(pb, "av1C"); > > -ff_isom_write_av1c(pb, track->vos_data, track->vos_len, 1); > > +ff_isom_write_av1c(pb, track->vos_data, track->vos_len, track->mode != > > MODE_AVIF); > > return update_size(pb, pos); > > } > > > > @@ -2004,12 +2004,13 @@ static int mov_write_colr_tag(AVIOContext *pb, > > MOVTrack *track, int prefer_icc) > > } > > } > > > > -/* We should only ever be called by MOV or MP4. */ > > -av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4); > > +/* We should only ever be called for MOV, MP4 and AVIF. */ > > +av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4 || > > + track->mode == MODE_AVIF); > > > > avio_wb32(pb, 0); /* size */ > > ffio_wfourcc(pb, "colr"); > > -if (track->mode == MODE_MP4) > > +if (track->mode == MODE_MP4 || track->mode == MODE_AVIF) > > ffio_wfourcc(pb, "nclx"); > > else > > ffio_wfourcc(pb, "nclc"); > > @@ -2019,7 +2020,7 @@ static int mov_write_colr_tag(AVIOContext *pb, > > MOVTrack *track, int prefer_icc) > > avio_wb16(pb, track->par->color_primaries); > > avio_wb16(pb, track->par->color_trc); > > avio_wb16(pb, track->par->color_space); > > -if (track->mode == MODE_MP4) { > > +if (track->mode == MODE_MP4 || track->mode == MODE_AVIF) { > > int full_range = track->par->color_range == AVCOL_RANGE_JPEG; > > avio_w8(pb, full_range << 7); > > } > > @@ -2085,7 +2086,7 @@ static void find_compressor(char * compressor_name, > > int len, MOVTrack *track) > >|| (track->par->width == 1440 && track->par->height == > > 1080) > >|| (track->par->width == 1920 && track->par->height == > > 1080); > > > > -if (track->mode == MODE_MOV && > > +if ((track->mode == MODE_AVIF || track->mode == MODE_MOV) && > > (encoder = av_dict_get(track->st->metadata, "encoder", NULL, 0))) { > > av_strlcpy(compressor_name, encoder->value, 32); > > } else if (track->par->codec_id == AV_CODEC_ID_MPEG2VIDEO && > > xdcam_res) { > > @@ -2106,6 +2107,25 @@ static void find_compressor(char * compressor_name, > > int len, MOVTrack *track) > > } > > } > > > > +static int mov_write_ccst_tag(AVIOContext *pb) > > +{ > > +int64_t pos = avio_tell(pb); > > +// Write sane defaults: > > +
[FFmpeg-devel] [PATCH 3/3] avformat/movenc: Add support for AVIF muxing
Add an AVIF muxer by re-using the existing the mov/mp4 muxer. AVIF Specifiation: https://aomediacodec.github.io/av1-avif Sample usage for still image: ffmpeg -i image.png -c:v libaom-av1 -avif-image 1 image.avif Sample usage for animated AVIF image: ffmpeg -i video.mp4 animated.avif We can re-use any of the AV1 encoding options that will make sense for image encoding (like bitrate, tiles, encoding speed, etc). The files generated by this muxer has been verified to be valid AVIF files by the following: 1) Displays on Chrome (both still and animated images). 2) Displays on Firefox (only still images, firefox does not support animated AVIF yet). 3) Verfied to be valid by Compliance Warden: https://github.com/gpac/ComplianceWarden Fixes the encoder/muxer part of Trac Ticket #7621 Signed-off-by: Vignesh Venkatasubramanian --- configure| 1 + libavformat/allformats.c | 1 + libavformat/movenc.c | 337 --- libavformat/movenc.h | 5 + 4 files changed, 319 insertions(+), 25 deletions(-) diff --git a/configure b/configure index dff53e88bc..5aaf198704 100755 --- a/configure +++ b/configure @@ -3394,6 +3394,7 @@ asf_stream_muxer_select="asf_muxer" av1_demuxer_select="av1_frame_merge_bsf av1_parser" avi_demuxer_select="riffdec exif" avi_muxer_select="riffenc" +avif_muxer_select="mov_muxer" caf_demuxer_select="iso_media" caf_muxer_select="iso_media" dash_muxer_select="mp4_muxer" diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 587ad59b3c..29e58353ee 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -81,6 +81,7 @@ extern const AVOutputFormat ff_au_muxer; extern const AVInputFormat ff_av1_demuxer; extern const AVInputFormat ff_avi_demuxer; extern const AVOutputFormat ff_avi_muxer; +extern const AVOutputFormat ff_avif_muxer; extern const AVInputFormat ff_avisynth_demuxer; extern const AVOutputFormat ff_avm2_muxer; extern const AVInputFormat ff_avr_demuxer; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 1c31f48abb..b9b424bc97 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1306,7 +1306,7 @@ static int mov_write_av1c_tag(AVIOContext *pb, MOVTrack *track) avio_wb32(pb, 0); ffio_wfourcc(pb, "av1C"); -ff_isom_write_av1c(pb, track->vos_data, track->vos_len, 1); +ff_isom_write_av1c(pb, track->vos_data, track->vos_len, track->mode != MODE_AVIF); return update_size(pb, pos); } @@ -2007,12 +2007,13 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc) } } -/* We should only ever be called by MOV or MP4. */ -av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4); +/* We should only ever be called for MOV, MP4 and AVIF. */ +av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4 || + track->mode == MODE_AVIF); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "colr"); -if (track->mode == MODE_MP4) +if (track->mode == MODE_MP4 || track->mode == MODE_AVIF) ffio_wfourcc(pb, "nclx"); else ffio_wfourcc(pb, "nclc"); @@ -2022,7 +2023,7 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc) avio_wb16(pb, track->par->color_primaries); avio_wb16(pb, track->par->color_trc); avio_wb16(pb, track->par->color_space); -if (track->mode == MODE_MP4) { +if (track->mode == MODE_MP4 || track->mode == MODE_AVIF) { int full_range = track->par->color_range == AVCOL_RANGE_JPEG; avio_w8(pb, full_range << 7); } @@ -2088,7 +2089,7 @@ static void find_compressor(char * compressor_name, int len, MOVTrack *track) || (track->par->width == 1440 && track->par->height == 1080) || (track->par->width == 1920 && track->par->height == 1080); -if (track->mode == MODE_MOV && +if ((track->mode == MODE_AVIF || track->mode == MODE_MOV) && (encoder = av_dict_get(track->st->metadata, "encoder", NULL, 0))) { av_strlcpy(compressor_name, encoder->value, 32); } else if (track->par->codec_id == AV_CODEC_ID_MPEG2VIDEO && xdcam_res) { @@ -2109,6 +2110,25 @@ static void find_compressor(char * compressor_name, int len, MOVTrack *track) } } +static int mov_write_ccst_tag(AVIOContext *pb) +{ +int64_t pos = avio_tell(pb); +// Write sane defaults: +// all_ref_pics_intra = 0 : all samples can use any type of reference. +// intra_pred_used = 1 : intra prediction may or may not be used. +// max_ref_per_pic = 15 : reserved value to indicate that any number of +//reference images can be used. +uint8_t ccstValue = (0 << 7) | /* all_ref_pics_intra */ +(1 << 6) | /* intra_pred_used */ +(15 << 2); /* max_ref_per_pic */ +avio_wb32(pb, 0); /* size */ +ffio_wfourcc(pb, "ccst"); +avio_wb32(pb, 0); /* Version & f
Re: [FFmpeg-devel] [PATCH v3 1/2] lavf/mpegenc: fix ever-growing fifo size since the new API
Nicolas Gaullier: > The older av_fifo_realloc2 implemented an auto grow that > should be ported as such in the new API. > > This patch introduces a limitation in the fifo buffer size. > The default is set to 128MB and may be overriden by a new user option. > The amount of memory allocated depends on multiple factors, including > the number of audio streams. > A worst case scenario is where an out-of-spec high video bitrate is > combined with numerous low bitrate audios. > > Fix regressing since ea511196a6c85eb433e10cdbecb0b2c722faf20d > > Signed-off-by: Nicolas Gaullier > --- > libavformat/mpegenc.c | 11 +-- > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c > index cc47a43288..5d755e3bdd 100644 > --- a/libavformat/mpegenc.c > +++ b/libavformat/mpegenc.c > @@ -84,6 +84,7 @@ typedef struct MpegMuxContext { > int64_t vcd_padding_bytes_written; > > int preload; > +uint32_t fifo_size_limit; > } MpegMuxContext; > > extern const AVOutputFormat ff_mpeg1vcd_muxer; > @@ -461,9 +462,10 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) > av_get_media_type_string(st->codecpar->codec_type), i); > return AVERROR(EINVAL); > } > -stream->fifo = av_fifo_alloc2(16, 1, 0); > +stream->fifo = av_fifo_alloc2(16, 1, AV_FIFO_FLAG_AUTO_GROW); > if (!stream->fifo) > return AVERROR(ENOMEM); > +av_fifo_auto_grow_limit(stream->fifo, s->fifo_size_limit); > } > bitrate = 0; > audio_bitrate = 0; > @@ -1151,7 +1153,7 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, > AVPacket *pkt) > StreamInfo *stream = st->priv_data; > int64_t pts, dts; > PacketDesc *pkt_desc; > -int preload, ret; > +int preload; > const int is_iframe = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && >(pkt->flags & AV_PKT_FLAG_KEY); > > @@ -1207,10 +1209,6 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, > AVPacket *pkt) > pkt_desc->unwritten_size = > pkt_desc->size = size; > > -ret = av_fifo_grow2(stream->fifo, size); > -if (ret < 0) > -return ret; > - > if (s->is_dvd) { > // min VOBU length 0.4 seconds (mpucoder) > if (is_iframe && > @@ -1277,6 +1275,7 @@ static void mpeg_mux_deinit(AVFormatContext *ctx) > static const AVOption options[] = { > { "muxrate", NULL, > OFFSET(user_mux_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, ((1<<22) - 1) * (8 * > 50), E }, > { "preload", "Initial demux-decode delay in microseconds.", > OFFSET(preload), AV_OPT_TYPE_INT, { .i64 = 50 }, 0, INT_MAX, E }, > +{ "fifo_size_limit", "Maximum allowed memory for buffering an input > stream in bytes", OFFSET(fifo_size_limit), AV_OPT_TYPE_INT, {.i64 = 128 * > 1024 * 1024 }, 0, UINT_MAX, E}, > { NULL }, > }; > 1. Options of type AV_OPT_TYPE_INT need to have a target of type int. 2. Setting UINT_MAX as maximum for such an option is nonsense; INT_MAX is the maximum for it. (FFMIN(INT_MAX, SIZE_MAX) would be even better.) 3. Allowing zero for fifo_size_limit makes no sense, as the above code allocates 16 when allocating the FIFO. 4. After removing av_fifo_grow2() it is no longer assured that av_fifo_write() succeeds; it therefore needs to be checked. - Andreas ___ 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 v3 2/2] lavf/mpegenc: fix termination following a fifo overrun
Nicolas Gaullier: > Avoid an infinite 'retry' loop in output_packet when flushing. > > A fatal error mentions the availability of fifo_size_limit option. > > Signed-off-by: Nicolas Gaullier > --- > libavformat/mpegenc.c | 18 +++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > > diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c > index 5d755e3bdd..eff4531037 100644 > --- a/libavformat/mpegenc.c > +++ b/libavformat/mpegenc.c > @@ -85,6 +85,7 @@ typedef struct MpegMuxContext { > > int preload; > uint32_t fifo_size_limit; > +int fifo_size_exceeded; > } MpegMuxContext; > > extern const AVOutputFormat ff_mpeg1vcd_muxer; > @@ -1153,7 +1154,7 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, > AVPacket *pkt) > StreamInfo *stream = st->priv_data; > int64_t pts, dts; > PacketDesc *pkt_desc; > -int preload; > +int preload, ret; > const int is_iframe = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && >(pkt->flags & AV_PKT_FLAG_KEY); > > @@ -1220,10 +1221,17 @@ static int mpeg_mux_write_packet(AVFormatContext > *ctx, AVPacket *pkt) > } > } > > -av_fifo_write(stream->fifo, buf, size); > +ret = av_fifo_write(stream->fifo, buf, size); > +if (ret == AVERROR(ENOSPC)) { > +s->fifo_size_exceeded = 1; > +av_log(s, AV_LOG_FATAL, "Input stream buffer overrun. " > +"To avoid, increase fifo_size_limit option.\n"); > +} > +if (ret < 0) > +return ret; > > for (;;) { > -int ret = output_packet(ctx, 0); > +ret = output_packet(ctx, 0); > if (ret <= 0) > return ret; > } > @@ -1231,9 +1239,13 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, > AVPacket *pkt) > > static int mpeg_mux_end(AVFormatContext *ctx) > { > +MpegMuxContext *s = ctx->priv_data; > StreamInfo *stream; > int i; > > +if (s->fifo_size_exceeded) > +return 0; > + > for (;;) { > int ret = output_packet(ctx, 1); > if (ret < 0) Could this infinite loop also happen before switching to the new API? Does it happen because avail_data is zero for all streams? - Andreas ___ 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 v4 1/2] lavf/mpegenc: fix ever-growing fifo size since the new API
The older av_fifo_realloc2 implemented an auto grow that should be ported as such in the new API. This patch introduces a limitation in the fifo buffer size. The default is set to 128MB and may be overriden by a new user option. The amount of memory allocated depends on multiple factors, including the number of audio streams. A worst case scenario is where an out-of-spec high video bitrate is combined with numerous low bitrate audios. A fatal error mentions the availability of fifo_size_limit option. Fix regressing since ea511196a6c85eb433e10cdbecb0b2c722faf20d Signed-off-by: Nicolas Gaullier --- libavformat/mpegenc.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index cc47a43288..e0955a7d33 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -84,6 +84,7 @@ typedef struct MpegMuxContext { int64_t vcd_padding_bytes_written; int preload; +int fifo_size_limit; } MpegMuxContext; extern const AVOutputFormat ff_mpeg1vcd_muxer; @@ -461,9 +462,10 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) av_get_media_type_string(st->codecpar->codec_type), i); return AVERROR(EINVAL); } -stream->fifo = av_fifo_alloc2(16, 1, 0); +stream->fifo = av_fifo_alloc2(16, 1, AV_FIFO_FLAG_AUTO_GROW); if (!stream->fifo) return AVERROR(ENOMEM); +av_fifo_auto_grow_limit(stream->fifo, s->fifo_size_limit); } bitrate = 0; audio_bitrate = 0; @@ -1207,10 +1209,6 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) pkt_desc->unwritten_size = pkt_desc->size = size; -ret = av_fifo_grow2(stream->fifo, size); -if (ret < 0) -return ret; - if (s->is_dvd) { // min VOBU length 0.4 seconds (mpucoder) if (is_iframe && @@ -1222,10 +1220,15 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) } } -av_fifo_write(stream->fifo, buf, size); +ret = av_fifo_write(stream->fifo, buf, size); +if (ret == AVERROR(ENOSPC)) +av_log(s, AV_LOG_FATAL, "Input stream buffer overrun. " +"To avoid, increase fifo_size_limit option.\n"); +if (ret < 0) +return ret; for (;;) { -int ret = output_packet(ctx, 0); +ret = output_packet(ctx, 0); if (ret <= 0) return ret; } @@ -1277,6 +1280,7 @@ static void mpeg_mux_deinit(AVFormatContext *ctx) static const AVOption options[] = { { "muxrate", NULL, OFFSET(user_mux_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, ((1<<22) - 1) * (8 * 50), E }, { "preload", "Initial demux-decode delay in microseconds.", OFFSET(preload), AV_OPT_TYPE_INT, { .i64 = 50 }, 0, INT_MAX, E }, +{ "fifo_size_limit", "Maximum allowed memory for buffering an input stream in bytes", OFFSET(fifo_size_limit), AV_OPT_TYPE_INT, {.i64 = 128 * 1024 * 1024 }, 16, FFMIN(INT_MAX, SIZE_MAX), E}, { NULL }, }; -- 2.34.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".
[FFmpeg-devel] [PATCH v4 2/2] lavf/mpegenc: fix termination following a fifo overrun
Avoid an infinite 'retry' loop in output_packet when flushing. Signed-off-by: Nicolas Gaullier --- libavformat/mpegenc.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index e0955a7d33..91574ca95a 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -85,6 +85,7 @@ typedef struct MpegMuxContext { int preload; int fifo_size_limit; +int fifo_size_exceeded; } MpegMuxContext; extern const AVOutputFormat ff_mpeg1vcd_muxer; @@ -1221,9 +1222,11 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) } ret = av_fifo_write(stream->fifo, buf, size); -if (ret == AVERROR(ENOSPC)) +if (ret == AVERROR(ENOSPC)) { +s->fifo_size_exceeded = 1; av_log(s, AV_LOG_FATAL, "Input stream buffer overrun. " "To avoid, increase fifo_size_limit option.\n"); +} if (ret < 0) return ret; @@ -1236,9 +1239,13 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) static int mpeg_mux_end(AVFormatContext *ctx) { +MpegMuxContext *s = ctx->priv_data; StreamInfo *stream; int i; +if (s->fifo_size_exceeded) +return 0; + for (;;) { int ret = output_packet(ctx, 1); if (ret < 0) -- 2.34.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 v3 1/2] lavf/mpegenc: fix ever-growing fifo size since the new API
>1. Options of type AV_OPT_TYPE_INT need to have a target of type int. >2. Setting UINT_MAX as maximum for such an option is nonsense; INT_MAX is the >maximum for it. (FFMIN(INT_MAX, SIZE_MAX) would be even better.) 3. Allowing >zero for fifo_size_limit makes no sense, as the above code allocates 16 >when >allocating the FIFO. >4. After removing av_fifo_grow2() it is no longer assured that >av_fifo_write() succeeds; it therefore needs to be checked. > >- Andreas Fixed in v4. Thanks (I have revised the spliting between the 2 patches). Nicolas ___ 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 v3 2/2] lavf/mpegenc: fix termination following a fifo overrun
>Could this infinite loop also happen before switching to the new API? >Does it happen because avail_data is zero for all streams? > >- Andreas I will take time to double-check this very carefully, but in my experience, if I remember correctly, it is nothing easy and was already buggy before. (but with the older API, it was almost impossible to reach such conditions). Nicolas ___ 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] Add and use cli options for v4l2 encoder=h264_v4l2m2m
On Sun, 13 Mar 2022 at 18:34, wrote: > Well, let's try to submit a patch and see how it fares. > > > Add commandline options to v4l2_m2m_enc (h264_v4l2m2m only) > and use those to configure options for the h264_v4l2m2m encoder. > Uses AVOption options to filter for valid options per v4l2 spec. > For h264 it adds spec-compliant: > -profile (high is max accepted by Raspberry Pi) > -level(4.2 is max accepted by Raspberry Pi) > -rc (Bitrate mode, VBR or CBR or CQ) > -shm(Sequence Header Mode, separate_buffer or joined_1st_frame) > -rsh (Repeat Sequence Header 0(false) 1(true)) > -fsme (Frame Skip Mode for encoder, rejected by Pi OS) > -b:v (Bit per second) > -g (pseudo GOP size, not an actual one) > -iframe_period (the period between two I-frames) > -qmin (Minimum quantization parameter for h264) > -qmax (Maximum quantization parameter for h264) > > Patch does not address pre-existing quirks with h264_v4l2m2m, > eg on a Raspberry Pi, > - Bitrate mode VBR, file is reported by mediainfo as CBR > - Bitrate mode CBR, encoder hangs and appears to > "lock" /dev/video11 until reboot > - CFR input yields a VFR file reported by mediainfo (and an > odd framerate) whereas an equivalent libx264 commandline > yields expected CFR; tested on a Raspberry Pi4 > - Bitrate mode CBR, profile is limited to less than "high" > - Bitrate mode VBR, only target bitrate option exposed to set > - Bitrate mode CQ, is not exposed to set > > Notes: > Patch arises from a desire to use ffmpeg on a Raspberry Pi (4 +). > Fixes "--profile high" not working (required an integer). > The Raspberry Pi OS does not expose a GOP size to set, so -g is > used for backward compatibility with its value overriding > the "close enough" effect of an "iframe_period" value. > Hardware like Raspberry Pi 4 rejects some spec-compliant options > beyond its capacity and/or not implemented by the Raspberry Pi OS. > The Raspberry Pi OS repository for ffmpeg appears to have Repeat > Sequence Header hard-coded as True, rather than a cli an option. > Added more return value checking, AV_LOG_WARNING and a lot > more AV_LOG_DEBUG code; one-time runtime cost of debug code > during init phase is negligible. > Intentionally left in //commented-out debug code. > > A working commandline using an interlaced source: > /usr/local/bin/ffmpeg -hide_banner -nostats -v debug -i > "~/Desktop/input_file_tiny.mp4" -vsync cfr -sws_flags > lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -strict experimental > -filter_complex "[0:v]yadif=0:0:0,format=pix_fmts=yuv420p" > -c:v h264_v4l2m2m -pix_fmt yuv420p -rc VBR -b:v 400 -qmin 10 -qmax 51 > -profile:v high -level 4.2 -shm separate_buffer -rsh 0 > -g:v 25 -movflags +faststart+write_colr -an -y > "./output_file_tiny_h264_VBR_g25.mp4" > > Signed-off-by: hydra > --- > libavcodec/v4l2_m2m.h | 13 +- > libavcodec/v4l2_m2m_enc.c | 1013 - > 2 files changed, 894 insertions(+), 132 deletions(-) > > diff --git a/libavcodec/v4l2_m2m.h b/libavcodec/v4l2_m2m.h > index b67b216..f3955b5 100644 > --- a/libavcodec/v4l2_m2m.h > +++ b/libavcodec/v4l2_m2m.h > @@ -73,9 +73,20 @@ typedef struct V4L2m2mPriv { > > V4L2m2mContext *context; > AVBufferRef*context_ref; > - > int num_output_buffers; > int num_capture_buffers; > +/// h264 (mpeg4 part 10: AVC) add these to enable extra privately > defined options (per V4L_M2M_h264_options) for h264 encoding > +int h264_profile; > +int h264_level; > +int h264_video_bit_rate_mode; > +int64_t h264_video_bit_rate; > +int h264_qmin; > +int h264_qmax; > +int h264_sequence_header_mode; > +_Bool h264_repeat_seq_header; > +int h264_iframe_period; // overridden by h264_gop_size > +int h264_gop_size;// if specified, overrides > h264_iframe_period > +int h264_frame_skip_mode_encoder; > } V4L2m2mPriv; > > /** > diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c > index 043fe80..9ac7514 100644 > --- a/libavcodec/v4l2_m2m_enc.c > +++ b/libavcodec/v4l2_m2m_enc.c > @@ -1,4 +1,4 @@ > -/* > +/** > * V4L2 mem2mem encoders > * > * Copyright (C) 2017 Alexis Ballier > @@ -38,37 +38,54 @@ > #define MPEG_CID(x) V4L2_CID_MPEG_VIDEO_##x > #define MPEG_VIDEO(x) V4L2_MPEG_VIDEO_##x > > -static inline void v4l2_set_timeperframe(V4L2m2mContext *s, unsigned int > num, unsigned int den) > +static inline int v4l2_set_timeperframe(V4L2m2mContext *s, unsigned int > num, unsigned int den) > { > +/** > + v4l2_streamparm, V4L2_TYPE_IS_MULTIPLANAR defined in > linux/videodev2.h > + */ > struct v4l2_streamparm parm = { 0 }; > - > +int ret; > parm.type = V4L2_TYPE_IS_MULTIPLANAR(s->output.type) ? > V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE : V4L2_BUF_TYPE_VIDEO_OUTPUT; > parm.parm.output.timeperframe.denominator = den; > parm.parm.output.timeperframe.numerator = num; > - > -if (i
Re: [FFmpeg-devel] [PATCH 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame
Am 14.03.2022 um 07:41 schrieb Andreas Unterweger: Am 02.03.2022 um 15:07 schrieb Paul B Mahol: The patch on patchwork looks fine. Good morning. Can this patch be merged? Thanks and best regards Andreas ___ Since other commits have been merged in the meantime which made changes to this file, I am sending an updated second version that I rebased onto this newer state. As the previous version was already deemed fine, I would kindly ask again to merge this patch so that the audio transcoding example does not ignore frames anymore and that the timebase is set correctly. Thanks. Andreas ___ 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 v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame
The last encoded frame is now fetched on EOF. It was previously left in the encoder and caused a "1 frame left in queue" warning. Signed-off-by: Andreas Unterweger --- doc/examples/transcode_aac.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c index 9102e55f16..c9b93f6439 100644 --- a/doc/examples/transcode_aac.c +++ b/doc/examples/transcode_aac.c @@ -377,6 +377,8 @@ static int decode_audio_frame(AVFrame *frame, if (error < 0) return error; +*data_present = 0; +*finished = 0; /* Read one audio frame from the input file into a temporary packet. */ if ((error = av_read_frame(input_format_context, input_packet)) < 0) { /* If we are at the end of the file, flush the decoder below. */ @@ -555,7 +557,7 @@ static int read_decode_convert_and_store(AVAudioFifo *fifo, AVFrame *input_frame = NULL; /* Temporary storage for the converted input samples. */ uint8_t **converted_input_samples = NULL; -int data_present = 0; +int data_present; int ret = AVERROR_EXIT; /* Initialize temporary storage for one input frame. */ @@ -675,18 +677,17 @@ static int encode_audio_frame(AVFrame *frame, frame->pts = pts; pts += frame->nb_samples; } - + +*data_present = 0; /* Send the audio frame stored in the temporary packet to the encoder. * The output audio stream encoder is used to do this. */ error = avcodec_send_frame(output_codec_context, frame); -/* The encoder signals that it has nothing more to encode. */ -if (error == AVERROR_EOF) { -error = 0; -goto cleanup; -} else if (error < 0) { -fprintf(stderr, "Could not send packet for encoding (error '%s')\n", -av_err2str(error)); -goto cleanup; +/* Check for errors, but proceed with fetching encoded samples if the + * encoder signals that it has nothing more to encode. */ +if (error < 0 && error != AVERROR_EOF) { + fprintf(stderr, "Could not send packet for encoding (error '%s')\n", + av_err2str(error)); + goto cleanup; } /* Receive one encoded frame from the encoder. */ @@ -857,7 +858,6 @@ int main(int argc, char **argv) int data_written; /* Flush the encoder as it may have delayed frames. */ do { -data_written = 0; if (encode_audio_frame(NULL, output_format_context, output_codec_context, &data_written)) goto cleanup; -- 2.30.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 v2 2/2] doc/examples/transcode_aac: Set decoder packet timebase
Previously, the default timebase caused two warnings during decoding about not being able to update timestamps for skipped and discarded samples, respectively. Signed-off-by: Andreas Unterweger --- doc/examples/transcode_aac.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c index c9b93f6439..6197369756 100644 --- a/doc/examples/transcode_aac.c +++ b/doc/examples/transcode_aac.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018 Andreas Unterweger + * Copyright (c) 2013-2022 Andreas Unterweger * * This file is part of FFmpeg. * @@ -120,6 +120,10 @@ static int open_input_file(const char *filename, avformat_close_input(input_format_context); return error; } + +/* Set the packet timebase for the decoder. The input file's sample + * rate is used as the denominator for simplicity. */ +avctx->pkt_timebase = (AVRational) { 1, avctx->sample_rate }; /* Save the decoder context for easier access later. */ *input_codec_context = avctx; -- 2.30.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] rtpenc_vp8: Use 15-bit PictureIDs
From: Kevin Wang 7-bit PictureIDs are not supported by WebRTC: https://groups.google.com/g/discuss-webrtc/c/333-L02vuWA In practice, 15-bit PictureIDs offer better compatibility. Signed-off-by: Kevin Wang --- libavformat/rtpenc_vp8.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/rtpenc_vp8.c b/libavformat/rtpenc_vp8.c index 671d245758..655d44517e 100644 --- a/libavformat/rtpenc_vp8.c +++ b/libavformat/rtpenc_vp8.c @@ -35,7 +35,8 @@ void ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buf, int size) // partition id 0 *s->buf_ptr++ = 0x90; *s->buf_ptr++ = 0x80; // Picture id present -*s->buf_ptr++ = s->frame_count++ & 0x7f; +*s->buf_ptr++ = ((s->frame_count & 0x7f00) >> 8) | 0x80; +*s->buf_ptr++ = s->frame_count++ & 0xff; // Calculate the number of remaining bytes header_size = s->buf_ptr - s->buf; max_packet_size = s->max_payload_size - header_size; -- 2.34.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".
Re: [FFmpeg-devel] [PATCH 1/6] Fix dshow device name/description
On Tue, Mar 22, 2022 at 3:10 PM Roger Pack wrote: > > On Tue, Mar 22, 2022 at 7:40 AM wrote: > > > > From: Romain Beauxis > > > > diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c > > index 6039578ff9..4ee3f6e194 100644 > > --- a/libavdevice/dshow.c > > +++ b/libavdevice/dshow.c > > @@ -552,8 +552,8 @@ dshow_cycle_devices(AVFormatContext *avctx, > > ICreateDevEnum *devenum, > > if (!device) > > goto fail; > > > > -device->device_name = av_strdup(friendly_name); > > -device->device_description = av_strdup(unique_name); > > +device->device_name = av_strdup(unique_name); > > +device->device_description = av_strdup(friendly_name); > > if (!device->device_name || !device->device_description) > > goto fail; > > > > LGTM. > The device enumeration API was added only recently to dshow, guess a > bug crept in. > Thanks! LGTM. Indeed, this was code introduced by my patch, committed to the ffmpeg repo only 91 days ago. Indeed, this should have been the other way around given the documentation of struct AVDeviceInfo. All the best, Dee ___ 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/2] avcodec/av1: only set the private context pix_fmt field if get_pixel_format() succeeds
Otherwise get_pixel_format() will not be called when parsing a subsequent Sequence Header in non hwaccel enabled scenarios, allowing frame parsing when it shouldn't. This prevents the scenario seqhdr -> frame_hdr/redundant_frame_hdr -> seqhdr -> redundant_frame_hdr from having the latter redundant frame header parsed as if it was a frame header by the decoder because the former was discarded. Since CBS did not discard it, the latter redundant frame header is output with a zeroed AV1RawFrameHeader struct, which can have undesired results, like division by zero with fields normally guaranteed to be anything else. Signed-off-by: James Almer --- libavcodec/av1dec.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 613efc5d11..727d829e5b 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -506,9 +506,8 @@ static int get_pixel_format(AVCodecContext *avctx) if (pix_fmt == AV_PIX_FMT_NONE) return -1; -s->pix_fmt = pix_fmt; -switch (s->pix_fmt) { +switch (pix_fmt) { case AV_PIX_FMT_YUV420P: #if CONFIG_AV1_DXVA2_HWACCEL *fmtp++ = AV_PIX_FMT_DXVA2_VLD; @@ -551,7 +550,7 @@ static int get_pixel_format(AVCodecContext *avctx) break; } -*fmtp++ = s->pix_fmt; +*fmtp++ = pix_fmt; *fmtp = AV_PIX_FMT_NONE; ret = ff_thread_get_format(avctx, pix_fmts); @@ -569,7 +568,7 @@ static int get_pixel_format(AVCodecContext *avctx) return AVERROR(ENOSYS); } -avctx->pix_fmt = ret; +avctx->pix_fmt = s->pix_fmt = ret; return 0; } -- 2.35.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 2/2] Revert "avcodec/av1dec: Check tile_cols"
This reverts commit 4fdfe430c12225e819f68993474bd2f473c7e8b1. The previous commit ensures this field will never be zero. --- libavcodec/av1dec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 727d829e5b..0543452b06 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -398,9 +398,6 @@ static int get_tiles_info(AVCodecContext *avctx, const AV1RawTileGroup *tile_gro s->tg_start = tile_group->tg_start; s->tg_end = tile_group->tg_end; -if (s->raw_frame_header->tile_cols == 0) -return AVERROR_INVALIDDATA; - for (tile_num = tile_group->tg_start; tile_num <= tile_group->tg_end; tile_num++) { tile_row = tile_num / s->raw_frame_header->tile_cols; tile_col = tile_num % s->raw_frame_header->tile_cols; -- 2.35.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".
Re: [FFmpeg-devel] [PATCH v7 3/5] avcodec/libjxl: add Jpeg XL encoding via libjxl
On 3/22/22 11:35, Lynne wrote: 19 Mar 2022, 18:26 by leo.i...@gmail.com: This commit adds encoding support to libavcodec for Jpeg XL images via the external library libjxl. --- configure | 3 +- libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/libjxlenc.c | 386 + 4 files changed, 390 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libjxlenc.c I can't accept this as-is, so NAK. The coding style needs to be fixed. And you must remove the sneaky MAINTAINERS change to get yourself push access. We made that against the rules, which you've clearly read before submitting the patchset, right? Then I'll spare time to look at it and merge it myself. What's wrong with the coding style? Could you please be more specific? I did read the rules on https://ffmpeg.org/developers.html and I believe I followed them all. As for the MAINTAINERS change, this is not a sneaky way to gain push access. I specifically do not want push access. In fact, a discussion about this already occurred on IRC, and the conclusion was that I could be added to the list without gaining push access as I do not want it. Thanks, Leo Izen ___ 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 v2] avcodec/libsvtav1: pass color description info
From: Christopher Degawa Signed-off-by: Christopher Degawa --- libavcodec/libsvtav1.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index f02e410f69..6cf280377e 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -228,6 +228,16 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, return AVERROR(EINVAL); } +param->color_primaries = avctx->color_primaries; +param->matrix_coefficients = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? + AVCOL_SPC_RGB : avctx->colorspace; +param->transfer_characteristics = avctx->color_trc; + +if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED) +param->color_range = avctx->color_range == AVCOL_RANGE_JPEG; +else +param->color_range = !!(desc->flags & AV_PIX_FMT_FLAG_RGB); + if (avctx->profile != FF_PROFILE_UNKNOWN) param->profile = avctx->profile; -- 2.35.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".
Re: [FFmpeg-devel] [PATCH] avformat/mov: Add support for still image AVIF parsing
On Wed, Mar 16, 2022 at 10:02 AM Vignesh Venkatasubramanian wrote: > > Add support for parsing AVIF still images. This patches supports > AVIF still images that have exactly 1 item (i.e.) no alpha channel. > Essentially, we will have to parse the "iloc" box and populate > the mov index. > > With this patch, we can decode still AVIF images like so: > ffmpeg -i image.avif image.png > > Partially fixes trac ticket #7621 > > Signed-off-by: Vignesh Venkatasubramanian > --- > libavformat/isom.h | 1 + > libavformat/mov.c | 142 + > 2 files changed, 143 insertions(+) > > diff --git a/libavformat/isom.h b/libavformat/isom.h > index 5caf42b15d..02d681e3ae 100644 > --- a/libavformat/isom.h > +++ b/libavformat/isom.h > @@ -315,6 +315,7 @@ typedef struct MOVContext { > int have_read_mfra_size; > uint32_t mfra_size; > uint32_t max_stts_delta; > +int is_still_picture_avif; > } MOVContext; > > int ff_mp4_read_descr_len(AVIOContext *pb); > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 6c847de164..3af49427b9 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -1136,6 +1136,7 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > c->isom = 1; > av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char > *)&type); > av_dict_set(&c->fc->metadata, "major_brand", type, 0); > +c->is_still_picture_avif = !strncmp(type, "avif", 4); > minor_ver = avio_rb32(pb); /* minor version */ > av_dict_set_int(&c->fc->metadata, "minor_version", minor_ver, 0); > > @@ -7430,6 +7431,146 @@ static int mov_read_SAND(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > return 0; > } > > +static int rb_size(AVIOContext *pb, uint64_t* value, int size) > +{ > +if (size == 0) { > +*value = 0; > +} else if (size == 1) { > +*value = avio_r8(pb); > +} else if (size == 2) { > +*value = avio_rb16(pb); > +} else if (size == 4) { > +*value = avio_rb32(pb); > +} else if (size == 8) { > +*value = avio_rb64(pb); > +} else { > +return -1; > +} > +return size; > +} > + > +static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) > +{ > +int version, offset_size, length_size, base_offset_size, index_size; > +int item_count, extent_count; > +uint64_t base_offset, extent_offset, extent_length; > +int i, j; > +uint8_t value; > +AVStream *st; > +MOVStreamContext *sc; > + > +if (!c->is_still_picture_avif) { > +// * For non-avif, we simply ignore the iloc box. > +// * For animated avif, we don't care about the iloc box as all the > +// necessary information can be found in the moov box. > +return 0; > +} > + > +if (c->fc->nb_streams) { > +av_log(c->fc, AV_LOG_INFO, "Duplicate iloc box found\n"); > +return 0; > +} > + > +st = avformat_new_stream(c->fc, NULL); > +if (!st) return AVERROR(ENOMEM); > +st->id = c->fc->nb_streams; > +sc = av_mallocz(sizeof(MOVStreamContext)); > +if (!sc) return AVERROR(ENOMEM); > + > +st->priv_data = sc; > +st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; > +st->codecpar->codec_id = AV_CODEC_ID_AV1; > +sc->ffindex = st->index; > +c->trak_index = st->index; > +st->avg_frame_rate.num = st->avg_frame_rate.den = 1; > +st->time_base.num = st->time_base.den = 1; > +st->nb_frames = 1; > +sc->time_scale = 1; > +sc = st->priv_data; > +sc->pb = c->fc->pb; > +sc->pb_is_copied = 1; > + > +version = avio_r8(pb); > +avio_rb24(pb); // flags. > + > +value = avio_r8(pb); > +offset_size = (value >> 4) & 0xF; > +length_size = value & 0xF; > +value = avio_r8(pb); > +base_offset_size = (value >> 4) & 0xF; > +index_size = (version == 0) ? 0 : (value & 0xF); > +if (index_size != 0) { > +return AVERROR_PATCHWELCOME; > +} > +item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb); > +if (item_count > 1) { > +// For still AVIF images, we only support one item. Second item will > +// generally be found for AVIF images with alpha channel. We don't > +// support them as of now. > +return AVERROR_PATCHWELCOME; > +} > + > +// Populate the necessary fields used by mov_build_index. > +sc->stsc_count = item_count; > +sc->stsc_data = av_malloc_array(item_count, sizeof(*sc->stsc_data)); > +if (!sc->stsc_data) { > +return AVERROR(ENOMEM); > +} > +sc->stsc_data[0].first = 1; > +sc->stsc_data[0].count = 1; > +sc->stsc_data[0].id = 1; > +sc->chunk_count = item_count; > +sc->chunk_offsets = av_malloc_array(item_count, > sizeof(*sc->chunk_offsets)); > +if (!sc->chunk_offsets) { > +return AVERROR(ENOMEM); > +} > +sc->sample_count = item_count; > +sc->sample_sizes = av_malloc_array(item_count, > sizeof(*sc
[FFmpeg-devel] [PATCH 1/4] avcodec/vp9_raw_reorder_bsf: Check for existence of data before reading it
Signed-off-by: Andreas Rheinhardt --- @michaelni: Please tell me the exact fuzzer issue id. libavcodec/vp9_raw_reorder_bsf.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/vp9_raw_reorder_bsf.c b/libavcodec/vp9_raw_reorder_bsf.c index 6562399159..1608360fe1 100644 --- a/libavcodec/vp9_raw_reorder_bsf.c +++ b/libavcodec/vp9_raw_reorder_bsf.c @@ -292,6 +292,11 @@ static int vp9_raw_reorder_filter(AVBSFContext *bsf, AVPacket *out) return err; } +if (!in->size) { +av_packet_free(&in); +return AVERROR_INVALIDDATA; +} + if ((in->data[in->size - 1] & 0xe0) == 0xc0) { av_log(bsf, AV_LOG_ERROR, "Input in superframes is not " "supported.\n"); -- 2.32.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".
[FFmpeg-devel] [PATCH 2/4] avcodec/vp9_superframe_bsf: Check for existence of data before reading it
Packets without data need to be handled specially in order to avoid undefined reads. Pass these packets through unchanged in case there are no cached packets* and error out in case there are cached packets: Returning the packet would mess with the order of the packets; if one returned the zero-sized packet before the superframe that will be created from the packets in the cache, the zero-sized packet would overtake the packets in the cache; if one returned the packet later, the packets that complete the superframe will overtake the zero-sized packet. *: This case e.g. encompasses the scenario of updated extradata side-data at the end. Fixes: Out of array read Fixes: 45722/clusterfuzz-testcase-minimized-ffmpeg_BSF_VP9_SUPERFRAME_fuzzer-5173378975137792 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Andreas Rheinhardt --- The current way of passthrough has been suggested by James. libavcodec/vp9_superframe_bsf.c | 9 + 1 file changed, 9 insertions(+) diff --git a/libavcodec/vp9_superframe_bsf.c b/libavcodec/vp9_superframe_bsf.c index 57681e29e4..df9b97fa3c 100644 --- a/libavcodec/vp9_superframe_bsf.c +++ b/libavcodec/vp9_superframe_bsf.c @@ -108,6 +108,15 @@ static int vp9_superframe_filter(AVBSFContext *ctx, AVPacket *pkt) if (res < 0) return res; +if (!pkt->size) { +/* In case the cache is empty we can pass side-data-only packets + * through unchanged. Otherwise, such a packet makes no sense. */ +if (!s->n_cache) +return 0; +res = AVERROR_INVALIDDATA; +goto done; +} + marker = pkt->data[pkt->size - 1]; if ((marker & 0xe0) == 0xc0) { int nbytes = 1 + ((marker >> 3) & 0x3); -- 2.32.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".
[FFmpeg-devel] [PATCH 3/4] avcodec/vp9_superframe_split_bsf: Discard invalid zero-sized frames
They are invalid in VP9. If any of the frames inside a superframe had a size of zero, the code would either read into the next frame or into the superframe index; so check for the length to stop this. Signed-off-by: Andreas Rheinhardt --- Now split into a patch of its own. libavcodec/vp9_superframe_split_bsf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vp9_superframe_split_bsf.c b/libavcodec/vp9_superframe_split_bsf.c index ed0444561a..7f0cad1ea0 100644 --- a/libavcodec/vp9_superframe_split_bsf.c +++ b/libavcodec/vp9_superframe_split_bsf.c @@ -70,7 +70,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out) frame_size |= bytestream2_get_byte(&bc) << (j * 8); total_size += frame_size; -if (frame_size < 0 || total_size > in->size - idx_size) { +if (frame_size <= 0 || total_size > in->size - idx_size) { av_log(ctx, AV_LOG_ERROR, "Invalid frame size in a superframe: %d\n", frame_size); ret = AVERROR(EINVAL); -- 2.32.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".
[FFmpeg-devel] [PATCH 4/4] avcodec/vp9_superframe_split_bsf: Don't read inexistent data
Fixes: Out of array read Fixes: 45137/clusterfuzz-testcase-minimized-ffmpeg_BSF_VP9_SUPERFRAME_SPLIT_fuzzer-4984270639202304 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Andreas Rheinhardt --- libavcodec/vp9_superframe_split_bsf.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/vp9_superframe_split_bsf.c b/libavcodec/vp9_superframe_split_bsf.c index 7f0cad1ea0..c9cf21b541 100644 --- a/libavcodec/vp9_superframe_split_bsf.c +++ b/libavcodec/vp9_superframe_split_bsf.c @@ -51,6 +51,9 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out) return ret; in = s->buffer_pkt; +if (!in->size) +goto passthrough; + marker = in->data[in->size - 1]; if ((marker & 0xe0) == 0xc0) { int length_size = 1 + ((marker >> 3) & 0x3); @@ -121,6 +124,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out) out->pts = AV_NOPTS_VALUE; } else { +passthrough: av_packet_move_ref(out, s->buffer_pkt); } -- 2.32.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".
[FFmpeg-devel] [PATCH] avcodec/libwebpenc_animencoder: Fix memory leak of WebPData in libwebp_anim_encode_frame()
A fix attached. ``` ==37349==ERROR: LeakSanitizer: detected memory leaks Direct leak of 153770 byte(s) in 1 object(s) allocated from: #0 0x7fa249785330 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9330) #1 0x7fa245c41e59 in WebPMuxAssemble /libwebp-0.6.1/src/mux/muxedit.c:628 #2 0x7fa245c4103e in WebPAnimEncoderAssemble /libwebp-0.6.1/src/mux/anim_encode.c:1562 #3 0x7fa2485774f9 in libwebp_anim_encode_frame libavcodec/libwebpenc_animencoder.c:68 #4 0x7fa24833a6ac in encode_simple_internal libavcodec/encode.c:214 #5 0x7fa24833a6ac in encode_simple_receive_packet libavcodec/encode.c:275 #6 0x7fa24833a6ac in encode_receive_packet_internal libavcodec/encode.c:309 #7 0x7fa24833abf8 in avcodec_send_frame libavcodec/encode.c:387 #8 0x7fa24833af1c in compat_encode libavcodec/encode.c:439 #9 0x7fa24833b1a5 in avcodec_encode_video2 (/usr/local/ffmpeg/lib/x86_64-linux-gnu/libavcodec.so.58+0x2bb1a5) ``` --- Begin Message --- Signed-off-by: Andrey Volk --- libavcodec/libwebpenc_animencoder.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/libwebpenc_animencoder.c b/libavcodec/libwebpenc_animencoder.c index 0f5b524335..29c0d8bb0f 100644 --- a/libavcodec/libwebpenc_animencoder.c +++ b/libavcodec/libwebpenc_animencoder.c @@ -70,14 +70,18 @@ static int libwebp_anim_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ret = WebPAnimEncoderAssemble(s->enc, &assembled_data); if (ret) { ret = ff_get_encode_buffer(avctx, pkt, assembled_data.size, 0); -if (ret < 0) +if (ret < 0) { +WebPDataClear(&assembled_data); return ret; +} memcpy(pkt->data, assembled_data.bytes, assembled_data.size); +WebPDataClear(&assembled_data); s->done = 1; pkt->pts = pkt->dts = s->first_frame_pts; *got_packet = 1; return 0; } else { +WebPDataClear(&assembled_data); av_log(s, AV_LOG_ERROR, "WebPAnimEncoderAssemble() failed with error: %d\n", VP8_ENC_ERROR_OUT_OF_MEMORY); -- 2.33.0.windows.2 --- End Message --- ___ 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/libwebpenc_animencoder: Fix memory leak of WebPData in libwebp_anim_encode_frame()
Signed-off-by: Andrey Volk --- libavcodec/libwebpenc_animencoder.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/libwebpenc_animencoder.c b/libavcodec/libwebpenc_animencoder.c index 0f5b524335..29c0d8bb0f 100644 --- a/libavcodec/libwebpenc_animencoder.c +++ b/libavcodec/libwebpenc_animencoder.c @@ -70,14 +70,18 @@ static int libwebp_anim_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ret = WebPAnimEncoderAssemble(s->enc, &assembled_data); if (ret) { ret = ff_get_encode_buffer(avctx, pkt, assembled_data.size, 0); -if (ret < 0) +if (ret < 0) { +WebPDataClear(&assembled_data); return ret; +} memcpy(pkt->data, assembled_data.bytes, assembled_data.size); +WebPDataClear(&assembled_data); s->done = 1; pkt->pts = pkt->dts = s->first_frame_pts; *got_packet = 1; return 0; } else { +WebPDataClear(&assembled_data); av_log(s, AV_LOG_ERROR, "WebPAnimEncoderAssemble() failed with error: %d\n", VP8_ENC_ERROR_OUT_OF_MEMORY); -- 2.33.0.windows.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] avcodec/binkaudio: fix indentation to match previous line
--- libavcodec/binkaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 56b58b57c8..0b6888e3e3 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -264,7 +264,7 @@ static int decode_block(BinkAudioContext *s, float **out, int use_dct, j = ch; for (i = 0; i < s->overlap_len; i++, j += channels) out[ch + ch_offset][i] = (s->previous[ch + ch_offset][i] * (count - j) + - out[ch + ch_offset][i] * j) / count; + out[ch + ch_offset][i] * j) / count; } memcpy(s->previous[ch + ch_offset], &out[ch + ch_offset][s->frame_len - s->overlap_len], s->overlap_len * sizeof(*s->previous[ch + ch_offset])); -- 2.35.1 -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) 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".
[FFmpeg-devel] [PATCH] avformat/codec2: remove surplus include 'memory.h' statement
on glibc memory.h drags in string.h, but codec2 does not use any str* or mem* functions. additionally, memory.h is not part of the C99 or POSIX standards. --- libavformat/codec2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/codec2.c b/libavformat/codec2.c index cd0521299c..400c5acbdb 100644 --- a/libavformat/codec2.c +++ b/libavformat/codec2.c @@ -21,7 +21,6 @@ #include "config_components.h" -#include #include "libavcodec/codec2utils.h" #include "libavutil/channel_layout.h" #include "libavutil/intreadwrite.h" -- 2.35.1 -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) 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".