diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-03-19 21:40:54 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-03-22 23:57:19 +0100 |
commit | f4167842c12ad0e406a2bed4c2bb17084b184710 (patch) | |
tree | c7230409284fe0232e5f9cee586edfc0763f599c /libavformat/astenc.c | |
parent | c6bc2d4fea99bfc0ad125897f61d205d78d0a8c1 (diff) | |
download | ffmpeg-f4167842c12ad0e406a2bed4c2bb17084b184710.tar.gz |
avformat/mux: Add flag for "not more than one stream of each type"
More exactly: Not more than one stream of each type for which
a default codec (i.e. AVOutputFormat.(audio|video|subtitle)_codec)
is set; for those types for which no such codec is set (or for
which no designated default codec in AVOutputFormat exists at all)
no streams are permitted.
Given that with this flag set the default codecs become more important,
they are now set explicitly to AV_CODEC_ID_NONE for "unset";
the earlier code relied on AV_CODEC_ID_NONE being equal to zero,
so that default static initialization set it accordingly;
but this is not how one is supposed to use an enum.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/astenc.c')
-rw-r--r-- | libavformat/astenc.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/libavformat/astenc.c b/libavformat/astenc.c index c6b02e3848..1fa06a2da8 100644 --- a/libavformat/astenc.c +++ b/libavformat/astenc.c @@ -49,16 +49,9 @@ static int ast_write_header(AVFormatContext *s) { ASTMuxContext *ast = s->priv_data; AVIOContext *pb = s->pb; - AVCodecParameters *par; + AVCodecParameters *par = s->streams[0]->codecpar; unsigned int codec_tag; - if (s->nb_streams == 1) { - par = s->streams[0]->codecpar; - } else { - av_log(s, AV_LOG_ERROR, "only one stream is supported\n"); - return AVERROR(EINVAL); - } - if (par->codec_id == AV_CODEC_ID_ADPCM_AFC) { av_log(s, AV_LOG_ERROR, "muxing ADPCM AFC is not implemented\n"); return AVERROR_PATCHWELCOME; @@ -204,6 +197,8 @@ const FFOutputFormat ff_ast_muxer = { .priv_data_size = sizeof(ASTMuxContext), .p.audio_codec = AV_CODEC_ID_PCM_S16BE_PLANAR, .p.video_codec = AV_CODEC_ID_NONE, + .p.subtitle_codec = AV_CODEC_ID_NONE, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .write_header = ast_write_header, .write_packet = ast_write_packet, .write_trailer = ast_write_trailer, |