[FFmpeg-devel] [PATCH] lavc/pngdec: actually use SIMD version for bpp<=2
The SIMD version was only used by the bpp > 2 case. This patch uses the SIMD version for both code paths. Change has been tested to still work with a 1-bpp image that uses paeth, to generate one: pngnq-s9 input.png optipng -f4 -force input-nq8.png --- libavcodec/pngdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index f2e6f689b0..2cb7946b49 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -311,7 +311,7 @@ void ff_png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type, i = w; } } -ff_add_png_paeth_prediction(dst + i, src + i, last + i, size - i, bpp); +dsp->add_paeth_prediction(dst + i, src + i, last + i, size - i, bpp); break; } } -- 2.31.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] avcodec/allcodecs: Don't include libx264 twice in the list of codecs
Andreas Rheinhardt: > Since a247ac640df3da573cd661065bf53f37863e2b46, allcodecs.c contained > two lines that matched the regex used by find_filters_extern in > configure; as a result, libx264 appeared twice the list of codecs > (if enabled). > > Fix this by using only one matching line by adding a preprocessor define > for the part that differed in the two old lines: The const qualifier. > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/allcodecs.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index 0b15b59364..a68bbd413e 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -766,10 +766,11 @@ extern const AVCodec ff_libx262_encoder; > #if CONFIG_LIBX264_ENCODER > #include > #if X264_BUILD < 153 > -extern AVCodec ff_libx264_encoder; > +#define X264_CONST > #else > -extern const AVCodec ff_libx264_encoder; > +#define X264_CONST const > #endif > +extern X264_CONST AVCodec ff_libx264_encoder; > #endif > extern const AVCodec ff_libx264rgb_encoder; > extern AVCodec ff_libx265_encoder; > Changed this locally to LIBX264_CONST in order not to invade the namespace used by libx264 itself. Will apply tomorrow unless there are objections. - 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 1/5] lavfi/dnn_backend_native_layer_avgpool.h: Documentation
> -Original Message- > From: ffmpeg-devel On Behalf Of > Shubhanshu Saxena > Sent: 2021年5月8日 20:10 > To: ffmpeg-devel@ffmpeg.org > Cc: Shubhanshu Saxena > Subject: [FFmpeg-devel] [PATCH 1/5] > lavfi/dnn_backend_native_layer_avgpool.h: Documentation > > Add documentation for Average Pool Layer > > Signed-off-by: Shubhanshu Saxena > --- > .../dnn/dnn_backend_native_layer_avgpool.h| 27 > +++ > 1 file changed, 27 insertions(+) > > diff --git a/libavfilter/dnn/dnn_backend_native_layer_avgpool.h > b/libavfilter/dnn/dnn_backend_native_layer_avgpool.h > index 75d9eb187b..0f629b9165 100644 > --- a/libavfilter/dnn/dnn_backend_native_layer_avgpool.h > +++ b/libavfilter/dnn/dnn_backend_native_layer_avgpool.h > @@ -33,7 +33,34 @@ typedef struct AvgPoolParams{ > DNNPaddingParam padding_method; > } AvgPoolParams; > > +/** > + * @brief Load Average Pooling Layer. > + * > + * It assigns the layer parameters to the hyperparameters > + * like strides, padding method, and kernel size after > + * parsing from the model file context. > + * please run 'git show' for every patch to make sure there's no tailing spaces in the change. > + * @param layer pointer to the DNN layer instance > + * @param model_file_context pointer to model file context > + * @param file_size model file size > + * @param operands_num number of operands for the layer operands_num is the operand count of the whole model, it is used to check the data read from model file is correct, just like the usage of file_size. > + * @return Size of DNN Layer Size -> size. return the number of bytes read from model file. > + * @retval 0 if model file context contains invalid hyperparameters. return 0 for error. there's another case to return 0 for out of memory. > + */ > int ff_dnn_load_layer_avg_pool(Layer *layer, AVIOContext > *model_file_context, int file_size, int operands_num); > + > +/** > + * @brief Execute the Average Pooling Layer. > + * Padding in channel dimensions is currently not supported. > + * > + * @param operands input operands operands contain all the operands of the model > + * @param input_operand_indexes input operand indexes input operand indexes for this layer. > + * @param output_operand_index output operand index output operand index for this layer. > + * @param parameters average pooling parameters > + * @param ctx pointer to Native model context and its usage is for logging only. > + * @retval 0 if the execution succeeds > + * @retval DNN_ERROR if the execution fails > + */ > int ff_dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t > *input_operand_indexes, >int32_t output_operand_index, > const void *parameters, NativeContext *ctx); > > -- > 2.27.0 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] lavf/flvdec: normalize exporting date metadata
On 2021-05-11 17:51 +0200, Anton Khirnov wrote: > Quoting Alexander Strasser (2021-05-10 15:35:02) > > On 2021-05-10 10:22 +0200, Anton Khirnov wrote: > > > Export them in UTC, not the local timezone. This way the output is > > > the same everywhere. The timezone information stored in the file is > > > still ignored, since there seems to be no simple way to export it > > > correctly. > > > > > > Format them according to ISO 8601, which we generally use for exporting > > > dates. > > > --- > > > If anyone has practical suggestions for exporting the timezone, I would > > > love to hear them. Don't see anything in the standard library for > > > "express this UTC timestamp in a given timezone". Just adding the offset > > > to the timestamp would AFAIU not be correct wrt leap seconds (and maybe > > > something else? dates are hard). > > > > Surprisingly it seems best to ignore the timezone part on purpose! > > > > In 2.13 of Adobe's AMF 0 spec > > > > https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf0-file-format-specification.pdf > > > > it is stated that the timezone part should not be filled, nor > > used. > > > > So the commit message part about it and the comment in the > > added by this patch should probably be removed. > > > > Though independent of this patch, one could maybe add a > > check that states sample welcome if a file with a timezone > > offset is found. > > I have no idea how FLV is related to AMF0, FLV reuses AMF0 spec for serialization of the metadata we talk about? > but the sample used in the > test in question here does have a non-zero value of the tz offset. So > the comment seems appropriate to me. Interesting. In case of that sample it is probably FLVTool2 that wrote that wrote the metadata. Then this should be its Ruby code for handling the AMF date type: def write__AMF_date(time) write__UI8 11 write [(time.to_f * 1000.0)].pack('G') write__SI16( (Time.now.gmtoff / 60).to_i ) end def read__AMF_date utc_time = Time.at((read__AMF_double / 1000).to_i) utc_time + (read__SI16 * 60) - Time.now.gmtoff end I have a attached patch, that on top of your patch, adds output of timezone information according to the quoted interpretation of FLVTool2. Best regards, Alexander [...] From 3fd6c8f81baacace49e0a6cc431295dc56a077bc Mon Sep 17 00:00:00 2001 From: Alexander Strasser Date: Wed, 12 May 2021 00:46:54 +0200 Subject: [PATCH] lavf/flvdec: metadata date: respect timezone information if present If the timezone data of an AMF 0 date type is non-zero, include that information as UTC offset in hours and minutes. --- libavformat/flvdec.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index ddaceaafe4..c941e62e23 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -688,9 +688,21 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, time = date.milliseconds / 1000; // to seconds gmtime_r(&time, &t); -// timezone is ignored, since there is no easy way to offset the UTC -// timestamp into the specified timezone -strftime(datestr, sizeof(datestr), "%Y-%m-%dT%H:%M:%SZ", &t); +strftime(datestr, sizeof(datestr), "%Y-%m-%dT%H:%M:%S", &t); + +if (date.timezone) { +int off_tz = date.timezone; // offset in minutes +char ch_sign = '+'; +if (off_tz < 0) { +off_tz = -off_tz; +ch_sign = '-'; +} +if (off_tz > 99*60 + 59) +off_tz = 99*60 + 59; + +av_strlcatf(datestr, sizeof(datestr), "%c%02d%02d", ch_sign, off_tz / 60, off_tz % 60); +} else +av_strlcat(datestr, "Z", sizeof(datestr)); av_dict_set(&s->metadata, key, datestr, 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] avformat/hls: add macros for iv and key size
On Tue, May 11, 2021 at 05:04:57PM +0200, Nicolas George wrote: > lance.lmw...@gmail.com (12021-05-11): > > I'm trying to test with AES-192 and AES-256 support. > > Then you will need to differentiate places that are a buffer and you > need to know the maximum size of the key, and places where the size you > have is the actual key size. Introducing these macros will not help > much. The current code assume it's 128bit and what I want to change is the maximum size of the fixed array and don't break any code first. The actual key size will get by method and will change later. Maybe I should change the macros to MAX_KEYSIZE? > > Regards, > > -- > Nicolas George > ___ > 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 v2] ffmpeg: add -fpsmin to clamp output framerate
Add -fpsmin analogously to -fpsmax for setting a lower bound to the auto-set frame rate. Signed-off-by: Matthias Neugebauer --- doc/ffmpeg.texi | 7 +++ fftools/ffmpeg.c | 8 +++- fftools/ffmpeg.h | 3 +++ fftools/ffmpeg_opt.c | 26 +++--- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 9feabe6517..5576508347 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -862,6 +862,13 @@ Clamps output frame rate when output framerate is auto-set and is higher than th Useful in batch processing or when input framerate is wrongly detected as very high. It cannot be set together with @code{-r}. It is ignored during streamcopy. +@item -fpsmin[:@var{stream_specifier}] @var{fps} (@emph{output,per-stream}) +Set minimum frame rate (Hz value, fraction or abbreviation). + +Clamps output frame rate when output framerate is auto-set and is lower than this value. +Useful in batch processing or when input framerate is wrongly detected as very low. +It cannot be set together with @code{-r}. It is ignored during streamcopy. + @item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream}) Set frame size. diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 3ad11452da..696ba7d730 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3390,7 +3390,8 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) ost->frame_rate = ist->framerate; if (ist && !ost->frame_rate.num) ost->frame_rate = ist->st->r_frame_rate; -if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num) { +if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num && !ost->min_frame_rate.num) +{ ost->frame_rate = (AVRational){25, 1}; av_log(NULL, AV_LOG_WARNING, "No information " @@ -3400,6 +3401,11 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) ost->file_index, ost->index); } +if (ost->min_frame_rate.num && +(av_q2d(ost->frame_rate) < av_q2d(ost->min_frame_rate) || +!ost->frame_rate.den)) +ost->frame_rate = ost->min_frame_rate; + if (ost->max_frame_rate.num && (av_q2d(ost->frame_rate) > av_q2d(ost->max_frame_rate) || !ost->frame_rate.den)) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 606f2afe0c..515d0c7a46 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -110,6 +110,8 @@ typedef struct OptionsContext { intnb_frame_rates; SpecifierOpt *max_frame_rates; intnb_max_frame_rates; +SpecifierOpt *min_frame_rates; +intnb_min_frame_rates; SpecifierOpt *frame_sizes; intnb_frame_sizes; SpecifierOpt *frame_pix_fmts; @@ -486,6 +488,7 @@ typedef struct OutputStream { /* video only */ AVRational frame_rate; AVRational max_frame_rate; +AVRational min_frame_rate; int is_cfr; int force_fps; int top_field_first; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 849d24b16d..b0d7550ce6 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -56,6 +56,7 @@ static const char *const opt_name_audio_channels[] = {"ac", NULL}; static const char *const opt_name_audio_sample_rate[] = {"ar", NULL}; static const char *const opt_name_frame_rates[] = {"r", NULL}; static const char *const opt_name_max_frame_rates[] = {"fpsmax", NULL}; +static const char *const opt_name_min_frame_rates[] = {"fpsmin", NULL}; static const char *const opt_name_frame_sizes[] = {"s", NULL}; static const char *const opt_name_frame_pix_fmts[]= {"pix_fmt", NULL}; static const char *const opt_name_ts_scale[] = {"itsscale", NULL}; @@ -1694,7 +1695,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in AVStream *st; OutputStream *ost; AVCodecContext *video_enc; -char *frame_rate = NULL, *max_frame_rate = NULL, *frame_aspect_ratio = NULL; +char *frame_rate = NULL, *max_frame_rate = NULL, *min_frame_rate = NULL, *frame_aspect_ratio = NULL; ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index); st = ost->st; @@ -1712,14 +1713,30 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in exit_program(1); } +MATCH_PER_STREAM_OPT(min_frame_rates, str, min_frame_rate, oc, st); +if (min_frame_rate && av_parse_video_rate(&ost->min_frame_rate, min_frame_rate) < 0) { +av_log(NULL, AV_LOG_FATAL, "Invalid minimum framerate value: %s\n", min_frame_rate); +exit_program(1); +} + if (frame_rate && max_frame_rate) { av_log(NULL, AV_LOG_ERROR, "Only one of -fpsmax and -r can be set for a stream.\n"); exit_program(1); } -if ((frame_rate || max_fr
[FFmpeg-devel] [PATCH] ffmpeg: add -fpsmin to clamp output framerate
Add -fpsmin analogously to -fpsmax for setting a lower bound to the auto-set frame rate. --- doc/ffmpeg.texi | 7 +++ fftools/ffmpeg.c | 8 +++- fftools/ffmpeg.h | 3 +++ fftools/ffmpeg_opt.c | 26 +++--- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 9feabe6517..5576508347 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -862,6 +862,13 @@ Clamps output frame rate when output framerate is auto-set and is higher than th Useful in batch processing or when input framerate is wrongly detected as very high. It cannot be set together with @code{-r}. It is ignored during streamcopy. +@item -fpsmin[:@var{stream_specifier}] @var{fps} (@emph{output,per-stream}) +Set minimum frame rate (Hz value, fraction or abbreviation). + +Clamps output frame rate when output framerate is auto-set and is lower than this value. +Useful in batch processing or when input framerate is wrongly detected as very low. +It cannot be set together with @code{-r}. It is ignored during streamcopy. + @item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream}) Set frame size. diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 3ad11452da..696ba7d730 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3390,7 +3390,8 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) ost->frame_rate = ist->framerate; if (ist && !ost->frame_rate.num) ost->frame_rate = ist->st->r_frame_rate; -if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num) { +if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num && !ost->min_frame_rate.num) +{ ost->frame_rate = (AVRational){25, 1}; av_log(NULL, AV_LOG_WARNING, "No information " @@ -3400,6 +3401,11 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) ost->file_index, ost->index); } +if (ost->min_frame_rate.num && +(av_q2d(ost->frame_rate) < av_q2d(ost->min_frame_rate) || +!ost->frame_rate.den)) +ost->frame_rate = ost->min_frame_rate; + if (ost->max_frame_rate.num && (av_q2d(ost->frame_rate) > av_q2d(ost->max_frame_rate) || !ost->frame_rate.den)) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 606f2afe0c..515d0c7a46 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -110,6 +110,8 @@ typedef struct OptionsContext { intnb_frame_rates; SpecifierOpt *max_frame_rates; intnb_max_frame_rates; +SpecifierOpt *min_frame_rates; +intnb_min_frame_rates; SpecifierOpt *frame_sizes; intnb_frame_sizes; SpecifierOpt *frame_pix_fmts; @@ -486,6 +488,7 @@ typedef struct OutputStream { /* video only */ AVRational frame_rate; AVRational max_frame_rate; +AVRational min_frame_rate; int is_cfr; int force_fps; int top_field_first; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 849d24b16d..3adccd10a3 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -56,6 +56,7 @@ static const char *const opt_name_audio_channels[] = {"ac", NULL}; static const char *const opt_name_audio_sample_rate[] = {"ar", NULL}; static const char *const opt_name_frame_rates[] = {"r", NULL}; static const char *const opt_name_max_frame_rates[] = {"fpsmax", NULL}; +static const char *const opt_name_min_frame_rates[] = {"fpsmin", NULL}; static const char *const opt_name_frame_sizes[] = {"s", NULL}; static const char *const opt_name_frame_pix_fmts[]= {"pix_fmt", NULL}; static const char *const opt_name_ts_scale[] = {"itsscale", NULL}; @@ -1694,7 +1695,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in AVStream *st; OutputStream *ost; AVCodecContext *video_enc; -char *frame_rate = NULL, *max_frame_rate = NULL, *frame_aspect_ratio = NULL; +char *frame_rate = NULL, *max_frame_rate = NULL, *min_frame_rate = NULL, *frame_aspect_ratio = NULL; ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index); st = ost->st; @@ -1712,14 +1713,30 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in exit_program(1); } +MATCH_PER_STREAM_OPT(min_frame_rates, str, min_frame_rate, oc, st); +if (min_frame_rate && av_parse_video_rate(&ost->min_frame_rate, min_frame_rate) < 0) { +av_log(NULL, AV_LOG_FATAL, "Invalid minimum framerate value: %s\n", min_frame_rate); +exit_program(1); +} + if (frame_rate && max_frame_rate) { av_log(NULL, AV_LOG_ERROR, "Only one of -fpsmax and -r can be set for a stream.\n"); exit_program(1); } -if ((frame_rate || max_frame_rate) && +if (frame_rate && m
Re: [FFmpeg-devel] [PATCH] lavf/flvdec: normalize exporting date metadata
Quoting Marton Balint (2021-05-10 19:36:59) > > > On Mon, 10 May 2021, Anton Khirnov wrote: > > > Export them in UTC, not the local timezone. This way the output is > > the same everywhere. The timezone information stored in the file is > > still ignored, since there seems to be no simple way to export it > > correctly. > > > > Format them according to ISO 8601, which we generally use for exporting > > dates. > > --- > > If anyone has practical suggestions for exporting the timezone, I would > > love to hear them. Don't see anything in the standard library for > > "express this UTC timestamp in a given timezone". Just adding the offset > > to the timestamp would AFAIU not be correct wrt leap seconds (and maybe > > something else? dates are hard). > > > > Also, the conversion of double to time_t is potentially UB if the source > > value is out of range, but there seems to be no standard way to check, > > since the range of time_t is not standard either. Anyone got any ideas? > > --- > > libavformat/flvdec.c | 7 +-- > > tests/ref/fate/flv-demux | 2 +- > > 2 files changed, 6 insertions(+), 3 deletions(-) > > > > diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c > > index e6c2877a74..ddaceaafe4 100644 > > --- a/libavformat/flvdec.c > > +++ b/libavformat/flvdec.c > > @@ -686,8 +686,11 @@ static int amf_parse_object(AVFormatContext *s, > > AVStream *astream, > > struct tm t; > > char datestr[128]; > > time = date.milliseconds / 1000; // to seconds > > -localtime_r(&time, &t); > > -strftime(datestr, sizeof(datestr), "%a, %d %b %Y %H:%M:%S %z", > > &t); > > +gmtime_r(&time, &t); > > + > > +// timezone is ignored, since there is no easy way to offset > > the UTC > > +// timestamp into the specified timezone > > +strftime(datestr, sizeof(datestr), "%Y-%m-%dT%H:%M:%SZ", &t); > > > > av_dict_set(&s->metadata, key, datestr, 0); > > Maybe avpriv_dict_set_timestamp() should be used instead. That way > milisecond precision can also be respected. Huh, I did not know about that function. But since we are converting from double, I am somewhat concerned about the result remaining the same on all platforms (which is the point of this patch). -- Anton Khirnov ___ 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/1] configure: add emscripten support
Hi! Ping, can someone please review? Thanks, Regards On Tue, Apr 27, 2021 at 1:57 AM Mehdi Sabwat wrote: > From: Mehdi Sabwat > > Fix configure test to allow it to have the right suffix when > $target_os=emscripten > --- > configure | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/configure b/configure > index cc1013fb1d..501c715b82 100755 > --- a/configure > +++ b/configure > @@ -4381,6 +4381,7 @@ fi > exesuf() { > case $1 in > > mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) > echo .exe ;; > +emscripten) echo .js ;; > esac > } > > @@ -5580,6 +5581,8 @@ case $target_os in > ;; > minix) > ;; > +emscripten) > +;; > none) > ;; > *) > -- > 2.31.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] lavf/flvdec: normalize exporting date metadata
Quoting Alexander Strasser (2021-05-10 15:35:02) > On 2021-05-10 10:22 +0200, Anton Khirnov wrote: > > Export them in UTC, not the local timezone. This way the output is > > the same everywhere. The timezone information stored in the file is > > still ignored, since there seems to be no simple way to export it > > correctly. > > > > Format them according to ISO 8601, which we generally use for exporting > > dates. > > --- > > If anyone has practical suggestions for exporting the timezone, I would > > love to hear them. Don't see anything in the standard library for > > "express this UTC timestamp in a given timezone". Just adding the offset > > to the timestamp would AFAIU not be correct wrt leap seconds (and maybe > > something else? dates are hard). > > Surprisingly it seems best to ignore the timezone part on purpose! > > In 2.13 of Adobe's AMF 0 spec > > https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf0-file-format-specification.pdf > > it is stated that the timezone part should not be filled, nor > used. > > So the commit message part about it and the comment in the > added by this patch should probably be removed. > > Though independent of this patch, one could maybe add a > check that states sample welcome if a file with a timezone > offset is found. I have no idea how FLV is related to AMF0, but the sample used in the test in question here does have a non-zero value of the tz offset. So the comment seems appropriate to me. > > > > Also, the conversion of double to time_t is potentially UB if the source > > value is out of range, but there seems to be no standard way to check, > > since the range of time_t is not standard either. Anyone got any ideas? > > Not really. One could use sizeof to obtain the size, but for > that to be useful one would need to assume signedness. The > C standard doesn't seem to be explicit about that. And if > it did, we still don't know if the functions handle negative > offsets correctly. > > Seems that can't really by handled well locally here only > Maybe we do already or could add a check in configure > to find out about the bounds of time_t . Could be useful > elsewhere in the codebase too. Maybe other have better > ideas... > > > Otherwise your patch looks good to me and fine without > additional bound checks as it's not a new problem here. > > It could cause problems for people handling the timestamp > in the currently exported format though. Maybe at least a > micro bump should be in the final commit? We are in an ABI instability period right now, so this should not be necessary. -- Anton Khirnov ___ 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 08/12] fate/demux: convert flv-demux to ffprobe
> -Original Message- > From: ffmpeg-devel On Behalf Of Anton > Khirnov > Sent: Sunday, April 25, 2021 12:03 AM > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH 08/12] fate/demux: convert flv-demux to ffprobe > > It can handle side data cleanly. > --- This patch breaks FATE (http://trac.ffmpeg.org/ticket/9235). Please fix. ___ 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/hls: add macros for iv and key size
lance.lmw...@gmail.com (12021-05-11): > I'm trying to test with AES-192 and AES-256 support. Then you will need to differentiate places that are a buffer and you need to know the maximum size of the key, and places where the size you have is the actual key size. Introducing these macros will not help much. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH]: examples/transcode_aac.c - Do not use global pts for frame pts counting
James Almer (12021-05-11): > An alternative solution is introducing a struct containing all variables > used by the process, including {input,output}_format_context, > {input,output}_codec_context, resample_context, fifo, and pts, which will > simplify the code a lot by making every function in the example take a > single argument for all of them, so that should address your concerns about > making the example more complex. I agree, this would make the example more readable and clear. > Our library usage examples should not result in people making mistakes like > this when used as reference, so removing this global variable is a good > idea. If somebody follows the example without bothering to wonder what the various pieces of code do, they will get something wrong. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH]: examples/transcode_aac.c - Do not use global pts for frame pts counting
On 5/11/2021 10:53 AM, Nicolas George wrote: Ray (12021-05-11): The example transcode_aac.c uses a global pts for counting. For libavcodec novices this can cause them to overlook this and result with incorrect "start" times of output files if called multiple times (see user error resulting in bug report https://trac.ffmpeg.org/ticket/9228) I think it is a bad idea, it makes the example more complex, and only fix a very particular issue for people who know it already. Regards, An alternative solution is introducing a struct containing all variables used by the process, including {input,output}_format_context, {input,output}_codec_context, resample_context, fifo, and pts, which will simplify the code a lot by making every function in the example take a single argument for all of them, so that should address your concerns about making the example more complex. Our library usage examples should not result in people making mistakes like this when used as reference, so removing this global variable is a good idea. ___ 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/hls: add macros for iv and key size
On Tue, May 11, 2021 at 10:56:50AM -0300, James Almer wrote: > On 5/11/2021 10:21 AM, lance.lmw...@gmail.com wrote: > > On Tue, May 11, 2021 at 02:44:34PM +0200, Nicolas George wrote: > > > lance.lmw...@gmail.com (12021-05-11): > > > > From: Limin Wang > > > > > > > > Signed-off-by: Limin Wang > > > > --- > > > > libavformat/hls.c | 12 ++-- > > > > libavformat/hlsenc.c | 19 +-- > > > > libavformat/internal.h | 2 ++ > > > > 3 files changed, 17 insertions(+), 16 deletions(-) > > > > > > > > diff --git a/libavformat/hls.c b/libavformat/hls.c > > > > index 8fc6924..a215c6a 100644 > > > > --- a/libavformat/hls.c > > > > +++ b/libavformat/hls.c > > > > @@ -72,7 +72,7 @@ struct segment { > > > > char *url; > > > > char *key; > > > > enum KeyType key_type; > > > > -uint8_t iv[16]; > > > > +uint8_t iv[KEYSIZE]; > > > > /* associated Media Initialization Section, treated as a segment > > > > */ > > > > struct segment *init_section; > > > > }; > > > > @@ -131,7 +131,7 @@ struct playlist { > > > > unsigned int init_sec_buf_read_offset; > > > > char key_url[MAX_URL_SIZE]; > > > > -uint8_t key[16]; > > > > +uint8_t key[KEYSIZE]; > > > > /* ID3 timestamp handling (elementary audio streams have ID3 > > > > timestamps > > > >* (and possibly other ID3 tags) in the beginning of each > > > > segment) */ > > > > @@ -374,7 +374,7 @@ static void handle_variant_args(struct variant_info > > > > *info, const char *key, > > > > struct key_info { > > > >char uri[MAX_URL_SIZE]; > > > >char method[11]; > > > > - char iv[35]; > > > > + char iv[KEY_STRING_SIZE + 2]; /* 2 -> 0x */ > > > > }; > > > > static void handle_key_args(struct key_info *info, const char *key, > > > > @@ -714,7 +714,7 @@ static int parse_playlist(HLSContext *c, const char > > > > *url, > > > > int ret = 0, is_segment = 0, is_variant = 0; > > > > int64_t duration = 0; > > > > enum KeyType key_type = KEY_NONE; > > > > -uint8_t iv[16] = ""; > > > > +uint8_t iv[KEYSIZE] = ""; > > > > int has_iv = 0; > > > > char key[MAX_URL_SIZE] = ""; > > > > char line[MAX_URL_SIZE]; > > > > @@ -1252,7 +1252,7 @@ static int open_input(HLSContext *c, struct > > > > playlist *pls, struct segment *seg, > > > > if (seg->key_type == KEY_NONE) { > > > > ret = open_url(pls->parent, in, seg->url, &c->avio_opts, > > > > opts, &is_http); > > > > } else if (seg->key_type == KEY_AES_128) { > > > > -char iv[33], key[33], url[MAX_URL_SIZE]; > > > > +char iv[KEY_STRING_SIZE], key[KEY_STRING_SIZE], > > > > url[MAX_URL_SIZE]; > > > > if (strcmp(seg->key, pls->key_url)) { > > > > AVIOContext *pb = NULL; > > > > if (open_url(pls->parent, &pb, seg->key, &c->avio_opts, > > > > opts, NULL) == 0) { > > > > @@ -1270,7 +1270,7 @@ static int open_input(HLSContext *c, struct > > > > playlist *pls, struct segment *seg, > > > > } > > > > ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0); > > > > ff_data_to_hex(key, pls->key, sizeof(pls->key), 0); > > > > -iv[32] = key[32] = '\0'; > > > > +iv[KEY_STRING_SIZE - 1] = key[KEY_STRING_SIZE - 1] = '\0'; > > > > if (strstr(seg->url, "://")) > > > > snprintf(url, sizeof(url), "crypto+%s", seg->url); > > > > else > > > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > > > > index c43d02c..d72edcf 100644 > > > > --- a/libavformat/hlsenc.c > > > > +++ b/libavformat/hlsenc.c > > > > @@ -67,7 +67,6 @@ typedef enum { > > > > CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN, > > > > } CodecAttributeStatus; > > > > -#define KEYSIZE 16 > > > > #define LINE_BUFFER_SIZE MAX_URL_SIZE > > > > #define HLS_MICROSECOND_UNIT 100 > > > > #define BUFSIZE (16 * 1024) > > > > @@ -85,7 +84,7 @@ typedef struct HLSSegment { > > > > unsigned var_stream_idx; > > > > char key_uri[LINE_BUFFER_SIZE + 1]; > > > > -char iv_string[KEYSIZE*2 + 1]; > > > > +char iv_string[KEY_STRING_SIZE]; > > > > struct HLSSegment *next; > > > > double discont_program_date_time; > > > > @@ -169,8 +168,8 @@ typedef struct VariantStream { > > > > char key_file[LINE_BUFFER_SIZE + 1]; > > > > char key_uri[LINE_BUFFER_SIZE + 1]; > > > > -char key_string[KEYSIZE*2 + 1]; > > > > -char iv_string[KEYSIZE*2 + 1]; > > > > +char key_string[KEY_STRING_SIZE]; > > > > +char iv_string[KEY_STRING_SIZE]; > > > > AVStream **streams; > > > > char codec_attr[128]; > > > > @@ -228,8 +227,8 @@ typedef struct HLSContext { > > > > char *key_info_file; > > > > char key_file[LINE_BUFFER_SIZE + 1]; > > > > char key_uri[LINE_BUFFER_SIZE + 1]; > > > > -char key_string[KEYSIZE*2 + 1]; > > > > -char iv_string[KEYSIZE*2 + 1]; > > > > +char key_string[KEY_STRING_SIZE]; > > > > +char i
Re: [FFmpeg-devel] [PATCH] avformat/hls: add macros for iv and key size
On 5/11/2021 10:21 AM, lance.lmw...@gmail.com wrote: On Tue, May 11, 2021 at 02:44:34PM +0200, Nicolas George wrote: lance.lmw...@gmail.com (12021-05-11): From: Limin Wang Signed-off-by: Limin Wang --- libavformat/hls.c | 12 ++-- libavformat/hlsenc.c | 19 +-- libavformat/internal.h | 2 ++ 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 8fc6924..a215c6a 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -72,7 +72,7 @@ struct segment { char *url; char *key; enum KeyType key_type; -uint8_t iv[16]; +uint8_t iv[KEYSIZE]; /* associated Media Initialization Section, treated as a segment */ struct segment *init_section; }; @@ -131,7 +131,7 @@ struct playlist { unsigned int init_sec_buf_read_offset; char key_url[MAX_URL_SIZE]; -uint8_t key[16]; +uint8_t key[KEYSIZE]; /* ID3 timestamp handling (elementary audio streams have ID3 timestamps * (and possibly other ID3 tags) in the beginning of each segment) */ @@ -374,7 +374,7 @@ static void handle_variant_args(struct variant_info *info, const char *key, struct key_info { char uri[MAX_URL_SIZE]; char method[11]; - char iv[35]; + char iv[KEY_STRING_SIZE + 2]; /* 2 -> 0x */ }; static void handle_key_args(struct key_info *info, const char *key, @@ -714,7 +714,7 @@ static int parse_playlist(HLSContext *c, const char *url, int ret = 0, is_segment = 0, is_variant = 0; int64_t duration = 0; enum KeyType key_type = KEY_NONE; -uint8_t iv[16] = ""; +uint8_t iv[KEYSIZE] = ""; int has_iv = 0; char key[MAX_URL_SIZE] = ""; char line[MAX_URL_SIZE]; @@ -1252,7 +1252,7 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg, if (seg->key_type == KEY_NONE) { ret = open_url(pls->parent, in, seg->url, &c->avio_opts, opts, &is_http); } else if (seg->key_type == KEY_AES_128) { -char iv[33], key[33], url[MAX_URL_SIZE]; +char iv[KEY_STRING_SIZE], key[KEY_STRING_SIZE], url[MAX_URL_SIZE]; if (strcmp(seg->key, pls->key_url)) { AVIOContext *pb = NULL; if (open_url(pls->parent, &pb, seg->key, &c->avio_opts, opts, NULL) == 0) { @@ -1270,7 +1270,7 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg, } ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0); ff_data_to_hex(key, pls->key, sizeof(pls->key), 0); -iv[32] = key[32] = '\0'; +iv[KEY_STRING_SIZE - 1] = key[KEY_STRING_SIZE - 1] = '\0'; if (strstr(seg->url, "://")) snprintf(url, sizeof(url), "crypto+%s", seg->url); else diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index c43d02c..d72edcf 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -67,7 +67,6 @@ typedef enum { CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN, } CodecAttributeStatus; -#define KEYSIZE 16 #define LINE_BUFFER_SIZE MAX_URL_SIZE #define HLS_MICROSECOND_UNIT 100 #define BUFSIZE (16 * 1024) @@ -85,7 +84,7 @@ typedef struct HLSSegment { unsigned var_stream_idx; char key_uri[LINE_BUFFER_SIZE + 1]; -char iv_string[KEYSIZE*2 + 1]; +char iv_string[KEY_STRING_SIZE]; struct HLSSegment *next; double discont_program_date_time; @@ -169,8 +168,8 @@ typedef struct VariantStream { char key_file[LINE_BUFFER_SIZE + 1]; char key_uri[LINE_BUFFER_SIZE + 1]; -char key_string[KEYSIZE*2 + 1]; -char iv_string[KEYSIZE*2 + 1]; +char key_string[KEY_STRING_SIZE]; +char iv_string[KEY_STRING_SIZE]; AVStream **streams; char codec_attr[128]; @@ -228,8 +227,8 @@ typedef struct HLSContext { char *key_info_file; char key_file[LINE_BUFFER_SIZE + 1]; char key_uri[LINE_BUFFER_SIZE + 1]; -char key_string[KEYSIZE*2 + 1]; -char iv_string[KEYSIZE*2 + 1]; +char key_string[KEY_STRING_SIZE]; +char iv_string[KEY_STRING_SIZE]; AVDictionary *vtt_format_options; char *method; @@ -734,8 +733,8 @@ static int do_encrypt(AVFormatContext *s, VariantStream *vs) } if (!*hls->iv_string) { -uint8_t iv[16] = { 0 }; -char buf[33]; +uint8_t iv[KEYSIZE] = { 0 }; +char buf[KEY_STRING_SIZE]; if (!hls->iv) { AV_WB64(iv + 8, vs->sequence); @@ -743,7 +742,7 @@ static int do_encrypt(AVFormatContext *s, VariantStream *vs) memcpy(iv, hls->iv, sizeof(iv)); } ff_data_to_hex(buf, iv, sizeof(iv), 0); -buf[32] = '\0'; +buf[KEY_STRING_SIZE - 1] = '\0'; memcpy(hls->iv_string, buf, sizeof(hls->iv_string)); } @@ -1674,7 +1673,7 @@ static int hls_start(AVFormatContext *s, VariantStream *vs) AVDictionary *options = NULL; const char *proto = NULL; int use
Re: [FFmpeg-devel] [PATCH] avformat/hls: add macros for iv and key size
On Tue, May 11, 2021 at 02:45:07PM +0200, Nicolas George wrote: > Nicolas George (12021-05-11): > > So, anything using internal.h can only deal with 128 bits keys? Seems > > wrong. > > Are you actually trying to fix something? I'm trying to test with AES-192 and AES-256 support. > > Regards, > > -- > Nicolas George > ___ > 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]: examples/transcode_aac.c - Do not use global pts for frame pts counting
Ray (12021-05-11): > The example transcode_aac.c uses a global pts for counting. For > libavcodec novices this can cause them to overlook this and result > with incorrect "start" times of output files if called multiple times > (see user error resulting in bug report > https://trac.ffmpeg.org/ticket/9228) I think it is a bad idea, it makes the example more complex, and only fix a very particular issue for people who know it already. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/hls: add macros for iv and key size
On Tue, May 11, 2021 at 02:44:34PM +0200, Nicolas George wrote: > lance.lmw...@gmail.com (12021-05-11): > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavformat/hls.c | 12 ++-- > > libavformat/hlsenc.c | 19 +-- > > libavformat/internal.h | 2 ++ > > 3 files changed, 17 insertions(+), 16 deletions(-) > > > > diff --git a/libavformat/hls.c b/libavformat/hls.c > > index 8fc6924..a215c6a 100644 > > --- a/libavformat/hls.c > > +++ b/libavformat/hls.c > > @@ -72,7 +72,7 @@ struct segment { > > char *url; > > char *key; > > enum KeyType key_type; > > -uint8_t iv[16]; > > +uint8_t iv[KEYSIZE]; > > /* associated Media Initialization Section, treated as a segment */ > > struct segment *init_section; > > }; > > @@ -131,7 +131,7 @@ struct playlist { > > unsigned int init_sec_buf_read_offset; > > > > char key_url[MAX_URL_SIZE]; > > -uint8_t key[16]; > > +uint8_t key[KEYSIZE]; > > > > /* ID3 timestamp handling (elementary audio streams have ID3 timestamps > > * (and possibly other ID3 tags) in the beginning of each segment) */ > > @@ -374,7 +374,7 @@ static void handle_variant_args(struct variant_info > > *info, const char *key, > > struct key_info { > > char uri[MAX_URL_SIZE]; > > char method[11]; > > - char iv[35]; > > + char iv[KEY_STRING_SIZE + 2]; /* 2 -> 0x */ > > }; > > > > static void handle_key_args(struct key_info *info, const char *key, > > @@ -714,7 +714,7 @@ static int parse_playlist(HLSContext *c, const char > > *url, > > int ret = 0, is_segment = 0, is_variant = 0; > > int64_t duration = 0; > > enum KeyType key_type = KEY_NONE; > > -uint8_t iv[16] = ""; > > +uint8_t iv[KEYSIZE] = ""; > > int has_iv = 0; > > char key[MAX_URL_SIZE] = ""; > > char line[MAX_URL_SIZE]; > > @@ -1252,7 +1252,7 @@ static int open_input(HLSContext *c, struct playlist > > *pls, struct segment *seg, > > if (seg->key_type == KEY_NONE) { > > ret = open_url(pls->parent, in, seg->url, &c->avio_opts, opts, > > &is_http); > > } else if (seg->key_type == KEY_AES_128) { > > -char iv[33], key[33], url[MAX_URL_SIZE]; > > +char iv[KEY_STRING_SIZE], key[KEY_STRING_SIZE], url[MAX_URL_SIZE]; > > if (strcmp(seg->key, pls->key_url)) { > > AVIOContext *pb = NULL; > > if (open_url(pls->parent, &pb, seg->key, &c->avio_opts, opts, > > NULL) == 0) { > > @@ -1270,7 +1270,7 @@ static int open_input(HLSContext *c, struct playlist > > *pls, struct segment *seg, > > } > > ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0); > > ff_data_to_hex(key, pls->key, sizeof(pls->key), 0); > > -iv[32] = key[32] = '\0'; > > +iv[KEY_STRING_SIZE - 1] = key[KEY_STRING_SIZE - 1] = '\0'; > > if (strstr(seg->url, "://")) > > snprintf(url, sizeof(url), "crypto+%s", seg->url); > > else > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > > index c43d02c..d72edcf 100644 > > --- a/libavformat/hlsenc.c > > +++ b/libavformat/hlsenc.c > > @@ -67,7 +67,6 @@ typedef enum { > > CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN, > > } CodecAttributeStatus; > > > > -#define KEYSIZE 16 > > #define LINE_BUFFER_SIZE MAX_URL_SIZE > > #define HLS_MICROSECOND_UNIT 100 > > #define BUFSIZE (16 * 1024) > > @@ -85,7 +84,7 @@ typedef struct HLSSegment { > > unsigned var_stream_idx; > > > > char key_uri[LINE_BUFFER_SIZE + 1]; > > -char iv_string[KEYSIZE*2 + 1]; > > +char iv_string[KEY_STRING_SIZE]; > > > > struct HLSSegment *next; > > double discont_program_date_time; > > @@ -169,8 +168,8 @@ typedef struct VariantStream { > > > > char key_file[LINE_BUFFER_SIZE + 1]; > > char key_uri[LINE_BUFFER_SIZE + 1]; > > -char key_string[KEYSIZE*2 + 1]; > > -char iv_string[KEYSIZE*2 + 1]; > > +char key_string[KEY_STRING_SIZE]; > > +char iv_string[KEY_STRING_SIZE]; > > > > AVStream **streams; > > char codec_attr[128]; > > @@ -228,8 +227,8 @@ typedef struct HLSContext { > > char *key_info_file; > > char key_file[LINE_BUFFER_SIZE + 1]; > > char key_uri[LINE_BUFFER_SIZE + 1]; > > -char key_string[KEYSIZE*2 + 1]; > > -char iv_string[KEYSIZE*2 + 1]; > > +char key_string[KEY_STRING_SIZE]; > > +char iv_string[KEY_STRING_SIZE]; > > AVDictionary *vtt_format_options; > > > > char *method; > > @@ -734,8 +733,8 @@ static int do_encrypt(AVFormatContext *s, VariantStream > > *vs) > > } > > > > if (!*hls->iv_string) { > > -uint8_t iv[16] = { 0 }; > > -char buf[33]; > > +uint8_t iv[KEYSIZE] = { 0 }; > > +char buf[KEY_STRING_SIZE]; > > > > if (!hls->iv) { > > AV_WB64(iv + 8, vs->sequence); > > @@ -743,7 +742,7 @@ static int do_encrypt(AVFormatContext *s, VariantStream > > *vs) > > memcpy(iv,
Re: [FFmpeg-devel] Encode user data unregistered SEI (H.264/H.265)
On Saturday, 1 May 2021 12:23:00 PM AEST Brad Hards wrote: > MISB ST 0604 and ST 2101 require user data unregistered SEI messages > (precision timestamps and sensor identifiers) to be included. That > currently isn't supported. This series adds encoding for libx264, > libx265, hevc_nvenc and h264_nvenc. > > v2 removes the API addition, modifies nvenc to use a dynamic array, > and corrects formatting. Any comments on v2? If not, can it please be applied? Brad ___ 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]: examples/transcode_aac.c - Do not use global pts for frame pts counting
The example transcode_aac.c uses a global pts for counting. For libavcodec novices this can cause them to overlook this and result with incorrect "start" times of output files if called multiple times (see user error resulting in bug report https://trac.ffmpeg.org/ticket/9228) From 52cbed063ee54e667905ca243e8ee4a811a108dc Mon Sep 17 00:00:00 2001 From: whatdoineed2do/Ray Date: Tue, 11 May 2021 13:16:48 +0100 Subject: [PATCH] Do not use global pts for frame pts counting Signed-off-by: whatdoineed2do/Ray --- doc/examples/transcode_aac.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c index c9badaa561..7f6148fa15 100644 --- a/doc/examples/transcode_aac.c +++ b/doc/examples/transcode_aac.c @@ -648,8 +648,6 @@ static int init_output_frame(AVFrame **frame, return 0; } -/* Global timestamp for the audio frames. */ -static int64_t pts = 0; /** * Encode one frame worth of audio to the output file. @@ -663,6 +661,7 @@ static int64_t pts = 0; static int encode_audio_frame(AVFrame *frame, AVFormatContext *output_format_context, AVCodecContext *output_codec_context, + int64_t* pts, int *data_present) { /* Packet used for temporary storage. */ @@ -675,8 +674,8 @@ static int encode_audio_frame(AVFrame *frame, /* Set a timestamp based on the sample rate for the container. */ if (frame) { - frame->pts = pts; - pts += frame->nb_samples; + frame->pts = *pts; + *pts += frame->nb_samples; } /* Send the audio frame stored in the temporary packet to the encoder. @@ -734,7 +733,8 @@ cleanup: */ static int load_encode_and_write(AVAudioFifo *fifo, AVFormatContext *output_format_context, - AVCodecContext *output_codec_context) + AVCodecContext *output_codec_context, + int64_t* pts) { /* Temporary storage of the output samples of the frame written to the file. */ AVFrame *output_frame; @@ -759,7 +759,7 @@ static int load_encode_and_write(AVAudioFifo *fifo, /* Encode one frame worth of audio samples. */ if (encode_audio_frame(output_frame, output_format_context, - output_codec_context, &data_written)) { + output_codec_context, pts, &data_written)) { av_frame_free(&output_frame); return AVERROR_EXIT; } @@ -790,6 +790,8 @@ int main(int argc, char **argv) SwrContext *resample_context = NULL; AVAudioFifo *fifo = NULL; int ret = AVERROR_EXIT; + /* timestamp for the audio frames. */ + int64_t pts = 0; if (argc != 3) { fprintf(stderr, "Usage: %s \n", argv[0]); @@ -850,7 +852,7 @@ int main(int argc, char **argv) /* Take one frame worth of audio samples from the FIFO buffer, * encode it and write it to the output file. */ if (load_encode_and_write(fifo, output_format_context, - output_codec_context)) + output_codec_context, &pts)) goto cleanup; /* If we are at the end of the input file and have encoded @@ -861,7 +863,7 @@ int main(int argc, char **argv) do { data_written = 0; if (encode_audio_frame(NULL, output_format_context, - output_codec_context, &data_written)) + output_codec_context, &pts, &data_written)) goto cleanup; } while (data_written); break; -- 2.26.3 ___ 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/hls: add macros for iv and key size
Nicolas George (12021-05-11): > So, anything using internal.h can only deal with 128 bits keys? Seems > wrong. Are you actually trying to fix something? Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/hls: add macros for iv and key size
lance.lmw...@gmail.com (12021-05-11): > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavformat/hls.c | 12 ++-- > libavformat/hlsenc.c | 19 +-- > libavformat/internal.h | 2 ++ > 3 files changed, 17 insertions(+), 16 deletions(-) > > diff --git a/libavformat/hls.c b/libavformat/hls.c > index 8fc6924..a215c6a 100644 > --- a/libavformat/hls.c > +++ b/libavformat/hls.c > @@ -72,7 +72,7 @@ struct segment { > char *url; > char *key; > enum KeyType key_type; > -uint8_t iv[16]; > +uint8_t iv[KEYSIZE]; > /* associated Media Initialization Section, treated as a segment */ > struct segment *init_section; > }; > @@ -131,7 +131,7 @@ struct playlist { > unsigned int init_sec_buf_read_offset; > > char key_url[MAX_URL_SIZE]; > -uint8_t key[16]; > +uint8_t key[KEYSIZE]; > > /* ID3 timestamp handling (elementary audio streams have ID3 timestamps > * (and possibly other ID3 tags) in the beginning of each segment) */ > @@ -374,7 +374,7 @@ static void handle_variant_args(struct variant_info > *info, const char *key, > struct key_info { > char uri[MAX_URL_SIZE]; > char method[11]; > - char iv[35]; > + char iv[KEY_STRING_SIZE + 2]; /* 2 -> 0x */ > }; > > static void handle_key_args(struct key_info *info, const char *key, > @@ -714,7 +714,7 @@ static int parse_playlist(HLSContext *c, const char *url, > int ret = 0, is_segment = 0, is_variant = 0; > int64_t duration = 0; > enum KeyType key_type = KEY_NONE; > -uint8_t iv[16] = ""; > +uint8_t iv[KEYSIZE] = ""; > int has_iv = 0; > char key[MAX_URL_SIZE] = ""; > char line[MAX_URL_SIZE]; > @@ -1252,7 +1252,7 @@ static int open_input(HLSContext *c, struct playlist > *pls, struct segment *seg, > if (seg->key_type == KEY_NONE) { > ret = open_url(pls->parent, in, seg->url, &c->avio_opts, opts, > &is_http); > } else if (seg->key_type == KEY_AES_128) { > -char iv[33], key[33], url[MAX_URL_SIZE]; > +char iv[KEY_STRING_SIZE], key[KEY_STRING_SIZE], url[MAX_URL_SIZE]; > if (strcmp(seg->key, pls->key_url)) { > AVIOContext *pb = NULL; > if (open_url(pls->parent, &pb, seg->key, &c->avio_opts, opts, > NULL) == 0) { > @@ -1270,7 +1270,7 @@ static int open_input(HLSContext *c, struct playlist > *pls, struct segment *seg, > } > ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0); > ff_data_to_hex(key, pls->key, sizeof(pls->key), 0); > -iv[32] = key[32] = '\0'; > +iv[KEY_STRING_SIZE - 1] = key[KEY_STRING_SIZE - 1] = '\0'; > if (strstr(seg->url, "://")) > snprintf(url, sizeof(url), "crypto+%s", seg->url); > else > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index c43d02c..d72edcf 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -67,7 +67,6 @@ typedef enum { > CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN, > } CodecAttributeStatus; > > -#define KEYSIZE 16 > #define LINE_BUFFER_SIZE MAX_URL_SIZE > #define HLS_MICROSECOND_UNIT 100 > #define BUFSIZE (16 * 1024) > @@ -85,7 +84,7 @@ typedef struct HLSSegment { > unsigned var_stream_idx; > > char key_uri[LINE_BUFFER_SIZE + 1]; > -char iv_string[KEYSIZE*2 + 1]; > +char iv_string[KEY_STRING_SIZE]; > > struct HLSSegment *next; > double discont_program_date_time; > @@ -169,8 +168,8 @@ typedef struct VariantStream { > > char key_file[LINE_BUFFER_SIZE + 1]; > char key_uri[LINE_BUFFER_SIZE + 1]; > -char key_string[KEYSIZE*2 + 1]; > -char iv_string[KEYSIZE*2 + 1]; > +char key_string[KEY_STRING_SIZE]; > +char iv_string[KEY_STRING_SIZE]; > > AVStream **streams; > char codec_attr[128]; > @@ -228,8 +227,8 @@ typedef struct HLSContext { > char *key_info_file; > char key_file[LINE_BUFFER_SIZE + 1]; > char key_uri[LINE_BUFFER_SIZE + 1]; > -char key_string[KEYSIZE*2 + 1]; > -char iv_string[KEYSIZE*2 + 1]; > +char key_string[KEY_STRING_SIZE]; > +char iv_string[KEY_STRING_SIZE]; > AVDictionary *vtt_format_options; > > char *method; > @@ -734,8 +733,8 @@ static int do_encrypt(AVFormatContext *s, VariantStream > *vs) > } > > if (!*hls->iv_string) { > -uint8_t iv[16] = { 0 }; > -char buf[33]; > +uint8_t iv[KEYSIZE] = { 0 }; > +char buf[KEY_STRING_SIZE]; > > if (!hls->iv) { > AV_WB64(iv + 8, vs->sequence); > @@ -743,7 +742,7 @@ static int do_encrypt(AVFormatContext *s, VariantStream > *vs) > memcpy(iv, hls->iv, sizeof(iv)); > } > ff_data_to_hex(buf, iv, sizeof(iv), 0); > -buf[32] = '\0'; > +buf[KEY_STRING_SIZE - 1] = '\0'; > memcpy(hls->iv_string, buf, sizeof(hls->iv_string)); > } > > @@ -1674,7 +1673,7 @@ static int hls_start(AVFormatContext *s, VariantStream > *vs) > AV
[FFmpeg-devel] [PATCH] avformat/hls: add macros for iv and key size
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/hls.c | 12 ++-- libavformat/hlsenc.c | 19 +-- libavformat/internal.h | 2 ++ 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 8fc6924..a215c6a 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -72,7 +72,7 @@ struct segment { char *url; char *key; enum KeyType key_type; -uint8_t iv[16]; +uint8_t iv[KEYSIZE]; /* associated Media Initialization Section, treated as a segment */ struct segment *init_section; }; @@ -131,7 +131,7 @@ struct playlist { unsigned int init_sec_buf_read_offset; char key_url[MAX_URL_SIZE]; -uint8_t key[16]; +uint8_t key[KEYSIZE]; /* ID3 timestamp handling (elementary audio streams have ID3 timestamps * (and possibly other ID3 tags) in the beginning of each segment) */ @@ -374,7 +374,7 @@ static void handle_variant_args(struct variant_info *info, const char *key, struct key_info { char uri[MAX_URL_SIZE]; char method[11]; - char iv[35]; + char iv[KEY_STRING_SIZE + 2]; /* 2 -> 0x */ }; static void handle_key_args(struct key_info *info, const char *key, @@ -714,7 +714,7 @@ static int parse_playlist(HLSContext *c, const char *url, int ret = 0, is_segment = 0, is_variant = 0; int64_t duration = 0; enum KeyType key_type = KEY_NONE; -uint8_t iv[16] = ""; +uint8_t iv[KEYSIZE] = ""; int has_iv = 0; char key[MAX_URL_SIZE] = ""; char line[MAX_URL_SIZE]; @@ -1252,7 +1252,7 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg, if (seg->key_type == KEY_NONE) { ret = open_url(pls->parent, in, seg->url, &c->avio_opts, opts, &is_http); } else if (seg->key_type == KEY_AES_128) { -char iv[33], key[33], url[MAX_URL_SIZE]; +char iv[KEY_STRING_SIZE], key[KEY_STRING_SIZE], url[MAX_URL_SIZE]; if (strcmp(seg->key, pls->key_url)) { AVIOContext *pb = NULL; if (open_url(pls->parent, &pb, seg->key, &c->avio_opts, opts, NULL) == 0) { @@ -1270,7 +1270,7 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg, } ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0); ff_data_to_hex(key, pls->key, sizeof(pls->key), 0); -iv[32] = key[32] = '\0'; +iv[KEY_STRING_SIZE - 1] = key[KEY_STRING_SIZE - 1] = '\0'; if (strstr(seg->url, "://")) snprintf(url, sizeof(url), "crypto+%s", seg->url); else diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index c43d02c..d72edcf 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -67,7 +67,6 @@ typedef enum { CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN, } CodecAttributeStatus; -#define KEYSIZE 16 #define LINE_BUFFER_SIZE MAX_URL_SIZE #define HLS_MICROSECOND_UNIT 100 #define BUFSIZE (16 * 1024) @@ -85,7 +84,7 @@ typedef struct HLSSegment { unsigned var_stream_idx; char key_uri[LINE_BUFFER_SIZE + 1]; -char iv_string[KEYSIZE*2 + 1]; +char iv_string[KEY_STRING_SIZE]; struct HLSSegment *next; double discont_program_date_time; @@ -169,8 +168,8 @@ typedef struct VariantStream { char key_file[LINE_BUFFER_SIZE + 1]; char key_uri[LINE_BUFFER_SIZE + 1]; -char key_string[KEYSIZE*2 + 1]; -char iv_string[KEYSIZE*2 + 1]; +char key_string[KEY_STRING_SIZE]; +char iv_string[KEY_STRING_SIZE]; AVStream **streams; char codec_attr[128]; @@ -228,8 +227,8 @@ typedef struct HLSContext { char *key_info_file; char key_file[LINE_BUFFER_SIZE + 1]; char key_uri[LINE_BUFFER_SIZE + 1]; -char key_string[KEYSIZE*2 + 1]; -char iv_string[KEYSIZE*2 + 1]; +char key_string[KEY_STRING_SIZE]; +char iv_string[KEY_STRING_SIZE]; AVDictionary *vtt_format_options; char *method; @@ -734,8 +733,8 @@ static int do_encrypt(AVFormatContext *s, VariantStream *vs) } if (!*hls->iv_string) { -uint8_t iv[16] = { 0 }; -char buf[33]; +uint8_t iv[KEYSIZE] = { 0 }; +char buf[KEY_STRING_SIZE]; if (!hls->iv) { AV_WB64(iv + 8, vs->sequence); @@ -743,7 +742,7 @@ static int do_encrypt(AVFormatContext *s, VariantStream *vs) memcpy(iv, hls->iv, sizeof(iv)); } ff_data_to_hex(buf, iv, sizeof(iv), 0); -buf[32] = '\0'; +buf[KEY_STRING_SIZE - 1] = '\0'; memcpy(hls->iv_string, buf, sizeof(hls->iv_string)); } @@ -1674,7 +1673,7 @@ static int hls_start(AVFormatContext *s, VariantStream *vs) AVDictionary *options = NULL; const char *proto = NULL; int use_temp_file = 0; -char iv_string[KEYSIZE*2 + 1]; +char iv_string[KEY_STRING_SIZE]; int err = 0; if (c->flags & HLS_SINGLE_FILE) { diff --git a/libavformat/internal.h b/libavformat/internal.h index d57e63c..2aefac0 100644 --- a/lib
[FFmpeg-devel] [PATCH 1/3] tools/target_dec_fuzzer: Adjust threshold for theora
Fixes: Timeout Fixes: 33916/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-4620863119949824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- tools/target_dec_fuzzer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index 2bdf9ea8d5..adc4b0923f 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -193,7 +193,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { case AV_CODEC_ID_SMACKVIDEO: maxpixels /= 64;break; case AV_CODEC_ID_SNOW:maxpixels /= 128; break; case AV_CODEC_ID_TGV: maxpixels /= 32;break; -case AV_CODEC_ID_THEORA: maxpixels /= 1024; break; +case AV_CODEC_ID_THEORA: maxpixels /= 16384; break; case AV_CODEC_ID_TRUEMOTION2: maxpixels /= 1024; break; case AV_CODEC_ID_TSCC:maxpixels /= 1024; break; case AV_CODEC_ID_VC1IMAGE:maxpixels /= 8192; break; -- 2.17.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/3] avcodec/mjpegdec: Fix order of condition for pal8
Fixes: out of array access Fixes: 33960/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THP_fuzzer-5052852809629696 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/mjpegdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 500cd373bc..02a987fd0c 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -681,7 +681,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) } else if (s->nb_components != 1) { av_log(s->avctx, AV_LOG_ERROR, "Unsupported number of components %d\n", s->nb_components); return AVERROR_PATCHWELCOME; -} else if (s->palette_index && s->bits <= 8 || s->force_pal8) +} else if ((s->palette_index || s->force_pal8) && s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_PAL8; else if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GRAY8; -- 2.17.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 3/3] avcodec/jpeglsdec: force pal8 only once
Fixes: Infinite loop Fixes: 33958/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THP_fuzzer-6590264069193728 Fixes: 33981/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-5343224173559808 Fixes: 33986/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-6598815122587648 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/jpeglsdec.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index c61cb14f49..32c0d2eb3f 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -118,9 +118,12 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s) shift = 8 - s->avctx->bits_per_raw_sample; } -s->force_pal8 = 1; -if (!pal) +s->force_pal8++; +if (!pal) { +if (s->force_pal8 > 1) +return AVERROR_INVALIDDATA; return 1; +} for (i=s->palette_index; i<=maxtab; i++) { uint8_t k = i << shift; -- 2.17.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 3/3] lavfi/vf_dnn_processing.c: fix CID 1460603
CID 1460603 (#1 of 1): Improper use of negative value (NEGATIVE_RETURNS) --- libavfilter/vf_dnn_processing.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c index e05d59a649..e1d9d24683 100644 --- a/libavfilter/vf_dnn_processing.c +++ b/libavfilter/vf_dnn_processing.c @@ -225,6 +225,9 @@ static int copy_uv_planes(DnnProcessingContext *ctx, AVFrame *out, const AVFrame uv_height = AV_CEIL_RSHIFT(in->height, desc->log2_chroma_h); for (int i = 1; i < 3; ++i) { int bytewidth = av_image_get_linesize(in->format, in->width, i); +if (bytewidth < 0) { +return AVERROR(EINVAL); +} av_image_copy_plane(out->data[i], out->linesize[i], in->data[i], in->linesize[i], bytewidth, uv_height); -- 2.17.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/3] lavfi/dnn/dnn_io_proc.c: fix Improper use of negative value (NEGATIVE_RETURNS)
fix coverity CID 1473511 and 1473566 --- libavfilter/dnn/dnn_io_proc.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c index d5d2654162..02c8e13ed7 100644 --- a/libavfilter/dnn/dnn_io_proc.c +++ b/libavfilter/dnn/dnn_io_proc.c @@ -28,6 +28,9 @@ DNNReturnType ff_proc_from_dnn_to_frame(AVFrame *frame, DNNData *output, void *l { struct SwsContext *sws_ctx; int bytewidth = av_image_get_linesize(frame->format, frame->width, 0); +if (bytewidth < 0) { +return DNN_ERROR; +} if (output->dt != DNN_FLOAT) { avpriv_report_missing_feature(log_ctx, "data type rather than DNN_FLOAT"); return DNN_ERROR; @@ -98,6 +101,9 @@ static DNNReturnType proc_from_frame_to_dnn_frameprocessing(AVFrame *frame, DNND { struct SwsContext *sws_ctx; int bytewidth = av_image_get_linesize(frame->format, frame->width, 0); +if (bytewidth < 0) { +return DNN_ERROR; +} if (input->dt != DNN_FLOAT) { avpriv_report_missing_feature(log_ctx, "data type rather than DNN_FLOAT"); return DNN_ERROR; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/3] lavfi/dnn/dnn_io_proc.c: Fix Out-of-bounds access (ARRAY_VS_SINGLETON)
fix coverity CID 1473571, 1473577 and 1482089 --- libavfilter/dnn/dnn_io_proc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c index 1e2bef3f9a..d5d2654162 100644 --- a/libavfilter/dnn/dnn_io_proc.c +++ b/libavfilter/dnn/dnn_io_proc.c @@ -154,7 +154,7 @@ static DNNReturnType proc_from_frame_to_dnn_frameprocessing(AVFrame *frame, DNND } sws_scale(sws_ctx, (const uint8_t **)frame->data, frame->linesize, 0, frame->height, - (uint8_t * const*)(&input->data), + (uint8_t * const [4]){input->data, 0, 0, 0}, (const int [4]){frame->width * sizeof(float), 0, 0, 0}); sws_freeContext(sws_ctx); break; @@ -236,7 +236,7 @@ DNNReturnType ff_frame_to_dnn_classify(AVFrame *frame, DNNData *input, uint32_t sws_scale(sws_ctx, (const uint8_t *const *)&bbox_data, frame->linesize, 0, height, - (uint8_t *const *)(&input->data), linesizes); + (uint8_t *const [4]){input->data, 0, 0, 0}, linesizes); sws_freeContext(sws_ctx); @@ -266,7 +266,7 @@ static DNNReturnType proc_from_frame_to_dnn_analytics(AVFrame *frame, DNNData *i } sws_scale(sws_ctx, (const uint8_t *const *)frame->data, frame->linesize, 0, frame->height, - (uint8_t *const *)(&input->data), linesizes); + (uint8_t *const [4]){input->data, 0, 0, 0}, linesizes); sws_freeContext(sws_ctx); return DNN_SUCCESS; -- 2.17.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".