Commit c669af0f authored by Clément Bœsch's avatar Clément Bœsch

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

parent 3d258696
......@@ -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");
}
......@@ -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);
/**
......
......@@ -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,
......
......@@ -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);
......
......@@ -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)
......
......@@ -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;
}
......
......@@ -59,7 +59,6 @@ static int mpl2_event_to_ass(AVBPrint *buf, const char *p)
}
}
av_bprintf(buf, "\r\n");
return 0;
}
......
......@@ -52,7 +52,6 @@ static int rt_event_to_ass(AVBPrint *buf, const char *p)
}
p++;
}
av_bprintf(buf, "\r\n");
return 0;
}
......
......@@ -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);
......
......@@ -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,
......
......@@ -43,7 +43,6 @@ static int subviewer_event_to_ass(AVBPrint *buf, const char *p)
}
}
av_bprintf(buf, "\r\n");
return 0;
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment