diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-03-19 22:07:12 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-03-22 23:57:19 +0100 |
commit | 03b04eef72a5f23e30c2d7700b290d915c31d3a1 (patch) | |
tree | f38ab979e156dd3a5ec293162119b9d537c1db83 | |
parent | f4167842c12ad0e406a2bed4c2bb17084b184710 (diff) | |
download | ffmpeg-03b04eef72a5f23e30c2d7700b290d915c31d3a1.tar.gz |
avformat: Enforce one-stream limit where appropriate
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>
-rw-r--r-- | libavformat/a64.c | 3 | ||||
-rw-r--r-- | libavformat/adtsenc.c | 2 | ||||
-rw-r--r-- | libavformat/amr.c | 2 | ||||
-rw-r--r-- | libavformat/amvenc.c | 2 | ||||
-rw-r--r-- | libavformat/bit.c | 2 | ||||
-rw-r--r-- | libavformat/daudenc.c | 2 | ||||
-rw-r--r-- | libavformat/filmstripenc.c | 2 | ||||
-rw-r--r-- | libavformat/fitsenc.c | 2 | ||||
-rw-r--r-- | libavformat/idroqenc.c | 2 | ||||
-rw-r--r-- | libavformat/jacosubenc.c | 3 | ||||
-rw-r--r-- | libavformat/latmenc.c | 2 | ||||
-rw-r--r-- | libavformat/mmf.c | 2 | ||||
-rw-r--r-- | libavformat/omaenc.c | 3 | ||||
-rw-r--r-- | libavformat/pcmenc.c | 2 | ||||
-rw-r--r-- | libavformat/rsoenc.c | 2 | ||||
-rw-r--r-- | libavformat/smjpegenc.c | 6 | ||||
-rw-r--r-- | libavformat/soxenc.c | 2 | ||||
-rw-r--r-- | libavformat/spdifenc.c | 2 | ||||
-rw-r--r-- | 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, }; |