mirror of
https://github.com/librempeg/librempeg
synced 2024-11-22 00:51:37 +00:00
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> Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
ba6e2391b9
commit
0aaf30e805
@ -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,
|
||||
};
|
||||
|
@ -240,6 +240,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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -267,6 +267,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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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) \
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -680,9 +680,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,
|
||||
};
|
||||
|
@ -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,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user