X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fwebvttenc.c;h=fcbd9698f49ccb1cec59dfececebd11ddd63d4d2;hb=6c497ac93bd98c78cc1dbba18319aa14a68fc28c;hp=c84bbf4b4e1ccb12815d88938017dd1f477c96d8;hpb=409e684e79b6ee0c511292326f09b13fe230e58e;p=ffmpeg diff --git a/libavcodec/webvttenc.c b/libavcodec/webvttenc.c index c84bbf4b4e1..fcbd9698f49 100644 --- a/libavcodec/webvttenc.c +++ b/libavcodec/webvttenc.c @@ -168,29 +168,15 @@ static int webvtt_encode_frame(AVCodecContext *avctx, if (sub->rects[i]->type != SUBTITLE_ASS) { av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n"); - return AVERROR(ENOSYS); + return AVERROR(EINVAL); } -#if FF_API_ASS_TIMING - if (!strncmp(ass, "Dialogue: ", 10)) { - int num; - dialog = ff_ass_split_dialog(s->ass_ctx, ass, 0, &num); - // TODO reindent - for (; dialog && num--; dialog++) { - webvtt_style_apply(s, dialog->style); - ff_ass_split_override_codes(&webvtt_callbacks, s, dialog->text); - } - } else { -#endif - dialog = ff_ass_split_dialog2(s->ass_ctx, ass); - if (!dialog) - return AVERROR(ENOMEM); - webvtt_style_apply(s, dialog->style); - ff_ass_split_override_codes(&webvtt_callbacks, s, dialog->text); - ff_ass_free_dialog(&dialog); -#if FF_API_ASS_TIMING - } -#endif + dialog = ff_ass_split_dialog2(s->ass_ctx, ass); + if (!dialog) + return AVERROR(ENOMEM); + webvtt_style_apply(s, dialog->style); + ff_ass_split_override_codes(&webvtt_callbacks, s, dialog->text); + ff_ass_free_dialog(&dialog); } if (!av_bprint_is_complete(&s->buffer)) @@ -200,7 +186,7 @@ static int webvtt_encode_frame(AVCodecContext *avctx, if (s->buffer.len > bufsize) { av_log(avctx, AV_LOG_ERROR, "Buffer too small for ASS event.\n"); - return -1; + return AVERROR_BUFFER_TOO_SMALL; } memcpy(buf, s->buffer.str, s->buffer.len);