From: Thilo Borgmann via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Thilo Borgmann <thilo.borgmann@mail.de>
Subject: [FFmpeg-devel] [PATCH 1/5] fftools/ffmpeg: split loop for parsing and validation of -stats_* specifiers
Date: Mon, 11 Dec 2023 16:07:21 +0100
Message-ID: <20231211150725.46473-2-thilo.borgmann@mail.de> (raw)
In-Reply-To: <20231211150725.46473-1-thilo.borgmann@mail.de>
---
fftools/ffmpeg_mux_init.c | 40 ++++++++++++++++++++++++++-------------
1 file changed, 27 insertions(+), 13 deletions(-)
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 63a25a350f..6c473a8f09 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -365,6 +365,26 @@ static int enc_stats_init(OutputStream *ost, EncStats *es, int pre,
c = &es->components[es->nb_components - 1];
+ for (size_t i = 0; i < FF_ARRAY_ELEMS(fmt_specs); i++) {
+ if (!strcmp(val, fmt_specs[i].str)) {
+ c->type = fmt_specs[i].type;
+ c->str = val;
+ c->str_len = val_len;
+ break;
+ }
+ }
+
+ if (!c->type) {
+ av_log(NULL, AV_LOG_ERROR, "Invalid format directive: %s\n", val);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ }
+
+ for (int j = 0; j < es->nb_components; j++) {
+ EncStatsComponent *c = &es->components[j];
+ char *val = c->str;
+
for (size_t i = 0; i < FF_ARRAY_ELEMS(fmt_specs); i++) {
if (!strcmp(val, fmt_specs[i].str)) {
if ((pre && fmt_specs[i].post_only) || (!pre && fmt_specs[i].pre_only)) {
@@ -375,8 +395,6 @@ static int enc_stats_init(OutputStream *ost, EncStats *es, int pre,
goto fail;
}
- c->type = fmt_specs[i].type;
-
if (fmt_specs[i].need_input_data && !ost->ist) {
av_log(ost, AV_LOG_WARNING,
"Format directive '%s' is unavailable, because "
@@ -387,20 +405,16 @@ static int enc_stats_init(OutputStream *ost, EncStats *es, int pre,
break;
}
}
-
- if (!c->type) {
- av_log(NULL, AV_LOG_ERROR, "Invalid format directive: %s\n", val);
- ret = AVERROR(EINVAL);
- goto fail;
- }
-
-fail:
- av_freep(&val);
- if (ret < 0)
- return ret;
}
ret = enc_stats_get_file(&es->io, path);
+fail:
+ for (int j = 0; j < es->nb_components; j++) {
+ EncStatsComponent *c = &es->components[j];
+ if (c->type != ENC_STATS_LITERAL) {
+ av_freep(&c->str);
+ }
+ }
if (ret < 0)
return ret;
--
2.37.1 (Apple Git-137.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-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-12-11 15:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 15:07 [FFmpeg-devel] [PATCH 0/5] avfilter: Add fsync filter Thilo Borgmann via ffmpeg-devel
2023-12-11 15:07 ` Thilo Borgmann via ffmpeg-devel [this message]
2023-12-11 15:07 ` [FFmpeg-devel] [PATCH 2/5] fftools/ffmpeg: move parsing of -stats_* specifiers to lavu/parseutils Thilo Borgmann via ffmpeg-devel
2023-12-13 12:00 ` Anton Khirnov
2023-12-13 12:05 ` Thilo Borgmann via ffmpeg-devel
2023-12-13 12:08 ` Anton Khirnov
2023-12-13 12:15 ` Thilo Borgmann via ffmpeg-devel
2023-12-13 12:39 ` Anton Khirnov
2023-12-13 12:50 ` Thilo Borgmann via ffmpeg-devel
2023-12-13 16:28 ` Anton Khirnov
2023-12-13 18:17 ` Thilo Borgmann via ffmpeg-devel
2023-12-14 5:23 ` Anton Khirnov
2023-12-14 10:34 ` Thilo Borgmann via ffmpeg-devel
2023-12-14 17:51 ` Anton Khirnov
2023-12-14 18:42 ` Thilo Borgmann via ffmpeg-devel
2023-12-13 12:10 ` Nicolas George
2023-12-11 15:07 ` [FFmpeg-devel] [PATCH 3/5] reindent after last commit Thilo Borgmann via ffmpeg-devel
2023-12-11 15:07 ` [FFmpeg-devel] [PATCH 4/5] avfilter: Add fsync filter Thilo Borgmann via ffmpeg-devel
2023-12-11 15:14 ` Thilo Borgmann via ffmpeg-devel
2023-12-11 15:07 ` [FFmpeg-devel] [PATCH 5/5] fate: Add fsync filter tests Thilo Borgmann via ffmpeg-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231211150725.46473-2-thilo.borgmann@mail.de \
--to=ffmpeg-devel@ffmpeg.org \
--cc=thilo.borgmann@mail.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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