* [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec
@ 2024-03-20 2:07 Andreas Rheinhardt
2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 02/13] libavformat/westwood_audenc: Use proper logcontext Andreas Rheinhardt
` (12 more replies)
0 siblings, 13 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:07 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signal that anything except MP3 and the ID3V2 attached pic types
are forbidden.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/mp3enc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index cb250a46ca..4a02a45069 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -495,12 +495,16 @@ static int mp3_write_trailer(struct AVFormatContext *s)
static int query_codec(enum AVCodecID id, int std_compliance)
{
const CodecMime *cm= ff_id3v2_mime_tags;
+
+ if (id == AV_CODEC_ID_MP3)
+ return 1;
+
while(cm->id != AV_CODEC_ID_NONE) {
if(id == cm->id)
return MKTAG('A', 'P', 'I', 'C');
cm++;
}
- return -1;
+ return 0;
}
static const AVOption options[] = {
--
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 02/13] libavformat/westwood_audenc: Use proper logcontext
2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
@ 2024-03-20 2:12 ` 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
` (11 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
(AVStream did not have an AVClass when this muxer was added.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/westwood_audenc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/westwood_audenc.c b/libavformat/westwood_audenc.c
index 84a871e478..46456e2ecb 100644
--- a/libavformat/westwood_audenc.c
+++ b/libavformat/westwood_audenc.c
@@ -48,19 +48,19 @@ static int wsaud_write_init(AVFormatContext *ctx)
/* Stream must be seekable to correctly write the file. */
if (!(pb->seekable & AVIO_SEEKABLE_NORMAL)) {
- av_log(ctx->streams[0], AV_LOG_ERROR, "Cannot write Westwood AUD to"
+ av_log(ctx, AV_LOG_ERROR, "Cannot write Westwood AUD to"
" non-seekable stream.\n");
return AVERROR(EINVAL);
}
if (st->codecpar->codec_id != AV_CODEC_ID_ADPCM_IMA_WS) {
- av_log(st, AV_LOG_ERROR, "%s codec not supported for Westwood AUD.\n",
+ av_log(ctx, AV_LOG_ERROR, "%s codec not supported for Westwood AUD.\n",
avcodec_get_name(st->codecpar->codec_id));
return AVERROR(EINVAL);
}
if (ctx->nb_streams != 1) {
- av_log(st, AV_LOG_ERROR, "AUD files have exactly one stream\n");
+ av_log(ctx, AV_LOG_ERROR, "AUD files have exactly one stream\n");
return AVERROR(EINVAL);
}
--
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 03/13] avformat/mux: Rename FF_FMT_ALLOW_FLUSH->FF_OFMT_FLAG_ALLOW_FLUSH
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 ` Andreas Rheinhardt
2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 04/13] avformat/codec2: Don't allocate Codec2Context for muxer Andreas Rheinhardt
` (10 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
It better reflects that this is a muxer-only flag.
Also document the flag.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavdevice/pulse_audio_enc.c | 2 +-
libavformat/fifo.c | 2 +-
libavformat/hlsenc.c | 2 +-
libavformat/matroskaenc.c | 6 +++---
libavformat/movenc.c | 18 +++++++++---------
libavformat/mpegtsenc.c | 2 +-
libavformat/mux.c | 4 ++--
libavformat/mux.h | 14 +++++++++++---
libavformat/oggenc.c | 10 +++++-----
libavformat/tee.c | 2 +-
libavformat/tests/fifo_muxer.c | 2 +-
11 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c
index 4955b3b884..3e2cc91f69 100644
--- a/libavdevice/pulse_audio_enc.c
+++ b/libavdevice/pulse_audio_enc.c
@@ -801,5 +801,5 @@ const FFOutputFormat ff_pulse_muxer = {
.p.flags = AVFMT_NOFILE,
#endif
.p.priv_class = &pulse_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index 2a2673f4d8..23e4149ad6 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -728,5 +728,5 @@ const FFOutputFormat ff_fifo_muxer = {
.write_packet = fifo_write_packet,
.write_trailer = fifo_write_trailer,
.deinit = fifo_deinit,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index e5350323b1..2202ce64e4 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -3205,7 +3205,7 @@ const FFOutputFormat ff_hls_muxer = {
.p.flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER | AVFMT_NODIMENSIONS,
#endif
.p.priv_class = &hls_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
.priv_data_size = sizeof(HLSContext),
.init = hls_init,
.write_header = hls_write_header,
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index db41d3d1c2..0de4ec1dc0 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -3569,7 +3569,7 @@ const FFOutputFormat ff_matroska_muxer = {
.query_codec = mkv_query_codec,
.check_bitstream = mkv_check_bitstream,
.p.priv_class = &matroska_webm_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@@ -3606,7 +3606,7 @@ const FFOutputFormat ff_webm_muxer = {
AVFMT_TS_NONSTRICT,
#endif
.p.priv_class = &matroska_webm_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@@ -3636,6 +3636,6 @@ const FFOutputFormat ff_matroska_audio_muxer = {
ff_codec_wav_tags, additional_audio_tags, 0
},
.p.priv_class = &matroska_webm_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 724a1eb673..127673a9e6 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -8239,7 +8239,7 @@ const FFOutputFormat ff_mov_muxer = {
},
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_TGP_MUXER
@@ -8263,7 +8263,7 @@ const FFOutputFormat ff_tgp_muxer = {
.p.codec_tag = codec_3gp_tags_list,
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_MP4_MUXER
@@ -8289,7 +8289,7 @@ const FFOutputFormat ff_mp4_muxer = {
.p.codec_tag = mp4_codec_tags_list,
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_PSP_MUXER
@@ -8314,7 +8314,7 @@ const FFOutputFormat ff_psp_muxer = {
.p.codec_tag = mp4_codec_tags_list,
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_TG2_MUXER
@@ -8338,7 +8338,7 @@ const FFOutputFormat ff_tg2_muxer = {
.p.codec_tag = codec_3gp_tags_list,
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_IPOD_MUXER
@@ -8363,7 +8363,7 @@ const FFOutputFormat ff_ipod_muxer = {
.p.codec_tag = (const AVCodecTag* const []){ codec_ipod_tags, 0 },
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_ISMV_MUXER
@@ -8389,7 +8389,7 @@ const FFOutputFormat ff_ismv_muxer = {
codec_mp4_tags, codec_ism_tags, 0 },
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_F4V_MUXER
@@ -8414,7 +8414,7 @@ const FFOutputFormat ff_f4v_muxer = {
.p.codec_tag = (const AVCodecTag* const []){ codec_f4v_tags, 0 },
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_AVIF_MUXER
@@ -8437,6 +8437,6 @@ const FFOutputFormat ff_avif_muxer = {
#endif
.p.codec_tag = codec_avif_tags_list,
.p.priv_class = &mov_avif_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index b8efc535a7..d8c148bd3c 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -2415,6 +2415,6 @@ const FFOutputFormat ff_mpegts_muxer = {
#else
.p.flags = AVFMT_VARIABLE_FPS | AVFMT_NODIMENSIONS,
#endif
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
.p.priv_class = &mpegts_muxer_class,
};
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 772f300f16..a2cae97397 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1208,10 +1208,10 @@ int av_write_frame(AVFormatContext *s, AVPacket *in)
if (!in) {
#if FF_API_ALLOW_FLUSH || LIBAVFORMAT_VERSION_MAJOR >= 61
// Hint: The pulse audio output device has this set,
- // so we can't switch the check to FF_FMT_ALLOW_FLUSH immediately.
+ // so we can't switch the check to FF_OFMT_FLAG_ALLOW_FLUSH immediately.
if (s->oformat->flags & AVFMT_ALLOW_FLUSH) {
#else
- if (ffofmt(s->oformat)->flags_internal & FF_FMT_ALLOW_FLUSH) {
+ if (ffofmt(s->oformat)->flags_internal & FF_OFMT_FLAG_ALLOW_FLUSH) {
#endif
ret = ffofmt(s->oformat)->write_packet(s, NULL);
flush_if_needed(s);
diff --git a/libavformat/mux.h b/libavformat/mux.h
index b9ec75641d..bd3eb53380 100644
--- a/libavformat/mux.h
+++ b/libavformat/mux.h
@@ -27,7 +27,15 @@
struct AVDeviceInfoList;
-#define FF_FMT_ALLOW_FLUSH (1 << 1)
+/**
+ * This flag indicates that the muxer stores data internally
+ * and supports flushing it. Flushing is signalled by sending
+ * a NULL packet to the muxer's write_packet callback;
+ * without this flag, a muxer never receives NULL packets.
+ * So the documentation of write_packet below for the semantics
+ * of the return value in case of flushing.
+ */
+#define FF_OFMT_FLAG_ALLOW_FLUSH (1 << 1)
typedef struct FFOutputFormat {
/**
@@ -40,13 +48,13 @@ typedef struct FFOutputFormat {
int priv_data_size;
/**
- * Internal flags. See FF_FMT_* in internal.h and mux.h.
+ * Internal flags. See FF_OFMT_FLAG_* above and FF_FMT_FLAG_* in internal.h.
*/
int flags_internal;
int (*write_header)(AVFormatContext *);
/**
- * Write a packet. If FF_FMT_ALLOW_FLUSH is set in flags_internal,
+ * Write a packet. If FF_OFMT_FLAG_ALLOW_FLUSH is set in flags_internal,
* pkt can be NULL in order to flush data buffered in the muxer.
* When flushing, return 0 if there still is more data to flush,
* or 1 if everything was flushed and there is no more buffered
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 69a66f586d..bdd19530ce 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -777,7 +777,7 @@ const FFOutputFormat ff_ogg_muxer = {
.p.flags = AVFMT_TS_NEGATIVE | AVFMT_TS_NONSTRICT,
#endif
.p.priv_class = &ogg_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@@ -800,7 +800,7 @@ const FFOutputFormat ff_oga_muxer = {
.p.flags = AVFMT_TS_NEGATIVE,
#endif
.p.priv_class = &ogg_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@@ -826,7 +826,7 @@ const FFOutputFormat ff_ogv_muxer = {
.p.flags = AVFMT_TS_NEGATIVE | AVFMT_TS_NONSTRICT,
#endif
.p.priv_class = &ogg_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@@ -849,7 +849,7 @@ const FFOutputFormat ff_spx_muxer = {
.p.flags = AVFMT_TS_NEGATIVE,
#endif
.p.priv_class = &ogg_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@@ -872,6 +872,6 @@ const FFOutputFormat ff_opus_muxer = {
.p.flags = AVFMT_TS_NEGATIVE,
#endif
.p.priv_class = &ogg_muxer_class,
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
diff --git a/libavformat/tee.c b/libavformat/tee.c
index a101fede5b..9597137ec2 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -614,5 +614,5 @@ const FFOutputFormat ff_tee_muxer = {
#else
.p.flags = AVFMT_NOFILE | AVFMT_TS_NEGATIVE,
#endif
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
diff --git a/libavformat/tests/fifo_muxer.c b/libavformat/tests/fifo_muxer.c
index 032af07dc9..222761fed3 100644
--- a/libavformat/tests/fifo_muxer.c
+++ b/libavformat/tests/fifo_muxer.c
@@ -159,7 +159,7 @@ const FFOutputFormat ff_fifo_test_muxer = {
#else
.p.flags = AVFMT_NOFILE,
#endif
- .flags_internal = FF_FMT_ALLOW_FLUSH,
+ .flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
--
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 04/13] avformat/codec2: Don't allocate Codec2Context for muxer
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 ` 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
` (9 subsequent siblings)
12 siblings, 1 reply; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Only the demuxers use it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/codec2.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libavformat/codec2.c b/libavformat/codec2.c
index 4a3e10c6e3..9ed57af0a8 100644
--- a/libavformat/codec2.c
+++ b/libavformat/codec2.c
@@ -318,7 +318,6 @@ const FFOutputFormat ff_codec2_muxer = {
.p.audio_codec = AV_CODEC_ID_CODEC2,
.p.video_codec = AV_CODEC_ID_NONE,
.p.flags = AVFMT_NOTIMESTAMPS,
- .priv_data_size = sizeof(Codec2Context),
.write_header = codec2_write_header,
.write_packet = ff_raw_write_packet,
};
--
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 05/13] avformat/amr: Move write_header closer to muxer definition
2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
` (2 preceding siblings ...)
2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 04/13] avformat/codec2: Don't allocate Codec2Context for muxer Andreas Rheinhardt
@ 2024-03-20 2:12 ` 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
` (8 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Avoids one #if.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/amr.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/libavformat/amr.c b/libavformat/amr.c
index 85815e8675..1b80810302 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -51,23 +51,6 @@ static const uint8_t amrwb_packed_size[16] = {
18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 1, 1, 1, 1, 1, 1
};
-#if CONFIG_AMR_MUXER
-static int amr_write_header(AVFormatContext *s)
-{
- AVIOContext *pb = s->pb;
- AVCodecParameters *par = s->streams[0]->codecpar;
-
- if (par->codec_id == AV_CODEC_ID_AMR_NB) {
- avio_write(pb, AMR_header, sizeof(AMR_header)); /* magic number */
- } else if (par->codec_id == AV_CODEC_ID_AMR_WB) {
- avio_write(pb, AMRWB_header, sizeof(AMRWB_header)); /* magic number */
- } else {
- return -1;
- }
- return 0;
-}
-#endif /* CONFIG_AMR_MUXER */
-
#if CONFIG_AMR_DEMUXER
static int amr_probe(const AVProbeData *p)
{
@@ -268,6 +251,21 @@ const FFInputFormat ff_amrwb_demuxer = {
#endif
#if CONFIG_AMR_MUXER
+static int amr_write_header(AVFormatContext *s)
+{
+ AVIOContext *pb = s->pb;
+ AVCodecParameters *par = s->streams[0]->codecpar;
+
+ if (par->codec_id == AV_CODEC_ID_AMR_NB) {
+ avio_write(pb, AMR_header, sizeof(AMR_header)); /* magic number */
+ } else if (par->codec_id == AV_CODEC_ID_AMR_WB) {
+ avio_write(pb, AMRWB_header, sizeof(AMRWB_header)); /* magic number */
+ } else {
+ return -1;
+ }
+ return 0;
+}
+
const FFOutputFormat ff_amr_muxer = {
.p.name = "amr",
.p.long_name = NULL_IF_CONFIG_SMALL("3GPP AMR"),
--
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 06/13] avformat/mux_utils: Don't report that AV_CODEC_ID_NONE can be muxed
2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
` (3 preceding siblings ...)
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 ` 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
` (7 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
If AVOutputFormat.video_codec, audio_codec or subtitle_codec
is AV_CODEC_ID_NONE, it means that there is no default codec
for this format and not that it is supported to mux AV_CODEC_ID_NONE.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/mux_utils.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c
index 9d811c14e2..841a19a3a2 100644
--- a/libavformat/mux_utils.c
+++ b/libavformat/mux_utils.c
@@ -39,9 +39,10 @@ int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id,
return ffofmt(ofmt)->query_codec(codec_id, std_compliance);
else if (ofmt->codec_tag)
return !!av_codec_get_tag2(ofmt->codec_tag, codec_id, &codec_tag);
- else if (codec_id == ofmt->video_codec ||
- codec_id == ofmt->audio_codec ||
- codec_id == ofmt->subtitle_codec)
+ else if (codec_id != AV_CODEC_ID_NONE &&
+ (codec_id == ofmt->video_codec ||
+ codec_id == ofmt->audio_codec ||
+ codec_id == ofmt->subtitle_codec))
return 1;
}
return AVERROR_PATCHWELCOME;
--
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 07/13] fate/filter-audio: Don't use pcm output for channelsplit test
2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
` (4 preceding siblings ...)
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 ` 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
` (6 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
This test muxes two streams into a single pcm file, although
the two streams are of course not recoverable from the output
(unless one has extra information). So use the streamhash muxer
instead (which also provides coverage for it; it was surprisingly
unused in FATE so far). This is in preparation for actually
enforcing a limit of one stream for the PCM muxers.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
tests/fate/filter-audio.mak | 6 ++----
tests/ref/fate/filter-channelsplit | 2 ++
2 files changed, 4 insertions(+), 4 deletions(-)
create mode 100644 tests/ref/fate/filter-channelsplit
diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index 308969c4ac..8d05e6bd77 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -306,12 +306,10 @@ fate-filter-channelmap-one-str: REF = 0ea3052e482c95d5d3bd9da6dac1b5fa
FATE_AFILTER-$(call FILTERDEMDECENCMUX, CHANNELMAP ARESAMPLE, WAV, PCM_S16LE, PCM_S16LE, WAV) += $(FATE_FILTER_CHANNELMAP)
-FATE_AFILTER-$(call FILTERDEMDECENCMUX, CHANNELSPLIT ASETNSAMPLES ARESAMPLE, WAV, PCM_S16LE, PCM_S16LE, PCM_S16LE) += fate-filter-channelsplit
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, CHANNELSPLIT ASETNSAMPLES ARESAMPLE, WAV, PCM_S16LE, PCM_S16LE, STREAMHASH) += fate-filter-channelsplit
fate-filter-channelsplit: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
fate-filter-channelsplit: tests/data/asynth-44100-2.wav
-fate-filter-channelsplit: CMD = md5 -auto_conversion_filters -i $(SRC) -filter_complex asetnsamples=n=1024:p=0,channelsplit -f s16le
-fate-filter-channelsplit: CMP = oneline
-fate-filter-channelsplit: REF = d92988d0fe2dd92236763f47b07ab597
+fate-filter-channelsplit: CMD = fmtstdout streamhash -auto_conversion_filters -i $(SRC) -filter_complex asetnsamples=n=1024:p=0,channelsplit
FATE_AFILTER-$(call FILTERDEMDECENCMUX, JOIN ARESAMPLE, WAV, PCM_S16LE, PCM_S16LE, PCM_S16LE) += fate-filter-join
fate-filter-join: SRC1 = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
diff --git a/tests/ref/fate/filter-channelsplit b/tests/ref/fate/filter-channelsplit
new file mode 100644
index 0000000000..892801d94d
--- /dev/null
+++ b/tests/ref/fate/filter-channelsplit
@@ -0,0 +1,2 @@
+0,a,SHA256=a4f03d92f82d074d20bcc49ffcbb28911ae85b097142249a890af59422eb0da8
+1,a,SHA256=c2f021f2b2faa1629674e6126ce5f997ef2034ecd3a15df595a98aefa40614e9
--
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 08/13] avformat/mux: Add flag for "not more than one stream of each type"
2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
` (5 preceding siblings ...)
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 ` Andreas Rheinhardt
2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 09/13] avformat: Enforce one-stream limit where appropriate Andreas Rheinhardt
` (5 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
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>
---
libavformat/ac4enc.c | 4 +-
libavformat/aeaenc.c | 11 +--
libavformat/alp.c | 7 +-
libavformat/apm.c | 11 +--
libavformat/apngenc.c | 6 +-
libavformat/argo_asf.c | 11 +--
libavformat/argo_cvg.c | 11 +--
libavformat/assenc.c | 5 +-
libavformat/astenc.c | 11 +--
libavformat/au.c | 7 +-
libavformat/cafenc.c | 7 +-
libavformat/chromaprint.c | 8 +-
libavformat/codec2.c | 4 +-
libavformat/gif.c | 6 +-
libavformat/ilbc.c | 11 +--
libavformat/ircamenc.c | 7 +-
libavformat/ivfenc.c | 12 +--
libavformat/kvag.c | 11 +--
libavformat/lrcenc.c | 9 +--
libavformat/microdvdenc.c | 5 +-
libavformat/mux.c | 23 ++++++
libavformat/mux.h | 14 ++++
libavformat/mux_utils.c | 19 +++++
libavformat/rawenc.c | 135 ++++++++++++++++++++--------------
libavformat/rcwtenc.c | 9 ++-
libavformat/sccenc.c | 9 +--
libavformat/segafilmenc.c | 10 +--
libavformat/srtenc.c | 9 +--
libavformat/supenc.c | 9 +--
libavformat/swfenc.c | 12 +--
libavformat/ttaenc.c | 10 +--
libavformat/ttmlenc.c | 6 +-
libavformat/wavenc.c | 20 +----
libavformat/webpenc.c | 7 +-
libavformat/webvttenc.c | 5 +-
libavformat/westwood_audenc.c | 7 +-
libavformat/wvenc.c | 5 +-
libavformat/yuv4mpegenc.c | 5 +-
38 files changed, 241 insertions(+), 237 deletions(-)
diff --git a/libavformat/ac4enc.c b/libavformat/ac4enc.c
index aefbfc2684..02b8d4d976 100644
--- a/libavformat/ac4enc.c
+++ b/libavformat/ac4enc.c
@@ -35,7 +35,7 @@ static int ac4_init(AVFormatContext *s)
{
AVCodecParameters *par = s->streams[0]->codecpar;
- if (s->nb_streams != 1 || par->codec_id != AV_CODEC_ID_AC4) {
+ if (par->codec_id != AV_CODEC_ID_AC4) {
av_log(s, AV_LOG_ERROR, "Only one AC-4 stream can be muxed by the AC-4 muxer\n");
return AVERROR(EINVAL);
}
@@ -95,6 +95,8 @@ const FFOutputFormat ff_ac4_muxer = {
.priv_data_size = sizeof(AC4Context),
.p.audio_codec = AV_CODEC_ID_AC4,
.p.video_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.init = ac4_init,
.write_packet = ac4_write_packet,
.p.priv_class = &ac4_muxer_class,
diff --git a/libavformat/aeaenc.c b/libavformat/aeaenc.c
index 495e98c6a2..3303d108a5 100644
--- a/libavformat/aeaenc.c
+++ b/libavformat/aeaenc.c
@@ -29,14 +29,8 @@ static int aea_write_header(AVFormatContext *s)
{
const AVDictionaryEntry *title_entry;
size_t title_length = 0;
- AVStream *st;
-
- if (s->nb_streams > 1) {
- av_log(s, AV_LOG_ERROR, "Got more than one stream to encode. This is not supported.\n");
- return AVERROR(EINVAL);
- }
+ AVStream *st = s->streams[0];
- st = s->streams[0];
if (st->codecpar->ch_layout.nb_channels != 1 && st->codecpar->ch_layout.nb_channels != 2) {
av_log(s, AV_LOG_ERROR, "Only maximum 2 channels are supported in the audio"
" stream, %d channels were found.\n", st->codecpar->ch_layout.nb_channels);
@@ -108,7 +102,10 @@ const FFOutputFormat ff_aea_muxer = {
.p.long_name = NULL_IF_CONFIG_SMALL("MD STUDIO audio"),
.p.extensions = "aea",
.p.audio_codec = AV_CODEC_ID_ATRAC1,
+ .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 = aea_write_header,
.write_packet = ff_raw_write_packet,
.write_trailer = aea_write_trailer,
diff --git a/libavformat/alp.c b/libavformat/alp.c
index 3db256cd05..9d507cb310 100644
--- a/libavformat/alp.c
+++ b/libavformat/alp.c
@@ -189,11 +189,6 @@ static int alp_write_init(AVFormatContext *s)
alp->type = ALP_TYPE_TUN;
}
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "Too many streams\n");
- return AVERROR(EINVAL);
- }
-
par = s->streams[0]->codecpar;
if (par->codec_id != AV_CODEC_ID_ADPCM_IMA_ALP) {
@@ -298,7 +293,9 @@ const FFOutputFormat ff_alp_muxer = {
.p.extensions = "tun,pcm",
.p.audio_codec = AV_CODEC_ID_ADPCM_IMA_ALP,
.p.video_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.p.priv_class = &alp_muxer_class,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.init = alp_write_init,
.write_header = alp_write_header,
.write_packet = ff_raw_write_packet,
diff --git a/libavformat/apm.c b/libavformat/apm.c
index bcde82d958..89401dcf5b 100644
--- a/libavformat/apm.c
+++ b/libavformat/apm.c
@@ -215,14 +215,7 @@ const FFInputFormat ff_apm_demuxer = {
#if CONFIG_APM_MUXER
static int apm_write_init(AVFormatContext *s)
{
- AVCodecParameters *par;
-
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "APM files have exactly one stream\n");
- return AVERROR(EINVAL);
- }
-
- par = s->streams[0]->codecpar;
+ AVCodecParameters *par = s->streams[0]->codecpar;
if (par->codec_id != AV_CODEC_ID_ADPCM_IMA_APM) {
av_log(s, AV_LOG_ERROR, "%s codec not supported\n",
@@ -311,6 +304,8 @@ const FFOutputFormat ff_apm_muxer = {
.p.extensions = "apm",
.p.audio_codec = AV_CODEC_ID_ADPCM_IMA_APM,
.p.video_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.init = apm_write_init,
.write_header = apm_write_header,
.write_packet = ff_raw_write_packet,
diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c
index a0af916f14..79b0dbf0f7 100644
--- a/libavformat/apngenc.c
+++ b/libavformat/apngenc.c
@@ -84,9 +84,7 @@ static int apng_write_header(AVFormatContext *format_context)
APNGMuxContext *apng = format_context->priv_data;
AVCodecParameters *par = format_context->streams[0]->codecpar;
- if (format_context->nb_streams != 1 ||
- format_context->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ||
- format_context->streams[0]->codecpar->codec_id != AV_CODEC_ID_APNG) {
+ if (format_context->streams[0]->codecpar->codec_id != AV_CODEC_ID_APNG) {
av_log(format_context, AV_LOG_ERROR,
"APNG muxer supports only a single video APNG stream.\n");
return AVERROR(EINVAL);
@@ -315,6 +313,8 @@ const FFOutputFormat ff_apng_muxer = {
.priv_data_size = sizeof(APNGMuxContext),
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_APNG,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_header = apng_write_header,
.write_packet = apng_write_packet,
.write_trailer = apng_write_trailer,
diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 0e1eae24fb..28e3844394 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -288,14 +288,7 @@ const FFInputFormat ff_argo_asf_demuxer = {
static int argo_asf_write_init(AVFormatContext *s)
{
ArgoASFMuxContext *ctx = s->priv_data;
- const AVCodecParameters *par;
-
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "ASF files have exactly one stream\n");
- return AVERROR(EINVAL);
- }
-
- par = s->streams[0]->codecpar;
+ const AVCodecParameters *par = s->streams[0]->codecpar;
if (par->codec_id != AV_CODEC_ID_ADPCM_ARGO) {
av_log(s, AV_LOG_ERROR, "%s codec not supported\n",
@@ -481,7 +474,9 @@ const FFOutputFormat ff_argo_asf_muxer = {
*/
.p.audio_codec = AV_CODEC_ID_ADPCM_ARGO,
.p.video_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.p.priv_class = &argo_asf_muxer_class,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.init = argo_asf_write_init,
.write_header = argo_asf_write_header,
.write_packet = argo_asf_write_packet,
diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index 0cf0bf3e9a..aacc34daeb 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -269,14 +269,7 @@ const FFInputFormat ff_argo_cvg_demuxer = {
static int argo_cvg_write_init(AVFormatContext *s)
{
ArgoCVGMuxContext *ctx = s->priv_data;
- const AVCodecParameters *par;
-
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "CVG files have exactly one stream\n");
- return AVERROR(EINVAL);
- }
-
- par = s->streams[0]->codecpar;
+ const AVCodecParameters *par = s->streams[0]->codecpar;
if (par->codec_id != AV_CODEC_ID_ADPCM_PSX) {
av_log(s, AV_LOG_ERROR, "%s codec not supported\n",
@@ -408,7 +401,9 @@ const FFOutputFormat ff_argo_cvg_muxer = {
.p.extensions = "cvg",
.p.audio_codec = AV_CODEC_ID_ADPCM_PSX,
.p.video_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.p.priv_class = &argo_cvg_muxer_class,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.init = argo_cvg_write_init,
.write_header = argo_cvg_write_header,
.write_packet = argo_cvg_write_packet,
diff --git a/libavformat/assenc.c b/libavformat/assenc.c
index dad0d81ca8..c23c77acda 100644
--- a/libavformat/assenc.c
+++ b/libavformat/assenc.c
@@ -50,7 +50,7 @@ static int write_header(AVFormatContext *s)
ASSContext *ass = s->priv_data;
AVCodecParameters *par = s->streams[0]->codecpar;
- if (s->nb_streams != 1 || par->codec_id != AV_CODEC_ID_ASS) {
+ if (par->codec_id != AV_CODEC_ID_ASS) {
av_log(s, AV_LOG_ERROR, "Exactly one ASS/SSA stream is needed.\n");
return AVERROR(EINVAL);
}
@@ -237,8 +237,11 @@ const FFOutputFormat ff_ass_muxer = {
.p.long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"),
.p.mime_type = "text/x-ass",
.p.extensions = "ass,ssa",
+ .p.audio_codec = AV_CODEC_ID_NONE,
+ .p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_ASS,
.p.flags = AVFMT_GLOBALHEADER | AVFMT_NOTIMESTAMPS | AVFMT_TS_NONSTRICT,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.p.priv_class = &ass_class,
.priv_data_size = sizeof(ASSContext),
.write_header = write_header,
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,
diff --git a/libavformat/au.c b/libavformat/au.c
index da1fc79f0d..98f1a5b507 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -291,11 +291,6 @@ static int au_write_header(AVFormatContext *s)
AVCodecParameters *par = s->streams[0]->codecpar;
AVBPrint annotations;
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
- return AVERROR(EINVAL);
- }
-
par->codec_tag = ff_codec_get_tag(codec_au_tags, par->codec_id);
if (!par->codec_tag) {
av_log(s, AV_LOG_ERROR, "unsupported codec\n");
@@ -346,7 +341,9 @@ const FFOutputFormat ff_au_muxer = {
.p.codec_tag = au_codec_tags,
.p.audio_codec = AV_CODEC_ID_PCM_S16BE,
.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,
.priv_data_size = sizeof(AUContext),
.write_header = au_write_header,
.write_packet = ff_raw_write_packet,
diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index 67be59806c..426bc05209 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -118,11 +118,6 @@ static int caf_write_header(AVFormatContext *s)
int64_t chunk_size = 0;
int frame_size = par->frame_size, sample_rate = par->sample_rate;
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "CAF files have exactly one stream\n");
- return AVERROR(EINVAL);
- }
-
switch (par->codec_id) {
case AV_CODEC_ID_AAC:
av_log(s, AV_LOG_ERROR, "muxing codec currently unsupported\n");
@@ -284,6 +279,8 @@ const FFOutputFormat ff_caf_muxer = {
.priv_data_size = sizeof(CAFContext),
.p.audio_codec = AV_CODEC_ID_PCM_S16BE,
.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 = caf_write_header,
.write_packet = caf_write_packet,
.write_trailer = caf_write_trailer,
diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c
index 3229e9160d..62264d6a4b 100644
--- a/libavformat/chromaprint.c
+++ b/libavformat/chromaprint.c
@@ -85,11 +85,6 @@ static int write_header(AVFormatContext *s)
#endif
}
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "Only one stream is supported\n");
- return AVERROR(EINVAL);
- }
-
st = s->streams[0];
if (st->codecpar->ch_layout.nb_channels > 2) {
@@ -182,6 +177,9 @@ const FFOutputFormat ff_chromaprint_muxer = {
.p.long_name = NULL_IF_CONFIG_SMALL("Chromaprint"),
.priv_data_size = sizeof(ChromaprintMuxContext),
.p.audio_codec = AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE),
+ .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,
.write_trailer = write_trailer,
diff --git a/libavformat/codec2.c b/libavformat/codec2.c
index 9ed57af0a8..e49408e0fb 100644
--- a/libavformat/codec2.c
+++ b/libavformat/codec2.c
@@ -216,7 +216,7 @@ static int codec2_write_header(AVFormatContext *s)
{
AVStream *st;
- if (s->nb_streams != 1 || s->streams[0]->codecpar->codec_id != AV_CODEC_ID_CODEC2) {
+ if (s->streams[0]->codecpar->codec_id != AV_CODEC_ID_CODEC2) {
av_log(s, AV_LOG_ERROR, ".c2 files must have exactly one codec2 stream\n");
return AVERROR(EINVAL);
}
@@ -317,7 +317,9 @@ const FFOutputFormat ff_codec2_muxer = {
.p.extensions = "c2",
.p.audio_codec = AV_CODEC_ID_CODEC2,
.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 = codec2_write_header,
.write_packet = ff_raw_write_packet,
};
diff --git a/libavformat/gif.c b/libavformat/gif.c
index 568867cc5d..fe45637814 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -42,9 +42,7 @@ typedef struct GIFContext {
static int gif_write_header(AVFormatContext *s)
{
- if (s->nb_streams != 1 ||
- s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ||
- s->streams[0]->codecpar->codec_id != AV_CODEC_ID_GIF) {
+ if (s->streams[0]->codecpar->codec_id != AV_CODEC_ID_GIF) {
av_log(s, AV_LOG_ERROR,
"GIF muxer supports only a single video GIF stream.\n");
return AVERROR(EINVAL);
@@ -213,6 +211,8 @@ const FFOutputFormat ff_gif_muxer = {
.priv_data_size = sizeof(GIFContext),
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_GIF,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_header = gif_write_header,
.write_packet = gif_write_packet,
.write_trailer = gif_write_trailer,
diff --git a/libavformat/ilbc.c b/libavformat/ilbc.c
index bb98d0e62a..2e102a4be7 100644
--- a/libavformat/ilbc.c
+++ b/libavformat/ilbc.c
@@ -33,13 +33,7 @@ static const char mode30_header[] = "#!iLBC30\n";
static int ilbc_write_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
- AVCodecParameters *par;
-
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "Unsupported number of streams\n");
- return AVERROR(EINVAL);
- }
- par = s->streams[0]->codecpar;
+ AVCodecParameters *par = s->streams[0]->codecpar;
if (par->codec_id != AV_CODEC_ID_ILBC) {
av_log(s, AV_LOG_ERROR, "Unsupported codec\n");
@@ -127,8 +121,11 @@ const FFOutputFormat ff_ilbc_muxer = {
.p.long_name = NULL_IF_CONFIG_SMALL("iLBC storage"),
.p.mime_type = "audio/iLBC",
.p.extensions = "lbc",
+ .p.video_codec = AV_CODEC_ID_NONE,
.p.audio_codec = AV_CODEC_ID_ILBC,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.p.flags = AVFMT_NOTIMESTAMPS,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_header = ilbc_write_header,
.write_packet = ff_raw_write_packet,
};
diff --git a/libavformat/ircamenc.c b/libavformat/ircamenc.c
index ceeab2b305..7600d9a8a9 100644
--- a/libavformat/ircamenc.c
+++ b/libavformat/ircamenc.c
@@ -32,11 +32,6 @@ static int ircam_write_header(AVFormatContext *s)
AVCodecParameters *par = s->streams[0]->codecpar;
uint32_t tag;
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
- return AVERROR(EINVAL);
- }
-
tag = ff_codec_get_tag(ff_codec_ircam_le_tags, par->codec_id);
if (!tag) {
av_log(s, AV_LOG_ERROR, "unsupported codec\n");
@@ -57,6 +52,8 @@ const FFOutputFormat ff_ircam_muxer = {
.p.long_name = NULL_IF_CONFIG_SMALL("Berkeley/IRCAM/CARL Sound Format"),
.p.audio_codec = AV_CODEC_ID_PCM_S16LE,
.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 = ircam_write_header,
.write_packet = ff_raw_write_packet,
.p.codec_tag = (const AVCodecTag *const []){ ff_codec_ircam_le_tags, 0 },
diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index 88399099d4..09782eecd6 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -29,15 +29,9 @@ typedef struct IVFEncContext {
static int ivf_init(AVFormatContext *s)
{
- AVCodecParameters *par;
+ AVCodecParameters *par = s->streams[0]->codecpar;
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "Format supports only exactly one video stream\n");
- return AVERROR(EINVAL);
- }
- par = s->streams[0]->codecpar;
- if (par->codec_type != AVMEDIA_TYPE_VIDEO ||
- !(par->codec_id == AV_CODEC_ID_AV1 ||
+ if (!(par->codec_id == AV_CODEC_ID_AV1 ||
par->codec_id == AV_CODEC_ID_VP8 ||
par->codec_id == AV_CODEC_ID_VP9)) {
av_log(s, AV_LOG_ERROR, "Currently only VP8, VP9 and AV1 are supported!\n");
@@ -125,7 +119,9 @@ const FFOutputFormat ff_ivf_muxer = {
.p.extensions = "ivf",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_VP8,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.p.codec_tag = (const AVCodecTag* const []){ codec_ivf_tags, 0 },
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.priv_data_size = sizeof(IVFEncContext),
.init = ivf_init,
.write_header = ivf_write_header,
diff --git a/libavformat/kvag.c b/libavformat/kvag.c
index bea1dda3e5..2053f4730d 100644
--- a/libavformat/kvag.c
+++ b/libavformat/kvag.c
@@ -129,14 +129,7 @@ const FFInputFormat ff_kvag_demuxer = {
#if CONFIG_KVAG_MUXER
static int kvag_write_init(AVFormatContext *s)
{
- AVCodecParameters *par;
-
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "KVAG files have exactly one stream\n");
- return AVERROR(EINVAL);
- }
-
- par = s->streams[0]->codecpar;
+ AVCodecParameters *par = s->streams[0]->codecpar;
if (par->codec_id != AV_CODEC_ID_ADPCM_IMA_SSI) {
av_log(s, AV_LOG_ERROR, "%s codec not supported\n",
@@ -196,6 +189,8 @@ const FFOutputFormat ff_kvag_muxer = {
.p.extensions = "vag",
.p.audio_codec = AV_CODEC_ID_ADPCM_IMA_SSI,
.p.video_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.init = kvag_write_init,
.write_header = kvag_write_header,
.write_packet = ff_raw_write_packet,
diff --git a/libavformat/lrcenc.c b/libavformat/lrcenc.c
index d66be9a8fa..15c31d33b3 100644
--- a/libavformat/lrcenc.c
+++ b/libavformat/lrcenc.c
@@ -37,12 +37,6 @@ static int lrc_write_header(AVFormatContext *s)
{
const AVDictionaryEntry *metadata_item;
- if(s->nb_streams != 1 ||
- s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE) {
- av_log(s, AV_LOG_ERROR,
- "LRC supports only a single subtitle stream.\n");
- return AVERROR(EINVAL);
- }
if(s->streams[0]->codecpar->codec_id != AV_CODEC_ID_SUBRIP &&
s->streams[0]->codecpar->codec_id != AV_CODEC_ID_TEXT) {
av_log(s, AV_LOG_ERROR, "Unsupported subtitle codec: %s\n",
@@ -131,7 +125,10 @@ const FFOutputFormat ff_lrc_muxer = {
.p.extensions = "lrc",
.p.flags = AVFMT_VARIABLE_FPS | AVFMT_GLOBALHEADER |
AVFMT_TS_NEGATIVE | AVFMT_TS_NONSTRICT,
+ .p.video_codec = AV_CODEC_ID_NONE,
+ .p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_SUBRIP,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.priv_data_size = 0,
.write_header = lrc_write_header,
.write_packet = lrc_write_packet,
diff --git a/libavformat/microdvdenc.c b/libavformat/microdvdenc.c
index 950309981b..b9cadb8be4 100644
--- a/libavformat/microdvdenc.c
+++ b/libavformat/microdvdenc.c
@@ -29,7 +29,7 @@ static int microdvd_write_header(struct AVFormatContext *s)
AVCodecParameters *par = s->streams[0]->codecpar;
AVRational framerate = s->streams[0]->avg_frame_rate;
- if (s->nb_streams != 1 || par->codec_id != AV_CODEC_ID_MICRODVD) {
+ if (par->codec_id != AV_CODEC_ID_MICRODVD) {
av_log(s, AV_LOG_ERROR, "Exactly one MicroDVD stream is needed.\n");
return -1;
}
@@ -62,7 +62,10 @@ const FFOutputFormat ff_microdvd_muxer = {
.p.mime_type = "text/x-microdvd",
.p.extensions = "sub",
.p.flags = AVFMT_NOTIMESTAMPS,
+ .p.video_codec = AV_CODEC_ID_NONE,
+ .p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_MICRODVD,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_header = microdvd_write_header,
.write_packet = microdvd_write_packet,
};
diff --git a/libavformat/mux.c b/libavformat/mux.c
index a2cae97397..134c2875b6 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -188,6 +188,12 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
AVDictionary *tmp = NULL;
const FFOutputFormat *of = ffofmt(s->oformat);
AVDictionaryEntry *e;
+ static const unsigned default_codec_offsets[] = {
+ [AVMEDIA_TYPE_VIDEO] = offsetof(AVOutputFormat, video_codec),
+ [AVMEDIA_TYPE_AUDIO] = offsetof(AVOutputFormat, audio_codec),
+ [AVMEDIA_TYPE_SUBTITLE] = offsetof(AVOutputFormat, subtitle_codec),
+ };
+ unsigned nb_type[FF_ARRAY_ELEMS(default_codec_offsets)] = { 0 };
int ret = 0;
if (options)
@@ -262,6 +268,23 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
}
break;
}
+ if (of->flags_internal & FF_OFMT_FLAG_MAX_ONE_OF_EACH) {
+ enum AVCodecID default_codec_id = AV_CODEC_ID_NONE;
+ unsigned nb;
+ if ((unsigned)par->codec_type < FF_ARRAY_ELEMS(default_codec_offsets)) {
+ nb = ++nb_type[par->codec_type];
+ if (default_codec_offsets[par->codec_type])
+ default_codec_id = *(const enum AVCodecID*)((const char*)of + default_codec_offsets[par->codec_type]);
+ }
+ if (default_codec_id == AV_CODEC_ID_NONE || nb > 1) {
+ const char *type = av_get_media_type_string(par->codec_type);
+ av_log(s, AV_LOG_ERROR, "%s muxer does not support %s stream of type %s\n",
+ of->p.name, default_codec_id == AV_CODEC_ID_NONE ? "any" : "more than one",
+ type ? type : "unknown");
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ }
#if FF_API_AVSTREAM_SIDE_DATA
FF_DISABLE_DEPRECATION_WARNINGS
diff --git a/libavformat/mux.h b/libavformat/mux.h
index bd3eb53380..71ee5fd06b 100644
--- a/libavformat/mux.h
+++ b/libavformat/mux.h
@@ -36,6 +36,20 @@ struct AVDeviceInfoList;
* of the return value in case of flushing.
*/
#define FF_OFMT_FLAG_ALLOW_FLUSH (1 << 1)
+/**
+ * If this flag is set, it indicates that for each codec type
+ * whose corresponding default codec (i.e. AVOutputFormat.audio_codec,
+ * AVOutputFormat.video_codec and AVOutputFormat.subtitle_codec)
+ * is set (i.e. != AV_CODEC_ID_NONE) only one stream of this type
+ * can be muxed. It furthermore indicates that no stream with
+ * a codec type that has no default codec or whose default codec
+ * is AV_CODEC_ID_NONE can be muxed.
+ * Both of these restrictions are checked generically before
+ * the actual muxer's init/write_header callbacks.
+ *
+ * This flag is incompatible with FF_OFMT_FLAG_SUPPORT_ATTACHMENTS.
+ */
+#define FF_OFMT_FLAG_MAX_ONE_OF_EACH (1 << 2)
typedef struct FFOutputFormat {
/**
diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c
index 841a19a3a2..8a0ad4c9aa 100644
--- a/libavformat/mux_utils.c
+++ b/libavformat/mux_utils.c
@@ -44,6 +44,25 @@ int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id,
codec_id == ofmt->audio_codec ||
codec_id == ofmt->subtitle_codec))
return 1;
+ else if (ffofmt(ofmt)->flags_internal & FF_OFMT_FLAG_MAX_ONE_OF_EACH) {
+ enum AVMediaType type = avcodec_get_type(codec_id);
+ switch (type) {
+ case AVMEDIA_TYPE_AUDIO:
+ if (ofmt->audio_codec == AV_CODEC_ID_NONE)
+ return 0;
+ break;
+ case AVMEDIA_TYPE_VIDEO:
+ if (ofmt->video_codec == AV_CODEC_ID_NONE)
+ return 0;
+ break;
+ case AVMEDIA_TYPE_SUBTITLE:
+ if (ofmt->subtitle_codec == AV_CODEC_ID_NONE)
+ return 0;
+ break;
+ default:
+ return 0;
+ }
+ }
}
return AVERROR_PATCHWELCOME;
}
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index f916db13a2..49dc0a9109 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -34,28 +34,6 @@ int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
-static int force_one_stream(AVFormatContext *s)
-{
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "%s files have exactly one stream\n",
- s->oformat->name);
- return AVERROR(EINVAL);
- }
- if ( s->oformat->audio_codec != AV_CODEC_ID_NONE
- && s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
- av_log(s, AV_LOG_ERROR, "%s files have exactly one audio stream\n",
- s->oformat->name);
- return AVERROR(EINVAL);
- }
- if ( s->oformat->video_codec != AV_CODEC_ID_NONE
- && s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
- av_log(s, AV_LOG_ERROR, "%s files have exactly one video stream\n",
- s->oformat->name);
- return AVERROR(EINVAL);
- }
- return 0;
-}
-
/* Note: Do not forget to add new entries to the Makefile as well. */
#if CONFIG_AC3_MUXER
@@ -66,7 +44,8 @@ const FFOutputFormat ff_ac3_muxer = {
.p.extensions = "ac3",
.p.audio_codec = AV_CODEC_ID_AC3,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -98,7 +77,8 @@ const FFOutputFormat ff_adx_muxer = {
.p.extensions = "adx",
.p.audio_codec = AV_CODEC_ID_ADPCM_ADX,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.write_trailer = adx_write_trailer,
.p.flags = AVFMT_NOTIMESTAMPS,
@@ -112,7 +92,8 @@ const FFOutputFormat ff_aptx_muxer = {
.p.extensions = "aptx",
.p.audio_codec = AV_CODEC_ID_APTX,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -125,7 +106,8 @@ const FFOutputFormat ff_aptx_hd_muxer = {
.p.extensions = "aptxhd",
.p.audio_codec = AV_CODEC_ID_APTX_HD,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -138,7 +120,8 @@ const FFOutputFormat ff_avs2_muxer = {
.p.extensions = "avs,avs2",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_AVS2,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -151,7 +134,8 @@ const FFOutputFormat ff_avs3_muxer = {
.p.extensions = "avs3",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_AVS3,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -165,7 +149,8 @@ const FFOutputFormat ff_cavsvideo_muxer = {
.p.extensions = "cavs",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_CAVS,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -177,7 +162,8 @@ const FFOutputFormat ff_codec2raw_muxer = {
.p.long_name = NULL_IF_CONFIG_SMALL("raw codec2 muxer"),
.p.audio_codec = AV_CODEC_ID_CODEC2,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -185,6 +171,15 @@ const FFOutputFormat ff_codec2raw_muxer = {
#if CONFIG_DATA_MUXER
+static av_cold int force_one_stream(AVFormatContext *s)
+{
+ if (s->nb_streams != 1) {
+ av_log(s, AV_LOG_ERROR, "This muxer supports only one stream.\n");
+ return AVERROR(EINVAL);
+ }
+ return 0;
+}
+
const FFOutputFormat ff_data_muxer = {
.p.name = "data",
.p.long_name = NULL_IF_CONFIG_SMALL("raw data"),
@@ -201,7 +196,8 @@ const FFOutputFormat ff_dfpwm_muxer = {
.p.extensions = "dfpwm",
.p.audio_codec = AV_CODEC_ID_DFPWM,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -214,7 +210,8 @@ const FFOutputFormat ff_dirac_muxer = {
.p.extensions = "drc,vc2",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_DIRAC,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -227,7 +224,8 @@ const FFOutputFormat ff_dnxhd_muxer = {
.p.extensions = "dnxhd,dnxhr",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_DNXHD,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -241,7 +239,8 @@ const FFOutputFormat ff_dts_muxer = {
.p.extensions = "dts",
.p.audio_codec = AV_CODEC_ID_DTS,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -255,7 +254,8 @@ const FFOutputFormat ff_eac3_muxer = {
.p.extensions = "eac3,ec3",
.p.audio_codec = AV_CODEC_ID_EAC3,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -269,7 +269,8 @@ const FFOutputFormat ff_g722_muxer = {
.p.extensions = "g722",
.p.audio_codec = AV_CODEC_ID_ADPCM_G722,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -283,7 +284,8 @@ const FFOutputFormat ff_g723_1_muxer = {
.p.extensions = "tco,rco",
.p.audio_codec = AV_CODEC_ID_G723_1,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -295,7 +297,8 @@ const FFOutputFormat ff_g726_muxer = {
.p.long_name = NULL_IF_CONFIG_SMALL("raw big-endian G.726 (\"left-justified\")"),
.p.audio_codec = AV_CODEC_ID_ADPCM_G726,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -307,7 +310,8 @@ const FFOutputFormat ff_g726le_muxer = {
.p.long_name = NULL_IF_CONFIG_SMALL("raw little-endian G.726 (\"right-justified\")"),
.p.audio_codec = AV_CODEC_ID_ADPCM_G726LE,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -321,7 +325,8 @@ const FFOutputFormat ff_gsm_muxer = {
.p.extensions = "gsm",
.p.audio_codec = AV_CODEC_ID_GSM,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -335,7 +340,8 @@ const FFOutputFormat ff_h261_muxer = {
.p.extensions = "h261",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_H261,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -349,7 +355,8 @@ const FFOutputFormat ff_h263_muxer = {
.p.extensions = "h263",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_H263,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -371,7 +378,8 @@ const FFOutputFormat ff_h264_muxer = {
.p.extensions = "h264,264",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_H264,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.check_bitstream = h264_check_bitstream,
.p.flags = AVFMT_NOTIMESTAMPS,
@@ -394,7 +402,8 @@ const FFOutputFormat ff_vvc_muxer = {
.p.extensions = "vvc,h266,266",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_VVC,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.check_bitstream = vvc_check_bitstream,
.p.flags = AVFMT_NOTIMESTAMPS,
@@ -417,7 +426,8 @@ const FFOutputFormat ff_hevc_muxer = {
.p.extensions = "hevc,h265,265",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_HEVC,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.check_bitstream = hevc_check_bitstream,
.p.flags = AVFMT_NOTIMESTAMPS,
@@ -431,7 +441,8 @@ const FFOutputFormat ff_evc_muxer = {
.p.extensions = "evc",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_EVC,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -444,7 +455,8 @@ const FFOutputFormat ff_m4v_muxer = {
.p.extensions = "m4v",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_MPEG4,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -458,7 +470,8 @@ const FFOutputFormat ff_mjpeg_muxer = {
.p.extensions = "mjpg,mjpeg",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_MJPEG,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -471,7 +484,8 @@ const FFOutputFormat ff_mlp_muxer = {
.p.extensions = "mlp",
.p.audio_codec = AV_CODEC_ID_MLP,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -485,7 +499,8 @@ const FFOutputFormat ff_mp2_muxer = {
.p.extensions = "mp2,m2a,mpa",
.p.audio_codec = AV_CODEC_ID_MP2,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -499,7 +514,8 @@ const FFOutputFormat ff_mpeg1video_muxer = {
.p.extensions = "mpg,mpeg,m1v",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_MPEG1VIDEO,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -512,7 +528,8 @@ const FFOutputFormat ff_mpeg2video_muxer = {
.p.extensions = "m2v",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_MPEG2VIDEO,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -531,7 +548,8 @@ const FFOutputFormat ff_obu_muxer = {
.p.extensions = "obu",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_AV1,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.check_bitstream = obu_check_bitstream,
.p.flags = AVFMT_NOTIMESTAMPS,
@@ -545,6 +563,7 @@ const FFOutputFormat ff_rawvideo_muxer = {
.p.extensions = "yuv,rgb",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_RAWVIDEO,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -557,7 +576,9 @@ const FFOutputFormat ff_sbc_muxer = {
.p.mime_type = "audio/x-sbc",
.p.extensions = "sbc,msbc",
.p.audio_codec = AV_CODEC_ID_SBC,
- .init = force_one_stream,
+ .p.video_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -570,7 +591,8 @@ const FFOutputFormat ff_truehd_muxer = {
.p.extensions = "thd",
.p.audio_codec = AV_CODEC_ID_TRUEHD,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -583,7 +605,8 @@ const FFOutputFormat ff_vc1_muxer = {
.p.extensions = "vc1",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_VC1,
- .init = force_one_stream,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
index ed72de81ef..4ccd7b93c8 100644
--- a/libavformat/rcwtenc.c
+++ b/libavformat/rcwtenc.c
@@ -84,10 +84,8 @@ static void rcwt_flush_cluster(AVFormatContext *avf)
static int rcwt_write_header(AVFormatContext *avf)
{
- if (avf->nb_streams != 1 || avf->streams[0]->codecpar->codec_id != AV_CODEC_ID_EIA_608) {
- av_log(avf, AV_LOG_ERROR,
- "RCWT supports only one CC (608/708) stream, more than one stream was "
- "provided or its codec type was not CC (608/708)\n");
+ if (avf->streams[0]->codecpar->codec_id != AV_CODEC_ID_EIA_608) {
+ av_log(avf, AV_LOG_ERROR, "RCWT supports only CC (608/708)\n");
return AVERROR(EINVAL);
}
@@ -168,7 +166,10 @@ const FFOutputFormat ff_rcwt_muxer = {
.p.long_name = NULL_IF_CONFIG_SMALL("RCWT (Raw Captions With Time)"),
.p.extensions = "bin",
.p.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
+ .p.video_codec = AV_CODEC_ID_NONE,
+ .p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_EIA_608,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.priv_data_size = sizeof(RCWTContext),
.write_header = rcwt_write_header,
.write_packet = rcwt_write_packet,
diff --git a/libavformat/sccenc.c b/libavformat/sccenc.c
index ea7865ecf2..040d1ac96c 100644
--- a/libavformat/sccenc.c
+++ b/libavformat/sccenc.c
@@ -35,12 +35,6 @@ static int scc_write_header(AVFormatContext *avf)
{
SCCContext *scc = avf->priv_data;
- if (avf->nb_streams != 1 ||
- avf->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE) {
- av_log(avf, AV_LOG_ERROR,
- "SCC supports only a single subtitles stream.\n");
- return AVERROR(EINVAL);
- }
if (avf->streams[0]->codecpar->codec_id != AV_CODEC_ID_EIA_608) {
av_log(avf, AV_LOG_ERROR,
"Unsupported subtitles codec: %s\n",
@@ -117,7 +111,10 @@ const FFOutputFormat ff_scc_muxer = {
.p.long_name = NULL_IF_CONFIG_SMALL("Scenarist Closed Captions"),
.p.extensions = "scc",
.p.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
+ .p.video_codec = AV_CODEC_ID_NONE,
+ .p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_EIA_608,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.priv_data_size = sizeof(SCCContext),
.write_header = scc_write_header,
.write_packet = scc_write_packet,
diff --git a/libavformat/segafilmenc.c b/libavformat/segafilmenc.c
index ba06dc655d..88a5b9f972 100644
--- a/libavformat/segafilmenc.c
+++ b/libavformat/segafilmenc.c
@@ -124,10 +124,6 @@ static int film_init(AVFormatContext *format_context)
for (int i = 0; i < format_context->nb_streams; i++) {
AVStream *st = format_context->streams[i];
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
- if (film->audio_index > -1) {
- av_log(format_context, AV_LOG_ERROR, "Sega FILM allows a maximum of one audio stream.\n");
- return AVERROR(EINVAL);
- }
if (get_audio_codec_id(st->codecpar->codec_id) < 0) {
av_log(format_context, AV_LOG_ERROR,
"Incompatible audio stream format.\n");
@@ -137,10 +133,6 @@ static int film_init(AVFormatContext *format_context)
}
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
- if (film->video_index > -1) {
- av_log(format_context, AV_LOG_ERROR, "Sega FILM allows a maximum of one video stream.\n");
- return AVERROR(EINVAL);
- }
if (st->codecpar->codec_id != AV_CODEC_ID_CINEPAK &&
st->codecpar->codec_id != AV_CODEC_ID_RAWVIDEO) {
av_log(format_context, AV_LOG_ERROR,
@@ -287,6 +279,8 @@ const FFOutputFormat ff_segafilm_muxer = {
.priv_data_size = sizeof(FILMOutputContext),
.p.audio_codec = AV_CODEC_ID_PCM_S16BE_PLANAR,
.p.video_codec = AV_CODEC_ID_CINEPAK,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.init = film_init,
.write_trailer = film_write_header,
.write_packet = film_write_packet,
diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c
index 30dc59e0f8..a8a16a7f50 100644
--- a/libavformat/srtenc.c
+++ b/libavformat/srtenc.c
@@ -39,12 +39,6 @@ static int srt_write_header(AVFormatContext *avf)
{
SRTContext *srt = avf->priv_data;
- if (avf->nb_streams != 1 ||
- avf->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE) {
- av_log(avf, AV_LOG_ERROR,
- "SRT supports only a single subtitles stream.\n");
- return AVERROR(EINVAL);
- }
if (avf->streams[0]->codecpar->codec_id != AV_CODEC_ID_TEXT &&
avf->streams[0]->codecpar->codec_id != AV_CODEC_ID_SUBRIP) {
av_log(avf, AV_LOG_ERROR,
@@ -103,7 +97,10 @@ const FFOutputFormat ff_srt_muxer = {
.p.mime_type = "application/x-subrip",
.p.extensions = "srt",
.p.flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
+ .p.video_codec = AV_CODEC_ID_NONE,
+ .p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_SUBRIP,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.priv_data_size = sizeof(SRTContext),
.write_header = srt_write_header,
.write_packet = srt_write_packet,
diff --git a/libavformat/supenc.c b/libavformat/supenc.c
index 4af92fefa2..9d5ca51894 100644
--- a/libavformat/supenc.c
+++ b/libavformat/supenc.c
@@ -74,12 +74,6 @@ static int sup_write_packet(AVFormatContext *s, AVPacket *pkt)
static int sup_write_header(AVFormatContext *s)
{
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "%s files have exactly one stream\n",
- s->oformat->name);
- return AVERROR(EINVAL);
- }
-
avpriv_set_pts_info(s->streams[0], 32, 1, 90000);
return 0;
@@ -90,8 +84,11 @@ const FFOutputFormat ff_sup_muxer = {
.p.long_name = NULL_IF_CONFIG_SMALL("raw HDMV Presentation Graphic Stream subtitles"),
.p.extensions = "sup",
.p.mime_type = "application/x-pgs",
+ .p.video_codec = AV_CODEC_ID_NONE,
+ .p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_HDMV_PGS_SUBTITLE,
.p.flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_header = sup_write_header,
.write_packet = sup_write_packet,
};
diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
index f9ac69539b..d106e16d19 100644
--- a/libavformat/swfenc.c
+++ b/libavformat/swfenc.c
@@ -208,10 +208,6 @@ static int swf_write_header(AVFormatContext *s)
for(i=0;i<s->nb_streams;i++) {
AVCodecParameters *par = s->streams[i]->codecpar;
if (par->codec_type == AVMEDIA_TYPE_AUDIO) {
- if (swf->audio_par) {
- av_log(s, AV_LOG_ERROR, "SWF muxer only supports 1 audio stream\n");
- return AVERROR_INVALIDDATA;
- }
if (par->codec_id == AV_CODEC_ID_MP3) {
swf->audio_par = par;
swf->audio_fifo = av_fifo_alloc2(AUDIO_FIFO_SIZE, 1, 0);
@@ -222,10 +218,6 @@ static int swf_write_header(AVFormatContext *s)
return -1;
}
} else {
- if (swf->video_par) {
- av_log(s, AV_LOG_ERROR, "SWF muxer only supports 1 video stream\n");
- return AVERROR_INVALIDDATA;
- }
if (ff_codec_get_tag(ff_swf_codec_tags, par->codec_id) ||
par->codec_id == AV_CODEC_ID_PNG ||
par->codec_id == AV_CODEC_ID_MJPEG) {
@@ -556,11 +548,13 @@ const FFOutputFormat ff_swf_muxer = {
.priv_data_size = sizeof(SWFEncContext),
.p.audio_codec = AV_CODEC_ID_MP3,
.p.video_codec = AV_CODEC_ID_FLV1,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.write_header = swf_write_header,
.write_packet = swf_write_packet,
.write_trailer = swf_write_trailer,
.deinit = swf_deinit,
.p.flags = AVFMT_TS_NONSTRICT,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
};
#endif
#if CONFIG_AVM2_MUXER
@@ -571,10 +565,12 @@ const FFOutputFormat ff_avm2_muxer = {
.priv_data_size = sizeof(SWFEncContext),
.p.audio_codec = AV_CODEC_ID_MP3,
.p.video_codec = AV_CODEC_ID_FLV1,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.write_header = swf_write_header,
.write_packet = swf_write_packet,
.write_trailer = swf_write_trailer,
.deinit = swf_deinit,
.p.flags = AVFMT_TS_NONSTRICT,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
};
#endif
diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c
index c7f7e065dc..661aa8fc83 100644
--- a/libavformat/ttaenc.c
+++ b/libavformat/ttaenc.c
@@ -40,13 +40,7 @@ typedef struct TTAMuxContext {
static int tta_init(AVFormatContext *s)
{
TTAMuxContext *tta = s->priv_data;
- AVCodecParameters *par;
-
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "Only one stream is supported\n");
- return AVERROR(EINVAL);
- }
- par = s->streams[0]->codecpar;
+ AVCodecParameters *par = s->streams[0]->codecpar;
if (par->codec_id != AV_CODEC_ID_TTA) {
av_log(s, AV_LOG_ERROR, "Unsupported codec\n");
@@ -174,6 +168,8 @@ const FFOutputFormat ff_tta_muxer = {
.priv_data_size = sizeof(TTAMuxContext),
.p.audio_codec = AV_CODEC_ID_TTA,
.p.video_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.init = tta_init,
.deinit = tta_deinit,
.write_header = tta_write_header,
diff --git a/libavformat/ttmlenc.c b/libavformat/ttmlenc.c
index 212994be50..0af82d5753 100644
--- a/libavformat/ttmlenc.c
+++ b/libavformat/ttmlenc.c
@@ -126,8 +126,7 @@ static int ttml_write_header(AVFormatContext *ctx)
TTMLMuxContext *ttml_ctx = ctx->priv_data;
ttml_ctx->document_written = 0;
- if (ctx->nb_streams != 1 ||
- ctx->streams[0]->codecpar->codec_id != AV_CODEC_ID_TTML) {
+ if (ctx->streams[0]->codecpar->codec_id != AV_CODEC_ID_TTML) {
av_log(ctx, AV_LOG_ERROR, "Exactly one TTML stream is required!\n");
return AVERROR(EINVAL);
}
@@ -224,7 +223,10 @@ const FFOutputFormat ff_ttml_muxer = {
.priv_data_size = sizeof(TTMLMuxContext),
.p.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
AVFMT_TS_NONSTRICT,
+ .p.video_codec = AV_CODEC_ID_NONE,
+ .p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_TTML,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_header = ttml_write_header,
.write_packet = ttml_write_packet,
.write_trailer = ttml_write_trailer,
diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c
index 19daa813a0..7e853ce2fb 100644
--- a/libavformat/wavenc.c
+++ b/libavformat/wavenc.c
@@ -304,11 +304,6 @@ static int wav_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
int64_t fmt;
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "WAVE files have exactly one stream\n");
- return AVERROR(EINVAL);
- }
-
if (wav->rf64 == RF64_ALWAYS) {
ffio_wfourcc(pb, "RF64");
avio_wl32(pb, -1); /* RF64 chunk size: use size in ds64 */
@@ -516,6 +511,7 @@ const FFOutputFormat ff_wav_muxer = {
.priv_data_size = sizeof(WAVMuxContext),
.p.audio_codec = AV_CODEC_ID_PCM_S16LE,
.p.video_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.write_header = wav_write_header,
.write_packet = wav_write_packet,
.write_trailer = wav_write_trailer,
@@ -523,22 +519,13 @@ const FFOutputFormat ff_wav_muxer = {
.p.flags = AVFMT_TS_NONSTRICT,
.p.codec_tag = ff_wav_codec_tags_list,
.p.priv_class = &wav_muxer_class,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
};
#endif /* CONFIG_WAV_MUXER */
#if CONFIG_W64_MUXER
#include "w64.h"
-static av_cold int w64_init(AVFormatContext *ctx)
-{
- if (ctx->nb_streams != 1) {
- av_log(ctx, AV_LOG_ERROR, "This muxer only supports a single stream.\n");
- return AVERROR(EINVAL);
- }
-
- return 0;
-}
-
static void start_guid(AVIOContext *pb, const uint8_t *guid, int64_t *pos)
{
*pos = avio_tell(pb);
@@ -624,11 +611,12 @@ const FFOutputFormat ff_w64_muxer = {
.priv_data_size = sizeof(WAVMuxContext),
.p.audio_codec = AV_CODEC_ID_PCM_S16LE,
.p.video_codec = AV_CODEC_ID_NONE,
- .init = w64_init,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.write_header = w64_write_header,
.write_packet = wav_write_packet,
.write_trailer = w64_write_trailer,
.p.flags = AVFMT_TS_NONSTRICT,
.p.codec_tag = ff_wav_codec_tags_list,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
};
#endif /* CONFIG_W64_MUXER */
diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
index ea7a321975..85074ae315 100644
--- a/libavformat/webpenc.c
+++ b/libavformat/webpenc.c
@@ -42,10 +42,6 @@ static int webp_init(AVFormatContext *s)
w->last_pkt = ffformatcontext(s)->pkt;
- if (s->nb_streams != 1) {
- av_log(s, AV_LOG_ERROR, "Only exactly 1 stream is supported\n");
- return AVERROR(EINVAL);
- }
st = s->streams[0];
if (st->codecpar->codec_id != AV_CODEC_ID_WEBP) {
av_log(s, AV_LOG_ERROR, "Only WebP is supported\n");
@@ -230,9 +226,12 @@ const FFOutputFormat ff_webp_muxer = {
.p.extensions = "webp",
.priv_data_size = sizeof(WebpContext),
.p.video_codec = AV_CODEC_ID_WEBP,
+ .p.audio_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.init = webp_init,
.write_packet = webp_write_packet,
.write_trailer = webp_write_trailer,
.p.priv_class = &webp_muxer_class,
.p.flags = AVFMT_VARIABLE_FPS,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
};
diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c
index 1337045325..12a4b776dc 100644
--- a/libavformat/webvttenc.c
+++ b/libavformat/webvttenc.c
@@ -50,7 +50,7 @@ static int webvtt_write_header(AVFormatContext *ctx)
AVCodecParameters *par = ctx->streams[0]->codecpar;
AVIOContext *pb = ctx->pb;
- if (ctx->nb_streams != 1 || par->codec_id != AV_CODEC_ID_WEBVTT) {
+ if (par->codec_id != AV_CODEC_ID_WEBVTT) {
av_log(ctx, AV_LOG_ERROR, "Exactly one WebVTT stream is needed.\n");
return AVERROR(EINVAL);
}
@@ -109,7 +109,10 @@ const FFOutputFormat ff_webvtt_muxer = {
.p.extensions = "vtt",
.p.mime_type = "text/vtt",
.p.flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
+ .p.video_codec = AV_CODEC_ID_NONE,
+ .p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_WEBVTT,
.write_header = webvtt_write_header,
.write_packet = webvtt_write_packet,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
};
diff --git a/libavformat/westwood_audenc.c b/libavformat/westwood_audenc.c
index 46456e2ecb..2240d130b6 100644
--- a/libavformat/westwood_audenc.c
+++ b/libavformat/westwood_audenc.c
@@ -59,11 +59,6 @@ static int wsaud_write_init(AVFormatContext *ctx)
return AVERROR(EINVAL);
}
- if (ctx->nb_streams != 1) {
- av_log(ctx, AV_LOG_ERROR, "AUD files have exactly one stream\n");
- return AVERROR(EINVAL);
- }
-
return 0;
}
@@ -133,8 +128,10 @@ const FFOutputFormat ff_wsaud_muxer = {
.priv_data_size = sizeof(AUDMuxContext),
.p.audio_codec = AV_CODEC_ID_ADPCM_IMA_WS,
.p.video_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.init = wsaud_write_init,
.write_header = wsaud_write_header,
.write_packet = wsaud_write_packet,
.write_trailer = wsaud_write_trailer,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
};
diff --git a/libavformat/wvenc.c b/libavformat/wvenc.c
index 9d9190f252..6d5fefe1bc 100644
--- a/libavformat/wvenc.c
+++ b/libavformat/wvenc.c
@@ -33,8 +33,7 @@ typedef struct WvMuxContext {
static av_cold int wv_init(AVFormatContext *ctx)
{
- if (ctx->nb_streams > 1 ||
- ctx->streams[0]->codecpar->codec_id != AV_CODEC_ID_WAVPACK) {
+ if (ctx->streams[0]->codecpar->codec_id != AV_CODEC_ID_WAVPACK) {
av_log(ctx, AV_LOG_ERROR, "This muxer only supports a single WavPack stream.\n");
return AVERROR(EINVAL);
}
@@ -85,8 +84,10 @@ const FFOutputFormat ff_wv_muxer = {
.priv_data_size = sizeof(WvMuxContext),
.p.audio_codec = AV_CODEC_ID_WAVPACK,
.p.video_codec = AV_CODEC_ID_NONE,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.init = wv_init,
.write_packet = wv_write_packet,
.write_trailer = wv_write_trailer,
.p.flags = AVFMT_NOTIMESTAMPS,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
};
diff --git a/libavformat/yuv4mpegenc.c b/libavformat/yuv4mpegenc.c
index 1d641eb9e4..35397cbde0 100644
--- a/libavformat/yuv4mpegenc.c
+++ b/libavformat/yuv4mpegenc.c
@@ -221,9 +221,6 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
static int yuv4_init(AVFormatContext *s)
{
- if (s->nb_streams != 1)
- return AVERROR(EIO);
-
if (s->streams[0]->codecpar->codec_id != AV_CODEC_ID_WRAPPED_AVFRAME &&
s->streams[0]->codecpar->codec_id != AV_CODEC_ID_RAWVIDEO) {
av_log(s, AV_LOG_ERROR, "ERROR: Codec not supported.\n");
@@ -297,7 +294,9 @@ const FFOutputFormat ff_yuv4mpegpipe_muxer = {
.p.extensions = "y4m",
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_WRAPPED_AVFRAME,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
.init = yuv4_init,
.write_header = yuv4_write_header,
.write_packet = yuv4_write_packet,
+ .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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 09/13] avformat: Enforce one-stream limit where appropriate
2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
` (6 preceding siblings ...)
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
2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 10/13] avformat/mux: Add flag for "only default codecs allowed" Andreas Rheinhardt
` (4 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 10/13] avformat/mux: Add flag for "only default codecs allowed"
2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
` (7 preceding siblings ...)
2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 09/13] avformat: Enforce one-stream limit where appropriate Andreas Rheinhardt
@ 2024-03-20 2:12 ` Andreas Rheinhardt
2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 11/13] avformat/ttmlenc: Avoid unnecessary block Andreas Rheinhardt
` (3 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
AVOutputFormat has default codecs for audio, video and subtitle
and often these are the only codecs of this type allowed.
So add a flag to AVOutputFormat so that this can be checked generically.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/ac4enc.c | 17 ++---------------
libavformat/adtsenc.c | 7 ++-----
libavformat/aeaenc.c | 8 ++------
libavformat/alp.c | 9 ++-------
libavformat/amvenc.c | 9 +++------
libavformat/apm.c | 9 ++-------
libavformat/apngenc.c | 9 ++-------
libavformat/argo_asf.c | 9 ++-------
libavformat/argo_cvg.c | 9 ++-------
libavformat/assenc.c | 7 ++-----
libavformat/bit.c | 5 +++--
libavformat/codec2.c | 12 +++---------
libavformat/gif.c | 9 ++-------
libavformat/ilbc.c | 8 ++------
libavformat/kvag.c | 9 ++-------
libavformat/microdvdenc.c | 8 ++------
libavformat/mux.c | 11 +++++++++--
libavformat/mux.h | 9 +++++++++
libavformat/mux_utils.c | 2 ++
libavformat/rcwtenc.c | 8 ++------
libavformat/sccenc.c | 9 ++-------
libavformat/ttmlenc.c | 8 ++------
libavformat/vc1testenc.c | 7 ++-----
libavformat/webpenc.c | 10 +++-------
libavformat/webvttenc.c | 9 ++-------
libavformat/westwood_audenc.c | 10 ++--------
libavformat/wvenc.c | 14 ++------------
27 files changed, 72 insertions(+), 169 deletions(-)
diff --git a/libavformat/ac4enc.c b/libavformat/ac4enc.c
index 02b8d4d976..0505b05147 100644
--- a/libavformat/ac4enc.c
+++ b/libavformat/ac4enc.c
@@ -19,7 +19,6 @@
*/
#include "libavcodec/codec_id.h"
-#include "libavcodec/codec_par.h"
#include "libavcodec/packet.h"
#include "libavutil/crc.h"
#include "libavutil/opt.h"
@@ -31,18 +30,6 @@ typedef struct AC4Context {
int write_crc;
} AC4Context;
-static int ac4_init(AVFormatContext *s)
-{
- AVCodecParameters *par = s->streams[0]->codecpar;
-
- if (par->codec_id != AV_CODEC_ID_AC4) {
- av_log(s, AV_LOG_ERROR, "Only one AC-4 stream can be muxed by the AC-4 muxer\n");
- return AVERROR(EINVAL);
- }
-
- return 0;
-}
-
static int ac4_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AC4Context *ac4 = s->priv_data;
@@ -96,8 +83,8 @@ const FFOutputFormat ff_ac4_muxer = {
.p.audio_codec = AV_CODEC_ID_AC4,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
- .init = ac4_init,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ac4_write_packet,
.p.priv_class = &ac4_muxer_class,
.p.flags = AVFMT_NOTIMESTAMPS,
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index 7eaf91630c..0671224fc2 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -106,10 +106,6 @@ static int adts_init(AVFormatContext *s)
ADTSContext *adts = s->priv_data;
AVCodecParameters *par = s->streams[0]->codecpar;
- if (par->codec_id != AV_CODEC_ID_AAC) {
- av_log(s, AV_LOG_ERROR, "Only AAC streams can be muxed by the ADTS muxer\n");
- return AVERROR(EINVAL);
- }
if (par->extradata_size > 0)
return adts_decode_extradata(s, adts, par->extradata,
par->extradata_size);
@@ -242,7 +238,8 @@ const FFOutputFormat ff_adts_muxer = {
.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,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.init = adts_init,
.write_header = adts_write_header,
.write_packet = adts_write_packet,
diff --git a/libavformat/aeaenc.c b/libavformat/aeaenc.c
index 3303d108a5..f7969526f4 100644
--- a/libavformat/aeaenc.c
+++ b/libavformat/aeaenc.c
@@ -37,11 +37,6 @@ static int aea_write_header(AVFormatContext *s)
return AVERROR(EINVAL);
}
- if (st->codecpar->codec_id != AV_CODEC_ID_ATRAC1) {
- av_log(s, AV_LOG_ERROR, "AEA can only store ATRAC1 streams, %s was found.\n", avcodec_get_name(st->codecpar->codec_id));
- return AVERROR(EINVAL);
- }
-
if (st->codecpar->sample_rate != 44100) {
av_log(s, AV_LOG_ERROR, "Invalid sample rate (%d) AEA only supports 44.1kHz.\n", st->codecpar->sample_rate);
return AVERROR(EINVAL);
@@ -105,7 +100,8 @@ const FFOutputFormat ff_aea_muxer = {
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = aea_write_header,
.write_packet = ff_raw_write_packet,
.write_trailer = aea_write_trailer,
diff --git a/libavformat/alp.c b/libavformat/alp.c
index 9d507cb310..ad8e160223 100644
--- a/libavformat/alp.c
+++ b/libavformat/alp.c
@@ -191,12 +191,6 @@ static int alp_write_init(AVFormatContext *s)
par = s->streams[0]->codecpar;
- if (par->codec_id != AV_CODEC_ID_ADPCM_IMA_ALP) {
- av_log(s, AV_LOG_ERROR, "%s codec not supported\n",
- avcodec_get_name(par->codec_id));
- return AVERROR(EINVAL);
- }
-
if (par->ch_layout.nb_channels > 2) {
av_log(s, AV_LOG_ERROR, "A maximum of 2 channels are supported\n");
return AVERROR(EINVAL);
@@ -295,7 +289,8 @@ const FFOutputFormat ff_alp_muxer = {
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
.p.priv_class = &alp_muxer_class,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.init = alp_write_init,
.write_header = alp_write_header,
.write_packet = ff_raw_write_packet,
diff --git a/libavformat/amvenc.c b/libavformat/amvenc.c
index 9fcc09add2..5ff4f69cfa 100644
--- a/libavformat/amvenc.c
+++ b/libavformat/amvenc.c
@@ -113,11 +113,7 @@ static av_cold int amv_init(AVFormatContext *s)
return AVERROR(EINVAL);
}
- if (ast->codecpar->codec_id != AV_CODEC_ID_ADPCM_IMA_AMV) {
- av_log(s, AV_LOG_ERROR, "Second AMV stream must be %s\n",
- avcodec_get_name(AV_CODEC_ID_ADPCM_IMA_AMV));
- return AVERROR(EINVAL);
- }
+ av_assert1(ast->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_AMV);
/* These files are broken-enough as they are. They shouldn't be streamed. */
if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL)) {
@@ -411,7 +407,8 @@ const FFOutputFormat ff_amv_muxer = {
.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,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.init = amv_init,
.deinit = amv_deinit,
.write_header = amv_write_header,
diff --git a/libavformat/apm.c b/libavformat/apm.c
index 89401dcf5b..98c5439738 100644
--- a/libavformat/apm.c
+++ b/libavformat/apm.c
@@ -217,12 +217,6 @@ static int apm_write_init(AVFormatContext *s)
{
AVCodecParameters *par = s->streams[0]->codecpar;
- if (par->codec_id != AV_CODEC_ID_ADPCM_IMA_APM) {
- av_log(s, AV_LOG_ERROR, "%s codec not supported\n",
- avcodec_get_name(par->codec_id));
- return AVERROR(EINVAL);
- }
-
if (par->ch_layout.nb_channels > 2) {
av_log(s, AV_LOG_ERROR, "APM files only support up to 2 channels\n");
return AVERROR(EINVAL);
@@ -305,7 +299,8 @@ const FFOutputFormat ff_apm_muxer = {
.p.audio_codec = AV_CODEC_ID_ADPCM_IMA_APM,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.init = apm_write_init,
.write_header = apm_write_header,
.write_packet = ff_raw_write_packet,
diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c
index 79b0dbf0f7..4d0438f824 100644
--- a/libavformat/apngenc.c
+++ b/libavformat/apngenc.c
@@ -84,12 +84,6 @@ static int apng_write_header(AVFormatContext *format_context)
APNGMuxContext *apng = format_context->priv_data;
AVCodecParameters *par = format_context->streams[0]->codecpar;
- if (format_context->streams[0]->codecpar->codec_id != AV_CODEC_ID_APNG) {
- av_log(format_context, AV_LOG_ERROR,
- "APNG muxer supports only a single video APNG stream.\n");
- return AVERROR(EINVAL);
- }
-
if (apng->last_delay.num > UINT16_MAX || apng->last_delay.den > UINT16_MAX) {
av_reduce(&apng->last_delay.num, &apng->last_delay.den,
apng->last_delay.num, apng->last_delay.den, UINT16_MAX);
@@ -314,7 +308,8 @@ const FFOutputFormat ff_apng_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_APNG,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = apng_write_header,
.write_packet = apng_write_packet,
.write_trailer = apng_write_trailer,
diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 28e3844394..61bfc6de1f 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -290,12 +290,6 @@ static int argo_asf_write_init(AVFormatContext *s)
ArgoASFMuxContext *ctx = s->priv_data;
const AVCodecParameters *par = s->streams[0]->codecpar;
- if (par->codec_id != AV_CODEC_ID_ADPCM_ARGO) {
- av_log(s, AV_LOG_ERROR, "%s codec not supported\n",
- avcodec_get_name(par->codec_id));
- return AVERROR(EINVAL);
- }
-
if (ctx->version_major == 1 && ctx->version_minor == 1 && par->sample_rate != 22050) {
av_log(s, AV_LOG_ERROR, "ASF v1.1 files only support a sample rate of 22050\n");
return AVERROR(EINVAL);
@@ -476,7 +470,8 @@ const FFOutputFormat ff_argo_asf_muxer = {
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
.p.priv_class = &argo_asf_muxer_class,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.init = argo_asf_write_init,
.write_header = argo_asf_write_header,
.write_packet = argo_asf_write_packet,
diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index aacc34daeb..5db2a85dd8 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -271,12 +271,6 @@ static int argo_cvg_write_init(AVFormatContext *s)
ArgoCVGMuxContext *ctx = s->priv_data;
const AVCodecParameters *par = s->streams[0]->codecpar;
- if (par->codec_id != AV_CODEC_ID_ADPCM_PSX) {
- av_log(s, AV_LOG_ERROR, "%s codec not supported\n",
- avcodec_get_name(par->codec_id));
- return AVERROR(EINVAL);
- }
-
if (par->ch_layout.nb_channels != 1) {
av_log(s, AV_LOG_ERROR, "CVG files only support 1 channel\n");
return AVERROR(EINVAL);
@@ -403,7 +397,8 @@ const FFOutputFormat ff_argo_cvg_muxer = {
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
.p.priv_class = &argo_cvg_muxer_class,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.init = argo_cvg_write_init,
.write_header = argo_cvg_write_header,
.write_packet = argo_cvg_write_packet,
diff --git a/libavformat/assenc.c b/libavformat/assenc.c
index c23c77acda..7b474a6005 100644
--- a/libavformat/assenc.c
+++ b/libavformat/assenc.c
@@ -50,10 +50,6 @@ static int write_header(AVFormatContext *s)
ASSContext *ass = s->priv_data;
AVCodecParameters *par = s->streams[0]->codecpar;
- if (par->codec_id != AV_CODEC_ID_ASS) {
- av_log(s, AV_LOG_ERROR, "Exactly one ASS/SSA stream is needed.\n");
- return AVERROR(EINVAL);
- }
avpriv_set_pts_info(s->streams[0], 64, 1, 100);
if (par->extradata_size > 0) {
size_t header_size = par->extradata_size;
@@ -241,7 +237,8 @@ const FFOutputFormat ff_ass_muxer = {
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_ASS,
.p.flags = AVFMT_GLOBALHEADER | AVFMT_NOTIMESTAMPS | AVFMT_TS_NONSTRICT,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.p.priv_class = &ass_class,
.priv_data_size = sizeof(ASSContext),
.write_header = write_header,
diff --git a/libavformat/bit.c b/libavformat/bit.c
index 81a954c392..cd088b87ff 100644
--- a/libavformat/bit.c
+++ b/libavformat/bit.c
@@ -129,7 +129,7 @@ static int write_header(AVFormatContext *s)
{
AVCodecParameters *par = s->streams[0]->codecpar;
- if ((par->codec_id != AV_CODEC_ID_G729) || par->ch_layout.nb_channels != 1) {
+ if (par->ch_layout.nb_channels != 1) {
av_log(s, AV_LOG_ERROR,
"only codec g729 with 1 channel is supported by this format\n");
return AVERROR(EINVAL);
@@ -168,7 +168,8 @@ const FFOutputFormat ff_bit_muxer = {
.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,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = write_header,
.write_packet = write_packet,
};
diff --git a/libavformat/codec2.c b/libavformat/codec2.c
index e49408e0fb..dcc3ed9e59 100644
--- a/libavformat/codec2.c
+++ b/libavformat/codec2.c
@@ -214,14 +214,7 @@ static int codec2_read_packet(AVFormatContext *s, AVPacket *pkt)
static int codec2_write_header(AVFormatContext *s)
{
- AVStream *st;
-
- if (s->streams[0]->codecpar->codec_id != AV_CODEC_ID_CODEC2) {
- av_log(s, AV_LOG_ERROR, ".c2 files must have exactly one codec2 stream\n");
- return AVERROR(EINVAL);
- }
-
- st = s->streams[0];
+ AVStream *st = s->streams[0];
if (st->codecpar->extradata_size != CODEC2_EXTRADATA_SIZE) {
av_log(s, AV_LOG_ERROR, ".c2 files require exactly %i bytes of extradata (got %i)\n",
@@ -319,7 +312,8 @@ const FFOutputFormat ff_codec2_muxer = {
.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,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = codec2_write_header,
.write_packet = ff_raw_write_packet,
};
diff --git a/libavformat/gif.c b/libavformat/gif.c
index fe45637814..8264e118c6 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -42,12 +42,6 @@ typedef struct GIFContext {
static int gif_write_header(AVFormatContext *s)
{
- if (s->streams[0]->codecpar->codec_id != AV_CODEC_ID_GIF) {
- av_log(s, AV_LOG_ERROR,
- "GIF muxer supports only a single video GIF stream.\n");
- return AVERROR(EINVAL);
- }
-
avpriv_set_pts_info(s->streams[0], 64, 1, 100);
return 0;
@@ -212,7 +206,8 @@ const FFOutputFormat ff_gif_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_GIF,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = gif_write_header,
.write_packet = gif_write_packet,
.write_trailer = gif_write_trailer,
diff --git a/libavformat/ilbc.c b/libavformat/ilbc.c
index 2e102a4be7..a24aa3da9d 100644
--- a/libavformat/ilbc.c
+++ b/libavformat/ilbc.c
@@ -35,11 +35,6 @@ static int ilbc_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
AVCodecParameters *par = s->streams[0]->codecpar;
- if (par->codec_id != AV_CODEC_ID_ILBC) {
- av_log(s, AV_LOG_ERROR, "Unsupported codec\n");
- return AVERROR(EINVAL);
- }
-
if (par->block_align == 50) {
avio_write(pb, mode30_header, sizeof(mode30_header) - 1);
} else if (par->block_align == 38) {
@@ -125,7 +120,8 @@ const FFOutputFormat ff_ilbc_muxer = {
.p.audio_codec = AV_CODEC_ID_ILBC,
.p.subtitle_codec = AV_CODEC_ID_NONE,
.p.flags = AVFMT_NOTIMESTAMPS,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = ilbc_write_header,
.write_packet = ff_raw_write_packet,
};
diff --git a/libavformat/kvag.c b/libavformat/kvag.c
index 2053f4730d..1d0aee0994 100644
--- a/libavformat/kvag.c
+++ b/libavformat/kvag.c
@@ -131,12 +131,6 @@ static int kvag_write_init(AVFormatContext *s)
{
AVCodecParameters *par = s->streams[0]->codecpar;
- if (par->codec_id != AV_CODEC_ID_ADPCM_IMA_SSI) {
- av_log(s, AV_LOG_ERROR, "%s codec not supported\n",
- avcodec_get_name(par->codec_id));
- return AVERROR(EINVAL);
- }
-
if (par->ch_layout.nb_channels > 2) {
av_log(s, AV_LOG_ERROR, "KVAG files only support up to 2 channels\n");
return AVERROR(EINVAL);
@@ -190,7 +184,8 @@ const FFOutputFormat ff_kvag_muxer = {
.p.audio_codec = AV_CODEC_ID_ADPCM_IMA_SSI,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.init = kvag_write_init,
.write_header = kvag_write_header,
.write_packet = ff_raw_write_packet,
diff --git a/libavformat/microdvdenc.c b/libavformat/microdvdenc.c
index b9cadb8be4..d4910ecf71 100644
--- a/libavformat/microdvdenc.c
+++ b/libavformat/microdvdenc.c
@@ -29,11 +29,6 @@ static int microdvd_write_header(struct AVFormatContext *s)
AVCodecParameters *par = s->streams[0]->codecpar;
AVRational framerate = s->streams[0]->avg_frame_rate;
- if (par->codec_id != AV_CODEC_ID_MICRODVD) {
- av_log(s, AV_LOG_ERROR, "Exactly one MicroDVD stream is needed.\n");
- return -1;
- }
-
if (par->extradata && par->extradata_size > 0) {
avio_write(s->pb, "{DEFAULT}{}", 11);
avio_write(s->pb, par->extradata, par->extradata_size);
@@ -65,7 +60,8 @@ const FFOutputFormat ff_microdvd_muxer = {
.p.video_codec = AV_CODEC_ID_NONE,
.p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_MICRODVD,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = microdvd_write_header,
.write_packet = microdvd_write_packet,
};
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 134c2875b6..f23eb0188d 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -268,7 +268,7 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
}
break;
}
- if (of->flags_internal & FF_OFMT_FLAG_MAX_ONE_OF_EACH) {
+ if (of->flags_internal & (FF_OFMT_FLAG_MAX_ONE_OF_EACH | FF_OFMT_FLAG_ONLY_DEFAULT_CODECS)) {
enum AVCodecID default_codec_id = AV_CODEC_ID_NONE;
unsigned nb;
if ((unsigned)par->codec_type < FF_ARRAY_ELEMS(default_codec_offsets)) {
@@ -276,7 +276,14 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
if (default_codec_offsets[par->codec_type])
default_codec_id = *(const enum AVCodecID*)((const char*)of + default_codec_offsets[par->codec_type]);
}
- if (default_codec_id == AV_CODEC_ID_NONE || nb > 1) {
+ if (of->flags_internal & FF_OFMT_FLAG_ONLY_DEFAULT_CODECS &&
+ default_codec_id != AV_CODEC_ID_NONE && par->codec_id != default_codec_id) {
+ av_log(s, AV_LOG_ERROR, "%s muxer supports only codec %s for type %s\n",
+ of->p.name, avcodec_get_name(default_codec_id), av_get_media_type_string(par->codec_type));
+ ret = AVERROR(EINVAL);
+ goto fail;
+ } else if (default_codec_id == AV_CODEC_ID_NONE ||
+ (of->flags_internal & FF_OFMT_FLAG_MAX_ONE_OF_EACH && nb > 1)) {
const char *type = av_get_media_type_string(par->codec_type);
av_log(s, AV_LOG_ERROR, "%s muxer does not support %s stream of type %s\n",
of->p.name, default_codec_id == AV_CODEC_ID_NONE ? "any" : "more than one",
diff --git a/libavformat/mux.h b/libavformat/mux.h
index 71ee5fd06b..1f386e4488 100644
--- a/libavformat/mux.h
+++ b/libavformat/mux.h
@@ -50,6 +50,15 @@ struct AVDeviceInfoList;
* This flag is incompatible with FF_OFMT_FLAG_SUPPORT_ATTACHMENTS.
*/
#define FF_OFMT_FLAG_MAX_ONE_OF_EACH (1 << 2)
+/**
+ * If this flag is set, then the only permitted audio/video/subtitle
+ * codec ids are AVOutputFormat.audio/video/subtitle_codec;
+ * if any of the latter is unset (i.e. equal to AV_CODEC_ID_NONE),
+ * then no stream of the corresponding type is supported.
+ * In addition, codec types without default codec field
+ * are disallowed.
+ */
+#define FF_OFMT_FLAG_ONLY_DEFAULT_CODECS (1 << 3)
typedef struct FFOutputFormat {
/**
diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c
index 8a0ad4c9aa..ed1242a6a2 100644
--- a/libavformat/mux_utils.c
+++ b/libavformat/mux_utils.c
@@ -44,6 +44,8 @@ int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id,
codec_id == ofmt->audio_codec ||
codec_id == ofmt->subtitle_codec))
return 1;
+ else if (ffofmt(ofmt)->flags_internal & FF_OFMT_FLAG_ONLY_DEFAULT_CODECS)
+ return 0;
else if (ffofmt(ofmt)->flags_internal & FF_OFMT_FLAG_MAX_ONE_OF_EACH) {
enum AVMediaType type = avcodec_get_type(codec_id);
switch (type) {
diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
index 4ccd7b93c8..f2459ef1d3 100644
--- a/libavformat/rcwtenc.c
+++ b/libavformat/rcwtenc.c
@@ -84,11 +84,6 @@ static void rcwt_flush_cluster(AVFormatContext *avf)
static int rcwt_write_header(AVFormatContext *avf)
{
- if (avf->streams[0]->codecpar->codec_id != AV_CODEC_ID_EIA_608) {
- av_log(avf, AV_LOG_ERROR, "RCWT supports only CC (608/708)\n");
- return AVERROR(EINVAL);
- }
-
avpriv_set_pts_info(avf->streams[0], 64, 1, 1000);
/* magic number */
@@ -169,7 +164,8 @@ const FFOutputFormat ff_rcwt_muxer = {
.p.video_codec = AV_CODEC_ID_NONE,
.p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_EIA_608,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.priv_data_size = sizeof(RCWTContext),
.write_header = rcwt_write_header,
.write_packet = rcwt_write_packet,
diff --git a/libavformat/sccenc.c b/libavformat/sccenc.c
index 040d1ac96c..ced7208c12 100644
--- a/libavformat/sccenc.c
+++ b/libavformat/sccenc.c
@@ -35,12 +35,6 @@ static int scc_write_header(AVFormatContext *avf)
{
SCCContext *scc = avf->priv_data;
- if (avf->streams[0]->codecpar->codec_id != AV_CODEC_ID_EIA_608) {
- av_log(avf, AV_LOG_ERROR,
- "Unsupported subtitles codec: %s\n",
- avcodec_get_name(avf->streams[0]->codecpar->codec_id));
- return AVERROR(EINVAL);
- }
avpriv_set_pts_info(avf->streams[0], 64, 1, 1000);
avio_printf(avf->pb, "Scenarist_SCC V1.0\n");
@@ -114,7 +108,8 @@ const FFOutputFormat ff_scc_muxer = {
.p.video_codec = AV_CODEC_ID_NONE,
.p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_EIA_608,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.priv_data_size = sizeof(SCCContext),
.write_header = scc_write_header,
.write_packet = scc_write_packet,
diff --git a/libavformat/ttmlenc.c b/libavformat/ttmlenc.c
index 0af82d5753..af2e2b85a5 100644
--- a/libavformat/ttmlenc.c
+++ b/libavformat/ttmlenc.c
@@ -126,11 +126,6 @@ static int ttml_write_header(AVFormatContext *ctx)
TTMLMuxContext *ttml_ctx = ctx->priv_data;
ttml_ctx->document_written = 0;
- if (ctx->streams[0]->codecpar->codec_id != AV_CODEC_ID_TTML) {
- av_log(ctx, AV_LOG_ERROR, "Exactly one TTML stream is required!\n");
- return AVERROR(EINVAL);
- }
-
{
AVStream *st = ctx->streams[0];
AVIOContext *pb = ctx->pb;
@@ -226,7 +221,8 @@ const FFOutputFormat ff_ttml_muxer = {
.p.video_codec = AV_CODEC_ID_NONE,
.p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_TTML,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = ttml_write_header,
.write_packet = ttml_write_packet,
.write_trailer = ttml_write_trailer,
diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c
index 6b4cbd1152..40d764c4de 100644
--- a/libavformat/vc1testenc.c
+++ b/libavformat/vc1testenc.c
@@ -31,10 +31,6 @@ static int vc1test_write_header(AVFormatContext *s)
AVCodecParameters *par = s->streams[0]->codecpar;
AVIOContext *pb = s->pb;
- if (par->codec_id != AV_CODEC_ID_WMV3) {
- av_log(s, AV_LOG_ERROR, "Only WMV3 is accepted!\n");
- return -1;
- }
avio_wl24(pb, 0); //frames count will be here
avio_w8(pb, 0xC5);
avio_wl32(pb, 4);
@@ -92,5 +88,6 @@ const FFOutputFormat ff_vc1t_muxer = {
.write_header = vc1test_write_header,
.write_packet = vc1test_write_packet,
.write_trailer = vc1test_write_trailer,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
};
diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
index 85074ae315..1c5b93e0ab 100644
--- a/libavformat/webpenc.c
+++ b/libavformat/webpenc.c
@@ -38,15 +38,10 @@ typedef struct WebpContext{
static int webp_init(AVFormatContext *s)
{
WebpContext *const w = s->priv_data;
- AVStream *st;
+ AVStream *st = s->streams[0];
w->last_pkt = ffformatcontext(s)->pkt;
- st = s->streams[0];
- if (st->codecpar->codec_id != AV_CODEC_ID_WEBP) {
- av_log(s, AV_LOG_ERROR, "Only WebP is supported\n");
- return AVERROR(EINVAL);
- }
avpriv_set_pts_info(st, 24, 1, 1000);
return 0;
@@ -233,5 +228,6 @@ const FFOutputFormat ff_webp_muxer = {
.write_trailer = webp_write_trailer,
.p.priv_class = &webp_muxer_class,
.p.flags = AVFMT_VARIABLE_FPS,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
};
diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c
index 12a4b776dc..e71a6224ae 100644
--- a/libavformat/webvttenc.c
+++ b/libavformat/webvttenc.c
@@ -47,14 +47,8 @@ static void webvtt_write_time(AVIOContext *pb, int64_t millisec)
static int webvtt_write_header(AVFormatContext *ctx)
{
AVStream *s = ctx->streams[0];
- AVCodecParameters *par = ctx->streams[0]->codecpar;
AVIOContext *pb = ctx->pb;
- if (par->codec_id != AV_CODEC_ID_WEBVTT) {
- av_log(ctx, AV_LOG_ERROR, "Exactly one WebVTT stream is needed.\n");
- return AVERROR(EINVAL);
- }
-
avpriv_set_pts_info(s, 64, 1, 1000);
avio_printf(pb, "WEBVTT\n");
@@ -114,5 +108,6 @@ const FFOutputFormat ff_webvtt_muxer = {
.p.subtitle_codec = AV_CODEC_ID_WEBVTT,
.write_header = webvtt_write_header,
.write_packet = webvtt_write_packet,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
};
diff --git a/libavformat/westwood_audenc.c b/libavformat/westwood_audenc.c
index 2240d130b6..ab47e0ff8e 100644
--- a/libavformat/westwood_audenc.c
+++ b/libavformat/westwood_audenc.c
@@ -43,7 +43,6 @@ typedef struct AUDMuxContext {
static int wsaud_write_init(AVFormatContext *ctx)
{
- AVStream *st = ctx->streams[0];
AVIOContext *pb = ctx->pb;
/* Stream must be seekable to correctly write the file. */
@@ -53,12 +52,6 @@ static int wsaud_write_init(AVFormatContext *ctx)
return AVERROR(EINVAL);
}
- if (st->codecpar->codec_id != AV_CODEC_ID_ADPCM_IMA_WS) {
- av_log(ctx, AV_LOG_ERROR, "%s codec not supported for Westwood AUD.\n",
- avcodec_get_name(st->codecpar->codec_id));
- return AVERROR(EINVAL);
- }
-
return 0;
}
@@ -133,5 +126,6 @@ const FFOutputFormat ff_wsaud_muxer = {
.write_header = wsaud_write_header,
.write_packet = wsaud_write_packet,
.write_trailer = wsaud_write_trailer,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
};
diff --git a/libavformat/wvenc.c b/libavformat/wvenc.c
index 6d5fefe1bc..7da0879050 100644
--- a/libavformat/wvenc.c
+++ b/libavformat/wvenc.c
@@ -31,16 +31,6 @@ typedef struct WvMuxContext {
int64_t samples;
} WvMuxContext;
-static av_cold int wv_init(AVFormatContext *ctx)
-{
- if (ctx->streams[0]->codecpar->codec_id != AV_CODEC_ID_WAVPACK) {
- av_log(ctx, AV_LOG_ERROR, "This muxer only supports a single WavPack stream.\n");
- return AVERROR(EINVAL);
- }
-
- return 0;
-}
-
static int wv_write_packet(AVFormatContext *ctx, AVPacket *pkt)
{
WvMuxContext *s = ctx->priv_data;
@@ -85,9 +75,9 @@ const FFOutputFormat ff_wv_muxer = {
.p.audio_codec = AV_CODEC_ID_WAVPACK,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .init = wv_init,
.write_packet = wv_write_packet,
.write_trailer = wv_write_trailer,
.p.flags = AVFMT_NOTIMESTAMPS,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
};
--
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 11/13] avformat/ttmlenc: Avoid unnecessary block
2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
` (8 preceding siblings ...)
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 ` Andreas Rheinhardt
2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 12/13] avformat: Enforce codec_id where appropriate Andreas Rheinhardt
` (2 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/ttmlenc.c | 55 ++++++++++++++++++++-----------------------
1 file changed, 26 insertions(+), 29 deletions(-)
diff --git a/libavformat/ttmlenc.c b/libavformat/ttmlenc.c
index af2e2b85a5..1ffbd66f80 100644
--- a/libavformat/ttmlenc.c
+++ b/libavformat/ttmlenc.c
@@ -124,38 +124,35 @@ static int ttml_set_header_values_from_extradata(
static int ttml_write_header(AVFormatContext *ctx)
{
TTMLMuxContext *ttml_ctx = ctx->priv_data;
+ AVStream *st = ctx->streams[0];
+ AVIOContext *pb = ctx->pb;
+
+ const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,
+ 0);
+ const char *printed_lang = (lang && lang->value) ? lang->value : "";
+
ttml_ctx->document_written = 0;
+ ttml_ctx->input_type = ff_is_ttml_stream_paragraph_based(st->codecpar) ?
+ PACKET_TYPE_PARAGRAPH :
+ PACKET_TYPE_DOCUMENT;
+
+ avpriv_set_pts_info(st, 64, 1, 1000);
- {
- AVStream *st = ctx->streams[0];
- AVIOContext *pb = ctx->pb;
-
- AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,
- 0);
- const char *printed_lang = (lang && lang->value) ? lang->value : "";
-
- ttml_ctx->input_type = ff_is_ttml_stream_paragraph_based(st->codecpar) ?
- PACKET_TYPE_PARAGRAPH :
- PACKET_TYPE_DOCUMENT;
-
- avpriv_set_pts_info(st, 64, 1, 1000);
-
- if (ttml_ctx->input_type == PACKET_TYPE_PARAGRAPH) {
- struct TTMLHeaderParameters header_params;
- int ret = ttml_set_header_values_from_extradata(
- st->codecpar, &header_params);
- if (ret < 0) {
- av_log(ctx, AV_LOG_ERROR,
- "Failed to parse TTML header values from extradata: "
- "%s!\n", av_err2str(ret));
- return ret;
- }
-
- avio_printf(pb, ttml_header_text,
- header_params.tt_element_params,
- printed_lang,
- header_params.pre_body_elements);
+ if (ttml_ctx->input_type == PACKET_TYPE_PARAGRAPH) {
+ struct TTMLHeaderParameters header_params;
+ int ret = ttml_set_header_values_from_extradata(
+ st->codecpar, &header_params);
+ if (ret < 0) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Failed to parse TTML header values from extradata: "
+ "%s!\n", av_err2str(ret));
+ return ret;
}
+
+ avio_printf(pb, ttml_header_text,
+ header_params.tt_element_params,
+ printed_lang,
+ header_params.pre_body_elements);
}
return 0;
--
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 12/13] avformat: Enforce codec_id where appropriate
2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
` (9 preceding siblings ...)
2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 11/13] avformat/ttmlenc: Avoid unnecessary block Andreas Rheinhardt
@ 2024-03-20 2:12 ` 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
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
E.g. chromaprint expects to be fed 16bit signed PCM
in native endianness, yet there was no check for this.
Similarly for other muxers. Use the new
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS to enfore this where
appropriate, e.g. for pcm/raw muxers.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/chromaprint.c | 3 +-
libavformat/daudenc.c | 3 +-
libavformat/filmstripenc.c | 3 +-
libavformat/fitsenc.c | 3 +-
libavformat/idroqenc.c | 3 +-
libavformat/jacosubenc.c | 3 +-
libavformat/mmf.c | 3 +-
libavformat/mpjpeg.c | 2 +
libavformat/pcmenc.c | 3 +-
libavformat/rawenc.c | 102 ++++++++++++++++++++++++-------------
libavformat/ttaenc.c | 3 +-
11 files changed, 88 insertions(+), 43 deletions(-)
diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c
index 62264d6a4b..4beb75c7a9 100644
--- a/libavformat/chromaprint.c
+++ b/libavformat/chromaprint.c
@@ -179,7 +179,8 @@ const FFOutputFormat ff_chromaprint_muxer = {
.p.audio_codec = AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE),
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = write_header,
.write_packet = write_packet,
.write_trailer = write_trailer,
diff --git a/libavformat/daudenc.c b/libavformat/daudenc.c
index f1e0da058b..5c8db5104e 100644
--- a/libavformat/daudenc.c
+++ b/libavformat/daudenc.c
@@ -64,7 +64,8 @@ const FFOutputFormat ff_daud_muxer = {
.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,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.init = daud_init,
.write_packet = daud_write_packet,
};
diff --git a/libavformat/filmstripenc.c b/libavformat/filmstripenc.c
index b2a4cee8fa..ec9c814f8c 100644
--- a/libavformat/filmstripenc.c
+++ b/libavformat/filmstripenc.c
@@ -67,7 +67,8 @@ const FFOutputFormat ff_filmstrip_muxer = {
.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,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.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 605056af59..a8efe93d3c 100644
--- a/libavformat/fitsenc.c
+++ b/libavformat/fitsenc.c
@@ -199,7 +199,8 @@ const FFOutputFormat ff_fits_muxer = {
.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,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.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 75a191189c..f3172692e0 100644
--- a/libavformat/idroqenc.c
+++ b/libavformat/idroqenc.c
@@ -67,7 +67,8 @@ const FFOutputFormat ff_roq_muxer = {
.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,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = roq_write_header,
.write_packet = ff_raw_write_packet,
};
diff --git a/libavformat/jacosubenc.c b/libavformat/jacosubenc.c
index a792fda42e..428505e51f 100644
--- a/libavformat/jacosubenc.c
+++ b/libavformat/jacosubenc.c
@@ -39,7 +39,8 @@ const FFOutputFormat ff_jacosub_muxer = {
.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,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = jacosub_write_header,
.write_packet = ff_raw_write_packet,
};
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index fab4509711..42a88cff90 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -320,7 +320,8 @@ const FFOutputFormat ff_mmf_muxer = {
.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,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = mmf_write_header,
.write_packet = ff_raw_write_packet,
.write_trailer = mmf_write_trailer,
diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c
index 81ace8e9ee..8641c9c670 100644
--- a/libavformat/mpjpeg.c
+++ b/libavformat/mpjpeg.c
@@ -70,6 +70,8 @@ const FFOutputFormat ff_mpjpeg_muxer = {
.priv_data_size = sizeof(MPJPEGContext),
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_MJPEG,
+ .p.subtitle_codec = AV_CODEC_ID_NONE,
+ .flags_internal = FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = mpjpeg_write_header,
.write_packet = mpjpeg_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
diff --git a/libavformat/pcmenc.c b/libavformat/pcmenc.c
index 4879f1deed..c4dd8e43c5 100644
--- a/libavformat/pcmenc.c
+++ b/libavformat/pcmenc.c
@@ -35,7 +35,8 @@ const FFOutputFormat ff_pcm_ ## name_ ## _muxer = { \
.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, \
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH | \
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS, \
.write_packet = ff_raw_write_packet, \
};
#define PCMDEF_2(name, long_name, ext, codec, enabled) \
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 49dc0a9109..cf298d223d 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -45,7 +45,8 @@ const FFOutputFormat ff_ac3_muxer = {
.p.audio_codec = AV_CODEC_ID_AC3,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -78,7 +79,8 @@ const FFOutputFormat ff_adx_muxer = {
.p.audio_codec = AV_CODEC_ID_ADPCM_ADX,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.write_trailer = adx_write_trailer,
.p.flags = AVFMT_NOTIMESTAMPS,
@@ -93,7 +95,8 @@ const FFOutputFormat ff_aptx_muxer = {
.p.audio_codec = AV_CODEC_ID_APTX,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -107,7 +110,8 @@ const FFOutputFormat ff_aptx_hd_muxer = {
.p.audio_codec = AV_CODEC_ID_APTX_HD,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -121,7 +125,8 @@ const FFOutputFormat ff_avs2_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_AVS2,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -135,7 +140,8 @@ const FFOutputFormat ff_avs3_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_AVS3,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -150,7 +156,8 @@ const FFOutputFormat ff_cavsvideo_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_CAVS,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -163,7 +170,8 @@ const FFOutputFormat ff_codec2raw_muxer = {
.p.audio_codec = AV_CODEC_ID_CODEC2,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -197,7 +205,8 @@ const FFOutputFormat ff_dfpwm_muxer = {
.p.audio_codec = AV_CODEC_ID_DFPWM,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -211,7 +220,8 @@ const FFOutputFormat ff_dirac_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_DIRAC,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -225,7 +235,8 @@ const FFOutputFormat ff_dnxhd_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_DNXHD,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -240,7 +251,8 @@ const FFOutputFormat ff_dts_muxer = {
.p.audio_codec = AV_CODEC_ID_DTS,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -255,7 +267,8 @@ const FFOutputFormat ff_eac3_muxer = {
.p.audio_codec = AV_CODEC_ID_EAC3,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -270,7 +283,8 @@ const FFOutputFormat ff_g722_muxer = {
.p.audio_codec = AV_CODEC_ID_ADPCM_G722,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -285,7 +299,8 @@ const FFOutputFormat ff_g723_1_muxer = {
.p.audio_codec = AV_CODEC_ID_G723_1,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -298,7 +313,8 @@ const FFOutputFormat ff_g726_muxer = {
.p.audio_codec = AV_CODEC_ID_ADPCM_G726,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -311,7 +327,8 @@ const FFOutputFormat ff_g726le_muxer = {
.p.audio_codec = AV_CODEC_ID_ADPCM_G726LE,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -326,7 +343,8 @@ const FFOutputFormat ff_gsm_muxer = {
.p.audio_codec = AV_CODEC_ID_GSM,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -341,7 +359,8 @@ const FFOutputFormat ff_h261_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_H261,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -356,7 +375,8 @@ const FFOutputFormat ff_h263_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_H263,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -379,7 +399,8 @@ const FFOutputFormat ff_h264_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_H264,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.check_bitstream = h264_check_bitstream,
.p.flags = AVFMT_NOTIMESTAMPS,
@@ -403,7 +424,8 @@ const FFOutputFormat ff_vvc_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_VVC,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.check_bitstream = vvc_check_bitstream,
.p.flags = AVFMT_NOTIMESTAMPS,
@@ -427,7 +449,8 @@ const FFOutputFormat ff_hevc_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_HEVC,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.check_bitstream = hevc_check_bitstream,
.p.flags = AVFMT_NOTIMESTAMPS,
@@ -442,7 +465,8 @@ const FFOutputFormat ff_evc_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_EVC,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -456,7 +480,8 @@ const FFOutputFormat ff_m4v_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_MPEG4,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -471,7 +496,8 @@ const FFOutputFormat ff_mjpeg_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_MJPEG,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -485,7 +511,8 @@ const FFOutputFormat ff_mlp_muxer = {
.p.audio_codec = AV_CODEC_ID_MLP,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -500,7 +527,8 @@ const FFOutputFormat ff_mp2_muxer = {
.p.audio_codec = AV_CODEC_ID_MP2,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -515,7 +543,8 @@ const FFOutputFormat ff_mpeg1video_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_MPEG1VIDEO,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -529,7 +558,8 @@ const FFOutputFormat ff_mpeg2video_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_MPEG2VIDEO,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -549,7 +579,8 @@ const FFOutputFormat ff_obu_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_AV1,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.check_bitstream = obu_check_bitstream,
.p.flags = AVFMT_NOTIMESTAMPS,
@@ -578,7 +609,8 @@ const FFOutputFormat ff_sbc_muxer = {
.p.audio_codec = AV_CODEC_ID_SBC,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -592,7 +624,8 @@ const FFOutputFormat ff_truehd_muxer = {
.p.audio_codec = AV_CODEC_ID_TRUEHD,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
@@ -606,7 +639,8 @@ const FFOutputFormat ff_vc1_muxer = {
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_VC1,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_packet = ff_raw_write_packet,
.p.flags = AVFMT_NOTIMESTAMPS,
};
diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c
index 661aa8fc83..671820f00e 100644
--- a/libavformat/ttaenc.c
+++ b/libavformat/ttaenc.c
@@ -169,7 +169,8 @@ const FFOutputFormat ff_tta_muxer = {
.p.audio_codec = AV_CODEC_ID_TTA,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
- .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+ .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
+ FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.init = tta_init,
.deinit = tta_deinit,
.write_header = tta_write_header,
--
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH 13/13] avformat: Make init function out of write_header functions if possible
2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
` (10 preceding siblings ...)
2024-03-20 2:12 ` [FFmpeg-devel] [PATCH 12/13] avformat: Enforce codec_id where appropriate Andreas Rheinhardt
@ 2024-03-20 2:12 ` Andreas Rheinhardt
2024-03-22 12:13 ` [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-20 2:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Also mark them as av_cold while just at it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/bit.c | 4 ++--
libavformat/chromaprint.c | 4 ++--
libavformat/filmstripenc.c | 4 ++--
libavformat/gif.c | 4 ++--
libavformat/supenc.c | 4 ++--
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/libavformat/bit.c b/libavformat/bit.c
index cd088b87ff..5c3eb31c57 100644
--- a/libavformat/bit.c
+++ b/libavformat/bit.c
@@ -125,7 +125,7 @@ const FFInputFormat ff_bit_demuxer = {
#endif
#if CONFIG_BIT_MUXER
-static int write_header(AVFormatContext *s)
+static av_cold int init(AVFormatContext *s)
{
AVCodecParameters *par = s->streams[0]->codecpar;
@@ -170,7 +170,7 @@ const FFOutputFormat ff_bit_muxer = {
.p.subtitle_codec = AV_CODEC_ID_NONE,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
- .write_header = write_header,
+ .init = init,
.write_packet = write_packet,
};
#endif
diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c
index 4beb75c7a9..1cdca47ea5 100644
--- a/libavformat/chromaprint.c
+++ b/libavformat/chromaprint.c
@@ -58,7 +58,7 @@ static void deinit(AVFormatContext *s)
}
}
-static int write_header(AVFormatContext *s)
+static av_cold int init(AVFormatContext *s)
{
ChromaprintMuxContext *cpr = s->priv_data;
AVStream *st;
@@ -181,7 +181,7 @@ const FFOutputFormat ff_chromaprint_muxer = {
.p.subtitle_codec = AV_CODEC_ID_NONE,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
- .write_header = write_header,
+ .init = init,
.write_packet = write_packet,
.write_trailer = write_trailer,
.deinit = deinit,
diff --git a/libavformat/filmstripenc.c b/libavformat/filmstripenc.c
index ec9c814f8c..b5d9179ff3 100644
--- a/libavformat/filmstripenc.c
+++ b/libavformat/filmstripenc.c
@@ -32,7 +32,7 @@
#define RAND_TAG MKBETAG('R','a','n','d')
-static int write_header(AVFormatContext *s)
+static av_cold int init(AVFormatContext *s)
{
if (s->streams[0]->codecpar->format != AV_PIX_FMT_RGBA) {
av_log(s, AV_LOG_ERROR, "only AV_PIX_FMT_RGBA is supported\n");
@@ -69,7 +69,7 @@ const FFOutputFormat ff_filmstrip_muxer = {
.p.subtitle_codec = AV_CODEC_ID_NONE,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
- .write_header = write_header,
+ .init = init,
.write_packet = ff_raw_write_packet,
.write_trailer = write_trailer,
};
diff --git a/libavformat/gif.c b/libavformat/gif.c
index 8264e118c6..211705facc 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -40,7 +40,7 @@ typedef struct GIFContext {
AVPacket *prev_pkt;
} GIFContext;
-static int gif_write_header(AVFormatContext *s)
+static av_cold int gif_init(AVFormatContext *s)
{
avpriv_set_pts_info(s->streams[0], 64, 1, 100);
@@ -208,7 +208,7 @@ const FFOutputFormat ff_gif_muxer = {
.p.subtitle_codec = AV_CODEC_ID_NONE,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
- .write_header = gif_write_header,
+ .init = gif_init,
.write_packet = gif_write_packet,
.write_trailer = gif_write_trailer,
.p.priv_class = &gif_muxer_class,
diff --git a/libavformat/supenc.c b/libavformat/supenc.c
index 9d5ca51894..ebdfc7c939 100644
--- a/libavformat/supenc.c
+++ b/libavformat/supenc.c
@@ -72,7 +72,7 @@ static int sup_write_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
-static int sup_write_header(AVFormatContext *s)
+static av_cold int sup_init(AVFormatContext *s)
{
avpriv_set_pts_info(s->streams[0], 32, 1, 90000);
@@ -89,6 +89,6 @@ const FFOutputFormat ff_sup_muxer = {
.p.subtitle_codec = AV_CODEC_ID_HDMV_PGS_SUBTITLE,
.p.flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
- .write_header = sup_write_header,
+ .init = sup_init,
.write_packet = sup_write_packet,
};
--
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH 04/13] avformat/codec2: Don't allocate Codec2Context for muxer
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
0 siblings, 0 replies; 15+ messages in thread
From: Tomas Härdin @ 2024-03-20 11:23 UTC (permalink / raw)
To: FFmpeg development discussions and patches
ons 2024-03-20 klockan 03:12 +0100 skrev Andreas Rheinhardt:
> Only the demuxers use it.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavformat/codec2.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/libavformat/codec2.c b/libavformat/codec2.c
> index 4a3e10c6e3..9ed57af0a8 100644
> --- a/libavformat/codec2.c
> +++ b/libavformat/codec2.c
> @@ -318,7 +318,6 @@ const FFOutputFormat ff_codec2_muxer = {
> .p.audio_codec = AV_CODEC_ID_CODEC2,
> .p.video_codec = AV_CODEC_ID_NONE,
> .p.flags = AVFMT_NOTIMESTAMPS,
> - .priv_data_size = sizeof(Codec2Context),
> .write_header = codec2_write_header,
> .write_packet = ff_raw_write_packet,
> };
Right, mode is carried in extradata. OK.
/Tomas
_______________________________________________
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec
2024-03-20 2:07 [FFmpeg-devel] [PATCH 01/13] avformat/mp3enc: Improve query_codec Andreas Rheinhardt
` (11 preceding siblings ...)
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 ` Andreas Rheinhardt
12 siblings, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-03-22 12:13 UTC (permalink / raw)
To: ffmpeg-devel
Andreas Rheinhardt:
> Signal that anything except MP3 and the ID3V2 attached pic types
> are forbidden.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavformat/mp3enc.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
> index cb250a46ca..4a02a45069 100644
> --- a/libavformat/mp3enc.c
> +++ b/libavformat/mp3enc.c
> @@ -495,12 +495,16 @@ static int mp3_write_trailer(struct AVFormatContext *s)
> static int query_codec(enum AVCodecID id, int std_compliance)
> {
> const CodecMime *cm= ff_id3v2_mime_tags;
> +
> + if (id == AV_CODEC_ID_MP3)
> + return 1;
> +
> while(cm->id != AV_CODEC_ID_NONE) {
> if(id == cm->id)
> return MKTAG('A', 'P', 'I', 'C');
> cm++;
> }
> - return -1;
> + return 0;
> }
>
> static const AVOption options[] = {
Will apply this patchset tomorrow unless there are objections.
- Andreas
_______________________________________________
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".
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2024-03-22 12:13 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [FFmpeg-devel] [PATCH 09/13] avformat: Enforce one-stream limit where appropriate Andreas Rheinhardt
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
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