From: Anton Khirnov <anton@khirnov.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 3/8] ffmpeg: add support for muxing AVStreamGroups
Date: Mon, 11 Dec 2023 12:48:03 +0100
Message-ID: <170229528332.8914.3392013065667453741@lain.khirnov.net> (raw)
In-Reply-To: <20231205224402.14540-4-jamrial@gmail.com>
Quoting James Almer (2023-12-05 23:43:57)
> Starting with IAMF support.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> fftools/ffmpeg.h | 2 +
> fftools/ffmpeg_mux_init.c | 335 ++++++++++++++++++++++++++++++++++++++
> fftools/ffmpeg_opt.c | 2 +
> 3 files changed, 339 insertions(+)
Missing documentation.
> +static int of_add_groups(Muxer *mux, const OptionsContext *o)
> +{
> + AVFormatContext *oc = mux->fc;
> + int ret;
> +
> + /* process manually set groups */
> + for (int i = 0; i < o->nb_stream_groups; i++) {
> + AVDictionary *dict = NULL, *tmp = NULL;
> + const AVDictionaryEntry *e;
> + AVStreamGroup *stg = NULL;
> + int type;
> + const char *token;
> + char *str, *ptr = NULL;
> + const AVOption opts[] = {
> + { "type", "Set group type", offsetof(AVStreamGroup, type), AV_OPT_TYPE_INT,
> + { .i64 = 0 }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "type" },
> + { "iamf_audio_element", NULL, 0, AV_OPT_TYPE_CONST,
> + { .i64 = AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT }, .unit = "type" },
> + { "iamf_mix_presentation", NULL, 0, AV_OPT_TYPE_CONST,
> + { .i64 = AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION }, .unit = "type" },
> + { NULL },
> + };
> + const AVClass class = {
> + .class_name = "StreamGroupType",
> + .item_name = av_default_item_name,
> + .option = opts,
> + .version = LIBAVUTIL_VERSION_INT,
> + };
> + const AVClass *pclass = &class;
> +
> + str = av_strdup(o->stream_groups[i].u.str);
> + if (!str)
> + goto end;
> +
> + token = av_strtok(str, ",", &ptr);
> + if (token) {
Too many indentation levels, move this whole block into a separate
function.
> + ret = av_dict_parse_string(&dict, token, "=", ":", AV_DICT_MULTIKEY);
> + if (ret < 0) {
> + av_log(mux, AV_LOG_ERROR, "Error parsing group specification %s\n", token);
> + goto end;
> + }
> +
> + // "type" is not a user settable option in AVStreamGroup
This comment confuses me.
> + e = av_dict_get(dict, "type", NULL, 0);
> + if (!e) {
> + av_log(mux, AV_LOG_ERROR, "No type define for Steam Group %d\n", i);
1) Steam
2) defined? Or maybe specified.
3) Print the string, not the index.
> + ret = AVERROR(EINVAL);
> + goto end;
> + }
> +
> + ret = av_opt_eval_int(&pclass, opts, e->value, &type);
> + if (ret < 0 || type == AV_STREAM_GROUP_PARAMS_NONE) {
> + av_log(mux, AV_LOG_ERROR, "Invalid group type \"%s\"\n", e->value);
> + goto end;
> + }
> +
> + av_dict_copy(&tmp, dict, 0);
> + stg = avformat_stream_group_create(oc, type, &tmp);
> + if (!stg) {
> + ret = AVERROR(ENOMEM);
> + goto end;
> + }
> + av_dict_set(&tmp, "type", NULL, 0);
> +
> + e = NULL;
> + while (e = av_dict_get(dict, "st", e, 0)) {
> + unsigned int idx = strtol(e->value, NULL, 0);
> + if (idx >= oc->nb_streams) {
> + av_log(mux, AV_LOG_ERROR, "Invalid stream index %d\n", idx);
> + ret = AVERROR(EINVAL);
> + goto end;
> + }
This block seems confused about signedness of e->value.
> + avformat_stream_group_add_stream(stg, oc->streams[idx]);
Unchecked return value.
--
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".
next prev parent reply other threads:[~2023-12-11 11:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-05 22:43 [FFmpeg-devel] [PATCH v6 0/8] avformat: introduce AVStreamGroup James Almer
2023-12-05 22:43 ` [FFmpeg-devel] [PATCH 1/8] avutil: introduce an Immersive Audio Model and Formats API James Almer
2023-12-11 10:19 ` Anton Khirnov
2023-12-05 22:43 ` [FFmpeg-devel] [PATCH 2/8] avformat: introduce AVStreamGroup James Almer
2023-12-11 10:59 ` Anton Khirnov
2023-12-11 12:48 ` James Almer
2023-12-11 12:51 ` Anton Khirnov
2023-12-11 11:03 ` Anton Khirnov
2023-12-11 12:53 ` James Almer
2023-12-12 11:46 ` Anton Khirnov
2023-12-05 22:43 ` [FFmpeg-devel] [PATCH 3/8] ffmpeg: add support for muxing AVStreamGroups James Almer
2023-12-11 11:48 ` Anton Khirnov [this message]
2023-12-11 12:46 ` James Almer
2023-12-12 11:26 ` Anton Khirnov
2023-12-05 22:43 ` [FFmpeg-devel] [PATCH 4/8] avcodec/packet: add IAMF Parameters side data types James Almer
2023-12-05 22:43 ` [FFmpeg-devel] [PATCH 5/8] avcodec/get_bits: add get_leb() James Almer
2023-12-05 22:44 ` [FFmpeg-devel] [PATCH 6/8] avformat/aviobuf: add ffio_read_leb() and ffio_write_leb() James Almer
2023-12-05 22:44 ` [FFmpeg-devel] [PATCH 7/8] avformat: Immersive Audio Model and Formats demuxer James Almer
2023-12-05 22:44 ` [FFmpeg-devel] [PATCH 8/8] avformat: Immersive Audio Model and Formats muxer James Almer
2023-12-10 21:52 ` [FFmpeg-devel] [PATCH v6 0/8] avformat: introduce AVStreamGroup James Almer
2023-12-14 20:14 [FFmpeg-devel] [PATCH v7 " James Almer
2023-12-14 20:14 ` [FFmpeg-devel] [PATCH 3/8] ffmpeg: add support for muxing AVStreamGroups James Almer
2023-12-15 21:28 ` James Almer
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=170229528332.8914.3392013065667453741@lain.khirnov.net \
--to=anton@khirnov.net \
--cc=ffmpeg-devel@ffmpeg.org \
/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