diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-03-19 23:28:36 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-03-22 23:57:19 +0100 |
commit | a24bccc23859b37e03cbf395b3349cb4f707b3e0 (patch) | |
tree | 6fb3d44ad0b78c8e8ebf9c10c83da94e7ef015c6 /libavformat/webvttenc.c | |
parent | 03b04eef72a5f23e30c2d7700b290d915c31d3a1 (diff) | |
download | ffmpeg-a24bccc23859b37e03cbf395b3349cb4f707b3e0.tar.gz |
avformat/mux: Add flag for "only default codecs allowed"
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>
Diffstat (limited to 'libavformat/webvttenc.c')
-rw-r--r-- | libavformat/webvttenc.c | 9 |
1 files changed, 2 insertions, 7 deletions
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, }; |