]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/movtextenc.c
avfilter/buffersrc: postpone removal of sws_param
[ffmpeg] / libavcodec / movtextenc.c
index 1bef21e0b9b04341a3c6443c1df6cff81ccab207..4e782c785607279791a2c6ce2aabeb88e53f25e3 100644 (file)
@@ -355,7 +355,7 @@ static int mov_text_style_start(MovTextContext *s)
         StyleBox *tmp;
 
         // last style != defaults, end the style entry and start a new one
-        if (s->count + 1 > SIZE_MAX / sizeof(*s->style_attributes) ||
+        if (s->count + 1 > FFMIN(SIZE_MAX / sizeof(*s->style_attributes), UINT16_MAX) ||
             !(tmp = av_fast_realloc(s->style_attributes,
                                     &s->style_attributes_bytes_allocated,
                                     (s->count + 1) * sizeof(*s->style_attributes)))) {
@@ -655,25 +655,12 @@ static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf,
             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++) {
-                mov_text_dialog(s, dialog);
-                ff_ass_split_override_codes(&mov_text_callbacks, s, dialog->text);
-            }
-        } else {
-#endif
-            dialog = ff_ass_split_dialog2(s->ass_ctx, ass);
-            if (!dialog)
-                return AVERROR(ENOMEM);
-            mov_text_dialog(s, dialog);
-            ff_ass_split_override_codes(&mov_text_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);
+        mov_text_dialog(s, dialog);
+        ff_ass_split_override_codes(&mov_text_callbacks, s, dialog->text);
+        ff_ass_free_dialog(&dialog);
 
         for (j = 0; j < box_count; j++) {
             box_types[j].encode(s);
@@ -721,7 +708,7 @@ static const AVClass mov_text_encoder_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-AVCodec ff_movtext_encoder = {
+const AVCodec ff_movtext_encoder = {
     .name           = "mov_text",
     .long_name      = NULL_IF_CONFIG_SMALL("3GPP Timed Text subtitle"),
     .type           = AVMEDIA_TYPE_SUBTITLE,