From 6da82c0172c33e8c23ab78f9f231096d7d53a8ae Mon Sep 17 00:00:00 2001 From: kinddragon Date: Wed, 26 May 2010 01:56:33 +0000 Subject: Bug with PGS subtitles finally fixed (ticket #455) git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1948 10f7b99b-c216-0410-bff0-8a66a9350fd8 --- src/DSUtil/DSUtil.cpp | 16 +++++++++++++--- src/DSUtil/DSUtil.h | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src/DSUtil') diff --git a/src/DSUtil/DSUtil.cpp b/src/DSUtil/DSUtil.cpp index aff89b0cc..845dad8a7 100644 --- a/src/DSUtil/DSUtil.cpp +++ b/src/DSUtil/DSUtil.cpp @@ -992,14 +992,24 @@ void memsetd(void* dst, unsigned int c, size_t nbytes) switch(n - o) { case 3: - ((DWORD*)dst)[n + 2] = c; + ((DWORD*)dst)[o + 2] = c; case 2: - ((DWORD*)dst)[n + 1] = c; + ((DWORD*)dst)[o + 1] = c; case 1: - ((DWORD*)dst)[n + 0] = c; + ((DWORD*)dst)[o + 0] = c; } } +void memsetw(void* dst, unsigned short c, size_t nbytes) +{ + memsetd(dst, c << 16 | c, nbytes); + + size_t n = nbytes / 2; + size_t o = (n / 2) * 2; + if ((n - o) == 1) + ((WORD*)dst)[o] = c; +} + bool ExtractBIH(const AM_MEDIA_TYPE* pmt, BITMAPINFOHEADER* bih) { if(pmt && bih) diff --git a/src/DSUtil/DSUtil.h b/src/DSUtil/DSUtil.h index eb9cde17e..aa439cafa 100644 --- a/src/DSUtil/DSUtil.h +++ b/src/DSUtil/DSUtil.h @@ -71,6 +71,7 @@ extern bool GetKeyFrames(CString fn, CUIntArray& kfs); extern DVD_HMSF_TIMECODE RT2HMSF(REFERENCE_TIME rt, double fps = 0); extern REFERENCE_TIME HMSF2RT(DVD_HMSF_TIMECODE hmsf, double fps = 0); extern void memsetd(void* dst, unsigned int c, size_t nbytes); +extern void memsetw(void* dst, unsigned short c, size_t nbytes); extern bool ExtractBIH(const AM_MEDIA_TYPE* pmt, BITMAPINFOHEADER* bih); extern bool ExtractBIH(IMediaSample* pMS, BITMAPINFOHEADER* bih); extern bool ExtractAvgTimePerFrame(const AM_MEDIA_TYPE* pmt, REFERENCE_TIME& rtAvgTimePerFrame); -- cgit v1.2.3