diff mbox series

[FFmpeg-devel,v3,4/4] avocdec/ass: simplify linebreaks

Message ID 20240212020159.6806-5-oneric@oneric.de
State New
Headers show
Series Fix some active sequences in subtitles | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

Oneric Feb. 12, 2024, 2:01 a.m. UTC
ff_ass_subtitle_header_* still used explicit CRLF linebreaks
eventhough they will get normalised to LF later since commit
7bf1b9b35769b37684dd2f18a54f01d852a540c8. Just directly use LF.
---
 libavcodec/ass.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Comments

Marth64 March 11, 2024, 4:41 p.m. UTC | #1
LGTM. sha256 sum of my sample is bit-identical
ab6d14ea8b6ce04f3dd57c0be03bc34a064c9babe439d3882a0797f12c4e9d40
 TEST_ATSC.cc.ass
ab6d14ea8b6ce04f3dd57c0be03bc34a064c9babe439d3882a0797f12c4e9d40
 TEST_ATSC_SimplifyLinebreaks.cc.ass

On Sun, Feb 11, 2024 at 8:02 PM Oneric <oneric@oneric.de> wrote:

> ff_ass_subtitle_header_* still used explicit CRLF linebreaks
> eventhough they will get normalised to LF later since commit
> 7bf1b9b35769b37684dd2f18a54f01d852a540c8. Just directly use LF.
> ---
>  libavcodec/ass.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/libavcodec/ass.c b/libavcodec/ass.c
> index e7a1ac0eb5..927b801404 100644
> --- a/libavcodec/ass.c
> +++ b/libavcodec/ass.c
> @@ -35,15 +35,15 @@ int ff_ass_subtitle_header_full(AVCodecContext *avctx,
>                                  int border_style, int alignment)
>  {
>      avctx->subtitle_header = av_asprintf(
> -             "[Script Info]\r\n"
> -             "; Script generated by FFmpeg/Lavc%s\r\n"
> -             "ScriptType: v4.00+\r\n"
> -             "PlayResX: %d\r\n"
> -             "PlayResY: %d\r\n"
> -             "ScaledBorderAndShadow: yes\r\n"
> -             "YCbCr Matrix: None\r\n"
> -             "\r\n"
> -             "[V4+ Styles]\r\n"
> +             "[Script Info]\n"
> +             "; Script generated by FFmpeg/Lavc%s\n"
> +             "ScriptType: v4.00+\n"
> +             "PlayResX: %d\n"
> +             "PlayResY: %d\n"
> +             "ScaledBorderAndShadow: yes\n"
> +             "YCbCr Matrix: None\n"
> +             "\n"
> +             "[V4+ Styles]\n"
>
>               /* ASS (v4+) header */
>               "Format: Name, "
> @@ -54,7 +54,7 @@ int ff_ass_subtitle_header_full(AVCodecContext *avctx,
>               "Spacing, Angle, "
>               "BorderStyle, Outline, Shadow, "
>               "Alignment, MarginL, MarginR, MarginV, "
> -             "Encoding\r\n"
> +             "Encoding\n"
>
>               "Style: "
>               "Default,"             /* Name */
> @@ -65,11 +65,11 @@ int ff_ass_subtitle_header_full(AVCodecContext *avctx,
>               "0,0,"                 /* Spacing, Angle */
>               "%d,1,0,"              /* BorderStyle, Outline, Shadow */
>               "%d,10,10,10,"         /* Alignment, Margin[LRV] */
> -             "1\r\n"                /* Encoding */
> +             "1\n"                  /* Encoding */
>
> -             "\r\n"
> -             "[Events]\r\n"
> -             "Format: Layer, Start, End, Style, Name, MarginL, MarginR,
> MarginV, Effect, Text\r\n",
> +             "\n"
> +             "[Events]\n"
> +             "Format: Layer, Start, End, Style, Name, MarginL, MarginR,
> MarginV, Effect, Text\n",
>               !(avctx->flags & AV_CODEC_FLAG_BITEXACT) ?
> AV_STRINGIFY(LIBAVCODEC_VERSION) : "",
>               play_res_x, play_res_y, font, font_size,
>               primary_color, secondary_color, outline_color, back_color,
> --
> 2.39.2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/libavcodec/ass.c b/libavcodec/ass.c
index e7a1ac0eb5..927b801404 100644
--- a/libavcodec/ass.c
+++ b/libavcodec/ass.c
@@ -35,15 +35,15 @@  int ff_ass_subtitle_header_full(AVCodecContext *avctx,
                                 int border_style, int alignment)
 {
     avctx->subtitle_header = av_asprintf(
-             "[Script Info]\r\n"
-             "; Script generated by FFmpeg/Lavc%s\r\n"
-             "ScriptType: v4.00+\r\n"
-             "PlayResX: %d\r\n"
-             "PlayResY: %d\r\n"
-             "ScaledBorderAndShadow: yes\r\n"
-             "YCbCr Matrix: None\r\n"
-             "\r\n"
-             "[V4+ Styles]\r\n"
+             "[Script Info]\n"
+             "; Script generated by FFmpeg/Lavc%s\n"
+             "ScriptType: v4.00+\n"
+             "PlayResX: %d\n"
+             "PlayResY: %d\n"
+             "ScaledBorderAndShadow: yes\n"
+             "YCbCr Matrix: None\n"
+             "\n"
+             "[V4+ Styles]\n"
 
              /* ASS (v4+) header */
              "Format: Name, "
@@ -54,7 +54,7 @@  int ff_ass_subtitle_header_full(AVCodecContext *avctx,
              "Spacing, Angle, "
              "BorderStyle, Outline, Shadow, "
              "Alignment, MarginL, MarginR, MarginV, "
-             "Encoding\r\n"
+             "Encoding\n"
 
              "Style: "
              "Default,"             /* Name */
@@ -65,11 +65,11 @@  int ff_ass_subtitle_header_full(AVCodecContext *avctx,
              "0,0,"                 /* Spacing, Angle */
              "%d,1,0,"              /* BorderStyle, Outline, Shadow */
              "%d,10,10,10,"         /* Alignment, Margin[LRV] */
-             "1\r\n"                /* Encoding */
+             "1\n"                  /* Encoding */
 
-             "\r\n"
-             "[Events]\r\n"
-             "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n",
+             "\n"
+             "[Events]\n"
+             "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n",
              !(avctx->flags & AV_CODEC_FLAG_BITEXACT) ? AV_STRINGIFY(LIBAVCODEC_VERSION) : "",
              play_res_x, play_res_y, font, font_size,
              primary_color, secondary_color, outline_color, back_color,