X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fwebvttenc.c;h=c38653871862d997fd09244b2c83952fb214fb21;hb=b84232694ef0c6897e82b52326c9ea4027c69ec4;hp=b93993d55ce2a8e7f4c8a70725de396db9441ed3;hpb=305f46175429ed4f19f5a5bc6c1ca07498c4f26c;p=ffmpeg diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c index b93993d55ce..c3865387186 100644 --- a/libavformat/webvttenc.c +++ b/libavformat/webvttenc.c @@ -46,8 +46,14 @@ static void webvtt_write_time(AVIOContext *pb, int64_t millisec) static int webvtt_write_header(AVFormatContext *ctx) { AVStream *s = ctx->streams[0]; + AVCodecContext *avctx = ctx->streams[0]->codec; AVIOContext *pb = ctx->pb; + if (ctx->nb_streams != 1 || avctx->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");