Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: change new lines to \n in ASS header
@ 2024-05-10 20:30 Kacper Michajłow
  2024-05-10 20:30 ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/libaribcaption: " Kacper Michajłow
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kacper Michajłow @ 2024-05-10 20:30 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Kacper Michajłow

Fixes remaining \r\n is ASS header after 57c545090d.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libavcodec/libaribb24.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/libaribb24.c b/libavcodec/libaribb24.c
index 009c995ded..0e4fa9935c 100644
--- a/libavcodec/libaribb24.c
+++ b/libavcodec/libaribb24.c
@@ -96,13 +96,13 @@ static int libaribb24_generate_ass_header(AVCodecContext *avctx)
     font_size = get_profile_font_size(avctx);
 
     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"
-             "\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"
+             "\n"
+             "[V4+ Styles]\n"
 
              /* ASSv4 header */
              "Format: Name, "
@@ -113,7 +113,7 @@ static int libaribb24_generate_ass_header(AVCodecContext *avctx)
              "Spacing, Angle, "
              "BorderStyle, Outline, Shadow, "
              "Alignment, MarginL, MarginR, MarginV, "
-             "Encoding\r\n"
+             "Encoding\n"
 
              "Style: "
              "Default,"             /* Name */
@@ -124,11 +124,11 @@ static int libaribb24_generate_ass_header(AVCodecContext *avctx)
              "0,0,"                 /* Spacing, Angle */
              "%d,1,0,"              /* BorderStyle, Outline, Shadow */
              "%d,10,10,10,"         /* Alignment, Margin[LRV] */
-             "0\r\n"                /* Encoding */
+             "0\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) : "",
              plane_width, plane_height,
              ASS_DEFAULT_FONT, font_size, ASS_DEFAULT_COLOR,
