* [FFmpeg-devel] [PATCH 1/4] fftools/cmdutils: only set array size after allocation succeeded @ 2023-11-07 12:58 Anton Khirnov 2023-11-07 12:58 ` [FFmpeg-devel] [PATCH 2/4] fftools/ffmpeg_filter: fail on ifilter_alloc() failure Anton Khirnov ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Anton Khirnov @ 2023-11-07 12:58 UTC (permalink / raw) To: ffmpeg-devel --- fftools/cmdutils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 156c13801a..86cd3bddb4 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -665,10 +665,10 @@ static int init_parse_context(OptionParseContext *octx, memset(octx, 0, sizeof(*octx)); - octx->nb_groups = nb_groups; - octx->groups = av_calloc(octx->nb_groups, sizeof(*octx->groups)); + octx->groups = av_calloc(nb_groups, sizeof(*octx->groups)); if (!octx->groups) return AVERROR(ENOMEM); + octx->nb_groups = nb_groups; for (i = 0; i < octx->nb_groups; i++) octx->groups[i].group_def = &groups[i]; -- 2.42.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-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH 2/4] fftools/ffmpeg_filter: fail on ifilter_alloc() failure 2023-11-07 12:58 [FFmpeg-devel] [PATCH 1/4] fftools/cmdutils: only set array size after allocation succeeded Anton Khirnov @ 2023-11-07 12:58 ` Anton Khirnov 2023-11-07 12:58 ` [FFmpeg-devel] [PATCH 3/4] fftools/ffmpeg_filter: return an error on ofilter_alloc() failure Anton Khirnov 2023-11-07 12:58 ` [FFmpeg-devel] [PATCH 4/4] lavu/log: do not assume AVClass.item_name is always set Anton Khirnov 2 siblings, 0 replies; 6+ messages in thread From: Anton Khirnov @ 2023-11-07 12:58 UTC (permalink / raw) To: ffmpeg-devel --- fftools/ffmpeg_filter.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index c738fc3397..c8920d9234 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -905,8 +905,14 @@ int fg_create(FilterGraph **pfg, char *graph_desc) for (AVFilterInOut *cur = inputs; cur; cur = cur->next) { InputFilter *const ifilter = ifilter_alloc(fg); - InputFilterPriv *ifp = ifp_from_ifilter(ifilter); + InputFilterPriv *ifp; + if (!ifilter) { + ret = AVERROR(ENOMEM); + goto fail; + } + + ifp = ifp_from_ifilter(ifilter); ifp->linklabel = cur->name; cur->name = NULL; -- 2.42.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-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH 3/4] fftools/ffmpeg_filter: return an error on ofilter_alloc() failure 2023-11-07 12:58 [FFmpeg-devel] [PATCH 1/4] fftools/cmdutils: only set array size after allocation succeeded Anton Khirnov 2023-11-07 12:58 ` [FFmpeg-devel] [PATCH 2/4] fftools/ffmpeg_filter: fail on ifilter_alloc() failure Anton Khirnov @ 2023-11-07 12:58 ` Anton Khirnov 2023-11-07 12:58 ` [FFmpeg-devel] [PATCH 4/4] lavu/log: do not assume AVClass.item_name is always set Anton Khirnov 2 siblings, 0 replies; 6+ messages in thread From: Anton Khirnov @ 2023-11-07 12:58 UTC (permalink / raw) To: ffmpeg-devel --- fftools/ffmpeg_filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index c8920d9234..b7da105141 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -928,8 +928,10 @@ int fg_create(FilterGraph **pfg, char *graph_desc) for (AVFilterInOut *cur = outputs; cur; cur = cur->next) { OutputFilter *const ofilter = ofilter_alloc(fg); - if (!ofilter) + if (!ofilter) { + ret = AVERROR(ENOMEM); goto fail; + } ofilter->linklabel = cur->name; cur->name = NULL; -- 2.42.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-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH 4/4] lavu/log: do not assume AVClass.item_name is always set 2023-11-07 12:58 [FFmpeg-devel] [PATCH 1/4] fftools/cmdutils: only set array size after allocation succeeded Anton Khirnov 2023-11-07 12:58 ` [FFmpeg-devel] [PATCH 2/4] fftools/ffmpeg_filter: fail on ifilter_alloc() failure Anton Khirnov 2023-11-07 12:58 ` [FFmpeg-devel] [PATCH 3/4] fftools/ffmpeg_filter: return an error on ofilter_alloc() failure Anton Khirnov @ 2023-11-07 12:58 ` Anton Khirnov 2023-11-07 20:52 ` James Almer 2 siblings, 1 reply; 6+ messages in thread From: Anton Khirnov @ 2023-11-07 12:58 UTC (permalink / raw) To: ffmpeg-devel --- libavutil/log.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavutil/log.c b/libavutil/log.c index 2d358b7ab9..46662f3db0 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -291,6 +291,11 @@ static const char *get_level_str(int level) } } +static const char *item_name(void *obj, const AVClass *cls) +{ + return (cls->item_name ? cls->item_name : av_default_item_name)(obj); +} + static void format_line(void *avcl, int level, const char *fmt, va_list vl, AVBPrint part[4], int *print_prefix, int type[2]) { @@ -307,12 +312,12 @@ static void format_line(void *avcl, int level, const char *fmt, va_list vl, avc->parent_log_context_offset); if (parent && *parent) { av_bprintf(part+0, "[%s @ %p] ", - (*parent)->item_name(parent), parent); + item_name(parent, *parent), parent); if(type) type[0] = get_category(parent); } } av_bprintf(part+1, "[%s @ %p] ", - avc->item_name(avcl), avcl); + item_name(avcl, avc), avcl); if(type) type[1] = get_category(avcl); } -- 2.42.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-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH 4/4] lavu/log: do not assume AVClass.item_name is always set 2023-11-07 12:58 ` [FFmpeg-devel] [PATCH 4/4] lavu/log: do not assume AVClass.item_name is always set Anton Khirnov @ 2023-11-07 20:52 ` James Almer 2023-11-09 10:25 ` Anton Khirnov 0 siblings, 1 reply; 6+ messages in thread From: James Almer @ 2023-11-07 20:52 UTC (permalink / raw) To: ffmpeg-devel On 11/7/2023 9:58 AM, Anton Khirnov wrote: > --- > libavutil/log.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/libavutil/log.c b/libavutil/log.c > index 2d358b7ab9..46662f3db0 100644 > --- a/libavutil/log.c > +++ b/libavutil/log.c > @@ -291,6 +291,11 @@ static const char *get_level_str(int level) > } > } > > +static const char *item_name(void *obj, const AVClass *cls) > +{ > + return (cls->item_name ? cls->item_name : av_default_item_name)(obj); > +} > + > static void format_line(void *avcl, int level, const char *fmt, va_list vl, > AVBPrint part[4], int *print_prefix, int type[2]) > { > @@ -307,12 +312,12 @@ static void format_line(void *avcl, int level, const char *fmt, va_list vl, > avc->parent_log_context_offset); > if (parent && *parent) { > av_bprintf(part+0, "[%s @ %p] ", > - (*parent)->item_name(parent), parent); > + item_name(parent, *parent), parent); > if(type) type[0] = get_category(parent); > } > } > av_bprintf(part+1, "[%s @ %p] ", > - avc->item_name(avcl), avcl); > + item_name(avcl, avc), avcl); > if(type) type[1] = get_category(avcl); > } If this lets us define an AVClass without having to add the item_name = av_default_item_name line, then +1. Btw, there's also .version that's always set to LIBAVUTIL_VERSION_INT, but that can't be changed as they are compile time constants. What can probably be dropped however are the checks in log.c for runtime major version 50 and 51. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH 4/4] lavu/log: do not assume AVClass.item_name is always set 2023-11-07 20:52 ` James Almer @ 2023-11-09 10:25 ` Anton Khirnov 0 siblings, 0 replies; 6+ messages in thread From: Anton Khirnov @ 2023-11-09 10:25 UTC (permalink / raw) To: FFmpeg development discussions and patches Quoting James Almer (2023-11-07 21:52:11) > What can probably be dropped however are the checks in log.c for > runtime major version 50 and 51. Right. Patches welcome? -- 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-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-11-09 10:25 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-11-07 12:58 [FFmpeg-devel] [PATCH 1/4] fftools/cmdutils: only set array size after allocation succeeded Anton Khirnov 2023-11-07 12:58 ` [FFmpeg-devel] [PATCH 2/4] fftools/ffmpeg_filter: fail on ifilter_alloc() failure Anton Khirnov 2023-11-07 12:58 ` [FFmpeg-devel] [PATCH 3/4] fftools/ffmpeg_filter: return an error on ofilter_alloc() failure Anton Khirnov 2023-11-07 12:58 ` [FFmpeg-devel] [PATCH 4/4] lavu/log: do not assume AVClass.item_name is always set Anton Khirnov 2023-11-07 20:52 ` James Almer 2023-11-09 10:25 ` Anton Khirnov
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git