[FFmpeg-cvslog] avcodec/ass: add ASS trailing \r\n in one single place

Clément Bœsch git at videolan.org
Sun Oct 19 23:29:48 CEST 2014


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sun Oct 19 21:19:07 2014 +0200| [c669af0f248e25781a2a12bd96bf9896b1c4484c] | committer: Clément Bœsch

avcodec/ass: add ASS trailing \r\n in one single place

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c669af0f248e25781a2a12bd96bf9896b1c4484c
---

 libavcodec/ass.c                 |    4 ++--
 libavcodec/ass.h                 |    2 +-
 libavcodec/jacosubdec.c          |    1 -
 libavcodec/libzvbi-teletextdec.c |    1 +
 libavcodec/microdvddec.c         |    1 -
 libavcodec/movtextdec.c          |    1 -
 libavcodec/mpl2dec.c             |    1 -
 libavcodec/realtextdec.c         |    1 -
 libavcodec/samidec.c             |    2 +-
 libavcodec/srtdec.c              |    1 -
 libavcodec/subviewerdec.c        |    1 -
 libavcodec/webvttdec.c           |    1 -
 12 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/libavcodec/ass.c b/libavcodec/ass.c
index 398a805..3a37cee 100644
--- a/libavcodec/ass.c
+++ b/libavcodec/ass.c
@@ -174,9 +174,10 @@ err:
     return ret;
 }
 
-int ff_ass_add_rect_bprint(AVSubtitle *sub, const AVBPrint *buf,
+int ff_ass_add_rect_bprint(AVSubtitle *sub, AVBPrint *buf,
                            int ts_start, int duration)
 {
+    av_bprintf(buf, "\r\n");
     if (!av_bprint_is_complete(buf))
         return AVERROR(ENOMEM);
     return ff_ass_add_rect(sub, buf->str, ts_start, duration, 0);
@@ -218,5 +219,4 @@ void ff_ass_bprint_text_event(AVBPrint *buf, const char *p, int size,
             av_bprint_chars(buf, *p, 1);
         }
     }
-    av_bprintf(buf, "\r\n");
 }
diff --git a/libavcodec/ass.h b/libavcodec/ass.h
index 08dcfdc..77218bf 100644
--- a/libavcodec/ass.h
+++ b/libavcodec/ass.h
@@ -95,7 +95,7 @@ int ff_ass_add_rect(AVSubtitle *sub, const char *dialog,
  * Same as ff_ass_add_rect_bprint, but taking an AVBPrint buffer instead of a
  * string, and assuming raw=0.
  */
-int ff_ass_add_rect_bprint(AVSubtitle *sub, const AVBPrint *buf,
+int ff_ass_add_rect_bprint(AVSubtitle *sub, AVBPrint *buf,
                            int ts_start, int duration);
 
 /**
diff --git a/libavcodec/jacosubdec.c b/libavcodec/jacosubdec.c
index e83fada..ef999ca 100644
--- a/libavcodec/jacosubdec.c
+++ b/libavcodec/jacosubdec.c
@@ -162,7 +162,6 @@ static void jacosub_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *src
         if (i == FF_ARRAY_ELEMS(ass_codes_map))
             av_bprintf(dst, "%c", *src++);
     }
-    av_bprintf(dst, "\r\n");
 }
 
 static int jacosub_decode_frame(AVCodecContext *avctx,
diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c
index e65e3fb..15c1a5d 100644
--- a/libavcodec/libzvbi-teletextdec.c
+++ b/libavcodec/libzvbi-teletextdec.c
@@ -101,6 +101,7 @@ static int create_ass_text(TeletextContext *ctx, const char *text, char **ass)
     /* First we escape the plain text into buf. */
     av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
     ff_ass_bprint_text_event(&buf, text, strlen(text), "", 0);
+    av_bprintf(&buf, "\r\n");
 
     if (!av_bprint_is_complete(&buf)) {
         av_bprint_finalize(&buf, NULL);
diff --git a/libavcodec/microdvddec.c b/libavcodec/microdvddec.c
index a605450..b20aac5 100644
--- a/libavcodec/microdvddec.c
+++ b/libavcodec/microdvddec.c
@@ -297,7 +297,6 @@ static int microdvd_decode_frame(AVCodecContext *avctx,
             int ts_duration  = duration != -1 ?
                 av_rescale_q(duration, avctx->time_base, (AVRational){1,100}) : -1;
 
-        av_bprintf(&new_line, "\r\n");
         ret = ff_ass_add_rect_bprint(sub, &new_line, ts_start, ts_duration);
         av_bprint_finalize(&new_line, NULL);
         if (ret < 0)
diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index 208aa46..1c7ffea 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -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;
 }
 
diff --git a/libavcodec/mpl2dec.c b/libavcodec/mpl2dec.c
index 8156d1e..ca95dc8 100644
--- a/libavcodec/mpl2dec.c
+++ b/libavcodec/mpl2dec.c
@@ -59,7 +59,6 @@ static int mpl2_event_to_ass(AVBPrint *buf, const char *p)
         }
     }
 
-    av_bprintf(buf, "\r\n");
     return 0;
 }
 
diff --git a/libavcodec/realtextdec.c b/libavcodec/realtextdec.c
index 23bd9d7..870953b 100644
--- a/libavcodec/realtextdec.c
+++ b/libavcodec/realtextdec.c
@@ -52,7 +52,6 @@ static int rt_event_to_ass(AVBPrint *buf, const char *p)
         }
         p++;
     }
-    av_bprintf(buf, "\r\n");
     return 0;
 }
 
diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c
index b2395a1..7705f93 100644
--- a/libavcodec/samidec.c
+++ b/libavcodec/samidec.c
@@ -104,7 +104,7 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src)
     av_bprint_clear(&sami->full);
     if (sami->source.len)
         av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str);
-    av_bprintf(&sami->full, "%s\r\n", sami->content.str);
+    av_bprintf(&sami->full, "%s", sami->content.str);
 
 end:
     av_free(dupsrc);
diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c
index 54abe5d..6d0c9bb 100644
--- a/libavcodec/srtdec.c
+++ b/libavcodec/srtdec.c
@@ -183,7 +183,6 @@ static void srt_to_ass(AVCodecContext *avctx, AVBPrint *dst,
         dst->len -= 2;
     dst->str[dst->len] = 0;
     rstrip_spaces_buf(dst);
-    av_bprintf(dst, "\r\n");
 }
 
 static int srt_decode_frame(AVCodecContext *avctx,
diff --git a/libavcodec/subviewerdec.c b/libavcodec/subviewerdec.c
index 82cb8cf..a008828 100644
--- a/libavcodec/subviewerdec.c
+++ b/libavcodec/subviewerdec.c
@@ -43,7 +43,6 @@ static int subviewer_event_to_ass(AVBPrint *buf, const char *p)
         }
     }
 
-    av_bprintf(buf, "\r\n");
     return 0;
 }
 
diff --git a/libavcodec/webvttdec.c b/libavcodec/webvttdec.c
index 66f5071..1284a17 100644
--- a/libavcodec/webvttdec.c
+++ b/libavcodec/webvttdec.c
@@ -67,7 +67,6 @@ static int webvtt_event_to_ass(AVBPrint *buf, const char *p)
             av_bprint_chars(buf, *p, 1);
         p++;
     }
-    av_bprintf(buf, "\r\n");
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list