-- 
2.43.0

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH v2 2/3] avcodec/libaribcaption: change new lines to \n in ASS header
  2024-05-10 20:30 [FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: change new lines to \n in ASS header Kacper Michajłow
@ 2024-05-10 20:30 ` Kacper Michajłow
  2024-05-10 20:30 ` [FFmpeg-devel] [PATCH v2 3/3] avcodec/libzvbi-teletextdec: " Kacper Michajłow
  2024-08-08 22:03 ` [FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: " Jan Ekström
  2 siblings, 0 replies; 5+ messages in thread
From: Kacper Michajłow @ 2024-05-10 20:30 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Kacper Michajłow

Fixes remaining \r\n is ASS header after 57c545090d.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libavcodec/libaribcaption.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c
index 0b67d41772..46a2a591c5 100644
--- a/libavcodec/libaribcaption.c
+++ b/libavcodec/libaribcaption.c
@@ -522,14 +522,14 @@ static int set_ass_header(ARIBCaptionContext *ctx)
 
     av_freep(&avctx->subtitle_header);
     avctx->subtitle_header = av_asprintf(
-            "[Script Info]\r\n"
-            "ScriptType: v4.00+\r\n"
-            "PlayResX: %d\r\n"
-            "PlayResY: %d\r\n"
-            "WrapStyle: 2\r\n"      /* 2: no word wrapping */
-            "\r\n"
-
-            "[V4+ Styles]\r\n"
+            "[Script Info]\n"
+            "ScriptType: v4.00+\n"
+            "PlayResX: %d\n"
+            "PlayResY: %d\n"
+            "WrapStyle: 2\n"        /* 2: no word wrapping */
+            "\n"
+
+            "[V4+ Styles]\n"
              "Format: Name, "
              "Fontname, Fontsize, "
              "PrimaryColour, SecondaryColour, OutlineColour, BackColour, "
@@ -538,7 +538,7 @@ static int set_ass_header(ARIBCaptionContext *ctx)
              "Spacing, Angle, "
              "BorderStyle, Outline, Shadow, "
              "Alignment, MarginL, MarginR, MarginV, "
-             "Encoding\r\n"
+             "Encoding\n"
 
              "Style: "
              "Default,"             /* Name */
@@ -549,11 +549,11 @@ static int set_ass_header(ARIBCaptionContext *ctx)
              "0,0,"                 /* Spacing, Angle */
              "%d,%d,%d,"            /* BorderStyle, Outline, Shadow */
              "%d,10,10,10,"         /* Alignment, Margin[LRV] */
-             "0\r\n"                /* Encoding */
-             "\r\n"
+             "0\n"                  /* Encoding */
+             "\n"
 
-             "[Events]\r\n"
-             "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n",
+             "[Events]\n"
+             "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n",
             ctx->plane_width, ctx->plane_height,
             font_name, ctx->font_size,
             ASS_DEFAULT_COLOR, ASS_DEFAULT_COLOR,
-- 
2.43.0

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH v2 3/3] avcodec/libzvbi-teletextdec: change new lines to \n in ASS header
  2024-05-10 20:30 [FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: change new lines to \n in ASS header Kacper Michajłow
  2024-05-10 20:30 ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/libaribcaption: " Kacper Michajłow
@ 2024-05-10 20:30 ` Kacper Michajłow
  2024-08-08 22:03 ` [FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: " Jan Ekström
  2 siblings, 0 replies; 5+ messages in thread
From: Kacper Michajłow @ 2024-05-10 20:30 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Kacper Michajłow

Fixes remaining \r\n is ASS header after 57c545090d.

Fixes AVERROR_BUG error during init as this decoder expected `\r\n` in
default ASS header. strstr(..., "\r\n[Events]\r\n") failed after changes
in 57c545090d.

Fixes: 57c545090d
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libavcodec/libzvbi-teletextdec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c
index 68ffe1f76c..e02ecb8b3a 100644
--- a/libavcodec/libzvbi-teletextdec.c
+++ b/libavcodec/libzvbi-teletextdec.c
@@ -91,7 +91,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx)
     if (ret < 0)
         return ret;
 
-    event_pos = strstr(avctx->subtitle_header, "\r\n[Events]\r\n");
+    event_pos = strstr(avctx->subtitle_header, "\n[Events]\n");
     if (!event_pos)
         return AVERROR_BUG;
 
@@ -106,7 +106,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx)
         "0,0,"                 /* Spacing, Angle */
         "3,0.1,0,"             /* BorderStyle, Outline, Shadow */
         "5,1,1,1,"             /* Alignment, Margin[LRV] */
-        "0\r\n"                /* Encoding */
+        "0\n"                  /* Encoding */
         "Style: "
         "Subtitle,"            /* Name */
         "Monospace,16,"        /* Font{name,size} */
@@ -116,7 +116,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx)
         "0,0,"                 /* Spacing, Angle */
         "1,1,1,"               /* BorderStyle, Outline, Shadow */
         "8,48,48,20,"          /* Alignment, Margin[LRV] */
-        "0\r\n"                /* Encoding */
+        "0\n"                  /* Encoding */
         , event_pos);
 
     if (!new_header)
-- 
2.43.0

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: change new lines to \n in ASS header
  2024-05-10 20:30 [FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: change new lines to \n in ASS header Kacper Michajłow
  2024-05-10 20:30 ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/libaribcaption: " Kacper Michajłow
  2024-05-10 20:30 ` [FFmpeg-devel] [PATCH v2 3/3] avcodec/libzvbi-teletextdec: " Kacper Michajłow
@ 2024-08-08 22:03 ` Jan Ekström
  2024-08-09  0:38   ` Kacper Michajlow
  2 siblings, 1 reply; 5+ messages in thread
From: Jan Ekström @ 2024-08-08 22:03 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Fri, May 10, 2024 at 11:31 PM Kacper Michajłow <kasper93@gmail.com> wrote:
>
> Fixes remaining \r\n is ASS header after 57c545090d.
>
> Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
> ---

With an initial look this set looks good. If I understand correctly,
the generic ASS encoder moved to outputting LF only in
7bf1b9b35769b37684dd2f18a54f01d852a540c8 and thus these modules which
still output manual headers with CRLF cause mismatching endlines
within a single document.

Set still applies. Will try to give this a proper look and verify
tomorrow, and then pull this in if it indeed does what it seems to do.

Jan
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: change new lines to \n in ASS header
  2024-08-08 22:03 ` [FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: " Jan Ekström
@ 2024-08-09  0:38   ` Kacper Michajlow
  0 siblings, 0 replies; 5+ messages in thread
From: Kacper Michajlow @ 2024-08-09  0:38 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Fri, 9 Aug 2024 at 00:04, Jan Ekström <jeebjp@gmail.com> wrote:
>
> On Fri, May 10, 2024 at 11:31 PM Kacper Michajłow <kasper93@gmail.com> wrote:
> >
> > Fixes remaining \r\n is ASS header after 57c545090d.
> >
> > Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
> > ---
>
> With an initial look this set looks good. If I understand correctly,
> the generic ASS encoder moved to outputting LF only in
> 7bf1b9b35769b37684dd2f18a54f01d852a540c8 and thus these modules which
> still output manual headers with CRLF cause mismatching endlines
> within a single document.

This patchest indeed fixes mismatched endlines, but the main thing it fixes is
libzvbi_teletextdec converter which currently always returns
AVERROR_BUG, because default style no longer matches (after 7bf1b9b35)
the `strstr` expectation.
https://github.com/FFmpeg/FFmpeg/blob/c390234da2e3c7a8884f5592f0b9b4928c482b3e/libavcodec/libzvbi-teletextdec.c#L94

    event_pos = strstr(avctx->subtitle_header, "\r\n[Events]\r\n");
    if (!event_pos)
        return AVERROR_BUG;

- Kacper
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-09  0:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-10 20:30 [FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: change new lines to \n in ASS header Kacper Michajłow
2024-05-10 20:30 ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/libaribcaption: " Kacper Michajłow
2024-05-10 20:30 ` [FFmpeg-devel] [PATCH v2 3/3] avcodec/libzvbi-teletextdec: " Kacper Michajłow
2024-08-08 22:03 ` [FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: " Jan Ekström
2024-08-09  0:38   ` Kacper Michajlow

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git