From f3a834d8f657afa9ba6f5c63535cecc323aa660b Mon Sep 17 00:00:00 2001 From: Cyberbeing Date: Sat, 6 Dec 2014 11:11:36 -0800 Subject: [PATCH] Partial fix for VOBSUB with alpha not being displayed Backport of MPC-BE commit 1459 --- src/subtitles/VobSubImage.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/subtitles/VobSubImage.cpp b/src/subtitles/VobSubImage.cpp index 7bc9f4b63..95134191b 100644 --- a/src/subtitles/VobSubImage.cpp +++ b/src/subtitles/VobSubImage.cpp @@ -98,6 +98,12 @@ bool CVobSubImage::Decode(BYTE* lpData, int packetsize, int datasize, int end0 = nOffset[1]; int end1 = datasize; + // fixme: support vobsub animation + if (nOffset[0] > nOffset[1]) { + end1 = nOffset[0]; + end0 = datasize; + } + while((nPlane == 0 && nOffset[0] < end0) || (nPlane == 1 && nOffset[1] < end1)) { DWORD code; @@ -186,7 +192,11 @@ void CVobSubImage::GetPacketInfo(BYTE* lpData, int packetsize, int datasize) pal = (lpData[i] << 8) | lpData[i+1]; i += 2; break; case 0x04: - tr = (lpData[i] << 8) | lpData[i+1]; i += 2; + if (lpData[i] || lpData[i+1]) { + tr = (lpData[i] << 8) | lpData[i+1]; + } + + i += 2; //tr &= 0x00f0; break; case 0x05: