From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 09/13] avformat: Enforce one-stream limit where appropriate Date: Wed, 20 Mar 2024 03:12:52 +0100 Message-ID: <AS8P250MB07448570B795E1CBCB7626648F332@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <AS8P250MB07447D5624C9B5EA91D18ED18F332@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> Several muxers (e.g. pcm muxers) did not check the number of streams even though the individual streams were not recoverable from the muxed files. This commit changes this by using the FF_OFMT_MAX_ONE_OF_EACH flag where appropriate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavformat/a64.c | 3 +++ libavformat/adtsenc.c | 2 ++ libavformat/amr.c | 2 ++ libavformat/amvenc.c | 2 ++ libavformat/bit.c | 2 ++ libavformat/daudenc.c | 2 ++ libavformat/filmstripenc.c | 2 ++ libavformat/fitsenc.c | 2 ++ libavformat/idroqenc.c | 2 ++ libavformat/jacosubenc.c | 3 +++ libavformat/latmenc.c | 2 ++ libavformat/mmf.c | 2 ++ libavformat/omaenc.c | 3 +++ libavformat/pcmenc.c | 2 ++ libavformat/rsoenc.c | 2 ++ libavformat/smjpegenc.c | 6 ++---- libavformat/soxenc.c | 2 ++ libavformat/spdifenc.c | 2 ++ libavformat/vc1testenc.c | 2 ++ 19 files changed, 41 insertions(+), 4 deletions(-) diff --git a/libavformat/a64.c b/libavformat/a64.c index 23b20fc8b7..6e722c7e9f 100644 --- a/libavformat/a64.c +++ b/libavformat/a64.c @@ -65,6 +65,9 @@ const FFOutputFormat ff_a64_muxer = { .p.long_name = NULL_IF_CONFIG_SMALL("a64 - video for Commodore 64"), .p.extensions = "a64, A64", .p.video_codec = AV_CODEC_ID_A64_MULTI, + .p.audio_codec = AV_CODEC_ID_NONE, + .p.subtitle_codec = AV_CODEC_ID_NONE, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .write_header = a64_write_header, .write_packet = ff_raw_write_packet, }; diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index c5765cc92e..7eaf91630c 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -241,6 +241,8 @@ const FFOutputFormat ff_adts_muxer = { .priv_data_size = sizeof(ADTSContext), .p.audio_codec = AV_CODEC_ID_AAC, .p.video_codec = AV_CODEC_ID_NONE, + .p.subtitle_codec = AV_CODEC_ID_NONE, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .init = adts_init, .write_header = adts_write_header, .write_packet = adts_write_packet, diff --git a/libavformat/amr.c b/libavformat/amr.c index 1b80810302..0db0a8d26a 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -273,7 +273,9 @@ const FFOutputFormat ff_amr_muxer = { .p.extensions = "amr", .p.audio_codec = AV_CODEC_ID_AMR_NB, .p.video_codec = AV_CODEC_ID_NONE, + .p.subtitle_codec = AV_CODEC_ID_NONE, .p.flags = AVFMT_NOTIMESTAMPS, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .write_header = amr_write_header, .write_packet = ff_raw_write_packet, }; diff --git a/libavformat/amvenc.c b/libavformat/amvenc.c index e1b1ffd42e..9fcc09add2 100644 --- a/libavformat/amvenc.c +++ b/libavformat/amvenc.c @@ -410,6 +410,8 @@ const FFOutputFormat ff_amv_muxer = { .priv_data_size = sizeof(AMVContext), .p.audio_codec = AV_CODEC_ID_ADPCM_IMA_AMV, .p.video_codec = AV_CODEC_ID_AMV, + .p.subtitle_codec = AV_CODEC_ID_NONE, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .init = amv_init, .deinit = amv_deinit, .write_header = amv_write_header, diff --git a/libavformat/bit.c b/libavformat/bit.c index 8133b1f44d..81a954c392 100644 --- a/libavformat/bit.c +++ b/libavformat/bit.c @@ -167,6 +167,8 @@ const FFOutputFormat ff_bit_muxer = { .p.extensions = "bit", .p.audio_codec = AV_CODEC_ID_G729, .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 = write_header, .write_packet = write_packet, }; diff --git a/libavformat/daudenc.c b/libavformat/daudenc.c index a995838351..f1e0da058b 100644 --- a/libavformat/daudenc.c +++ b/libavformat/daudenc.c @@ -62,7 +62,9 @@ const FFOutputFormat ff_daud_muxer = { .p.extensions = "302", .p.audio_codec = AV_CODEC_ID_PCM_S24DAUD, .p.video_codec = AV_CODEC_ID_NONE, + .p.subtitle_codec = AV_CODEC_ID_NONE, .p.flags = AVFMT_NOTIMESTAMPS, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .init = daud_init, .write_packet = daud_write_packet, }; diff --git a/libavformat/filmstripenc.c b/libavformat/filmstripenc.c index 9033dba692..b2a4cee8fa 100644 --- a/libavformat/filmstripenc.c +++ b/libavformat/filmstripenc.c @@ -66,6 +66,8 @@ const FFOutputFormat ff_filmstrip_muxer = { .p.extensions = "flm", .p.audio_codec = AV_CODEC_ID_NONE, .p.video_codec = AV_CODEC_ID_RAWVIDEO, + .p.subtitle_codec = AV_CODEC_ID_NONE, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .write_header = write_header, .write_packet = ff_raw_write_packet, .write_trailer = write_trailer, diff --git a/libavformat/fitsenc.c b/libavformat/fitsenc.c index 14a4572f70..605056af59 100644 --- a/libavformat/fitsenc.c +++ b/libavformat/fitsenc.c @@ -198,6 +198,8 @@ const FFOutputFormat ff_fits_muxer = { .p.extensions = "fits", .p.audio_codec = AV_CODEC_ID_NONE, .p.video_codec = AV_CODEC_ID_FITS, + .p.subtitle_codec = AV_CODEC_ID_NONE, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .priv_data_size = sizeof(FITSContext), .write_header = fits_write_header, .write_packet = fits_write_packet, diff --git a/libavformat/idroqenc.c b/libavformat/idroqenc.c index 9baf9ad1b1..75a191189c 100644 --- a/libavformat/idroqenc.c +++ b/libavformat/idroqenc.c @@ -66,6 +66,8 @@ const FFOutputFormat ff_roq_muxer = { .p.extensions = "roq", .p.audio_codec = AV_CODEC_ID_ROQ_DPCM, .p.video_codec = AV_CODEC_ID_ROQ, + .p.subtitle_codec = AV_CODEC_ID_NONE, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .write_header = roq_write_header, .write_packet = ff_raw_write_packet, }; diff --git a/libavformat/jacosubenc.c b/libavformat/jacosubenc.c index fa0f9fdaa2..a792fda42e 100644 --- a/libavformat/jacosubenc.c +++ b/libavformat/jacosubenc.c @@ -36,7 +36,10 @@ const FFOutputFormat ff_jacosub_muxer = { .p.mime_type = "text/x-jacosub", .p.extensions = "jss,js", .p.flags = AVFMT_TS_NONSTRICT, + .p.video_codec = AV_CODEC_ID_NONE, + .p.audio_codec = AV_CODEC_ID_NONE, .p.subtitle_codec = AV_CODEC_ID_JACOSUB, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .write_header = jacosub_write_header, .write_packet = ff_raw_write_packet, }; diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index 8eec632c54..05004048aa 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -268,6 +268,8 @@ const FFOutputFormat ff_latm_muxer = { .priv_data_size = sizeof(LATMContext), .p.audio_codec = AV_CODEC_ID_AAC, .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 = latm_write_header, .write_packet = latm_write_packet, .p.priv_class = &latm_muxer_class, diff --git a/libavformat/mmf.c b/libavformat/mmf.c index b3e257616d..fab4509711 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -319,6 +319,8 @@ const FFOutputFormat ff_mmf_muxer = { .priv_data_size = sizeof(MMFContext), .p.audio_codec = AV_CODEC_ID_ADPCM_YAMAHA, .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 = mmf_write_header, .write_packet = ff_raw_write_packet, .write_trailer = mmf_write_trailer, diff --git a/libavformat/omaenc.c b/libavformat/omaenc.c index 6d0b47465d..b553bc3e9d 100644 --- a/libavformat/omaenc.c +++ b/libavformat/omaenc.c @@ -97,9 +97,12 @@ const FFOutputFormat ff_oma_muxer = { .p.long_name = NULL_IF_CONFIG_SMALL("Sony OpenMG audio"), .p.mime_type = "audio/x-oma", .p.extensions = "oma", + .p.video_codec = AV_CODEC_ID_NONE, .p.audio_codec = AV_CODEC_ID_ATRAC3, + .p.subtitle_codec = AV_CODEC_ID_NONE, .write_header = oma_write_header, .write_packet = ff_raw_write_packet, .p.codec_tag = ff_oma_codec_tags_list, .p.flags = AVFMT_NOTIMESTAMPS, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, }; diff --git a/libavformat/pcmenc.c b/libavformat/pcmenc.c index 7f71644308..4879f1deed 100644 --- a/libavformat/pcmenc.c +++ b/libavformat/pcmenc.c @@ -33,7 +33,9 @@ const FFOutputFormat ff_pcm_ ## name_ ## _muxer = { \ .p.extensions = ext, \ .p.audio_codec = codec, \ .p.video_codec = AV_CODEC_ID_NONE, \ + .p.subtitle_codec = AV_CODEC_ID_NONE, \ .p.flags = AVFMT_NOTIMESTAMPS, \ + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, \ .write_packet = ff_raw_write_packet, \ }; #define PCMDEF_2(name, long_name, ext, codec, enabled) \ diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c index fe22e22812..552fe5816a 100644 --- a/libavformat/rsoenc.c +++ b/libavformat/rsoenc.c @@ -98,6 +98,8 @@ const FFOutputFormat ff_rso_muxer = { .p.extensions = "rso", .p.audio_codec = AV_CODEC_ID_PCM_U8, .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 = rso_write_header, .write_packet = ff_raw_write_packet, .write_trailer = rso_write_trailer, diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c index 56907c96f7..5b8f41d76d 100644 --- a/libavformat/smjpegenc.c +++ b/libavformat/smjpegenc.c @@ -39,10 +39,6 @@ static int smjpeg_write_header(AVFormatContext *s) AVIOContext *pb = s->pb; int n, tag; - if (s->nb_streams > 2) { - av_log(s, AV_LOG_ERROR, "more than >2 streams are not supported\n"); - return AVERROR(EINVAL); - } avio_write(pb, SMJPEG_MAGIC, 8); avio_wb32(pb, 0); avio_wb32(pb, 0); @@ -139,6 +135,8 @@ const FFOutputFormat ff_smjpeg_muxer = { .priv_data_size = sizeof(SMJPEGMuxContext), .p.audio_codec = AV_CODEC_ID_PCM_S16LE, .p.video_codec = AV_CODEC_ID_MJPEG, + .p.subtitle_codec = AV_CODEC_ID_NONE, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .write_header = smjpeg_write_header, .write_packet = smjpeg_write_packet, .write_trailer = smjpeg_write_trailer, diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index 359835f27b..6217eec043 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -112,8 +112,10 @@ const FFOutputFormat ff_sox_muxer = { .priv_data_size = sizeof(SoXContext), .p.audio_codec = AV_CODEC_ID_PCM_S32LE, .p.video_codec = AV_CODEC_ID_NONE, + .p.subtitle_codec = AV_CODEC_ID_NONE, .write_header = sox_write_header, .write_packet = ff_raw_write_packet, .write_trailer = sox_write_trailer, .p.flags = AVFMT_NOTIMESTAMPS, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, }; diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index a929ad2db3..f97f4d0175 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -681,9 +681,11 @@ const FFOutputFormat ff_spdif_muxer = { .priv_data_size = sizeof(IEC61937Context), .p.audio_codec = AV_CODEC_ID_AC3, .p.video_codec = AV_CODEC_ID_NONE, + .p.subtitle_codec = AV_CODEC_ID_NONE, .write_header = spdif_write_header, .write_packet = spdif_write_packet, .deinit = spdif_deinit, .p.flags = AVFMT_NOTIMESTAMPS, .p.priv_class = &spdif_class, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, }; diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c index 89b916deeb..6b4cbd1152 100644 --- a/libavformat/vc1testenc.c +++ b/libavformat/vc1testenc.c @@ -88,7 +88,9 @@ const FFOutputFormat ff_vc1t_muxer = { .priv_data_size = sizeof(RCVContext), .p.audio_codec = AV_CODEC_ID_NONE, .p.video_codec = AV_CODEC_ID_WMV3, + .p.subtitle_codec = AV_CODEC_ID_NONE, .write_header = vc1test_write_header, .write_packet = vc1test_write_packet, .write_trailer = vc1test_write_trailer, + .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, }; -- 2.40.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:[~2024-03-20 2:14 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt 2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 02/13] libavformat/westwood_audenc: Use proper logcontext Andreas Rheinhardt 2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 03/13] avformat/mux: Rename FF_FMT_ALLOW_FLUSH->FF_OFMT_FLAG_ALLOW_FLUSH Andreas Rheinhardt 2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 04/13] avformat/codec2: Don't allocate Codec2Context for muxer Andreas Rheinhardt 2024-03-20 11:23 ` Tomas Härdin 2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 05/13] avformat/amr: Move write_header closer to muxer definition Andreas Rheinhardt 2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 06/13] avformat/mux_utils: Don't report that AV_CODEC_ID_NONE can be muxed Andreas Rheinhardt 2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 07/13] fate/filter-audio: Don't use pcm output for channelsplit test Andreas Rheinhardt 2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 08/13] avformat/mux: Add flag for "not more than one stream of each type" Andreas Rheinhardt 2024-03-20 2:12 ` Andreas Rheinhardt [this message] 2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 10/13] avformat/mux: Add flag for "only default codecs allowed" Andreas Rheinhardt 2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 11/13] avformat/ttmlenc: Avoid unnecessary block Andreas Rheinhardt 2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 12/13] avformat: Enforce codec_id where appropriate Andreas Rheinhardt 2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 13/13] avformat: Make init function out of write_header functions if possible Andreas Rheinhardt 2024-03-22 12:13 ` [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
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=AS8P250MB07448570B795E1CBCB7626648F332@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \ --to=andreas.rheinhardt@outlook.com \ --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