From 0bb0e6ed99d5a4200cc89fc6e8b3013c70465402 Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Mon, 5 Jun 2023 10:13:15 +0200
Subject: [PATCH] StreamProcessor: fixed embedded ASS decoding

Seems embeded ASS subtitle format got changed in FFmpeg 6. Haven't found
any references to it tho, so this might still be borked in some cases.
---
 src/streamprocessor/streamprocessor.cpp | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/streamprocessor/streamprocessor.cpp b/src/streamprocessor/streamprocessor.cpp
index b759b0d3..1e883780 100644
--- a/src/streamprocessor/streamprocessor.cpp
+++ b/src/streamprocessor/streamprocessor.cpp
@@ -537,11 +537,10 @@ StreamProcessor::processText()
 				case SUBTITLE_ASS: {
 #if 1
 					const char *assText = sub->ass;
-					if(strncmp("Dialogue", assText, 8) != 0)
-						break;
-
+					// FIXME: did ass format change with ffmpeg6? can't find any references
+					const int textLocation = strncmp("Dialogue", assText, 8) ? 8 : 9;
 					// Dialogue: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-					for(int c = 9; c && *assText; assText++) {
+					for(int c = textLocation; c && *assText; assText++) {
 						if(*assText == ',')
 							c--;
 					}
@@ -550,7 +549,7 @@ StreamProcessor::processText()
 										  "{\\c&H0000ff&}red {\\c&H00ff00&}green {\\c&Hff0000&}blue{\\r}\\n"
 										  "Another {\\b100}bold\\h{\\i1}bolditalic{\\b0\\i0} some{\\anidfsd} unsupported tag";
 #endif
-					QString assChunk(assText);
+					QString assChunk = QString::fromUtf8(assText);
 
 					assChunk
 							.replace(QStringLiteral("\\N"), QStringLiteral("\n"))
-- 
GitLab

