X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fsrtenc.c;h=08c52c2d56cef8db6289ad1aa0f4862c07234e31;hb=7c4287b27628346321981b2529bff028f119c870;hp=34f0f0d5e66d4b2626ea8d03742be84d423a8f7e;hpb=c0a647644f2703e1da980dcf988cefd81528d8c9;p=ffmpeg diff --git a/libavcodec/srtenc.c b/libavcodec/srtenc.c index 34f0f0d5e66..08c52c2d56c 100644 --- a/libavcodec/srtenc.c +++ b/libavcodec/srtenc.c @@ -241,32 +241,17 @@ static int 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); - for (; dialog && num--; dialog++) { - s->alignment_applied = 0; - if (avctx->codec_id == AV_CODEC_ID_SUBRIP) - srt_style_apply(s, dialog->style); - ff_ass_split_override_codes(cb, s, dialog->text); - } - } else { -#endif - dialog = ff_ass_split_dialog2(s->ass_ctx, ass); - if (!dialog) - return AVERROR(ENOMEM); - s->alignment_applied = 0; - if (avctx->codec_id == AV_CODEC_ID_SUBRIP) - srt_style_apply(s, dialog->style); - ff_ass_split_override_codes(cb, 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); + s->alignment_applied = 0; + if (avctx->codec_id == AV_CODEC_ID_SUBRIP) + srt_style_apply(s, dialog->style); + ff_ass_split_override_codes(cb, s, dialog->text); + ff_ass_free_dialog(&dialog); } if (!av_bprint_is_complete(&s->buffer)) @@ -276,7 +261,7 @@ static int 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);