diff options
author | Aleksoid1978 <aleksoid@users.sourceforge.dot.net> | 2013-06-18 23:58:43 +0400 |
---|---|---|
committer | Underground78 <underground78@users.sourceforge.net> | 2013-06-19 00:10:45 +0400 |
commit | 0d31965a98684ffe01c42a15a40a30c8388f7d3d (patch) | |
tree | c14034b1a0e49b15a04e3b8148f1afab3b0f11a7 | |
parent | 6ceb064b030ebbbb33adbab346733be0ed39a872 (diff) |
VobSubFile: Fixed creation of a custom palette with Matroska
Fixes rendering of vobsubs in Matroska when the custom colors
feature was enabled.
Backport of MPC-BE commit 1995
-rw-r--r-- | src/Subtitles/VobSubFile.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Subtitles/VobSubFile.cpp b/src/Subtitles/VobSubFile.cpp index 76e3417e1..1b49a165a 100644 --- a/src/Subtitles/VobSubFile.cpp +++ b/src/Subtitles/VobSubFile.cpp @@ -2373,20 +2373,27 @@ void CVobSubStream::Open(CString name, BYTE* pData, int len) if (sl.GetCount() == 3) {
sl.RemoveHead();
CAtlList<CString> tridx, colors;
+
Explode(sl.RemoveHead(), tridx, ':', 2);
+ int _tridx = 1;
if (tridx.RemoveHead() == _T("tridx")) {
TCHAR tr[4];
_stscanf_s(tridx.RemoveHead(), _T("%c%c%c%c"), &tr[0], 1, &tr[1], 1, &tr[2], 1, &tr[3], 1);
for (size_t i = 0; i < 4; i++) {
- m_tridx |= ((tr[i] == '1') ? 1 : 0) << i;
+ _tridx |= ((tr[i] == '1') ? 1 : 0) << i;
}
}
+
Explode(sl.RemoveHead(), colors, ':', 2);
if (colors.RemoveHead() == _T("colors")) {
Explode(colors.RemoveHead(), colors, ',', 4);
+
+ RGBQUAD pal[4];
for (size_t i = 0; i < 4 && colors.GetCount(); i++) {
- *(DWORD*)&m_cuspal[i] = _tcstol(colors.RemoveHead(), nullptr, 16);
+ *(DWORD*)&pal[i] = _tcstol(colors.RemoveHead(), nullptr, 16);
}
+
+ SetCustomPal(pal, _tridx);
}
}
}
|