Imported Debian version 2.5.0~trusty1.1
[deb_ffmpeg.git] / ffmpeg / libavcodec / movtextdec.c
index 05ff53afb4c9fee8daa1fcb089964459e969c5c5..1c7ffea70e490534339956cf12821376069b7e07 100644 (file)
@@ -42,7 +42,6 @@ static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end)
         text++;
     }
 
-    av_bprintf(buf, "\r\n");
     return 0;
 }
 
@@ -60,7 +59,7 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
                             void *data, int *got_sub_ptr, AVPacket *avpkt)
 {
     AVSubtitle *sub = data;
-    int ts_start, ts_end;
+    int ret, ts_start, ts_end;
     AVBPrint buf;
     const char *ptr = avpkt->data;
     const char *end;
@@ -96,13 +95,11 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
     // Note that the spec recommends lines be no longer than 2048 characters.
     av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
     text_to_ass(&buf, ptr, end);
-
-    if (!av_bprint_is_complete(&buf))
-        return AVERROR(ENOMEM);
-
-    ff_ass_add_rect(sub, buf.str, ts_start, ts_end-ts_start, 0);
-    *got_sub_ptr = sub->num_rects > 0;
+    ret = ff_ass_add_rect_bprint(sub, &buf, ts_start, ts_end-ts_start);
     av_bprint_finalize(&buf, NULL);
+    if (ret < 0)
+        return ret;
+    *got_sub_ptr = sub->num_rects > 0;
     return avpkt->size;
 }