diff options
96 files changed, 956 insertions, 816 deletions
diff --git a/src/DSUtil/DSUtil.cpp b/src/DSUtil/DSUtil.cpp index 845dad8a7..0f6aaf716 100644 --- a/src/DSUtil/DSUtil.cpp +++ b/src/DSUtil/DSUtil.cpp @@ -1377,7 +1377,9 @@ HRESULT LoadExternalObject(LPCTSTR path, REFCLSID clsid, REFIID iid, void** ppv) HRESULT hr = E_FAIL;
- if(hInst || (hInst = CoLoadLibrary(CComBSTR(fullpath), TRUE)))
+ if(!hInst)
+ hInst = CoLoadLibrary(CComBSTR(fullpath), TRUE);
+ if(hInst)
{
typedef HRESULT (__stdcall * PDllGetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID* ppv);
PDllGetClassObject p = (PDllGetClassObject)GetProcAddress(hInst, "DllGetClassObject");
@@ -2066,7 +2068,7 @@ static struct {LPCSTR name, iso6392, iso6391; LCID lcid;} s_isolangs[] = // TODO {"Haitian", "hat", "ht"},
{"Kalmyk", "xal", ""},
{"", "", ""},
- {"No subtitles", "---", "", LCID_NOSUBTITLES},
+ {"No subtitles", "---", "", (LCID)LCID_NOSUBTITLES},
};
CString ISO6391ToLanguage(LPCSTR code)
@@ -2401,7 +2403,7 @@ LPCTSTR GetDXVAMode(const GUID* guidDecoder) void DumpBuffer(BYTE* pBuffer, int nSize)
{
CString strMsg;
- int nPos;
+ int nPos = 0;
strMsg.AppendFormat (L"Size : %d\n", nSize);
for (int i=0; i<3; i++)
{
diff --git a/src/DSUtil/deinterlace.cpp b/src/DSUtil/deinterlace.cpp index 1a7b47da0..3f2615d94 100644 --- a/src/DSUtil/deinterlace.cpp +++ b/src/DSUtil/deinterlace.cpp @@ -307,7 +307,7 @@ static void asm_blend_row(void *dst0, const void *src0, uint32 w, ptrdiff_t srcp void nela_L8_SSE2(__m128i *dst, const __m128i *elabuf, int w16) {
__m128i zero = _mm_setzero_si128();
- __m128i x80b = _mm_set1_epi8((char)0x80);
+ __m128i x80b = _mm_set1_epi8((unsigned char)0x80);
do {
__m128i x0, x1, x2, y;
diff --git a/src/SubPic/MemSubPic.cpp b/src/SubPic/MemSubPic.cpp index 58c3f1071..5463715ff 100644 --- a/src/SubPic/MemSubPic.cpp +++ b/src/SubPic/MemSubPic.cpp @@ -603,8 +603,6 @@ STDMETHODIMP CMemSubPic::AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget) dst.pitchUV = dst.pitch/2;
}
- int sizep4 = dst.pitchUV*dst.h/2;
-
BYTE* ss[2];
ss[0] = (BYTE*)src.bits + src.pitch*rs.top + rs.left*4;
ss[1] = ss[0] + 4;
diff --git a/src/apps/mplayerc/EditListEditor.cpp b/src/apps/mplayerc/EditListEditor.cpp index acaa863f6..f519d5f7d 100644 --- a/src/apps/mplayerc/EditListEditor.cpp +++ b/src/apps/mplayerc/EditListEditor.cpp @@ -226,7 +226,7 @@ void CEditListEditor::OpenFile(LPCTSTR lpFileName) m_bFileOpen = true;
while (EditListFile.ReadString(strLine))
{
- int nPos = 0;
+ //int nPos = 0;
CString strIn; // = strLine.Tokenize(_T(" \t"), nPos);
CString strOut; // = strLine.Tokenize(_T(" \t"), nPos);
CString strName; // = strLine.Tokenize(_T(" \t"), nPos);
diff --git a/src/apps/mplayerc/PPageInternalFilters.cpp b/src/apps/mplayerc/PPageInternalFilters.cpp index f4583ead4..4ef162637 100644 --- a/src/apps/mplayerc/PPageInternalFilters.cpp +++ b/src/apps/mplayerc/PPageInternalFilters.cpp @@ -326,8 +326,6 @@ void CPPageInternalFiltersListBox::OnRButtonDown(UINT nFlags, CPoint point) if (id == 0)
return;
- AppSettings& s = AfxGetAppSettings();
-
int Index = 0;
for(int i = 0; i < countof(s_filters); i++)
{
diff --git a/src/common.vsprops b/src/common.vsprops index 416ac067a..214c9004f 100644 --- a/src/common.vsprops +++ b/src/common.vsprops @@ -12,7 +12,7 @@ PreprocessorDefinitions="WINVER=0x0600"
EnableFunctionLevelLinking="true"
WarningLevel="3"
- DisableSpecificWarnings="4239;4510;4610"
+ DisableSpecificWarnings="4127;4211;4239;4510;4512;4610"
/>
<Tool
Name="VCLibrarianTool"
diff --git a/src/decss/DeCSSInputPin.cpp b/src/decss/DeCSSInputPin.cpp index 87f51e6d4..cb28f9c3e 100644 --- a/src/decss/DeCSSInputPin.cpp +++ b/src/decss/DeCSSInputPin.cpp @@ -65,8 +65,6 @@ STDMETHODIMP CDeCSSInputPin::Receive(IMediaSample* pSample) BYTE* p = NULL;
if(SUCCEEDED(pSample->GetPointer(&p)) && len > 0)
{
- BYTE* base = p;
-
if(m_mt.majortype == MEDIATYPE_DVD_ENCRYPTED_PACK && len == 2048 && (p[0x14]&0x30))
{
CSSdescramble(p, m_TitleKey);
diff --git a/src/decss/VobDec.cpp b/src/decss/VobDec.cpp index 592a6a2f2..09c89ccd9 100644 --- a/src/decss/VobDec.cpp +++ b/src/decss/VobDec.cpp @@ -127,7 +127,7 @@ int CVobDec::FindLfsr(const BYTE *crypt, int offset, const BYTE *plain) bool CVobDec::FindKey(BYTE* buff)
{
BYTE plain[7] = {0x00, 0x00, 0x01, 0xBE, 0x00, 0x00, 0xFF};
- int offset, left, flag = 0, block = 0, count, maxblock = 20000;
+ int offset, left, flag = 0, count;
m_fFoundKey = false;
diff --git a/src/decss/VobFile.cpp b/src/decss/VobFile.cpp index 1e043db59..8428f220a 100644 --- a/src/decss/VobFile.cpp +++ b/src/decss/VobFile.cpp @@ -60,6 +60,7 @@ bool CDVDSession::BeginSession() {
Close();
DWORD err = GetLastError();
+ UNUSED_ALWAYS(err);
return(false);
}
}
@@ -255,6 +256,7 @@ bool CDVDSession::ReadKey(DVD_KEY_TYPE KeyType, BYTE* pKeyData, int lba) if(!DeviceIoControl(m_hDrive, IOCTL_DVD_READ_KEY, key, key->KeyLength, key, key->KeyLength, &BytesReturned, NULL))
{
DWORD err = GetLastError();
+ UNUSED_ALWAYS(err);
return(false);
}
diff --git a/src/filters/BaseClasses/outputq.cpp b/src/filters/BaseClasses/outputq.cpp index d3ab6175e..63bd5c898 100644 --- a/src/filters/BaseClasses/outputq.cpp +++ b/src/filters/BaseClasses/outputq.cpp @@ -205,8 +205,8 @@ DWORD COutputQueue::ThreadProc() while (TRUE) {
BOOL bWait = FALSE;
IMediaSample *pSample;
- LONG lNumberToSend; // Local copy
- NewSegmentPacket* ppacket;
+ LONG lNumberToSend = 0; // Local copy
+ NewSegmentPacket* ppacket = NULL;
//
// Get a batch of samples and send it if possible
diff --git a/src/filters/BaseClasses/pullpin.cpp b/src/filters/BaseClasses/pullpin.cpp index a197ba58a..2ad43cd0c 100644 --- a/src/filters/BaseClasses/pullpin.cpp +++ b/src/filters/BaseClasses/pullpin.cpp @@ -11,6 +11,8 @@ #include <streams.h>
#include "pullpin.h"
+#define UNUSED_ALWAYS(x) x
+
#ifdef DXMPERF
#include "dxmperf.h"
#endif // DXMPERF
@@ -578,6 +580,7 @@ CPullPin::CleanupCancelled(void) 0, // no wait
&pSample,
&dwUnused);
+ UNUSED_ALWAYS(hr);
if(pSample) {
pSample->Release();
} else {
diff --git a/src/filters/BaseClasses/schedule.cpp b/src/filters/BaseClasses/schedule.cpp index 1b4a38190..5611185c9 100644 --- a/src/filters/BaseClasses/schedule.cpp +++ b/src/filters/BaseClasses/schedule.cpp @@ -117,24 +117,28 @@ HRESULT CAMSchedule::Unadvise(DWORD_PTR dwAdviseCookie) CAdvisePacket * p_prev = &head;
CAdvisePacket * p_n;
m_Serialize.Lock();
- while ( p_n = p_prev->Next() ) // The Next() method returns NULL when it hits z
+ p_n = p_prev->Next();
+ while ( p_n ) // The Next() method returns NULL when it hits z
{
if ( p_n->m_dwAdviseCookie == dwAdviseCookie )
{
Delete( p_prev->RemoveNext() );
--m_dwAdviseCount;
hr = S_OK;
- // Having found one cookie that matches, there should be no more
- #ifdef _DEBUG
- while (p_n = p_prev->Next())
- {
- ASSERT(p_n->m_dwAdviseCookie != dwAdviseCookie);
- p_prev = p_n;
- }
- #endif
+ // Having found one cookie that matches, there should be no more
+#ifdef _DEBUG
+ p_n = p_prev->Next();
+ while (p_n)
+ {
+ ASSERT(p_n->m_dwAdviseCookie != dwAdviseCookie);
+ p_prev = p_n;
+ p_n = p_prev->Next();
+ }
+#endif
break;
}
p_prev = p_n;
+ p_n = p_prev->Next();
};
m_Serialize.Unlock();
return hr;
diff --git a/src/filters/BaseClasses/videoctl.cpp b/src/filters/BaseClasses/videoctl.cpp index b12ccbd37..c75a813e6 100644 --- a/src/filters/BaseClasses/videoctl.cpp +++ b/src/filters/BaseClasses/videoctl.cpp @@ -603,7 +603,6 @@ HRESULT CLoadDirectDraw::LoadDirectDraw(__in LPSTR szDevice) PDRAWCREATE pDrawCreate;
PDRAWENUM pDrawEnum;
LPDIRECTDRAWENUMERATEEXA pDrawEnumEx;
- HRESULT hr = NOERROR;
NOTE("Entering DoLoadDirectDraw");
diff --git a/src/filters/BaseClasses/winutil.cpp b/src/filters/BaseClasses/winutil.cpp index e5a63cc02..2648da5fa 100644 --- a/src/filters/BaseClasses/winutil.cpp +++ b/src/filters/BaseClasses/winutil.cpp @@ -13,6 +13,8 @@ #include <strsafe.h>
#include <checkbmi.h>
+#define UNUSED_ALWAYS(x) x
+
static UINT MsgDestroy;
// Constructor
@@ -556,8 +558,10 @@ HRESULT CBaseWindow::InitialiseWindow(HWND hwnd) if (m_bDoGetDC)
{
- EXECUTE_ASSERT(m_hdc = GetDC(hwnd));
- EXECUTE_ASSERT(m_MemoryDC = CreateCompatibleDC(m_hdc));
+ m_hdc = GetDC(hwnd);
+ EXECUTE_ASSERT(m_hdc);
+ m_MemoryDC = CreateCompatibleDC(m_hdc);
+ EXECUTE_ASSERT(m_MemoryDC);
EXECUTE_ASSERT(SetStretchBltMode(m_hdc,COLORONCOLOR));
EXECUTE_ASSERT(SetStretchBltMode(m_MemoryDC,COLORONCOLOR));
@@ -2445,6 +2449,7 @@ HRESULT CImageDisplay::UpdateFormat(__inout VIDEOINFO *pVideoInfo) ASSERT(pVideoInfo);
BITMAPINFOHEADER *pbmi = HEADER(pVideoInfo);
+ UNUSED_ALWAYS(pbmi);
SetRectEmpty(&pVideoInfo->rcSource);
SetRectEmpty(&pVideoInfo->rcTarget);
@@ -2676,7 +2681,8 @@ STDAPI ConvertVideoInfoToVideoInfo2(__inout AM_MEDIA_TYPE *pmt) if (NULL == pmt->pbFormat || pmt->cbFormat < sizeof(VIDEOINFOHEADER)) {
return E_INVALIDARG;
}
- VIDEOINFO *pVideoInfo = (VIDEOINFO *)pmt->pbFormat;
+ VIDEOINFO *pVideoInfo = (VIDEOINFO *)pmt->pbFormat;
+ UNUSED_ALWAYS(pVideoInfo);
DWORD dwNewSize;
HRESULT hr = DWordAdd(pmt->cbFormat, sizeof(VIDEOINFOHEADER2) - sizeof(VIDEOINFOHEADER), &dwNewSize);
if (FAILED(hr)) {
diff --git a/src/filters/BaseClasses/wxutil.cpp b/src/filters/BaseClasses/wxutil.cpp index 271f68da0..ad086d10b 100644 --- a/src/filters/BaseClasses/wxutil.cpp +++ b/src/filters/BaseClasses/wxutil.cpp @@ -55,7 +55,7 @@ BOOL CAMMsgEvent::WaitMsg(DWORD dwTimeout) // timeout (in MS) to expire. allow SENT messages
// to be processed while we wait
DWORD dwWait;
- DWORD dwStartTime;
+ DWORD dwStartTime = 0;
// set the waiting period.
DWORD dwWaitTime = dwTimeout;
@@ -512,7 +512,6 @@ bool CCritSec::TryLock() {
UINT tracelevel=3;
DWORD us = GetCurrentThreadId();
- DWORD currentOwner = m_currentOwner;
BOOL bSuccess = TryEnterCriticalSection(&m_CritSec);
if (bSuccess)
{
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp index c4fff1a35..4ed4217d6 100644 --- a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp +++ b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp @@ -414,8 +414,8 @@ DWORD CMatroskaMuxerFilter::ThreadProc() Reply(S_OK);
Cue cue;
- ULONGLONG lastcueclusterpos = -1;
- INT64 lastcuetimecode = -1;
+ ULONGLONG lastcueclusterpos = (ULONGLONG)-1;
+ INT64 lastcuetimecode = (INT64)-1;
UINT64 nBlocksInCueTrack = 0;
while(!CheckRequest(NULL))
@@ -582,7 +582,6 @@ TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n") c.Write(pStream);
}
- ULONGLONG cuepos = 0;
if(!cue.CuePoints.IsEmpty())
{
sh.Attach(DNew SeekHead());
diff --git a/src/filters/parser/AviSplitter/AviFile.cpp b/src/filters/parser/AviSplitter/AviFile.cpp index 7b610a505..315a03741 100644 --- a/src/filters/parser/AviSplitter/AviFile.cpp +++ b/src/filters/parser/AviSplitter/AviFile.cpp @@ -31,6 +31,7 @@ HRESULT CAviFile::Init() m_isamv = (dw[2] == FCC('AMV '));
Seek(0);
HRESULT hr = Parse(0, GetLength());
+ UNUSED_ALWAYS(hr);
if(m_movis.GetCount() == 0) // FAILED(hr) is allowed as long as there was a movi chunk found
return E_FAIL;
@@ -304,7 +305,7 @@ HRESULT CAviFile::BuildIndex() {
EmptyIndex();
- int nSuperIndexes = 0;
+ DWORD nSuperIndexes = 0;
for(int i = 0; i < (int)m_avih.dwStreams; i++)
{
@@ -352,7 +353,7 @@ HRESULT CAviFile::BuildIndex() return E_FAIL;
}
- for(int k = 0, l = 0; k < (int)p->nEntriesInUse; k++)
+ for(int k = 0; k < (int)p->nEntriesInUse; k++)
{
s->cs[frame].size = size;
s->cs[frame].filepos = p->qwBaseOffset + p->aIndex[k].dwOffset;
@@ -398,7 +399,7 @@ HRESULT CAviFile::BuildIndex() DWORD frame = 0;
UINT64 size = 0;
- for(int j = 0, k = 0; j < len; j++)
+ for(int j = 0; j < len; j++)
{
DWORD TrackNumber = TRACKNUM(idx->aIndex[j].dwChunkId);
@@ -473,7 +474,7 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) {
UINT64 fpmin = _I64_MAX;
- DWORD n = -1;
+ DWORD n = (DWORD)-1;
for(int i = 0; i < (int)m_avih.dwStreams; i++)
{
int curchunk = curchunks[i];
@@ -502,7 +503,7 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
- strm_t::chunk2 cs2last = {-1, 0};
+ strm_t::chunk2 cs2last = {(DWORD)-1, 0};
bool fInterleaved = true;
diff --git a/src/filters/parser/AviSplitter/AviReportWnd.cpp b/src/filters/parser/AviSplitter/AviReportWnd.cpp index 95a20c668..f9489f566 100644 --- a/src/filters/parser/AviSplitter/AviReportWnd.cpp +++ b/src/filters/parser/AviSplitter/AviReportWnd.cpp @@ -262,7 +262,7 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) DWORD* curchunks = DNew DWORD[pAF->m_avih.dwStreams];
memset(curchunks, 0, sizeof(DWORD)*pAF->m_avih.dwStreams);
- CAviFile::strm_t::chunk2 cs2last = {-1, 0};
+ CAviFile::strm_t::chunk2 cs2last = {(DWORD)-1, 0};
while(1)
{
diff --git a/src/filters/parser/AviSplitter/AviSplitter.cpp b/src/filters/parser/AviSplitter/AviSplitter.cpp index 4c6e4e213..59cd8b621 100644 --- a/src/filters/parser/AviSplitter/AviSplitter.cpp +++ b/src/filters/parser/AviSplitter/AviSplitter.cpp @@ -338,7 +338,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool CAviSplitterFilter::DemuxInit()
{
- SetThreadName(-1, "CAviSplitterFilter");
+ SetThreadName((DWORD)-1, "CAviSplitterFilter");
if(!m_pFile) return(false);
@@ -544,7 +544,7 @@ bool CAviSplitterFilter::DemuxLoop() break;
}
- UINT64 expectedsize = -1;
+ UINT64 expectedsize = (UINT64)-1;
expectedsize = f < (DWORD)s->cs.GetCount()-1
? s->cs[f+1].size - s->cs[f].size
: s->totalsize - s->cs[f].size;
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp index 10f117bd8..3977fde20 100644 --- a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp +++ b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp @@ -126,8 +126,10 @@ bool CBaseSplitterFileEx::Read(pssyshdr& h) for(len -= 6; len > 3; len -= 3) // TODO: also store these, somewhere, if needed
{
UINT64 stream_id = BitRead(8);
+ UNUSED_ALWAYS(stream_id);
EXECUTE_ASSERT(BitRead(2) == 3);
UINT64 p_std_buff_size_bound = (BitRead(1)?1024:128)*BitRead(13);
+ UNUSED_ALWAYS(p_std_buff_size_bound);
}
return(true);
diff --git a/src/filters/parser/DSMSplitter/DSMSplitter.cpp b/src/filters/parser/DSMSplitter/DSMSplitter.cpp index bad3728e5..3329bb666 100644 --- a/src/filters/parser/DSMSplitter/DSMSplitter.cpp +++ b/src/filters/parser/DSMSplitter/DSMSplitter.cpp @@ -179,7 +179,7 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool CDSMSplitterFilter::DemuxInit()
{
- SetThreadName(-1, "CDSMSplitterFilter");
+ SetThreadName((DWORD)-1, "CDSMSplitterFilter");
return true;
}
diff --git a/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp b/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp index f4448f661..cb58bd929 100644 --- a/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp +++ b/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp @@ -223,6 +223,7 @@ bool CDSMSplitterFile::Read(__int64 len, IDSMResourceBagImpl& res) {
BYTE compression = (BYTE)BitRead(2);
BYTE reserved = (BYTE)BitRead(6);
+ UNUSED_ALWAYS(reserved);
len--;
CDSMResource r;
diff --git a/src/filters/parser/DiracSplitter/DiracSplitter.cpp b/src/filters/parser/DiracSplitter/DiracSplitter.cpp index 450eb81bb..8e6adb524 100644 --- a/src/filters/parser/DiracSplitter/DiracSplitter.cpp +++ b/src/filters/parser/DiracSplitter/DiracSplitter.cpp @@ -137,7 +137,7 @@ HRESULT CDiracSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool CDiracSplitterFilter::DemuxInit()
{
- SetThreadName(-1, "CDiracSplitterFilter");
+ SetThreadName((DWORD)-1, "CDiracSplitterFilter");
if(!m_pFile) return(false);
// TODO
diff --git a/src/filters/parser/DiracSplitter/DiracSplitterFile.cpp b/src/filters/parser/DiracSplitter/DiracSplitterFile.cpp index de3b42b45..5833ae0b1 100644 --- a/src/filters/parser/DiracSplitter/DiracSplitterFile.cpp +++ b/src/filters/parser/DiracSplitter/DiracSplitterFile.cpp @@ -97,7 +97,7 @@ UINT64 CDiracSplitterFile::UnsignedGolombDecode() bool CDiracSplitterFile::Next(BYTE& code, __int64 len)
{
BitByteAlign();
- UINT64 qw = -1;
+ UINT64 qw = (UINT64)-1;
do
{
if(len-- == 0 || GetPos() >= GetLength()) return(false);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.h b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.h index c0bb0566e..d34e97cb6 100644 --- a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.h +++ b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.h @@ -289,7 +289,7 @@ inline AP4_UI08 AP4_BitStream::ReadByte() { SkipBits(m_BitsCached & 7); - return ReadBits(8); + return (AP4_UI08)ReadBits(8); } /*---------------------------------------------------------------------- @@ -300,7 +300,7 @@ AP4_BitStream::PeekByte() { int extra_bits = m_BitsCached & 7; int data = PeekBits(extra_bits + 8); - int byte = data & 0xFF; + AP4_UI08 byte = data & 0xFF; return byte; } diff --git a/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.cpp b/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.cpp index a7b825d3a..507089a6d 100644 --- a/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.cpp +++ b/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.cpp @@ -757,9 +757,6 @@ AP4_MetaData::Entry::ToAtom(AP4_Atom*& atom) const atom = new AP4_DcfdAtom(m_Value->ToInteger()); return AP4_SUCCESS; } - - // not supported - return AP4_ERROR_NOT_SUPPORTED; } else { // create a '----' atom AP4_ContainerAtom* container = new AP4_ContainerAtom(AP4_ATOM_TYPE_dddd); @@ -777,7 +774,8 @@ AP4_MetaData::Entry::ToAtom(AP4_Atom*& atom) const atom = container; return AP4_SUCCESS; } - + + // not supported return AP4_ERROR_NOT_SUPPORTED; } diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.cpp b/src/filters/parser/MP4Splitter/MP4Splitter.cpp index 87e18e851..84aab0897 100644 --- a/src/filters/parser/MP4Splitter/MP4Splitter.cpp +++ b/src/filters/parser/MP4Splitter/MP4Splitter.cpp @@ -692,7 +692,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool CMP4SplitterFilter::DemuxInit()
{
- SetThreadName(-1, "CMP4SplitterFilter");
+ SetThreadName((DWORD)-1, "CMP4SplitterFilter");
AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
POSITION pos = m_trackpos.GetStartPosition();
@@ -740,7 +740,7 @@ void CMP4SplitterFilter::DemuxSeek(REFERENCE_TIME rt) const AP4_Array<AP4_UI32>& Entries = stss->GetEntries();
if(Entries.ItemCount() > 0)
{
- AP4_Cardinal i = -1;
+ AP4_Cardinal i = (AP4_Cardinal)-1;
while(++i < Entries.ItemCount() && Entries[i]-1 <= pPair->m_value.index);
if(i > 0) i--;
pPair->m_value.index = Entries[i]-1;
@@ -835,6 +835,7 @@ static CStringW ConvertTX3GToSSA( WORD flags = mods[0]; mods += 1;
WORD size = mods[0]; mods += 1;
const AP4_Byte* color = mods; mods += 4;
+ UNUSED_ALWAYS(font_id);
if(end > str_len) end = str_len;
@@ -949,7 +950,7 @@ static CStringW ConvertTX3GToSSA( int breaks = 0;
- for(int i = 0, j = 0; i <= str_len; i++)
+ for(int i = 0; i <= str_len; i++)
{
if(chars[i].c == '\n' /*|| chars[i].c == ' '*/)
{
@@ -1064,7 +1065,7 @@ bool CMP4SplitterFilter::DemuxLoop() {
p->bSyncPoint = FALSE;
- AP4_Cardinal i = -1;
+ AP4_Cardinal i = (AP4_Cardinal)-1;
while(++i < stss->GetEntries().ItemCount())
if(stss->GetEntries()[i]-1 == pPairNext->m_value.index)
p->bSyncPoint = TRUE;
@@ -1142,6 +1143,7 @@ bool CMP4SplitterFilter::DemuxLoop() if(mt.subtype == MEDIASUBTYPE_ASS2)
{
AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex());
+ UNUSED_ALWAYS(desc);
dlgln = "0,0,Text,,0000,0000,0000,0000,," + str;
dlgln_plaintext = str;
@@ -1337,6 +1339,8 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) {
BYTE visual_object_verid = (BYTE)m_pFile->BitRead(4);
BYTE visual_object_priority = (BYTE)m_pFile->BitRead(3);
+ UNUSED_ALWAYS(visual_object_verid);
+ UNUSED_ALWAYS(visual_object_priority);
}
BYTE visual_object_type = (BYTE)m_pFile->BitRead(4);
@@ -1350,12 +1354,18 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) BYTE video_format = (BYTE)m_pFile->BitRead(3);
BYTE video_range = (BYTE)m_pFile->BitRead(1);
BYTE colour_description = (BYTE)m_pFile->BitRead(1);
+ UNUSED_ALWAYS(video_format);
+ UNUSED_ALWAYS(video_range);
+ UNUSED_ALWAYS(colour_description);
if(colour_description)
{
BYTE colour_primaries = (BYTE)m_pFile->BitRead(8);
BYTE transfer_characteristics = (BYTE)m_pFile->BitRead(8);
BYTE matrix_coefficients = (BYTE)m_pFile->BitRead(8);
+ UNUSED_ALWAYS(colour_primaries);
+ UNUSED_ALWAYS(transfer_characteristics);
+ UNUSED_ALWAYS(matrix_coefficients);
}
}
}
@@ -1380,6 +1390,7 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) BYTE random_accessible_vol = (BYTE)m_pFile->BitRead(1);
BYTE video_object_type_indication = (BYTE)m_pFile->BitRead(8);
+ UNUSED_ALWAYS(random_accessible_vol);
if(video_object_type_indication == 0x12) // Fine Granularity Scalable
break; // huh
@@ -1414,6 +1425,8 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) BYTE chroma_format = (BYTE)m_pFile->BitRead(2);
BYTE low_delay = (BYTE)m_pFile->BitRead(1);
BYTE vbv_parameters = (BYTE)m_pFile->BitRead(1);
+ UNUSED_ALWAYS(chroma_format);
+ UNUSED_ALWAYS(low_delay);
if(vbv_parameters)
{
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp b/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp index 1bbe406f1..b6fd7d03a 100644 --- a/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp +++ b/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp @@ -192,17 +192,20 @@ HRESULT Segment::ParseMinimal(CMatroskaNode* pMN0) {
if(Cues.IsEmpty() && (pMN = pMN0->Child(0x1C53BB6B, false)))
{
- do {Cues.Parse(pMN);} while(pMN->Next(true));
+ do {Cues.Parse(pMN);}
+ while(pMN->Next(true));
}
if(Chapters.IsEmpty() && (pMN = pMN0->Child(0x1043A770, false)))
{
- do {Chapters.Parse(pMN); /*BIG UGLY HACK:*/ break;} while(pMN->Next(true));
+ do {Chapters.Parse(pMN); /*BIG UGLY HACK:*/ break;}
+ while(pMN->Next(true));
}
if(Attachments.IsEmpty() && (pMN = pMN0->Child(0x1941A469, false)))
{
- do {Attachments.Parse(pMN); /*BIG UGLY HACK:*/ break;} while (pMN->Next(true));
+ do {Attachments.Parse(pMN); /*BIG UGLY HACK:*/ break;}
+ while (pMN->Next(true));
}
}
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp index ddfee22bf..0fc106282 100644 --- a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp +++ b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp @@ -490,7 +490,7 @@ avcsuccess: memset(vf, 0, mt.FormatLength());
vf->nChannels = (WORD)pTE->a.Channels;
vf->nSamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
- vf->nMinBitsPerSec = vf->nMaxBitsPerSec = vf->nAvgBitsPerSec = -1;
+ vf->nMinBitsPerSec = vf->nMaxBitsPerSec = vf->nAvgBitsPerSec = (DWORD)-1;
mts.Add(mt);
}
else if(CodecID == "A_MS/ACM")
@@ -811,7 +811,7 @@ void CMatroskaSplitterFilter::SendVorbisHeaderSample() bool CMatroskaSplitterFilter::DemuxInit()
{
- SetThreadName(-1, "CMatroskaSplitterFilter");
+ SetThreadName((DWORD)-1, "CMatroskaSplitterFilter");
CMatroskaNode Root(m_pFile);
if(!m_pFile
@@ -878,7 +878,7 @@ void CMatroskaSplitterFilter::DemuxSeek(REFERENCE_TIME rt) {
rt += m_pFile->m_rtOffset;
- MatroskaReader::QWORD lastCueClusterPosition = -1;
+ MatroskaReader::QWORD lastCueClusterPosition = (MatroskaReader::QWORD)-1;
Segment& s = m_pFile->m_segment;
diff --git a/src/filters/parser/MpaSplitter/MpaSplitter.cpp b/src/filters/parser/MpaSplitter/MpaSplitter.cpp index 20e748f75..eb0ccbf0c 100644 --- a/src/filters/parser/MpaSplitter/MpaSplitter.cpp +++ b/src/filters/parser/MpaSplitter/MpaSplitter.cpp @@ -135,7 +135,7 @@ STDMETHODIMP CMpaSplitterFilter::GetDuration(LONGLONG* pDuration) bool CMpaSplitterFilter::DemuxInit()
{
- SetThreadName(-1, "CMpaSplitterFilter");
+ SetThreadName((DWORD)-1, "CMpaSplitterFilter");
if(!m_pFile) return(false);
// TODO
diff --git a/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp b/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp index 1590eee37..6696d7807 100644 --- a/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp +++ b/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp @@ -142,8 +142,10 @@ HRESULT CMpaSplitterFile::Init() BYTE major = (BYTE)BitRead(8);
BYTE revision = (BYTE)BitRead(8);
+ UNUSED_ALWAYS(revision);
BYTE flags = (BYTE)BitRead(8);
+ UNUSED_ALWAYS(flags);
DWORD size = 0;
if(BitRead(1) != 0) return E_FAIL;
size |= BitRead(7) << 21;
@@ -173,6 +175,7 @@ HRESULT CMpaSplitterFile::Init() size |= BitRead(8) << 8;
size |= BitRead(8);
WORD flags = (WORD)BitRead(16);
+ UNUSED_ALWAYS(flags);
pos += 4+4+2+size;
@@ -226,7 +229,7 @@ HRESULT CMpaSplitterFile::Init() __int64 searchlen = min(m_endpos - m_startpos, m_startpos > 0 ? 0x200 : 7);
- __int64 startpos;
+ __int64 startpos = m_startpos;
Seek(m_startpos);
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.cpp b/src/filters/parser/MpegSplitter/MpegSplitter.cpp index d773abdcc..43ca7db34 100644 --- a/src/filters/parser/MpegSplitter/MpegSplitter.cpp +++ b/src/filters/parser/MpegSplitter/MpegSplitter.cpp @@ -374,7 +374,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool CMpegSplitterFilter::DemuxInit()
{
- SetThreadName(-1, "CMpegSplitterFilter");
+ SetThreadName((DWORD)-1, "CMpegSplitterFilter");
if(!m_pFile) return(false);
m_rtStartOffset = 0;
@@ -918,6 +918,7 @@ CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Str else if (_pMediaType->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
{
const WAVEFORMATEX_HDMV_LPCM *pInfoHDMV = GetFormatHelper(pInfoHDMV, _pMediaType);
+ UNUSED_ALWAYS(pInfoHDMV);
Infos.AddTail(L"HDMV LPCM");
}
else
@@ -1083,7 +1084,7 @@ STDMETHODIMP CMpegSplitterFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* if (i == CMpegSplitterFile::subpic && s.pid == NO_SUBTITLE_PID)
{
str = _T("No subtitles");
- *plcid = LCID_NOSUBTITLES;
+ *plcid = (LCID)LCID_NOSUBTITLES;
}
else
{
@@ -1465,7 +1466,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) if(next >= end-4) break;
int size = next - start - 4;
-
+ UNUSED_ALWAYS(size);
CAutoPtr<Packet> p2(DNew Packet());
p2->TrackNumber = m_p->TrackNumber;
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp index a955a54f7..3cd9510d7 100644 --- a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp +++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp @@ -710,6 +710,7 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h) WORD program_number = (WORD)BitRead(16);
BYTE reserved = (BYTE)BitRead(3);
WORD pid = (WORD)BitRead(13);
+ UNUSED_ALWAYS(reserved);
if(program_number != 0)
{
m_programs[pid].program_number = program_number;
@@ -743,6 +744,9 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h) WORD PCR_PID = (WORD)BitRead(13);
BYTE reserved2 = (BYTE)BitRead(4);
WORD program_info_length = (WORD)BitRead(12);
+ UNUSED_ALWAYS(reserved1);
+ UNUSED_ALWAYS(PCR_PID);
+ UNUSED_ALWAYS(reserved2);
len -= 4+program_info_length;
@@ -756,6 +760,8 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h) WORD pid = (WORD)BitRead(13);
BYTE nreserved2 = (BYTE)BitRead(4);
WORD ES_info_length = (WORD)BitRead(12);
+ UNUSED_ALWAYS(nreserved1);
+ UNUSED_ALWAYS(nreserved2);
len -= 5+ES_info_length;
diff --git a/src/filters/parser/NutSplitter/NutSplitter.cpp b/src/filters/parser/NutSplitter/NutSplitter.cpp index 3938bd5e9..92dee697b 100644 --- a/src/filters/parser/NutSplitter/NutSplitter.cpp +++ b/src/filters/parser/NutSplitter/NutSplitter.cpp @@ -143,6 +143,7 @@ HRESULT CNutSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) else if(sh->stream_class == CNutFile::SC_AUDIO)
{
CNutFile::audio_stream_header& ash = sh->ash;
+ UNUSED_ALWAYS(ash);
// TODO
}
else if(sh->stream_class == CNutFile::SC_SUBTITLE)
@@ -165,7 +166,7 @@ HRESULT CNutSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool CNutSplitterFilter::DemuxInit()
{
- SetThreadName(-1, "CNutSplitterFilter");
+ SetThreadName((DWORD)-1, "CNutSplitterFilter");
if(!m_pFile) return(false);
m_pFile->Seek(0);
return(true);
diff --git a/src/filters/parser/OggSplitter/OggSplitter.cpp b/src/filters/parser/OggSplitter/OggSplitter.cpp index f13ae5c17..fc0ce3e51 100644 --- a/src/filters/parser/OggSplitter/OggSplitter.cpp +++ b/src/filters/parser/OggSplitter/OggSplitter.cpp @@ -347,7 +347,7 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool COggSplitterFilter::DemuxInit()
{
- SetThreadName(-1, "COggSplitterFilter");
+ SetThreadName((DWORD)-1, "COggSplitterFilter");
if(!m_pFile) return(false);
return(true);
@@ -578,7 +578,7 @@ COggSourceFilter::COggSourceFilter(LPUNKNOWN pUnk, HRESULT* phr) COggSplitterOutputPin::COggSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
: CBaseSplitterOutputPin(pName, pFilter, pLock, phr)
{
- ResetState(-1);
+ ResetState((DWORD)-1);
}
void COggSplitterOutputPin::AddComment(BYTE* p, int len)
@@ -824,6 +824,7 @@ HRESULT COggVorbisOutputPin::UnpackInitPage(OggPage& page) unsigned int transformtype = bs.getbits(-16);
unsigned int windowtype = bs.getbits(-16);
unsigned int blockflag = bs.getbits(-1);
+ UNUSED_ALWAYS(mapping);
if(transformtype != 0 || windowtype != 0)
{
diff --git a/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp b/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp index f2c04c8a7..790c44e7a 100644 --- a/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp +++ b/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp @@ -422,7 +422,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) {
lfi.GetNextAssoc(pos, key, value);
- int n;
+ int n = 0;
if(key.Find("CHAPTER") == 0 && key.Find("TIME") == key.GetLength()-4
&& (n = strtol(key.Mid(7), NULL, 10)) > 0)
{
@@ -492,7 +492,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool CRealMediaSplitterFilter::DemuxInit()
{
- SetThreadName(-1, "CRealMediaSplitterFilter");
+ SetThreadName((DWORD)-1, "CRealMediaSplitterFilter");
if(!m_pFile) return(false);
@@ -505,7 +505,7 @@ bool CRealMediaSplitterFilter::DemuxInit() int stream = m_pFile->GetMasterStream();
- UINT32 tLastStart = -1;
+ UINT32 tLastStart = (UINT32)-1;
UINT32 nPacket = 0;
POSITION pos = m_pFile->m_dcs.GetHeadPosition();
@@ -772,7 +772,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverSegments() CAutoPtr<Packet> p(DNew Packet());
- p->TrackNumber = -1;
+ p->TrackNumber = (DWORD)-1;
p->bDiscontinuity = m_segments.fDiscontinuity;
p->bSyncPoint = m_segments.fSyncPoint;
p->rtStart = m_segments.rtStart;
@@ -1010,7 +1010,7 @@ HRESULT CRMFile::Read(ChunkHdr& hdr) HRESULT CRMFile::Read(MediaPacketHeader& mph, bool fFull)
{
memset(&mph, 0, FIELD_OFFSET(MediaPacketHeader, pData));
- mph.stream = -1;
+ mph.stream = (UINT16)-1;
HRESULT hr;
@@ -1779,7 +1779,8 @@ HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn) paths.AddTail(olddll); // default dll paths
POSITION pos = paths.GetHeadPosition();
- while(pos && !(m_hDrvDll = LoadLibrary(paths.GetNext(pos))));
+ do { if (pos) m_hDrvDll = LoadLibrary(paths.GetNext(pos));
+ } while(pos && !m_hDrvDll);
if(m_hDrvDll)
{
@@ -1853,7 +1854,7 @@ HRESULT CRealVideoDecoder::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tSto {
CAutoLock cAutoLock(&m_csReceive);
- m_timestamp = ~0;
+ m_timestamp = (DWORD)~0;
m_fDropFrames = false;
DWORD tmp[2] = {20, 0};
@@ -2005,6 +2006,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) BYTE* pDataIn = NULL;
if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
BYTE* pDataInOrg = pDataIn;
+ UNUSED_ALWAYS(pDataInOrg);
long len = pIn->GetActualDataLength();
if(len <= 0) return S_OK;
@@ -2140,8 +2142,8 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) pOut->SetActualDataLength(len);
-DbgLog((LOG_TRACE, 0, _T("A: rtStart=%I64d, rtStop=%I64d, disc=%d, sync=%d"),
-rtStart, rtStop, pOut->IsDiscontinuity() == S_OK, pOut->IsSyncPoint() == S_OK));
+ DbgLog((LOG_TRACE, 0, _T("A: rtStart=%I64d, rtStop=%I64d, disc=%d, sync=%d"),
+ rtStart, rtStop, pOut->IsDiscontinuity() == S_OK, pOut->IsSyncPoint() == S_OK));
if(rtStart >= 0 && S_OK != (hr = m_pOutput->Deliver(pOut)))
return hr;
@@ -2219,7 +2221,8 @@ HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn) paths.AddTail(olddll); // default dll paths
POSITION pos = paths.GetHeadPosition();
- while(pos && !(m_hDrvDll = LoadLibrary(paths.GetNext(pos))));
+ do { if (pos) m_hDrvDll = LoadLibrary(paths.GetNext(pos));
+ } while(pos && !m_hDrvDll);
if(m_hDrvDll)
{
@@ -2352,6 +2355,7 @@ HRESULT CRealAudioDecoder::StartStreaming() int w = m_rai.coded_frame_size;
int h = m_rai.sub_packet_h;
int sps = m_rai.sub_packet_size;
+ UNUSED_ALWAYS(sps);
int len = w*h;
diff --git a/src/filters/parser/RoQSplitter/RoQSplitter.cpp b/src/filters/parser/RoQSplitter/RoQSplitter.cpp index c909b8168..78330a3a9 100644 --- a/src/filters/parser/RoQSplitter/RoQSplitter.cpp +++ b/src/filters/parser/RoQSplitter/RoQSplitter.cpp @@ -239,7 +239,7 @@ HRESULT CRoQSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool CRoQSplitterFilter::DemuxInit()
{
- SetThreadName(-1, "CRoQSplitterFilter");
+ SetThreadName((DWORD)-1, "CRoQSplitterFilter");
m_indexpos = m_index.GetHeadPosition();
return(true);
@@ -871,6 +871,7 @@ HRESULT CRoQAudioDecoder::Transform(IMediaSample* pIn, IMediaSample* pOut) }
WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+ UNUSED_ALWAYS(pwfe);
BYTE* pDataIn = NULL;
if(FAILED(hr = pIn->GetPointer(&pDataIn)))
diff --git a/src/filters/reader/CDDAReader/CDDAReader.cpp b/src/filters/reader/CDDAReader/CDDAReader.cpp index 193451274..f0c5357df 100644 --- a/src/filters/reader/CDDAReader/CDDAReader.cpp +++ b/src/filters/reader/CDDAReader/CDDAReader.cpp @@ -138,8 +138,9 @@ STDMETHODIMP CCDDAReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt) STDMETHODIMP CCDDAReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
CheckPointer(ppszFileName, E_POINTER);
-
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+
+ *ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
+ if(!(*ppszFileName))
return E_OUTOFMEMORY;
wcscpy(*ppszFileName, m_fn);
@@ -397,6 +398,7 @@ HRESULT CCDDAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDW &rawreadinfo, sizeof(rawreadinfo),
buff, RAW_SECTOR_SIZE,
&BytesReturned, 0);
+ UNUSED_ALWAYS(b);
size_t l = (size_t)min(min(len, RAW_SECTOR_SIZE - offset), m_llLength - pos);
memcpy(pbBuffer, &buff[offset], l);
diff --git a/src/filters/reader/CDXAReader/CDXAReader.cpp b/src/filters/reader/CDXAReader/CDXAReader.cpp index 9d9e5e854..e50c06d79 100644 --- a/src/filters/reader/CDXAReader/CDXAReader.cpp +++ b/src/filters/reader/CDXAReader/CDXAReader.cpp @@ -200,8 +200,9 @@ STDMETHODIMP CCDXAReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE *pmt) STDMETHODIMP CCDXAReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
if(!ppszFileName) return E_POINTER;
-
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+
+ *ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
+ if(!(*ppszFileName))
return E_OUTOFMEMORY;
wcscpy(*ppszFileName, m_fn);
@@ -294,7 +295,7 @@ HRESULT CCDXAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDW UINT sector = m_nFirstSector + int(pos/RAW_DATA_SIZE);
__int64 offset = pos%RAW_DATA_SIZE;
- if(m_nBufferedSector != sector)
+ if(m_nBufferedSector != (int)sector)
{
LARGE_INTEGER FilePointer;
FilePointer.QuadPart = RIFFCDXA_HEADER_SIZE + sector*RAW_SECTOR_SIZE;
diff --git a/src/filters/reader/UDPReader/UDPReader.cpp b/src/filters/reader/UDPReader/UDPReader.cpp index fbeb8426e..51a20d44d 100644 --- a/src/filters/reader/UDPReader/UDPReader.cpp +++ b/src/filters/reader/UDPReader/UDPReader.cpp @@ -115,7 +115,8 @@ STDMETHODIMP CUDPReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt) {
if(!ppszFileName) return E_POINTER;
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ *ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
+ if(!(*ppszFileName))
return E_OUTOFMEMORY;
wcscpy(*ppszFileName, m_fn);
@@ -128,7 +129,7 @@ STDMETHODIMP CUDPReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt) CUDPStream::CUDPStream()
{
m_port = 0;
- m_socket = -1;
+ m_socket = (SOCKET)-1;
m_subtype = MEDIASUBTYPE_NULL;
}
@@ -139,7 +140,7 @@ CUDPStream::~CUDPStream() void CUDPStream::Clear()
{
- if(m_socket >= 0) {closesocket(m_socket); m_socket = -1;}
+ if(m_socket >= 0) {closesocket(m_socket); m_socket = (SOCKET)-1;}
if(CAMThread::ThreadExists())
{
CAMThread::CallWorker(CMD_EXIT);
@@ -332,13 +333,13 @@ DWORD CUDPStream::ThreadProc() if(setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (const char*)&dw, sizeof(dw)) < 0)
{
closesocket(m_socket);
- m_socket = -1;
+ m_socket = (SOCKET)-1;
}
if(bind(m_socket, (struct sockaddr*)&addr, sizeof(addr)) < 0)
{
closesocket(m_socket);
- m_socket = -1;
+ m_socket = (SOCKET)-1;
}
if(IN_MULTICAST(htonl(imr.imr_multiaddr.s_addr)))
@@ -364,7 +365,7 @@ DWORD CUDPStream::ThreadProc() {
default:
case CMD_EXIT:
- if(m_socket >= 0) {closesocket(m_socket); m_socket = -1;}
+ if(m_socket >= 0) {closesocket(m_socket); m_socket = (SOCKET)-1;}
WSACleanup();
if(dump) fclose(dump);
if(log) fclose(log);
@@ -434,7 +435,7 @@ DWORD CUDPStream::ThreadProc() }
ASSERT(0);
- return -1;
+ return (SOCKET)-1;
}
CUDPStream::packet_t::packet_t(BYTE* p, __int64 start, __int64 end)
diff --git a/src/filters/reader/VTSReader/VTSReader.cpp b/src/filters/reader/VTSReader/VTSReader.cpp index 371dd4fbb..61f4f55bb 100644 --- a/src/filters/reader/VTSReader/VTSReader.cpp +++ b/src/filters/reader/VTSReader/VTSReader.cpp @@ -127,7 +127,8 @@ STDMETHODIMP CVTSReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt) {
if(!ppszFileName) return E_POINTER;
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ *ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
+ if(!(*ppszFileName))
return E_OUTOFMEMORY;
wcscpy(*ppszFileName, m_fn);
diff --git a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp index df623f2b2..e0dff543f 100644 --- a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp +++ b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp @@ -67,12 +67,12 @@ DEFINE_GUIDSTRUCT("0000000b-0cea-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_I const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&GUID_NULL},
+ {&GUID_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
{
- {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
};
const AMOVIESETUP_FILTER sudFilter[] =
@@ -82,7 +82,7 @@ const AMOVIESETUP_FILTER sudFilter[] = CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, &__uuidof(CMpcAudioRenderer), CreateInstance<CMpcAudioRenderer>, NULL, &sudFilter[0]},
+ {sudFilter[0].strName, &__uuidof(CMpcAudioRenderer), CreateInstance<CMpcAudioRenderer>, NULL, &sudFilter[0]},
//{L"CMpcAudioRendererPropertyPage", &__uuidof(CMpcAudioRendererSettingsWnd), CreateInstance<CInternalPropertyPageTempl<CMpcAudioRendererSettingsWnd> >},
};
@@ -158,7 +158,7 @@ CMpcAudioRenderer::~CMpcAudioRenderer() SAFE_RELEASE (pRenderClient);
SAFE_RELEASE (pAudioClient);
SAFE_RELEASE (pMMDevice);
-
+
if (m_pReferenceClock)
{
SetSyncSource(NULL);
@@ -185,52 +185,52 @@ HRESULT CMpcAudioRenderer::CheckInputType(const CMediaType *pmt) HRESULT CMpcAudioRenderer::CheckMediaType(const CMediaType *pmt)
{
- HRESULT hr = S_OK;
- if (pmt == NULL) return E_INVALIDARG;
- TRACE(_T("CMpcAudioRenderer::CheckMediaType"));
- WAVEFORMATEX *pwfx = (WAVEFORMATEX *) pmt->Format();
-
- if (pwfx == NULL) return VFW_E_TYPE_NOT_ACCEPTED;
-
-if ((pmt->majortype != MEDIATYPE_Audio ) ||
- (pmt->formattype != FORMAT_WaveFormatEx ))
- {
- TRACE(_T("CMpcAudioRenderer::CheckMediaType Not supported"));
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
-
- if(useWASAPI)
- {
- hr=CheckAudioClient((WAVEFORMATEX *)NULL);
- if (FAILED(hr))
- {
- TRACE(_T("CMpcAudioRenderer::CheckMediaType Error on check audio client"));
- return hr;
- }
- if (!pAudioClient)
- {
- TRACE(_T("CMpcAudioRenderer::CheckMediaType Error, audio client not loaded"));
- return VFW_E_CANNOT_CONNECT;
- }
-
- if (pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, NULL) != S_OK)
- {
- TRACE(_T("CMpcAudioRenderer::CheckMediaType WASAPI client refused the format"));
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
- TRACE(_T("CMpcAudioRenderer::CheckMediaType WASAPI client accepted the format"));
- }
- else if (pwfx->wFormatTag != WAVE_FORMAT_PCM)
- {
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
+ HRESULT hr = S_OK;
+ if (pmt == NULL) return E_INVALIDARG;
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType"));
+ WAVEFORMATEX *pwfx = (WAVEFORMATEX *) pmt->Format();
+
+ if (pwfx == NULL) return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if ((pmt->majortype != MEDIATYPE_Audio ) ||
+ (pmt->formattype != FORMAT_WaveFormatEx ))
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType Not supported"));
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ if(useWASAPI)
+ {
+ hr=CheckAudioClient((WAVEFORMATEX *)NULL);
+ if (FAILED(hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType Error on check audio client"));
+ return hr;
+ }
+ if (!pAudioClient)
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType Error, audio client not loaded"));
+ return VFW_E_CANNOT_CONNECT;
+ }
+
+ if (pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, NULL) != S_OK)
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType WASAPI client refused the format"));
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType WASAPI client accepted the format"));
+ }
+ else if (pwfx->wFormatTag != WAVE_FORMAT_PCM)
+ {
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
return S_OK;
}
void CMpcAudioRenderer::OnReceiveFirstSample(IMediaSample *pMediaSample)
{
- if (!useWASAPI)
- ClearBuffer();
+ if (!useWASAPI)
+ ClearBuffer();
}
BOOL CMpcAudioRenderer::ScheduleSample(IMediaSample *pMediaSample)
@@ -238,51 +238,51 @@ BOOL CMpcAudioRenderer::ScheduleSample(IMediaSample *pMediaSample) REFERENCE_TIME StartSample;
REFERENCE_TIME EndSample;
- // Is someone pulling our leg
- if (pMediaSample == NULL) return FALSE;
+ // Is someone pulling our leg
+ if (pMediaSample == NULL) return FALSE;
- // Get the next sample due up for rendering. If there aren't any ready
- // then GetNextSampleTimes returns an error. If there is one to be done
- // then it succeeds and yields the sample times. If it is due now then
- // it returns S_OK other if it's to be done when due it returns S_FALSE
- HRESULT hr = GetSampleTimes(pMediaSample, &StartSample, &EndSample);
- if (FAILED(hr)) return FALSE;
+ // Get the next sample due up for rendering. If there aren't any ready
+ // then GetNextSampleTimes returns an error. If there is one to be done
+ // then it succeeds and yields the sample times. If it is due now then
+ // it returns S_OK other if it's to be done when due it returns S_FALSE
+ HRESULT hr = GetSampleTimes(pMediaSample, &StartSample, &EndSample);
+ if (FAILED(hr)) return FALSE;
- // If we don't have a reference clock then we cannot set up the advise
- // time so we simply set the event indicating an image to render. This
- // will cause us to run flat out without any timing or synchronisation
- if (hr == S_OK)
+ // If we don't have a reference clock then we cannot set up the advise
+ // time so we simply set the event indicating an image to render. This
+ // will cause us to run flat out without any timing or synchronisation
+ if (hr == S_OK)
{
EXECUTE_ASSERT(SetEvent((HANDLE) m_RenderEvent));
return TRUE;
- }
-
- if (m_dRate <= 1.1)
- {
- ASSERT(m_dwAdvise == 0);
- ASSERT(m_pClock);
- WaitForSingleObject((HANDLE)m_RenderEvent,0);
-
- hr = m_pClock->AdviseTime( (REFERENCE_TIME) m_tStart, StartSample, (HEVENT)(HANDLE) m_RenderEvent, &m_dwAdvise);
- if (SUCCEEDED(hr)) return TRUE;
- }
- else
- hr = DoRenderSample (pMediaSample);
-
- // We could not schedule the next sample for rendering despite the fact
- // we have a valid sample here. This is a fair indication that either
- // the system clock is wrong or the time stamp for the sample is duff
- ASSERT(m_dwAdvise == 0);
-
- return FALSE;
+ }
+
+ if (m_dRate <= 1.1)
+ {
+ ASSERT(m_dwAdvise == 0);
+ ASSERT(m_pClock);
+ WaitForSingleObject((HANDLE)m_RenderEvent,0);
+
+ hr = m_pClock->AdviseTime( (REFERENCE_TIME) m_tStart, StartSample, (HEVENT)(HANDLE) m_RenderEvent, &m_dwAdvise);
+ if (SUCCEEDED(hr)) return TRUE;
+ }
+ else
+ hr = DoRenderSample (pMediaSample);
+
+ // We could not schedule the next sample for rendering despite the fact
+ // we have a valid sample here. This is a fair indication that either
+ // the system clock is wrong or the time stamp for the sample is duff
+ ASSERT(m_dwAdvise == 0);
+
+ return FALSE;
}
HRESULT CMpcAudioRenderer::DoRenderSample(IMediaSample *pMediaSample)
{
- if (useWASAPI)
- return DoRenderSampleWasapi(pMediaSample);
- else
- return DoRenderSampleDirectSound(pMediaSample);
+ if (useWASAPI)
+ return DoRenderSampleWasapi(pMediaSample);
+ else
+ return DoRenderSampleDirectSound(pMediaSample);
}
@@ -299,48 +299,47 @@ STDMETHODIMP CMpcAudioRenderer::NonDelegatingQueryInterface(REFIID riid, void ** HRESULT CMpcAudioRenderer::SetMediaType(const CMediaType *pmt)
{
if (! pmt) return E_POINTER;
- HRESULT hr = S_OK;
- int size = 0;
- TRACE(_T("CMpcAudioRenderer::SetMediaType"));
-
- if (useWASAPI)
- {
- // New media type set but render client already initialized => reset it
- if (pRenderClient!=NULL)
- {
- WAVEFORMATEX *pNewWf = (WAVEFORMATEX *) pmt->Format();
- TRACE(_T("CMpcAudioRenderer::SetMediaType Render client already initialized. Reinitialization..."));
- CheckAudioClient(pNewWf);
- }
- }
-
- if (m_pWaveFileFormat)
+ int size = 0;
+ TRACE(_T("CMpcAudioRenderer::SetMediaType"));
+
+ if (useWASAPI)
+ {
+ // New media type set but render client already initialized => reset it
+ if (pRenderClient!=NULL)
+ {
+ WAVEFORMATEX *pNewWf = (WAVEFORMATEX *) pmt->Format();
+ TRACE(_T("CMpcAudioRenderer::SetMediaType Render client already initialized. Reinitialization..."));
+ CheckAudioClient(pNewWf);
+ }
+ }
+
+ if (m_pWaveFileFormat)
{
BYTE *p = (BYTE *)m_pWaveFileFormat;
SAFE_DELETE_ARRAY(p);
}
- m_pWaveFileFormat=NULL;
+ m_pWaveFileFormat=NULL;
- WAVEFORMATEX *pwf = (WAVEFORMATEX *) pmt->Format();
- if (pwf!=NULL)
- {
- size = sizeof(WAVEFORMATEX) + pwf->cbSize;
+ WAVEFORMATEX *pwf = (WAVEFORMATEX *) pmt->Format();
+ if (pwf!=NULL)
+ {
+ size = sizeof(WAVEFORMATEX) + pwf->cbSize;
+
+ m_pWaveFileFormat = (WAVEFORMATEX *)new BYTE[size];
+ if (! m_pWaveFileFormat)
+ return E_OUTOFMEMORY;
- m_pWaveFileFormat = (WAVEFORMATEX *)new BYTE[size];
- if (! m_pWaveFileFormat)
- return E_OUTOFMEMORY;
-
- memcpy(m_pWaveFileFormat, pwf, size);
+ memcpy(m_pWaveFileFormat, pwf, size);
- if (!useWASAPI && m_pSoundTouch && (pwf->nChannels <= 2))
- {
- m_pSoundTouch->setSampleRate (pwf->nSamplesPerSec);
- m_pSoundTouch->setChannels (pwf->nChannels);
- m_pSoundTouch->setTempoChange (0);
- m_pSoundTouch->setPitchSemiTones(0);
- }
- }
+ if (!useWASAPI && m_pSoundTouch && (pwf->nChannels <= 2))
+ {
+ m_pSoundTouch->setSampleRate (pwf->nSamplesPerSec);
+ m_pSoundTouch->setChannels (pwf->nChannels);
+ m_pSoundTouch->setTempoChange (0);
+ m_pSoundTouch->setPitchSemiTones(0);
+ }
+ }
return CBaseRenderer::SetMediaType (pmt);
}
@@ -348,65 +347,64 @@ HRESULT CMpcAudioRenderer::SetMediaType(const CMediaType *pmt) HRESULT CMpcAudioRenderer::CompleteConnect(IPin *pReceivePin)
{
HRESULT hr = S_OK;
- TRACE(_T("CMpcAudioRenderer::CompleteConnect"));
+ TRACE(_T("CMpcAudioRenderer::CompleteConnect"));
- if (!useWASAPI && ! m_pDS) return E_FAIL;
+ if (!useWASAPI && ! m_pDS) return E_FAIL;
if (SUCCEEDED(hr)) hr = CBaseRenderer::CompleteConnect(pReceivePin);
if (SUCCEEDED(hr)) hr = InitCoopLevel();
if (!useWASAPI)
- {
- if (SUCCEEDED(hr)) hr = CreateDSBuffer();
- }
- if (SUCCEEDED(hr)) TRACE(_T("CMpcAudioRenderer::CompleteConnect Success"));
+ {
+ if (SUCCEEDED(hr)) hr = CreateDSBuffer();
+ }
+ if (SUCCEEDED(hr)) TRACE(_T("CMpcAudioRenderer::CompleteConnect Success"));
return hr;
-
}
STDMETHODIMP CMpcAudioRenderer::Run(REFERENCE_TIME tStart)
{
HRESULT hr;
- if (m_State == State_Running) return NOERROR;
-
- if (useWASAPI)
- {
- hr=CheckAudioClient(m_pWaveFileFormat);
- if (FAILED(hr))
- {
- TRACE(_T("CMpcAudioRenderer::Run Error on check audio client"));
- return hr;
- }
- // Rather start the client at the last moment when the buffer is fed
- /*hr = pAudioClient->Start();
- if (FAILED (hr))
- {
- TRACE(_T("CMpcAudioRenderer::Run Start error"));
- return hr;
- }*/
- }
- else
- {
- if (m_pDSBuffer &&
- m_pPosition &&
- m_pWaveFileFormat &&
- SUCCEEDED(m_pPosition->GetRate(&m_dRate)))
- {
- if (m_dRate < 1.0)
+ if (m_State == State_Running) return NOERROR;
+
+ if (useWASAPI)
+ {
+ hr=CheckAudioClient(m_pWaveFileFormat);
+ if (FAILED(hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::Run Error on check audio client"));
+ return hr;
+ }
+ // Rather start the client at the last moment when the buffer is fed
+ /*hr = pAudioClient->Start();
+ if (FAILED (hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::Run Start error"));
+ return hr;
+ }*/
+ }
+ else
+ {
+ if (m_pDSBuffer &&
+ m_pPosition &&
+ m_pWaveFileFormat &&
+ SUCCEEDED(m_pPosition->GetRate(&m_dRate)))
+ {
+ if (m_dRate < 1.0)
{
hr = m_pDSBuffer->SetFrequency ((long)(m_pWaveFileFormat->nSamplesPerSec * m_dRate));
if (FAILED (hr)) return hr;
}
- else
+ else
{
hr = m_pDSBuffer->SetFrequency ((long)m_pWaveFileFormat->nSamplesPerSec);
m_pSoundTouch->setRateChange((float)(m_dRate-1.0)*100);
}
- }
+ }
- ClearBuffer();
- }
+ ClearBuffer();
+ }
hr = CBaseRenderer::Run(tStart);
return hr;
@@ -415,17 +413,17 @@ STDMETHODIMP CMpcAudioRenderer::Run(REFERENCE_TIME tStart) STDMETHODIMP CMpcAudioRenderer::Stop()
{
if (m_pDSBuffer) m_pDSBuffer->Stop();
- isAudioClientStarted=false;
+ isAudioClientStarted=false;
- return CBaseRenderer::Stop();
+ return CBaseRenderer::Stop();
};
STDMETHODIMP CMpcAudioRenderer::Pause()
{
if (m_pDSBuffer) m_pDSBuffer->Stop();
- if (pAudioClient && isAudioClientStarted) pAudioClient->Stop();
- isAudioClientStarted=false;
+ if (pAudioClient && isAudioClientStarted) pAudioClient->Stop();
+ isAudioClientStarted=false;
return CBaseRenderer::Pause();
};
@@ -458,11 +456,11 @@ HRESULT CMpcAudioRenderer::GetReferenceClockInterface(REFIID riid, void **ppv) HRESULT CMpcAudioRenderer::EndOfStream(void)
{
- if (m_pDSBuffer) m_pDSBuffer->Stop();
+ if (m_pDSBuffer) m_pDSBuffer->Stop();
#if !FILEWRITER
- if (pAudioClient && isAudioClientStarted) pAudioClient->Stop();
+ if (pAudioClient && isAudioClientStarted) pAudioClient->Stop();
#endif
- isAudioClientStarted=false;
+ isAudioClientStarted=false;
return CBaseRenderer::EndOfStream();
}
@@ -500,14 +498,14 @@ HRESULT CMpcAudioRenderer::CreateDSBuffer() SAFE_RELEASE (m_pDSBuffer);
cDSBufferDesc.dwSize = sizeof (DSBUFFERDESC);
cDSBufferDesc.dwFlags = DSBCAPS_GLOBALFOCUS |
- DSBCAPS_GETCURRENTPOSITION2 |
- DSBCAPS_CTRLVOLUME |
- DSBCAPS_CTRLPAN |
- DSBCAPS_CTRLFREQUENCY;
+ DSBCAPS_GETCURRENTPOSITION2 |
+ DSBCAPS_CTRLVOLUME |
+ DSBCAPS_CTRLPAN |
+ DSBCAPS_CTRLFREQUENCY;
cDSBufferDesc.dwBufferBytes = dwDSBufSize;
cDSBufferDesc.dwReserved = 0;
cDSBufferDesc.lpwfxFormat = m_pWaveFileFormat;
- cDSBufferDesc.guid3DAlgorithm = GUID_NULL;
+ cDSBufferDesc.guid3DAlgorithm = GUID_NULL;
hr = m_pDS->CreateSoundBuffer (&cDSBufferDesc, &m_pDSBuffer, NULL);
@@ -609,23 +607,23 @@ HRESULT CMpcAudioRenderer::DoRenderSampleDirectSound(IMediaSample *pMediaSample) hr = m_pDSBuffer->Play( 0, 0, DSBPLAY_LOOPING);
ATLASSERT(SUCCEEDED(hr));
}
-
+
if (SUCCEEDED(hr)) hr = m_pDSBuffer->GetCurrentPosition(&dwPlayCursor, &dwWriteCursor);
if (SUCCEEDED(hr))
{
if ( ( (dwPlayCursor < dwWriteCursor) &&
- (
- ((m_dwDSWriteOff >= dwPlayCursor) && (m_dwDSWriteOff <= dwWriteCursor))
- ||
- ((m_dwDSWriteOff < dwPlayCursor) && (m_dwDSWriteOff + lSize >= dwPlayCursor))
- )
- )
- ||
- ( (dwWriteCursor < dwPlayCursor) &&
- (
- (m_dwDSWriteOff >= dwPlayCursor) || (m_dwDSWriteOff < dwWriteCursor)
- ) ) )
+ (
+ ((m_dwDSWriteOff >= dwPlayCursor) && (m_dwDSWriteOff <= dwWriteCursor))
+ ||
+ ((m_dwDSWriteOff < dwPlayCursor) && (m_dwDSWriteOff + lSize >= dwPlayCursor))
+ )
+ )
+ ||
+ ( (dwWriteCursor < dwPlayCursor) &&
+ (
+ (m_dwDSWriteOff >= dwPlayCursor) || (m_dwDSWriteOff < dwWriteCursor)
+ ) ) )
{
m_dwDSWriteOff = dwWriteCursor;
}
@@ -637,7 +635,7 @@ HRESULT CMpcAudioRenderer::DoRenderSampleDirectSound(IMediaSample *pMediaSample) }
if (SUCCEEDED(hr)) hr = WriteSampleToDSBuffer(pMediaSample, NULL);
-
+
return hr;
}
@@ -708,338 +706,337 @@ HRESULT CMpcAudioRenderer::WriteSampleToDSBuffer(IMediaSample *pMediaSample, boo HRESULT CMpcAudioRenderer::DoRenderSampleWasapi(IMediaSample *pMediaSample)
{
HRESULT hr = S_OK;
- REFERENCE_TIME rtStart = 0;
+ REFERENCE_TIME rtStart = 0;
REFERENCE_TIME rtStop = 0;
- DWORD flags = 0;
- BYTE *pMediaBuffer = NULL;
- BYTE *pInputBufferPointer = NULL;
- BYTE *pInputBufferEnd = NULL;
- BYTE *pData;
- bufferSize = pMediaSample->GetActualDataLength();
- const long lSize = bufferSize;
- pMediaSample->GetTime (&rtStart, &rtStop);
-
- AM_MEDIA_TYPE *pmt;
- if (SUCCEEDED(pMediaSample->GetMediaType(&pmt)) && pmt!=NULL)
- {
- CMediaType mt(*pmt);
- if ((WAVEFORMATEXTENSIBLE*)mt.Format() != NULL)
- hr=CheckAudioClient(&(((WAVEFORMATEXTENSIBLE*)mt.Format())->Format));
- else
- hr=CheckAudioClient((WAVEFORMATEX*)mt.Format());
- if (FAILED(hr))
- {
- TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Error while checking audio client with input media type"));
- return hr;
- }
- DeleteMediaType(pmt);
- pmt=NULL;
- }
-
- // Initialization
- hr = pMediaSample->GetPointer(&pMediaBuffer);
- if (FAILED (hr)) return hr;
-
- pInputBufferPointer=&pMediaBuffer[0];
- pInputBufferEnd=&pMediaBuffer[0]+lSize;
-
- WORD frameSize = m_pWaveFileFormat->nBlockAlign;
-
-
- // Sleep for half the buffer duration since last buffer feed
- DWORD currentTime=GetTickCount();
- if (lastBufferTime!=0 && hnsActualDuration!= 0 && lastBufferTime<currentTime && (currentTime-lastBufferTime)<hnsActualDuration)
- {
- hnsActualDuration=hnsActualDuration-(currentTime-lastBufferTime);
- Sleep(hnsActualDuration);
- }
+ BYTE *pMediaBuffer = NULL;
+ BYTE *pInputBufferPointer = NULL;
+ BYTE *pInputBufferEnd = NULL;
+ BYTE *pData;
+ bufferSize = pMediaSample->GetActualDataLength();
+ const long lSize = bufferSize;
+ pMediaSample->GetTime (&rtStart, &rtStop);
+
+ AM_MEDIA_TYPE *pmt;
+ if (SUCCEEDED(pMediaSample->GetMediaType(&pmt)) && pmt!=NULL)
+ {
+ CMediaType mt(*pmt);
+ if ((WAVEFORMATEXTENSIBLE*)mt.Format() != NULL)
+ hr=CheckAudioClient(&(((WAVEFORMATEXTENSIBLE*)mt.Format())->Format));
+ else
+ hr=CheckAudioClient((WAVEFORMATEX*)mt.Format());
+ if (FAILED(hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Error while checking audio client with input media type"));
+ return hr;
+ }
+ DeleteMediaType(pmt);
+ pmt=NULL;
+ }
+
+ // Initialization
+ hr = pMediaSample->GetPointer(&pMediaBuffer);
+ if (FAILED (hr)) return hr;
+
+ pInputBufferPointer=&pMediaBuffer[0];
+ pInputBufferEnd=&pMediaBuffer[0]+lSize;
+
+ WORD frameSize = m_pWaveFileFormat->nBlockAlign;
+
+
+ // Sleep for half the buffer duration since last buffer feed
+ DWORD currentTime=GetTickCount();
+ if (lastBufferTime!=0 && hnsActualDuration!= 0 && lastBufferTime<currentTime && (currentTime-lastBufferTime)<hnsActualDuration)
+ {
+ hnsActualDuration=hnsActualDuration-(currentTime-lastBufferTime);
+ Sleep(hnsActualDuration);
+ }
// Each loop fills one of the two buffers.
- while (pInputBufferPointer < pInputBufferEnd)
- {
- UINT32 numFramesPadding=0;
- pAudioClient->GetCurrentPadding(&numFramesPadding);
- UINT32 numFramesAvailable = nFramesInBuffer - numFramesPadding;
-
- UINT32 nAvailableBytes=numFramesAvailable*frameSize;
- UINT32 nBytesToWrite=nAvailableBytes;
- // More room than enough in the output buffer
- if (nAvailableBytes > pInputBufferEnd - pInputBufferPointer)
- {
- nBytesToWrite=pInputBufferEnd - pInputBufferPointer;
- numFramesAvailable=(UINT32)((float)nBytesToWrite/frameSize);
- }
-
- // Grab the next empty buffer from the audio device.
- hr = pRenderClient->GetBuffer(numFramesAvailable, &pData);
- if (FAILED (hr))
- {
- TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi GetBuffer failed with size %ld : (error %lx)"),nFramesInBuffer,hr);
- return hr;
- }
-
- // Load the buffer with data from the audio source.
- if (pData != NULL)
+ while (pInputBufferPointer < pInputBufferEnd)
+ {
+ UINT32 numFramesPadding=0;
+ pAudioClient->GetCurrentPadding(&numFramesPadding);
+ UINT32 numFramesAvailable = nFramesInBuffer - numFramesPadding;
+
+ UINT32 nAvailableBytes=numFramesAvailable*frameSize;
+ UINT32 nBytesToWrite=nAvailableBytes;
+ // More room than enough in the output buffer
+ if (nAvailableBytes > pInputBufferEnd - pInputBufferPointer)
+ {
+ nBytesToWrite=pInputBufferEnd - pInputBufferPointer;
+ numFramesAvailable=(UINT32)((float)nBytesToWrite/frameSize);
+ }
+
+ // Grab the next empty buffer from the audio device.
+ hr = pRenderClient->GetBuffer(numFramesAvailable, &pData);
+ if (FAILED (hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi GetBuffer failed with size %ld : (error %lx)"),nFramesInBuffer,hr);
+ return hr;
+ }
+
+ // Load the buffer with data from the audio source.
+ if (pData != NULL)
{
- memcpy(&pData[0], pInputBufferPointer, nBytesToWrite);
- pInputBufferPointer += nBytesToWrite;
+ memcpy(&pData[0], pInputBufferPointer, nBytesToWrite);
+ pInputBufferPointer += nBytesToWrite;
+ }
+ else
+ TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Output buffer is NULL"));
+
+ hr = pRenderClient->ReleaseBuffer(numFramesAvailable, 0); // no flags
+ if (FAILED (hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi ReleaseBuffer failed with size %ld (error %lx)"),nFramesInBuffer,hr);
+ return hr;
+ }
+
+ if (!isAudioClientStarted)
+ {
+ TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Starting audio client"));
+ pAudioClient->Start();
+ isAudioClientStarted=true;
+ }
+
+ if (pInputBufferPointer >= pInputBufferEnd)
+ {
+ lastBufferTime=GetTickCount();
+ // This is the duration of the filled buffer
+ hnsActualDuration=(double)REFTIMES_PER_SEC * numFramesAvailable / m_pWaveFileFormat->nSamplesPerSec;
+ // Sleep time is half this duration
+ hnsActualDuration=(DWORD)(hnsActualDuration/REFTIMES_PER_MILLISEC/2);
+ break;
}
- else
- TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Output buffer is NULL"));
-
- hr = pRenderClient->ReleaseBuffer(numFramesAvailable, 0); // no flags
- if (FAILED (hr))
- {
- TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi ReleaseBuffer failed with size %ld (error %lx)"),nFramesInBuffer,hr);
- return hr;
- }
-
- if (!isAudioClientStarted)
- {
- TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Starting audio client"));
- pAudioClient->Start();
- isAudioClientStarted=true;
- }
-
- if (pInputBufferPointer >= pInputBufferEnd)
- {
- lastBufferTime=GetTickCount();
- // This is the duration of the filled buffer
- hnsActualDuration=(double)REFTIMES_PER_SEC * numFramesAvailable / m_pWaveFileFormat->nSamplesPerSec;
- // Sleep time is half this duration
- hnsActualDuration=(DWORD)(hnsActualDuration/REFTIMES_PER_MILLISEC/2);
- break;
- }
-
- // Buffer not completely filled, sleep for half buffer capacity duration
- hnsActualDuration=(double)REFTIMES_PER_SEC * nFramesInBuffer / m_pWaveFileFormat->nSamplesPerSec;
- // Sleep time is half this duration
- hnsActualDuration=(DWORD)(hnsActualDuration/REFTIMES_PER_MILLISEC/2);
- Sleep(hnsActualDuration);
- }
+
+ // Buffer not completely filled, sleep for half buffer capacity duration
+ hnsActualDuration=(double)REFTIMES_PER_SEC * nFramesInBuffer / m_pWaveFileFormat->nSamplesPerSec;
+ // Sleep time is half this duration
+ hnsActualDuration=(DWORD)(hnsActualDuration/REFTIMES_PER_MILLISEC/2);
+ Sleep(hnsActualDuration);
+ }
return hr;
}
HRESULT CMpcAudioRenderer::CheckAudioClient(WAVEFORMATEX *pWaveFormatEx)
{
- HRESULT hr = S_OK;
- CAutoLock cAutoLock(&m_csCheck);
- TRACE(_T("CMpcAudioRenderer::CheckAudioClient"));
- if (pMMDevice == NULL) hr=GetDefaultAudioDevice(&pMMDevice);
-
- // If no WAVEFORMATEX structure provided and client already exists, return it
- if (pAudioClient != NULL && pWaveFormatEx == NULL) return hr;
-
- // Just create the audio client if no WAVEFORMATEX provided
- if (pAudioClient == NULL && pWaveFormatEx==NULL)
- {
- if (SUCCEEDED (hr)) hr=CreateAudioClient(pMMDevice, &pAudioClient);
- return hr;
- }
-
- // Compare the exisiting WAVEFORMATEX with the one provided
- WAVEFORMATEX *pNewWaveFormatEx = NULL;
- if (CheckFormatChanged(pWaveFormatEx, &pNewWaveFormatEx))
- {
- // Format has changed, audio client has to be reinitialized
- TRACE(_T("CMpcAudioRenderer::CheckAudioClient Format changed, reinitialize the audio client"));
- if (m_pWaveFileFormat)
- {
- BYTE *p = (BYTE *)m_pWaveFileFormat;
- SAFE_DELETE_ARRAY(p);
- }
- m_pWaveFileFormat=pNewWaveFormatEx;
- hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pWaveFormatEx, NULL);
- if (SUCCEEDED(hr))
- {
- if (pAudioClient!=NULL && isAudioClientStarted) pAudioClient->Stop();
- isAudioClientStarted=false;
- SAFE_RELEASE(pRenderClient);
- SAFE_RELEASE(pAudioClient);
- if (SUCCEEDED (hr)) hr=CreateAudioClient(pMMDevice, &pAudioClient);
- }
- else
- {
- TRACE(_T("CMpcAudioRenderer::CheckAudioClient New format not supported, accept it anyway"));
- return S_OK;
- }
- }
- else if (pRenderClient == NULL)
- {
- TRACE(_T("CMpcAudioRenderer::CheckAudioClient First initialization of the audio renderer"));
- }
- else
- return hr;
-
-
- SAFE_RELEASE(pRenderClient);
- if (SUCCEEDED (hr)) hr=InitAudioClient(pWaveFormatEx, pAudioClient, &pRenderClient);
- return hr;
+ HRESULT hr = S_OK;
+ CAutoLock cAutoLock(&m_csCheck);
+ TRACE(_T("CMpcAudioRenderer::CheckAudioClient"));
+ if (pMMDevice == NULL) hr=GetDefaultAudioDevice(&pMMDevice);
+
+ // If no WAVEFORMATEX structure provided and client already exists, return it
+ if (pAudioClient != NULL && pWaveFormatEx == NULL) return hr;
+
+ // Just create the audio client if no WAVEFORMATEX provided
+ if (pAudioClient == NULL && pWaveFormatEx==NULL)
+ {
+ if (SUCCEEDED (hr)) hr=CreateAudioClient(pMMDevice, &pAudioClient);
+ return hr;
+ }
+
+ // Compare the exisiting WAVEFORMATEX with the one provided
+ WAVEFORMATEX *pNewWaveFormatEx = NULL;
+ if (CheckFormatChanged(pWaveFormatEx, &pNewWaveFormatEx))
+ {
+ // Format has changed, audio client has to be reinitialized
+ TRACE(_T("CMpcAudioRenderer::CheckAudioClient Format changed, reinitialize the audio client"));
+ if (m_pWaveFileFormat)
+ {
+ BYTE *p = (BYTE *)m_pWaveFileFormat;
+ SAFE_DELETE_ARRAY(p);
+ }
+ m_pWaveFileFormat=pNewWaveFormatEx;
+ hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pWaveFormatEx, NULL);
+ if (SUCCEEDED(hr))
+ {
+ if (pAudioClient!=NULL && isAudioClientStarted) pAudioClient->Stop();
+ isAudioClientStarted=false;
+ SAFE_RELEASE(pRenderClient);
+ SAFE_RELEASE(pAudioClient);
+ if (SUCCEEDED (hr)) hr=CreateAudioClient(pMMDevice, &pAudioClient);
+ }
+ else
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckAudioClient New format not supported, accept it anyway"));
+ return S_OK;
+ }
+ }
+ else if (pRenderClient == NULL)
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckAudioClient First initialization of the audio renderer"));
+ }
+ else
+ return hr;
+
+
+ SAFE_RELEASE(pRenderClient);
+ if (SUCCEEDED (hr)) hr=InitAudioClient(pWaveFormatEx, pAudioClient, &pRenderClient);
+ return hr;
}
/* Retrieves the default audio device from the Core Audio API
- To be used for WASAPI mode
- TODO : choose a device in the renderer configuration dialogs
+To be used for WASAPI mode
+TODO : choose a device in the renderer configuration dialogs
*/
HRESULT CMpcAudioRenderer::GetDefaultAudioDevice(IMMDevice **ppMMDevice)
{
HRESULT hr;
CComPtr<IMMDeviceEnumerator> enumerator;
- TRACE(_T("CMpcAudioRenderer::GetDefaultAudioDevice"));
+ TRACE(_T("CMpcAudioRenderer::GetDefaultAudioDevice"));
hr = enumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator));
hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole,
- ppMMDevice);
- return hr;
+ ppMMDevice);
+ return hr;
}
bool CMpcAudioRenderer::CheckFormatChanged(WAVEFORMATEX *pWaveFormatEx, WAVEFORMATEX **ppNewWaveFormatEx)
{
- bool formatChanged=false;
- if (m_pWaveFileFormat==NULL)
- formatChanged=true;
- else if (pWaveFormatEx->wFormatTag != m_pWaveFileFormat->wFormatTag
- || pWaveFormatEx->nChannels != m_pWaveFileFormat->nChannels
- || pWaveFormatEx->wBitsPerSample != m_pWaveFileFormat->wBitsPerSample) // TODO : improve the checks
- formatChanged=true;
+ bool formatChanged=false;
+ if (m_pWaveFileFormat==NULL)
+ formatChanged=true;
+ else if (pWaveFormatEx->wFormatTag != m_pWaveFileFormat->wFormatTag
+ || pWaveFormatEx->nChannels != m_pWaveFileFormat->nChannels
+ || pWaveFormatEx->wBitsPerSample != m_pWaveFileFormat->wBitsPerSample) // TODO : improve the checks
+ formatChanged=true;
- if (!formatChanged) return false;
+ if (!formatChanged) return false;
- int size = sizeof(WAVEFORMATEX) + pWaveFormatEx->cbSize; // Always true, even for WAVEFORMATEXTENSIBLE and WAVEFORMATEXTENSIBLE_IEC61937
- *ppNewWaveFormatEx = (WAVEFORMATEX *)new BYTE[size];
+ int size = sizeof(WAVEFORMATEX) + pWaveFormatEx->cbSize; // Always true, even for WAVEFORMATEXTENSIBLE and WAVEFORMATEXTENSIBLE_IEC61937
+ *ppNewWaveFormatEx = (WAVEFORMATEX *)new BYTE[size];
if (! *ppNewWaveFormatEx)
return false;
- memcpy(*ppNewWaveFormatEx, pWaveFormatEx, size);
- return true;
+ memcpy(*ppNewWaveFormatEx, pWaveFormatEx, size);
+ return true;
}
HRESULT CMpcAudioRenderer::GetBufferSize(WAVEFORMATEX *pWaveFormatEx, REFERENCE_TIME *pHnsBufferPeriod)
{
- if (pWaveFormatEx==NULL) return S_OK;
- if (pWaveFormatEx->cbSize <22) //WAVEFORMATEX
- return S_OK;
-
- WAVEFORMATEXTENSIBLE *wfext=(WAVEFORMATEXTENSIBLE*)pWaveFormatEx;
-
- if (bufferSize==0)
- if (wfext->SubFormat==KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP)
- bufferSize=61440;
- else if (wfext->SubFormat==KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD)
- bufferSize=32768;
- else if (wfext->SubFormat==KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS)
- bufferSize=24576;
- else if (wfext->Format.wFormatTag==WAVE_FORMAT_DOLBY_AC3_SPDIF)
- bufferSize=6144;
- else return S_OK;
-
- *pHnsBufferPeriod = (REFERENCE_TIME)( (REFERENCE_TIME)bufferSize * 10000 * 8 / ((REFERENCE_TIME)pWaveFormatEx->nChannels * pWaveFormatEx->wBitsPerSample *
- 1.0 * pWaveFormatEx->nSamplesPerSec) /*+ 0.5*/);
- *pHnsBufferPeriod *= 1000;
-
- TRACE(_T("CMpcAudioRenderer::GetBufferSize set a %lld period for a %ld buffer size"),*pHnsBufferPeriod,bufferSize);
-
- return S_OK;
+ if (pWaveFormatEx==NULL) return S_OK;
+ if (pWaveFormatEx->cbSize <22) //WAVEFORMATEX
+ return S_OK;
+
+ WAVEFORMATEXTENSIBLE *wfext=(WAVEFORMATEXTENSIBLE*)pWaveFormatEx;
+
+ if (bufferSize==0)
+ if (wfext->SubFormat==KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP)
+ bufferSize=61440;
+ else if (wfext->SubFormat==KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD)
+ bufferSize=32768;
+ else if (wfext->SubFormat==KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS)
+ bufferSize=24576;
+ else if (wfext->Format.wFormatTag==WAVE_FORMAT_DOLBY_AC3_SPDIF)
+ bufferSize=6144;
+ else return S_OK;
+
+ *pHnsBufferPeriod = (REFERENCE_TIME)( (REFERENCE_TIME)bufferSize * 10000 * 8 / ((REFERENCE_TIME)pWaveFormatEx->nChannels * pWaveFormatEx->wBitsPerSample *
+ 1.0 * pWaveFormatEx->nSamplesPerSec) /*+ 0.5*/);
+ *pHnsBufferPeriod *= 1000;
+
+ TRACE(_T("CMpcAudioRenderer::GetBufferSize set a %lld period for a %ld buffer size"),*pHnsBufferPeriod,bufferSize);
+
+ return S_OK;
}
HRESULT CMpcAudioRenderer::InitAudioClient(WAVEFORMATEX *pWaveFormatEx, IAudioClient *pAudioClient, IAudioRenderClient **ppRenderClient)
{
- TRACE(_T("CMpcAudioRenderer::InitAudioClient"));
- HRESULT hr=S_OK;
- // Initialize the stream to play at the minimum latency.
- //if (SUCCEEDED (hr)) hr = pAudioClient->GetDevicePeriod(NULL, &hnsPeriod);
- hnsPeriod=500000; //50 ms is the best according to James @Slysoft
-
- hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pWaveFormatEx, NULL);
- if (FAILED(hr))
- TRACE(_T("CMpcAudioRenderer::InitAudioClient not supported (0x%08x)"), hr);
- else
- TRACE(_T("CMpcAudioRenderer::InitAudioClient format supported"));
-
- GetBufferSize(pWaveFormatEx, &hnsPeriod);
-
- if (SUCCEEDED (hr)) hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,0/*AUDCLNT_STREAMFLAGS_EVENTCALLBACK*/,
- hnsPeriod,hnsPeriod,pWaveFormatEx,NULL);
- if (FAILED (hr) && hr != AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED)
- {
- TRACE(_T("CMpcAudioRenderer::InitAudioClient failed (0x%08x)"), hr);
- return hr;
- }
-
- if (AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED == hr)
- {
- // if the buffer size was not aligned, need to do the alignment dance
- TRACE(_T("CMpcAudioRenderer::InitAudioClient Buffer size not aligned. Realigning"));
-
- // get the buffer size, which will be aligned
- hr = pAudioClient->GetBufferSize(&nFramesInBuffer);
-
- // throw away this IAudioClient
- pAudioClient->Release();pAudioClient=NULL;
-
- // calculate the new aligned periodicity
- hnsPeriod = // hns =
- (REFERENCE_TIME)(
- 10000.0 * // (hns / ms) *
- 1000 * // (ms / s) *
- nFramesInBuffer / // frames /
- pWaveFormatEx->nSamplesPerSec // (frames / s)
- + 0.5 // rounding
- );
-
- if (SUCCEEDED (hr)) hr=CreateAudioClient(pMMDevice, &pAudioClient);
- TRACE(_T("CMpcAudioRenderer::InitAudioClient Trying again with periodicity of %I64u hundred-nanoseconds, or %u frames.\n"), hnsPeriod, nFramesInBuffer);
- if (SUCCEEDED (hr))
- hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,0/*AUDCLNT_STREAMFLAGS_EVENTCALLBACK*/,
- hnsPeriod, hnsPeriod, pWaveFormatEx, NULL);
- if (FAILED(hr))
- {
- TRACE(_T("CMpcAudioRenderer::InitAudioClient Failed to reinitialize the audio client"));
- return hr;
- }
- } // if (AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED == hr)
-
- // get the buffer size, which is aligned
- if (SUCCEEDED (hr)) hr = pAudioClient->GetBufferSize(&nFramesInBuffer);
-
- // calculate the new period
- if (SUCCEEDED (hr)) hr = pAudioClient->GetService(__uuidof(IAudioRenderClient), (void**)(ppRenderClient));
-
- if (FAILED (hr))
- TRACE(_T("CMpcAudioRenderer::InitAudioClient service initialization failed (0x%08x)"), hr);
- else
- TRACE(_T("CMpcAudioRenderer::InitAudioClient service initialization success"));
-
- return hr;
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient"));
+ HRESULT hr=S_OK;
+ // Initialize the stream to play at the minimum latency.
+ //if (SUCCEEDED (hr)) hr = pAudioClient->GetDevicePeriod(NULL, &hnsPeriod);
+ hnsPeriod=500000; //50 ms is the best according to James @Slysoft
+
+ hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pWaveFormatEx, NULL);
+ if (FAILED(hr))
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient not supported (0x%08x)"), hr);
+ else
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient format supported"));
+
+ GetBufferSize(pWaveFormatEx, &hnsPeriod);
+
+ if (SUCCEEDED (hr)) hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,0/*AUDCLNT_STREAMFLAGS_EVENTCALLBACK*/,
+ hnsPeriod,hnsPeriod,pWaveFormatEx,NULL);
+ if (FAILED (hr) && hr != AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED)
+ {
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient failed (0x%08x)"), hr);
+ return hr;
+ }
+
+ if (AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED == hr)
+ {
+ // if the buffer size was not aligned, need to do the alignment dance
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient Buffer size not aligned. Realigning"));
+
+ // get the buffer size, which will be aligned
+ hr = pAudioClient->GetBufferSize(&nFramesInBuffer);
+
+ // throw away this IAudioClient
+ pAudioClient->Release();pAudioClient=NULL;
+
+ // calculate the new aligned periodicity
+ hnsPeriod = // hns =
+ (REFERENCE_TIME)(
+ 10000.0 * // (hns / ms) *
+ 1000 * // (ms / s) *
+ nFramesInBuffer / // frames /
+ pWaveFormatEx->nSamplesPerSec // (frames / s)
+ + 0.5 // rounding
+ );
+
+ if (SUCCEEDED (hr)) hr=CreateAudioClient(pMMDevice, &pAudioClient);
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient Trying again with periodicity of %I64u hundred-nanoseconds, or %u frames.\n"), hnsPeriod, nFramesInBuffer);
+ if (SUCCEEDED (hr))
+ hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,0/*AUDCLNT_STREAMFLAGS_EVENTCALLBACK*/,
+ hnsPeriod, hnsPeriod, pWaveFormatEx, NULL);
+ if (FAILED(hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient Failed to reinitialize the audio client"));
+ return hr;
+ }
+ } // if (AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED == hr)
+
+ // get the buffer size, which is aligned
+ if (SUCCEEDED (hr)) hr = pAudioClient->GetBufferSize(&nFramesInBuffer);
+
+ // calculate the new period
+ if (SUCCEEDED (hr)) hr = pAudioClient->GetService(__uuidof(IAudioRenderClient), (void**)(ppRenderClient));
+
+ if (FAILED (hr))
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient service initialization failed (0x%08x)"), hr);
+ else
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient service initialization success"));
+
+ return hr;
}
HRESULT CMpcAudioRenderer::CreateAudioClient(IMMDevice *pMMDevice, IAudioClient **ppAudioClient)
{
- HRESULT hr = S_OK;
- hnsPeriod = 0;
-
- TRACE(_T("CMpcAudioRenderer::CreateAudioClient"));
-
- if (*ppAudioClient)
- {
- if (isAudioClientStarted) (*ppAudioClient)->Stop();
- SAFE_RELEASE(*ppAudioClient);
- isAudioClientStarted=false;
- }
-
- if (pMMDevice==NULL)
- {
- TRACE(_T("CMpcAudioRenderer::CreateAudioClient failed, device not loaded"));
- return E_FAIL;
- }
-
- hr = pMMDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, NULL, reinterpret_cast<void**>(ppAudioClient));
- if (FAILED(hr))
- TRACE(_T("CMpcAudioRenderer::CreateAudioClient activation failed (0x%08x)"), hr);
- else
- TRACE(_T("CMpcAudioRenderer::CreateAudioClient success"));
- return hr;
+ HRESULT hr = S_OK;
+ hnsPeriod = 0;
+
+ TRACE(_T("CMpcAudioRenderer::CreateAudioClient"));
+
+ if (*ppAudioClient)
+ {
+ if (isAudioClientStarted) (*ppAudioClient)->Stop();
+ SAFE_RELEASE(*ppAudioClient);
+ isAudioClientStarted=false;
+ }
+
+ if (pMMDevice==NULL)
+ {
+ TRACE(_T("CMpcAudioRenderer::CreateAudioClient failed, device not loaded"));
+ return E_FAIL;
+ }
+
+ hr = pMMDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, NULL, reinterpret_cast<void**>(ppAudioClient));
+ if (FAILED(hr))
+ TRACE(_T("CMpcAudioRenderer::CreateAudioClient activation failed (0x%08x)"), hr);
+ else
+ TRACE(_T("CMpcAudioRenderer::CreateAudioClient success"));
+ return hr;
}
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.cpp index 159df256d..f17d997ed 100644 --- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.cpp +++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.cpp @@ -219,7 +219,7 @@ uint FIRFilter::evaluate(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSample // Operator 'new' is overloaded so that it automatically creates a suitable instance
// depending on if we've a MMX-capable CPU available or not.
-void * FIRFilter::operator new(size_t s)
+void * FIRFilter::operator new(size_t /*s*/)
{
// Notice! don't use "new FIRFilter" directly, use "newInstance" to create a new instance instead!
throw std::runtime_error("Error in FIRFilter::new: Don't use 'new FIRFilter', use 'newInstance' member instead!");
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.cpp index 7e0b277d6..49d71ab9d 100644 --- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.cpp +++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.cpp @@ -106,7 +106,7 @@ public: // Operator 'new' is overloaded so that it automatically creates a suitable instance
// depending on if we've a MMX/SSE/etc-capable CPU available or not.
-void * RateTransposer::operator new(size_t s)
+void * RateTransposer::operator new(size_t /*s*/)
{
throw runtime_error("Error in RateTransoser::new: don't use \"new TDStretch\" directly, use \"newInstance\" to create a new instance instead!");
return NULL;
@@ -417,7 +417,7 @@ uint RateTransposerInteger::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *sr // now always (iSlopeCount > SCALE)
iSlopeCount -= SCALE;
- while (1)
+ while (TRUE)
{
while (iSlopeCount > SCALE)
{
@@ -467,7 +467,7 @@ uint RateTransposerInteger::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE * // now always (iSlopeCount > SCALE)
iSlopeCount -= SCALE;
- while (1)
+ while (TRUE)
{
while (iSlopeCount > SCALE)
{
@@ -554,7 +554,7 @@ uint RateTransposerFloat::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, if (nSamples > 1)
{
- while (1)
+ while (TRUE)
{
while (fSlopeCount > 1.0f)
{
@@ -600,7 +600,7 @@ uint RateTransposerFloat::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *sr if (nSamples > 1)
{
- while (1)
+ while (TRUE)
{
while (fSlopeCount > 1.0f)
{
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.cpp index 062524c84..6dea5f516 100644 --- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.cpp +++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.cpp @@ -737,7 +737,7 @@ void TDStretch::acceptNewOverlapLength(int newOverlapLength) // Operator 'new' is overloaded so that it automatically creates a suitable instance
// depending on if we've a MMX/SSE/etc-capable CPU available or not.
-void * TDStretch::operator new(size_t s)
+void * TDStretch::operator new(size_t /*s*/)
{
// Notice! don't use "new TDStretch" directly, use "newInstance" to create a new instance instead!
throw std::runtime_error("Error in TDStretch::new: Don't use 'new TDStretch' directly, use 'newInstance' member instead!");
@@ -849,8 +849,8 @@ void TDStretch::overlapStereo(short *poutput, const short *input) const {
temp = (short)(overlapLength - i);
cnt2 = 2 * i;
- poutput[cnt2] = (input[cnt2] * i + pMidBuffer[cnt2] * temp ) / overlapLength;
- poutput[cnt2 + 1] = (input[cnt2 + 1] * i + pMidBuffer[cnt2 + 1] * temp ) / overlapLength;
+ poutput[cnt2] = (short)((input[cnt2] * i + pMidBuffer[cnt2] * temp ) / overlapLength);
+ poutput[cnt2 + 1] = (short)((input[cnt2 + 1] * i + pMidBuffer[cnt2 + 1] * temp ) / overlapLength);
}
}
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/mmx_optimized.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/mmx_optimized.cpp index 539ee57c8..2740617a0 100644 --- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/mmx_optimized.cpp +++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/mmx_optimized.cpp @@ -162,7 +162,7 @@ void TDStretchMMX::overlapStereo(short *output, const short *input) const // mix1 = mixer values for 2nd stereo sample
// adder = adder for updating mixer values after each round
- mix1 = _mm_set_pi16(0, overlapLength, 0, overlapLength);
+ mix1 = _mm_set_pi16(0, (short)overlapLength, 0, (short)overlapLength);
adder = _mm_set_pi16(1, -1, 1, -1);
mix2 = _mm_add_pi16(mix1, adder);
adder = _mm_add_pi16(adder, adder);
diff --git a/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp b/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp index f094311dd..fdff20133 100644 --- a/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp +++ b/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp @@ -50,7 +50,7 @@ HRESULT CreateAP7(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppA *ppAP = NULL;
- HRESULT hr;
+ HRESULT hr = S_OK;
if(clsid == CLSID_VMR7AllocatorPresenter && !(*ppAP = DNew CVMR7AllocatorPresenter(hWnd, hr))
|| clsid == CLSID_RM7AllocatorPresenter && !(*ppAP = DNew CRM7AllocatorPresenter(hWnd, hr))
|| clsid == CLSID_QT7AllocatorPresenter && !(*ppAP = DNew CQT7AllocatorPresenter(hWnd, hr)))
diff --git a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp index 9d6122cd2..f126c8f6d 100644 --- a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp @@ -122,49 +122,43 @@ static HRESULT TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[4] HRESULT hr;
- do
- {
- hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
- hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
-
- for(int i = 0; i < texcoords; i++)
- {
- hr = pD3DDev->SetSamplerState(i, D3DSAMP_MAGFILTER, filter);
- hr = pD3DDev->SetSamplerState(i, D3DSAMP_MINFILTER, filter);
- hr = pD3DDev->SetSamplerState(i, D3DSAMP_MIPFILTER, filter);
-
- hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
- hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
- }
+ hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
+
+ for(int i = 0; i < texcoords; i++)
+ {
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_MAGFILTER, filter);
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_MINFILTER, filter);
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_MIPFILTER, filter);
- //
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
+ }
- hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | FVF);
- // hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v, sizeof(v[0]));
+ //
- MYD3DVERTEX<texcoords> tmp = v[2];
- v[2] = v[3];
- v[3] = tmp;
- hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
+ hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | FVF);
+ // hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v, sizeof(v[0]));
- //
+ MYD3DVERTEX<texcoords> tmp = v[2];
+ v[2] = v[3];
+ v[3] = tmp;
+ hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
- for(int i = 0; i < texcoords; i++)
- {
- pD3DDev->SetTexture(i, NULL);
- }
+ //
- return S_OK;
- }
- while(0);
+ for(int i = 0; i < texcoords; i++)
+ {
+ pD3DDev->SetTexture(i, NULL);
+ }
- return E_FAIL;
+ return S_OK;
}
static HRESULT DrawRect(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<0> v[4])
@@ -172,35 +166,29 @@ static HRESULT DrawRect(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<0> v[4]) if(!pD3DDev)
return E_POINTER;
- do
- {
- HRESULT hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
- hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
- hr = pD3DDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
- hr = pD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
- //D3DRS_COLORVERTEX
- hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+ HRESULT hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
+ hr = pD3DDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
+ hr = pD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
+ //D3DRS_COLORVERTEX
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
+ hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
- hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX0 | D3DFVF_DIFFUSE);
- // hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v, sizeof(v[0]));
+ hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX0 | D3DFVF_DIFFUSE);
+ // hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v, sizeof(v[0]));
- MYD3DVERTEX<0> tmp = v[2];
- v[2] = v[3];
- v[3] = tmp;
- hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
+ MYD3DVERTEX<0> tmp = v[2];
+ v[2] = v[3];
+ v[3] = tmp;
+ hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
- return S_OK;
- }
- while(0);
-
- return E_FAIL;
+ return S_OK;
}
using namespace DSObjects;
@@ -928,7 +916,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error) return E_UNEXPECTED;
}
- HRESULT hr;
+ HRESULT hr = S_OK;
m_CurrentAdapter = GetAdapter(m_pD3D);
/* // TODO : add nVidia PerfHUD !!!
@@ -1738,7 +1726,7 @@ HRESULT CDX9AllocatorPresenter::TextureResizeBicubic2pass(IDirect3DTexture9* pTe // The 2 pass sampler is incorrect in that it only does bilinear resampling in the y direction.
return TextureResizeBicubic1pass(pTexture, dst, SrcRect);
- HRESULT hr;
+ /*HRESULT hr;
// rotated?
if(dst[0].z != dst[1].z || dst[2].z != dst[3].z || dst[0].z != dst[3].z
@@ -1853,7 +1841,7 @@ HRESULT CDX9AllocatorPresenter::TextureResizeBicubic2pass(IDirect3DTexture9* pTe m_pD3DDev->SetPixelShader(NULL);
- return hr;
+ return hr;*/
}
HRESULT CDX9AllocatorPresenter::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* pTexture)
@@ -1997,7 +1985,7 @@ void CDX9AllocatorPresenter::CalculateJitter(LONGLONG PerfCounter) bool CDX9AllocatorPresenter::GetVBlank(int &_ScanLine, int &_bInVBlank, bool _bMeasureTime)
{
- LONGLONG llPerf;
+ LONGLONG llPerf = 0;
if (_bMeasureTime)
llPerf = GetRenderersData()->GetPerfCounter();
@@ -2060,7 +2048,7 @@ bool CDX9AllocatorPresenter::WaitForVBlankRange(int &_RasterStart, int _RasterSi bool bWaited = false;
int ScanLine = 0;
int InVBlank = 0;
- LONGLONG llPerf;
+ LONGLONG llPerf = 0;
if (_bMeasure)
llPerf = GetRenderersData()->GetPerfCounter();
GetVBlank(ScanLine, InVBlank, _bMeasure);
@@ -2162,7 +2150,7 @@ bool CDX9AllocatorPresenter::WaitForVBlankRange(int &_RasterStart, int _RasterSi ScanLineDiffLock += m_ScreenSize.cy;
int LastLineDiffLock = ScanLineDiffLock;
- LONGLONG llPerfLock;
+ LONGLONG llPerfLock = 0;
while (1)
{
diff --git a/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp index eb92698e9..adfaba25c 100644 --- a/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp @@ -1549,6 +1549,7 @@ STDMETHODIMP CEVRAllocatorPresenter::GetVideoService(HANDLE hDevice, REFIID riid else if (riid == __uuidof(IDirectXVideoProcessorService))
{
IDirectXVideoProcessorService* pDXVAProcessor = (IDirectXVideoProcessorService*) *ppService;
+ UNUSED_ALWAYS(pDXVAProcessor);
}
return hr;
@@ -1609,7 +1610,7 @@ STDMETHODIMP CEVRAllocatorPresenter::InitializeDevice(AM_MEDIA_TYPE* pMediaType) DWORD WINAPI CEVRAllocatorPresenter::GetMixerThreadStatic(LPVOID lpParam)
{
- SetThreadName(-1, "CEVRPresenter::MixerThread");
+ SetThreadName((DWORD)-1, "CEVRPresenter::MixerThread");
CEVRAllocatorPresenter* pThis = (CEVRAllocatorPresenter*) lpParam;
pThis->GetMixerThread();
return 0;
@@ -1618,7 +1619,7 @@ DWORD WINAPI CEVRAllocatorPresenter::GetMixerThreadStatic(LPVOID lpParam) DWORD WINAPI CEVRAllocatorPresenter::PresentThread(LPVOID lpParam)
{
- SetThreadName(-1, "CEVRPresenter::PresentThread");
+ SetThreadName((DWORD)-1, "CEVRPresenter::PresentThread");
CEVRAllocatorPresenter* pThis = (CEVRAllocatorPresenter*) lpParam;
pThis->RenderThread();
return 0;
@@ -1652,13 +1653,13 @@ bool ExtractInterlaced(const AM_MEDIA_TYPE* pmt) void CEVRAllocatorPresenter::GetMixerThread()
{
- HANDLE hAvrt;
+ //HANDLE hAvrt;
HANDLE hEvts[] = { m_hEvtQuit};
bool bQuit = false;
TIMECAPS tc;
DWORD dwResolution;
DWORD dwUser = 0;
- DWORD dwTaskIndex = 0;
+ //DWORD dwTaskIndex = 0;
// Tell Vista Multimedia Class Scheduler we are a playback thretad (increase priority)
// if (pfAvSetMmThreadCharacteristicsW)
@@ -1765,6 +1766,7 @@ LONGLONG CEVRAllocatorPresenter::GetClockTime(LONGLONG PerformanceCounter) double TimeChange = llPerf - m_ModeratedTimeLast;
double ClockChange = llClockTime - m_ModeratedClockLast;
+ UNUSED_ALWAYS(ClockChange);
m_ModeratedTimeLast = llPerf;
m_ModeratedClockLast = llClockTime;
@@ -1999,8 +2001,6 @@ STDMETHODIMP_(bool) CEVRAllocatorPresenter::ResetDevice() void CEVRAllocatorPresenter::RenderThread()
{
- HANDLE hAvrt;
- DWORD dwTaskIndex = 0;
HANDLE hEvts[] = { m_hEvtQuit, m_hEvtFlush};
bool bQuit = false;
TIMECAPS tc;
@@ -2012,8 +2012,14 @@ void CEVRAllocatorPresenter::RenderThread() // Tell Vista Multimedia Class Scheduler we are a playback thretad (increase priority)
- if (pfAvSetMmThreadCharacteristicsW) hAvrt = pfAvSetMmThreadCharacteristicsW (L"Playback", &dwTaskIndex);
- if (pfAvSetMmThreadPriority) pfAvSetMmThreadPriority (hAvrt, AVRT_PRIORITY_HIGH /*AVRT_PRIORITY_CRITICAL*/);
+ HANDLE hAvrt = 0;
+ if (pfAvSetMmThreadCharacteristicsW)
+ {
+ DWORD dwTaskIndex = 0;
+ hAvrt = pfAvSetMmThreadCharacteristicsW (L"Playback", &dwTaskIndex);
+ if (pfAvSetMmThreadPriority)
+ pfAvSetMmThreadPriority (hAvrt, AVRT_PRIORITY_HIGH /*AVRT_PRIORITY_CRITICAL*/);
+ }
timeGetDevCaps(&tc, sizeof(TIMECAPS));
dwResolution = min(max(tc.wPeriodMin, 0), tc.wPeriodMax);
@@ -2024,6 +2030,7 @@ void CEVRAllocatorPresenter::RenderThread() while (!bQuit)
{
LONGLONG llPerf = GetRenderersData()->GetPerfCounter();
+ UNUSED_ALWAYS(llPerf);
if (!s.m_RenderSettings.iVMR9VSyncAccurate && NextSleepTime == 0)
NextSleepTime = 1;
dwObject = WaitForMultipleObjects (countof(hEvts), hEvts, FALSE, max(NextSleepTime < 0 ? 1 : NextSleepTime, 0));
@@ -2070,7 +2077,8 @@ void CEVRAllocatorPresenter::RenderThread() // if (WaitForMultipleObjects (countof(hEvtsBuff), hEvtsBuff, FALSE, INFINITE) == WAIT_OBJECT_0+2)
{
CComPtr<IMFSample> pMFSample;
- LONGLONG llPerf = GetRenderersData()->GetPerfCounter();
+ LONGLONG llPerf = GetRenderersData()->GetPerfCounter();
+ UNUSED_ALWAYS(llPerf);
int nSamplesLeft = 0;
if (SUCCEEDED (GetScheduledSample(&pMFSample, nSamplesLeft)))
{
@@ -2481,7 +2489,8 @@ void CEVRAllocatorPresenter::MoveToScheduledList(IMFSample* pSample, bool _bSort // double ForceFPS = 23.976;
if (ForceFPS != 0.0)
m_rtTimePerFrame = 10000000.0 / ForceFPS;
- LONGLONG Duration = m_rtTimePerFrame;
+ LONGLONG Duration = m_rtTimePerFrame;
+ UNUSED_ALWAYS(Duration);
LONGLONG PrevTime = m_LastScheduledUncorrectedSampleTime;
LONGLONG Time;
LONGLONG SetDuration;
diff --git a/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp index 451c5b2e0..324dad529 100644 --- a/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp @@ -113,8 +113,8 @@ STDMETHODIMP CQT7AllocatorPresenter::DoBlt(const BITMAP& bm) if(FAILED(m_pVideoSurfaceOff->GetSurfaceDesc(&ddsd)))
return E_FAIL;
- int w = bm.bmWidth;
- int h = abs(bm.bmHeight);
+ UINT w = (UINT)bm.bmWidth;
+ UINT h = abs(bm.bmHeight);
int bpp = bm.bmBitsPixel;
if((bpp == 16 || bpp == 24 || bpp == 32) && w == ddsd.dwWidth && h == ddsd.dwHeight)
diff --git a/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp index 115f5b4a3..ac2957308 100644 --- a/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp @@ -88,8 +88,8 @@ STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm) if(FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd)))
return E_FAIL;
- int w = bm.bmWidth;
- int h = abs(bm.bmHeight);
+ UINT w = (UINT)bm.bmWidth;
+ UINT h = abs(bm.bmHeight);
int bpp = bm.bmBitsPixel;
int dbpp =
d3dsd.Format == D3DFMT_R8G8B8 || d3dsd.Format == D3DFMT_X8R8G8B8 || d3dsd.Format == D3DFMT_A8R8G8B8 ? 32 :
diff --git a/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp index 272ea2f1f..ec6e36650 100644 --- a/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp @@ -160,6 +160,8 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
DWORD pitch = pBitmapInfo->biWidth*2;
+ UNUSED_ALWAYS(w);
+ UNUSED_ALWAYS(h);
BYTE* yvyu = pImageData + src.top*pitch + src.left*2;
@@ -190,6 +192,8 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
DWORD pitch = pBitmapInfo->biWidth*pBitmapInfo->biBitCount>>3;
+ UNUSED_ALWAYS(w);
+ UNUSED_ALWAYS(h);
BYTE* rgb = pImageData + src.top*pitch + src.left*(pBitmapInfo->biBitCount>>3);
diff --git a/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp index 7d5c25795..8681d5c9d 100644 --- a/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp @@ -139,7 +139,9 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* {
DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
- DWORD pitch = pBitmapInfo->biWidth*2;
+ DWORD pitch = pBitmapInfo->biWidth*2;
+ UNUSED_ALWAYS(w);
+ UNUSED_ALWAYS(h);
BYTE* yvyu = pImageData + src.top*pitch + src.left*2;
@@ -169,7 +171,9 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* {
DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
- DWORD pitch = pBitmapInfo->biWidth*pBitmapInfo->biBitCount>>3;
+ DWORD pitch = pBitmapInfo->biWidth*pBitmapInfo->biBitCount>>3;
+ UNUSED_ALWAYS(w);
+ UNUSED_ALWAYS(h);
BYTE* rgb = pImageData + src.top*pitch + src.left*(pBitmapInfo->biBitCount>>3);
diff --git a/src/filters/renderer/VideoRenderers/SyncRenderer.cpp b/src/filters/renderer/VideoRenderers/SyncRenderer.cpp index 9ff989588..3806759c0 100644 --- a/src/filters/renderer/VideoRenderers/SyncRenderer.cpp +++ b/src/filters/renderer/VideoRenderers/SyncRenderer.cpp @@ -347,75 +347,65 @@ HRESULT CBaseAP::TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[ return E_FAIL;
}
- HRESULT hr;
- do
- {
- hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
- hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
-
- for(int i = 0; i < texcoords; i++)
- {
- hr = pD3DDev->SetSamplerState(i, D3DSAMP_MAGFILTER, filter);
- hr = pD3DDev->SetSamplerState(i, D3DSAMP_MINFILTER, filter);
- hr = pD3DDev->SetSamplerState(i, D3DSAMP_MIPFILTER, filter);
+ HRESULT hr;
+ hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
+
+ for(int i = 0; i < texcoords; i++)
+ {
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_MAGFILTER, filter);
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_MINFILTER, filter);
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_MIPFILTER, filter);
- hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
- hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
- }
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
+ }
- hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | FVF);
+ hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | FVF);
- MYD3DVERTEX<texcoords> tmp = v[2];
- v[2] = v[3];
- v[3] = tmp;
- hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
+ MYD3DVERTEX<texcoords> tmp = v[2];
+ v[2] = v[3];
+ v[3] = tmp;
+ hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
- for(int i = 0; i < texcoords; i++)
- {
- pD3DDev->SetTexture(i, NULL);
- }
+ for(int i = 0; i < texcoords; i++)
+ {
+ pD3DDev->SetTexture(i, NULL);
+ }
- return S_OK;
- }
- while(0);
- return E_FAIL;
+ return S_OK;
}
HRESULT CBaseAP::DrawRectBase(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<0> v[4])
{
if(!pD3DDev) return E_POINTER;
- do
- {
- HRESULT hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
- hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
- hr = pD3DDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
- hr = pD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
- hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+ HRESULT hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
+ hr = pD3DDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
+ hr = pD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
- hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
+ hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
- hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX0 | D3DFVF_DIFFUSE);
+ hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX0 | D3DFVF_DIFFUSE);
- MYD3DVERTEX<0> tmp = v[2];
- v[2] = v[3];
- v[3] = tmp;
- hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
+ MYD3DVERTEX<0> tmp = v[2];
+ v[2] = v[3];
+ v[3] = tmp;
+ hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
- return S_OK;
- }
- while(0);
- return E_FAIL;
+ return S_OK;
}
MFOffset CBaseAP::GetOffset(float v)
@@ -1440,7 +1430,7 @@ HRESULT CBaseAP::TextureResizeBicubic2pass(IDirect3DTexture9* pTexture, Vector d // The 2 pass sampler is incorrect in that it only does bilinear resampling in the y direction.
return TextureResizeBicubic1pass(pTexture, dst, SrcRect);
- HRESULT hr;
+ /*HRESULT hr;
// rotated?
if(dst[0].z != dst[1].z || dst[2].z != dst[3].z || dst[0].z != dst[3].z
@@ -1517,7 +1507,7 @@ HRESULT CBaseAP::TextureResizeBicubic2pass(IDirect3DTexture9* pTexture, Vector d hr = m_pD3DDev->SetRenderTarget(0, pRTOld);
hr = TextureBlt(m_pD3DDev, vy, D3DTEXF_POINT);
m_pD3DDev->SetPixelShader(NULL);
- return hr;
+ return hr;*/
}
HRESULT CBaseAP::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* pTexture)
@@ -3699,8 +3689,6 @@ DWORD WINAPI CSyncAP::RenderThreadStatic(LPVOID lpParam) // Get samples that have been received and queued up by MixerThread() and present them at the correct time by calling Paint().
void CSyncAP::RenderThread()
{
- HANDLE hAvrt;
- DWORD dwTaskIndex = 0;
HANDLE hEvts[] = {m_hEvtQuit, m_hEvtFlush, m_hEvtSkip};
bool bQuit = false;
TIMECAPS tc;
@@ -3714,8 +3702,13 @@ void CSyncAP::RenderThread() CComPtr<IMFSample>pNewSample = NULL; // The sample next in line to be presented
// Tell Vista Multimedia Class Scheduler we are doing threaded playback (increase priority)
- if (pfAvSetMmThreadCharacteristicsW) hAvrt = pfAvSetMmThreadCharacteristicsW (L"Playback", &dwTaskIndex);
- if (pfAvSetMmThreadPriority) pfAvSetMmThreadPriority (hAvrt, AVRT_PRIORITY_HIGH);
+ HANDLE hAvrt = 0;
+ if (pfAvSetMmThreadCharacteristicsW)
+ {
+ DWORD dwTaskIndex = 0;
+ hAvrt = pfAvSetMmThreadCharacteristicsW (L"Playback", &dwTaskIndex);
+ if (pfAvSetMmThreadPriority) pfAvSetMmThreadPriority (hAvrt, AVRT_PRIORITY_HIGH);
+ }
// Set timer resolution
timeGetDevCaps(&tc, sizeof(TIMECAPS));
@@ -4460,7 +4453,6 @@ HRESULT CGenlock::ResetClock() adjDelta = 0;
if (syncClock == NULL) return E_FAIL;
else return syncClock->AdjustClock(1.0);
- return S_OK;
}
HRESULT CGenlock::SetTargetSyncOffset(DOUBLE targetD)
diff --git a/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp index a450fdc32..d43b4f3ce 100644 --- a/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp @@ -195,7 +195,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::FreeSurface(DWORD_PTR dwUserID) STDMETHODIMP CVMR7AllocatorPresenter::PrepareSurface(DWORD_PTR dwUserID, IDirectDrawSurface7* lpSurface, DWORD dwSurfaceFlags)
{
- SetThreadName(-1, "CVMR7AllocatorPresenter");
+ SetThreadName((DWORD)-1, "CVMR7AllocatorPresenter");
if(!lpSurface)
return E_POINTER;
diff --git a/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp index a1a9975be..da879d0ff 100644 --- a/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp @@ -459,8 +459,8 @@ public: *pHeight = s.Height();
return hr;
}
- */
- return E_NOTIMPL;
+ return E_NOTIMPL;
+ */
}
STDMETHODIMP SetDefaultSourcePosition()
{
@@ -773,7 +773,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A hr = m_pD3DDev->ColorFill(m_pVideoSurface[m_nCurSurface], NULL, 0);
- if (m_nVMR9Surfaces && m_nVMR9Surfaces != *lpNumBuffers)
+ if (m_nVMR9Surfaces && m_nVMR9Surfaces != (int)*lpNumBuffers)
m_nVMR9Surfaces = *lpNumBuffers;
*lpNumBuffers = min(nOriginal, *lpNumBuffers);
m_iVMR9Surface = 0;
@@ -850,7 +850,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::StopPresenting(DWORD_PTR dwUserID) STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9PresentationInfo* lpPresInfo)
{
- SetThreadName(-1, "CVMR9AllocatorPresenter");
+ SetThreadName((DWORD)-1, "CVMR9AllocatorPresenter");
CheckPointer(m_pIVMRSurfAllocNotify, E_UNEXPECTED);
if (m_rtTimePerFrame == 0 || m_bNeedCheckSample)
diff --git a/src/filters/source/BaseSource/BaseSource.h b/src/filters/source/BaseSource/BaseSource.h index 91e2ccdb8..0ab2d1cf4 100644 --- a/src/filters/source/BaseSource/BaseSource.h +++ b/src/filters/source/BaseSource/BaseSource.h @@ -76,7 +76,8 @@ public: if(!ppszFileName) return E_POINTER;
nCount = m_fn.GetLength()+1;
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc(nCount*sizeof(WCHAR))))
+ *ppszFileName = (LPOLESTR)CoTaskMemAlloc(nCount*sizeof(WCHAR));
+ if(!(*ppszFileName))
return E_OUTOFMEMORY;
wcscpy_s(*ppszFileName, nCount, m_fn);
diff --git a/src/filters/source/D2VSource/MPEG2Dec.cpp b/src/filters/source/D2VSource/MPEG2Dec.cpp index 4be664c00..4e7bdc87c 100644 --- a/src/filters/source/D2VSource/MPEG2Dec.cpp +++ b/src/filters/source/D2VSource/MPEG2Dec.cpp @@ -813,7 +813,8 @@ void CMPEG2Dec::sequence_header() vbv_buffer_size = Get_Bits(10);
constrained_parameters_flag = Get_Bits(1);
- if (load_intra_quantizer_matrix = Get_Bits(1))
+ load_intra_quantizer_matrix = Get_Bits(1);
+ if (load_intra_quantizer_matrix)
{
for (i=0; i<64; i++)
intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
@@ -824,7 +825,8 @@ void CMPEG2Dec::sequence_header() intra_quantizer_matrix[i] = default_intra_quantizer_matrix[i];
}
- if (load_non_intra_quantizer_matrix = Get_Bits(1))
+ load_non_intra_quantizer_matrix = Get_Bits(1);
+ if (load_non_intra_quantizer_matrix)
{
for (i=0; i<64; i++)
non_intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
@@ -988,21 +990,25 @@ void CMPEG2Dec::quant_matrix_extension() {
int i;
- if (load_intra_quantizer_matrix = Get_Bits(1))
+ load_intra_quantizer_matrix = Get_Bits(1);
+ if (load_intra_quantizer_matrix)
for (i=0; i<64; i++)
chroma_intra_quantizer_matrix[scan[ZIG_ZAG][i]]
= intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
- if (load_non_intra_quantizer_matrix = Get_Bits(1))
+ load_non_intra_quantizer_matrix = Get_Bits(1);
+ if (load_non_intra_quantizer_matrix)
for (i=0; i<64; i++)
chroma_non_intra_quantizer_matrix[scan[ZIG_ZAG][i]]
= non_intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
-
- if (load_chroma_intra_quantizer_matrix = Get_Bits(1))
+
+ load_chroma_intra_quantizer_matrix = Get_Bits(1);
+ if (load_chroma_intra_quantizer_matrix)
for (i=0; i<64; i++)
chroma_intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
- if (load_chroma_non_intra_quantizer_matrix = Get_Bits(1))
+ load_chroma_non_intra_quantizer_matrix = Get_Bits(1);
+ if (load_chroma_non_intra_quantizer_matrix)
for (i=0; i<64; i++)
chroma_non_intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
}
@@ -1775,6 +1781,11 @@ void CMPEG2Dec::Decode_MPEG2_Intra_Block(int comp, int dc_dct_pred[]) case 2:
val = (dc_dct_pred[2]+= Get_Chroma_DC_dct_diff());
break;
+
+ default: // ERROR
+ ASSERT(FALSE);
+ val = 0;
+ break;
}
bp[0] = val << (3-intra_dc_precision);
@@ -1831,7 +1842,8 @@ void CMPEG2Dec::Decode_MPEG2_Intra_Block(int comp, int dc_dct_pred[]) i+= Get_Bits(6);
val = Get_Bits(12);
- if (sign = (val>=2048))
+ sign = (val>=2048);
+ if (sign)
val = 4096 - val;
}
@@ -1901,7 +1913,8 @@ void CMPEG2Dec::Decode_MPEG2_Non_Intra_Block(int comp) i+= Get_Bits(6);
val = Get_Bits(12);
- if (sign = (val>=2048))
+ sign = (val>=2048);
+ if (sign)
val = 4096 - val;
}
@@ -1929,6 +1942,11 @@ int CMPEG2Dec::Get_macroblock_type() case B_TYPE:
macroblock_type = Get_B_macroblock_type();
break;
+
+ default: //ERROR
+ ASSERT(FALSE);
+ macroblock_type = 0;
+ break;
}
return macroblock_type;
@@ -3736,11 +3754,13 @@ static char* myfgets(char* buff, int len, FILE* file) char* ret = buff;
ret[0] = 0;
-
- while(ret = fgets(buff, len, file))
+
+ ret = fgets(buff, len, file);
+ while(ret)
{
while(isspace(*ret)) ret++;
if(*ret) break;
+ ret = fgets(buff, len, file);
}
return(ret);
@@ -4150,7 +4170,7 @@ int CMPEG2Dec::Open(LPCTSTR path, DstFormat dstFormat) void CMPEG2Dec::Decode(unsigned char *dst, DWORD frame, int pitch)
{
- DWORD i, now, size, origin, ref, fo;
+ DWORD i, now, size = 0, origin, ref, fo = 0;
int remain;
CMPEG2Dec* in = this;
diff --git a/src/filters/source/DTSAC3Source/DTSAC3Source.cpp b/src/filters/source/DTSAC3Source/DTSAC3Source.cpp index fc6251abf..3bec4c649 100644 --- a/src/filters/source/DTSAC3Source/DTSAC3Source.cpp +++ b/src/filters/source/DTSAC3Source/DTSAC3Source.cpp @@ -175,6 +175,11 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr) int audiochannelarrangement = (buff[3]&15)<<2|(buff[4]>>6); // 6
int freq = (buff[4]>>2)&15; // 4
int transbitrate = ((buff[4]&3)<<3)|(buff[5]>>5); // 5
+ UNUSED_ALWAYS(frametype);
+ UNUSED_ALWAYS(deficitsamplecount);
+ UNUSED_ALWAYS(crcpresent);
+ UNUSED_ALWAYS(npcmsampleblocks);
+ UNUSED_ALWAYS(audiochannelarrangement);
int freqtbl[] =
{
@@ -321,6 +326,7 @@ HRESULT CDTSAC3Stream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, const GUID* majortype = &m_mt.majortype;
const GUID* subtype = &m_mt.subtype;
+ UNUSED_ALWAYS(subtype);
if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
{
diff --git a/src/filters/source/FLICSource/FLICSource.cpp b/src/filters/source/FLICSource/FLICSource.cpp index 1c291cd33..c0f10cdc8 100644 --- a/src/filters/source/FLICSource/FLICSource.cpp +++ b/src/filters/source/FLICSource/FLICSource.cpp @@ -133,7 +133,8 @@ STDMETHODIMP CFLICSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt) {
if(!ppszFileName) return E_POINTER;
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ *ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
+ if(!(*ppszFileName))
return E_OUTOFMEMORY;
wcscpy(*ppszFileName, m_fn);
@@ -222,7 +223,7 @@ CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr) || fc.type == FLIC_BLACK
|| fc.type == FLIC_COPY);
- __int64 pos = m_flic.GetPosition() + fc.size - sizeof(fc);
+ ULONGLONG pos = m_flic.GetPosition() + fc.size - sizeof(fc);
if(m_flic.Seek(pos, CFile::begin) != pos)
break;
@@ -231,7 +232,7 @@ CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr) if(chunk < ffe.hdr.chunks)
break;
- __int64 pos = ffe.pos + ffe.hdr.size - sizeof(ffe.hdr);
+ ULONGLONG pos = ffe.pos + ffe.hdr.size - sizeof(ffe.hdr);
if(m_flic.Seek(pos, CFile::begin) != pos)
break;
@@ -536,7 +537,7 @@ void CFLICStream::ExtractFrame(int nFrame) if(m_flic.Read(&fc, sizeof(fc)) != sizeof(fc))
break;
- __int64 next = m_flic.GetPosition() + fc.size - sizeof(fc);
+ ULONGLONG next = m_flic.GetPosition() + fc.size - sizeof(fc);
switch(fc.type)
{
diff --git a/src/filters/source/FlacSource/FlacSource.cpp b/src/filters/source/FlacSource/FlacSource.cpp index 5283edfd1..9f0cf22b7 100644 --- a/src/filters/source/FlacSource/FlacSource.cpp +++ b/src/filters/source/FlacSource/FlacSource.cpp @@ -330,7 +330,7 @@ FLAC__bool StreamDecoderEof(const FLAC__StreamDecoder *decoder, void *client_dat FLAC__StreamDecoderWriteStatus StreamDecoderWrite(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
{
CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
-
+ UNUSED_ALWAYS(pThis);
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
diff --git a/src/filters/source/ShoutcastSource/ShoutcastSource.cpp b/src/filters/source/ShoutcastSource/ShoutcastSource.cpp index 75bdf8d51..a25bfe871 100644 --- a/src/filters/source/ShoutcastSource/ShoutcastSource.cpp +++ b/src/filters/source/ShoutcastSource/ShoutcastSource.cpp @@ -189,7 +189,8 @@ STDMETHODIMP CShoutcastSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* {
if(!ppszFileName) return E_POINTER;
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ *ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
+ if(!(*ppszFileName))
return E_OUTOFMEMORY;
wcscpy(*ppszFileName, m_fn);
@@ -491,7 +492,7 @@ HRESULT CShoutcastStream::OnThreadDestroy() fExitThread = true;
m_socket.CancelBlockingCall();
- WaitForSingleObject(m_hSocketThread, -1);
+ WaitForSingleObject(m_hSocketThread, (DWORD)-1);
return NOERROR;
}
@@ -615,6 +616,7 @@ bool CShoutcastStream::CShoutcastSocket::Connect(CUrl& url) do
{
int len = Send((BYTE*)(LPCSTR)str, str.GetLength());
+ UNUSED_ALWAYS(len);
m_nBytesRead = 0;
m_metaint = metaint = 0;
@@ -673,8 +675,8 @@ bool CShoutcastStream::CShoutcastSocket::Connect(CUrl& url) bool CShoutcastStream::CShoutcastSocket::FindSync()
{
- m_freq = -1;
- m_channels = -1;
+ m_freq = (DWORD)-1;
+ m_channels = (DWORD)-1;
BYTE b;
for(int i = MAXFRAMESIZE; i > 0; i--, Receive(&b, 1))
diff --git a/src/filters/source/ShoutcastSource/ShoutcastSource.h b/src/filters/source/ShoutcastSource/ShoutcastSource.h index fd512afcf..e8ef4c51a 100644 --- a/src/filters/source/ShoutcastSource/ShoutcastSource.h +++ b/src/filters/source/ShoutcastSource/ShoutcastSource.h @@ -84,7 +84,7 @@ class CShoutcastStream : public CSourceStream BYTE* pData;
REFERENCE_TIME rtStart, rtStop;
CString title;
- mp3frame(DWORD len = 0) {pData = (this->len = len) ? DNew BYTE[len] : NULL; rtStart = rtStop = 0;}
+ mp3frame(DWORD len = 0) {this->len = len; pData = len ? DNew BYTE[len] : NULL; rtStart = rtStop = 0;}
mp3frame(const mp3frame& f) {*this = f;}
~mp3frame() {delete pData;}
void operator = (const mp3frame& f)
diff --git a/src/filters/switcher/AudioSwitcher/Audio.cpp b/src/filters/switcher/AudioSwitcher/Audio.cpp index 2490b4e77..8ff328bf0 100644 --- a/src/filters/switcher/AudioSwitcher/Audio.cpp +++ b/src/filters/switcher/AudioSwitcher/Audio.cpp @@ -204,7 +204,8 @@ AudioStreamResampler::AudioStreamResampler(int bps, long org_rate, long new_rate filter_width = ((samp_frac + 0x7ffff)>>19)<<1 <<1;
- if(!(filter_bank = DNew long[filter_width * 256]))
+ filter_bank = DNew long[filter_width * 256];
+ if(!filter_bank)
{
filter_width = 1;
return;
@@ -309,6 +310,7 @@ long AudioStreamResampler::Downsample(void* input, long samplesin, void* output, }
int Bytes = lActualSamples * bps;
+ UNUSED_ALWAYS(Bytes);
return lActualSamples;
}
diff --git a/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp b/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp index b6844870d..90d8be90b 100644 --- a/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp +++ b/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp @@ -223,7 +223,6 @@ HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut) WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
WAVEFORMATEX* wfeout = (WAVEFORMATEX*)pOutPin->CurrentMediaType().pbFormat;
WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)wfe;
- WAVEFORMATEXTENSIBLE* wfexout = (WAVEFORMATEXTENSIBLE*)wfeout;
int bps = wfe->wBitsPerSample>>3;
diff --git a/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp b/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp index 081c3e1af..c44e25406 100644 --- a/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp +++ b/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp @@ -462,7 +462,10 @@ HRESULT CStreamSwitcherInputPin::CompleteConnect(IPin* pReceivePin) IPin* pPin = (IPin*)this;
IBaseFilter* pBF = (IBaseFilter*)m_pFilter;
- while((pPin = GetUpStreamPin(pBF, pPin)) && (pBF = GetFilterFromPin(pPin)))
+ pPin = GetUpStreamPin(pBF, pPin);
+ if (pPin)
+ pBF = GetFilterFromPin(pPin);
+ while(pPin && pBF)
{
if(IsSplitter(pBF))
{
@@ -505,6 +508,10 @@ HRESULT CStreamSwitcherInputPin::CompleteConnect(IPin* pReceivePin) }
pPin = GetFirstPin(pBF);
+
+ pPin = GetUpStreamPin(pBF, pPin);
+ if (pPin)
+ pBF = GetFilterFromPin(pPin);
}
if(!fForkedSomewhere)
@@ -794,7 +801,7 @@ STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample) STDMETHODIMP CStreamSwitcherInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- SetThreadName(-1, "CStreamSwitcherInputPin");
+ SetThreadName((DWORD)-1, "CStreamSwitcherInputPin");
if(!IsConnected())
return S_OK;
@@ -1138,7 +1145,7 @@ HRESULT CStreamSwitcherFilter::CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin m_pInput = static_cast<CStreamSwitcherInputPin*>(pPin);
}
- if(nConnected == m_pInputs.GetCount())
+ if((size_t)nConnected == m_pInputs.GetCount())
{
CStringW name;
name.Format(L"Channel %d", ++m_PinVersion);
@@ -1269,8 +1276,12 @@ STDMETHODIMP CStreamSwitcherFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWOR if(pdwGroup)
*pdwGroup = 0;
- if(ppszName && (*ppszName = (WCHAR*)CoTaskMemAlloc((wcslen(pPin->Name())+1)*sizeof(WCHAR))))
- wcscpy(*ppszName, pPin->Name());
+ if(ppszName)
+ {
+ *ppszName = (WCHAR*)CoTaskMemAlloc((wcslen(pPin->Name())+1)*sizeof(WCHAR));
+ if(*ppszName)
+ wcscpy(*ppszName, pPin->Name());
+ }
if(ppObject)
*ppObject = NULL;
diff --git a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp index d4ad8c14e..a468350a9 100644 --- a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp +++ b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp @@ -419,6 +419,7 @@ HRESULT CAVI2AC3Filter::GetMediaType(int iPosition, CMediaType* pMediaType) const GUID& majortype = m_pInput->CurrentMediaType().majortype;
const GUID& subtype = m_pInput->CurrentMediaType().subtype;
+ UNUSED_ALWAYS(majortype);
if(CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
{
diff --git a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp index f24d3be27..12a045769 100644 --- a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp +++ b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp @@ -466,6 +466,7 @@ HRESULT CBaseVideoFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_ ExtractBIH(&m_pOutput->CurrentMediaType(), &bih);
long cBuffers = m_pOutput->CurrentMediaType().formattype == FORMAT_VideoInfo ? 1 : m_cBuffers;
+ UNUSED_ALWAYS(cBuffers);
pProperties->cBuffers = m_cBuffers;
pProperties->cbBuffer = bih.biSizeImage;
diff --git a/src/filters/transform/BufferFilter/BufferFilter.cpp b/src/filters/transform/BufferFilter/BufferFilter.cpp index e728bcbc4..a45bdcefb 100644 --- a/src/filters/transform/BufferFilter/BufferFilter.cpp +++ b/src/filters/transform/BufferFilter/BufferFilter.cpp @@ -81,10 +81,12 @@ CBufferFilter::CBufferFilter(LPUNKNOWN lpunk, HRESULT* phr) do
{
- if(!(m_pInput = DNew CTransformInputPin(NAME("Transform input pin"), this, &hr, L"In"))) hr = E_OUTOFMEMORY;
+ m_pInput = DNew CTransformInputPin(NAME("Transform input pin"), this, &hr, L"In");
+ if(!m_pInput) hr = E_OUTOFMEMORY;
if(FAILED(hr)) break;
- if(!(m_pOutput = DNew CBufferFilterOutputPin(this, &hr))) hr = E_OUTOFMEMORY;
+ m_pOutput = DNew CBufferFilterOutputPin(this, &hr);
+ if(!m_pOutput) hr = E_OUTOFMEMORY;
if(FAILED(hr)) {delete m_pInput, m_pInput = NULL; break;}
}
while(false);
diff --git a/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp b/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp index e3bd46f23..2c5c4500a 100644 --- a/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp +++ b/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp @@ -110,10 +110,12 @@ CDeCSSFilter::CDeCSSFilter(LPUNKNOWN lpunk, HRESULT* phr) {
if(phr) *phr = S_OK;
- if(!(m_pInput = DNew CKsPSInputPin(NAME("CKsPSInputPin"), this, phr, L"In"))) *phr = E_OUTOFMEMORY;
+ m_pInput = DNew CKsPSInputPin(NAME("CKsPSInputPin"), this, phr, L"In");
+ if(!m_pInput) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) return;
- if(!(m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
+ m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out");
+ if(!m_pOutput) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
}
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoder.cpp b/src/filters/transform/MPCVideoDec/DXVADecoder.cpp index 8c28598ac..7b53a2676 100644 --- a/src/filters/transform/MPCVideoDec/DXVADecoder.cpp +++ b/src/filters/transform/MPCVideoDec/DXVADecoder.cpp @@ -415,7 +415,7 @@ HRESULT CDXVADecoder::FindFreeDXVA1Buffer(DWORD dwTypeIndex, DWORD& dwBufferInde dwBufferIndex = 0; //(dwBufferIndex + 1) % m_ComBufferInfo[DXVA_PICTURE_DECODE_BUFFER].dwNumCompBuffers;
- DO_DXVA_PENDING_LOOP (m_pAMVideoAccelerator->QueryRenderStatus (-1, dwBufferIndex, 0));
+ DO_DXVA_PENDING_LOOP (m_pAMVideoAccelerator->QueryRenderStatus ((DWORD)-1, dwBufferIndex, 0));
return hr;
}
@@ -443,7 +443,7 @@ HRESULT CDXVADecoder::BeginFrame(int nSurfaceIndex, IMediaSample* pSampleToDeliv ASSERT (SUCCEEDED (hr));
// TRACE ("BeginFrame %d\n",nSurfaceIndex);
if (SUCCEEDED (hr))
- hr = FindFreeDXVA1Buffer (-1, m_dwBufferIndex);
+ hr = FindFreeDXVA1Buffer ((DWORD)-1, m_dwBufferIndex);
break;
case ENGINE_DXVA2 :
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp index e270f8e67..ed1f22b62 100644 --- a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp +++ b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp @@ -1284,6 +1284,7 @@ void CMPCVideoDecFilter::AllocExtradata(AVCodecContext* pAVCtx, const CMediaType else if (pmt->formattype==FORMAT_VorbisFormat2)
{
const VORBISFORMAT2 *vf2=(const VORBISFORMAT2*)pmt->pbFormat;
+ UNUSED_ALWAYS(vf2);
size=pmt->cbFormat-sizeof(VORBISFORMAT2);
data=size?pmt->pbFormat+sizeof(VORBISFORMAT2):NULL;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dxva.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dxva.h index 92468f78d..003eeb10b 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dxva.h +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dxva.h @@ -223,7 +223,7 @@ typedef DWORD DXVA_ConfigQueryOrReplyFunc, *LPDXVA_ConfigQueryOrReplyFunc; #define readDXVA_QueryOrReplyFuncFunc(ptr) ((*(ptr)) & 0xFF)
-#define writeDXVA_QueryOrReplyFunc(ptr, flg, fnc) ((*(ptr)) = ((flg) << 8) | (fnc))
+#define writeDXVA_QueryOrReplyFunc(ptr, flg, fnc) ((*(ptr)) = (DXVA_ConfigQueryOrReplyFunc)(((flg) << 8) | (fnc)))
#define setDXVA_QueryOrReplyFuncFlag(ptr, flg) ((*(ptr)) |= ((flg) << 8))
#define setDXVA_QueryOrReplyFuncFunc(ptr, fnc) ((*(ptr)) |= (fnc));
diff --git a/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp b/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp index ca91ef027..9c2da7de9 100644 --- a/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp +++ b/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp @@ -163,6 +163,7 @@ CFilterApp theApp; // lets see how we can map these things to dshow (oh the joy!)
+#pragma warning(disable : 4245)
static struct scmap_t
{
WORD nChannels;
@@ -270,7 +271,8 @@ m_ffmpeg_ac3[] = // LFe
{6, {0, 1, 2, 3, 4, 5,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT},// AC3_CHMODE_3F2R
-};
+ };
+#pragma warning(default : 4245)
CMpaDecFilter::CMpaDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
: CTransformFilter(NAME("CMpaDecFilter"), lpunk, __uuidof(this))
@@ -280,10 +282,12 @@ CMpaDecFilter::CMpaDecFilter(LPUNKNOWN lpunk, HRESULT* phr) {
if(phr) *phr = S_OK;
- if(!(m_pInput = DNew CMpaDecInputPin(this, phr, L"In"))) *phr = E_OUTOFMEMORY;
+ m_pInput = DNew CMpaDecInputPin(this, phr, L"In");
+ if(!m_pInput) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) return;
- if(!(m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
+ m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out");
+ if(!m_pOutput) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
m_iSpeakerConfig[ac3] = A52_STEREO;
@@ -909,7 +913,6 @@ HRESULT CMpaDecFilter::ProcessAC3() else if ( (*((__int32*)(p+4)) == 0xba6f72f8) || // True HD major sync frame
m_DolbyDigitalMode == DD_TRUEHD )
{
- int nMLPLength=0;
int nMLPChunk;
int nLenght = (((p[0]<<8) + p[1]) & 0x0FFF)*2;
@@ -924,7 +927,6 @@ HRESULT CMpaDecFilter::ProcessAC3() else if ( (*((__int32*)(p+4)) == 0xbb6f72f8) ||
m_DolbyDigitalMode == DD_MLP ) // MLP
{
- int nMLPLength=0;
int nMLPChunk;
int nLenght = (((p[0]<<8) + p[1]) & 0x0FFF)*2;
@@ -1216,6 +1218,7 @@ static void decodeps2adpcm(ps2_state_t& s, int channel, BYTE* pin, double* pout) int tbl_index = pin[0]>>4;
int shift = pin[0]&0xf;
int unk = pin[1]; // ?
+ UNUSED_ALWAYS(unk);
if(tbl_index >= 10) {ASSERT(0); return;}
// if(unk == 7) {ASSERT(0); return;} // ???
@@ -1372,6 +1375,7 @@ static inline float fscale(mad_fixed_t sample) HRESULT CMpaDecFilter::ProcessFlac()
{
WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
+ UNUSED_ALWAYS(wfein);
FLAC__stream_decoder_process_single ((FLAC__StreamDecoder*) m_flac.pDecoder);
return m_flac.hr;
@@ -1744,11 +1748,13 @@ HRESULT CMpaDecFilter::CheckInputType(const CMediaType* mtIn) else if(mtIn->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
{
WAVEFORMATEX* wfe = (WAVEFORMATEX*)mtIn->Format();
+ UNUSED_ALWAYS(wfe);
return S_OK;
}
else if(mtIn->subtype == MEDIASUBTYPE_PS2_ADPCM)
{
WAVEFORMATEXPS2* wfe = (WAVEFORMATEXPS2*)mtIn->Format();
+ UNUSED_ALWAYS(wfe);
if(wfe->dwInterleave & 0xf) // has to be a multiple of the block size (16 bytes)
return VFW_E_TYPE_NOT_ACCEPTED;
}
@@ -1796,6 +1802,7 @@ HRESULT CMpaDecFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PRO CMediaType& mt = m_pInput->CurrentMediaType();
WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+ UNUSED_ALWAYS(wfe);
pProperties->cBuffers = 4;
// pProperties->cbBuffer = 1;
@@ -2030,7 +2037,8 @@ aac_state_t::~aac_state_t() {close();} bool aac_state_t::open()
{
close();
- if(!(h = NeAACDecOpen())) return false;
+ h = NeAACDecOpen();
+ if(!h) return false;
NeAACDecConfigurationPtr c = NeAACDecGetCurrentConfiguration(h);
c->outputFormat = FAAD_FMT_FLOAT;
NeAACDecSetConfiguration(h, c);
@@ -2386,6 +2394,7 @@ HRESULT CMpaDecFilter::DeliverFfmpeg(int nCodecId, BYTE* p, int buffsize, int& s if (size>0 && nPCMLength>0)
{
WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
+ UNUSED_ALWAYS(wfein);
CAtlArray<float> pBuff;
int iSpeakerConfig;
int nRemap;
diff --git a/src/filters/transform/MpaDecFilter/a52dec/vc++/liba52.vcproj b/src/filters/transform/MpaDecFilter/a52dec/vc++/liba52.vcproj index c5d705058..c1aa892fd 100644 --- a/src/filters/transform/MpaDecFilter/a52dec/vc++/liba52.vcproj +++ b/src/filters/transform/MpaDecFilter/a52dec/vc++/liba52.vcproj @@ -47,6 +47,7 @@ AdditionalIncludeDirectories=".,../include, ..\..\..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
PrecompiledHeaderFile=".\Release\liba52.pch"
+ WarningLevel="3"
CompileAs="0"
DisableSpecificWarnings="4244"
/>
@@ -111,6 +112,7 @@ PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=".\Release\liba52.pch"
+ WarningLevel="3"
CompileAs="0"
/>
<Tool
@@ -174,6 +176,7 @@ GeneratePreprocessedFile="0"
PrecompiledHeaderFile=".\Debug\liba52.pch"
AssemblerOutput="0"
+ WarningLevel="3"
CompileAs="0"
/>
<Tool
@@ -238,6 +241,7 @@ GeneratePreprocessedFile="0"
PrecompiledHeaderFile=".\Debug\liba52.pch"
AssemblerOutput="0"
+ WarningLevel="3"
DebugInformationFormat="3"
CompileAs="0"
/>
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp index 36bb391bf..d169da078 100644 --- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp +++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp @@ -200,16 +200,20 @@ CMpeg2DecFilter::CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr) if(FAILED(*phr)) return;
- if(!(m_pInput = DNew CMpeg2DecInputPin(this, phr, L"Video"))) *phr = E_OUTOFMEMORY;
+ m_pInput = DNew CMpeg2DecInputPin(this, phr, L"Video");
+ if(!m_pInput) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) return;
-// if(!(m_pOutput = DNew CMpeg2DecOutputPin(this, phr, L"Output"))) *phr = E_OUTOFMEMORY;
+// m_pOutput = DNew CMpeg2DecOutputPin(this, phr, L"Output");
+// if(!m_pOutput) *phr = E_OUTOFMEMORY;
// if(FAILED(*phr)) return;
- if(!(m_pSubpicInput = DNew CSubpicInputPin(this, phr))) *phr = E_OUTOFMEMORY;
+ m_pSubpicInput = DNew CSubpicInputPin(this, phr);
+ if(!m_pSubpicInput) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) return;
- if(!(m_pClosedCaptionOutput = DNew CClosedCaptionOutputPin(this, m_pLock, phr))) *phr = E_OUTOFMEMORY;
+ m_pClosedCaptionOutput = DNew CClosedCaptionOutputPin(this, m_pLock, phr);
+ if(!m_pClosedCaptionOutput) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) return;
SetDeinterlaceMethod(DIAuto);
@@ -522,6 +526,8 @@ HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn) REFERENCE_TIME rtStart = m_fb.rtStart;
REFERENCE_TIME rtStop = m_fb.rtStop;
+ UNUSED_ALWAYS(rtStart);
+ UNUSED_ALWAYS(rtStop);
//
@@ -1260,12 +1266,14 @@ STDMETHODIMP CMpeg2DecInputPin::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceD case AM_RATE_SimpleRateChange:
{
AM_SimpleRateChange* p = (AM_SimpleRateChange*)pPropertyData;
+ UNUSED_ALWAYS(p);
return E_PROP_ID_UNSUPPORTED;
}
break;
case AM_RATE_MaxFullDataRate:
{
AM_MaxFullDataRate* p = (AM_MaxFullDataRate*)pPropertyData;
+ UNUSED_ALWAYS(p);
*p = 8*10000;
*pBytesReturned = sizeof(AM_MaxFullDataRate);
}
@@ -1576,7 +1584,6 @@ HRESULT CSubpicInputPin::Transform(IMediaSample* pSample) POSITION pos = m_sps.GetTailPosition();
while(pos)
{
- POSITION cur = pos;
spu* sp = m_sps.GetPrev(pos);
if(sp->m_rtStop == _I64_MAX)
{
diff --git a/src/filters/transform/Mpeg2DecFilter/libmpeg2.cpp b/src/filters/transform/Mpeg2DecFilter/libmpeg2.cpp index 6251a2bf5..57af63dc4 100644 --- a/src/filters/transform/Mpeg2DecFilter/libmpeg2.cpp +++ b/src/filters/transform/Mpeg2DecFilter/libmpeg2.cpp @@ -850,9 +850,11 @@ int CMpeg2Dec::mpeg2_header_sequence() return 1;
int i = (buffer[0] << 16) | (buffer[1] << 8) | buffer[2];
- if(!(sequence->display_width = sequence->picture_width = i >> 12))
+ sequence->display_width = sequence->picture_width = i >> 12;
+ if(!sequence->display_width)
return 1;
- if(!(sequence->display_height = sequence->picture_height = i & 0xfff))
+ sequence->display_height = sequence->picture_height = i & 0xfff;
+ if(!sequence->display_height)
return 1;
sequence->width = (sequence->picture_width + 15) & ~15;
diff --git a/src/subtitles/CCDecoder.cpp b/src/subtitles/CCDecoder.cpp index 47367d62a..735122ac2 100644 --- a/src/subtitles/CCDecoder.cpp +++ b/src/subtitles/CCDecoder.cpp @@ -315,10 +315,6 @@ void CCDecoder::DecodeCC(BYTE* buff, int len, __int64 time) MoveCursor(col, row);
}
- else
- {
- int iiii = 0;
- }
i++;
}
diff --git a/src/subtitles/CompositionObject.cpp b/src/subtitles/CompositionObject.cpp index dd9355714..e8b2c0f57 100644 --- a/src/subtitles/CompositionObject.cpp +++ b/src/subtitles/CompositionObject.cpp @@ -89,9 +89,8 @@ void CompositionObject::RenderHdmv(SubPicDesc& spd) CGolombBuffer GBuffer (m_pRLEData, m_nRLEDataSize);
BYTE bTemp;
BYTE bSwitch;
- bool bEndOfLine = false;
- BYTE nPaletteIndex;
+ BYTE nPaletteIndex = 0;
SHORT nCount;
SHORT nX = 0;
SHORT nY = 0;
diff --git a/src/subtitles/DVBSub.cpp b/src/subtitles/DVBSub.cpp index 1b1e80308..0f1801ea4 100644 --- a/src/subtitles/DVBSub.cpp +++ b/src/subtitles/DVBSub.cpp @@ -170,6 +170,7 @@ HRESULT CDVBSub::ParseSample (IMediaSample* pSample) gb.SkipBytes(4);
WORD wLength = (WORD)gb.BitRead(16);
+ UNUSED_ALWAYS(wLength);
if (gb.BitRead(2) != 2) return E_FAIL; // type
@@ -418,7 +419,6 @@ void CDVBSub::Reset() HRESULT CDVBSub::ParsePage(CGolombBuffer& gb, WORD wSegLength, CAutoPtr<DVB_PAGE>& pPage)
{
- HRESULT hr = S_OK;
WORD wEnd = (WORD)gb.GetPos() + wSegLength;
int nPos = 0;
@@ -464,7 +464,6 @@ HRESULT CDVBSub::ParseDisplay(CGolombBuffer& gb, WORD wSegLength) HRESULT CDVBSub::ParseRegion(CGolombBuffer& gb, WORD wSegLength)
{
- HRESULT hr = S_OK;
WORD wEnd = (WORD)gb.GetPos() + wSegLength;
CDVBSub::DVB_REGION* pRegion;
CDVBSub::DVB_REGION DummyRegion;
@@ -534,6 +533,9 @@ HRESULT CDVBSub::ParseClut(CGolombBuffer& gb, WORD wSegLength) BYTE _2_bit = (BYTE)gb.BitRead(1);
BYTE _4_bit = (BYTE)gb.BitRead(1);
BYTE _8_bit = (BYTE)gb.BitRead(1);
+ UNUSED_ALWAYS(_2_bit);
+ UNUSED_ALWAYS(_4_bit);
+ UNUSED_ALWAYS(_8_bit);
gb.BitRead(4); // Reserved
pClut->Palette[entry_id].entry_id = entry_id;
diff --git a/src/subtitles/GFN.cpp b/src/subtitles/GFN.cpp index 96a4fe65e..ed701680f 100644 --- a/src/subtitles/GFN.cpp +++ b/src/subtitles/GFN.cpp @@ -28,7 +28,7 @@ TCHAR* exttypestr[] = {
_T("srt"), _T("sub"), _T("smi"), _T("psb"),
_T("ssa"), _T("ass"), _T("idx"), _T("usf"),
- _T("xss"), _T("txt"), _T("ssf"), _T("rt")
+ _T("xss"), _T("txt"), _T("ssf"), _T("rt"), _T("sup")
};
static TCHAR* ext[3][countof(exttypestr)] =
@@ -36,17 +36,17 @@ static TCHAR* ext[3][countof(exttypestr)] = {
_T(".srt"), _T(".sub"), _T(".smi"), _T(".psb"),
_T(".ssa"), _T(".ass"), _T(".idx"), _T(".usf"),
- _T(".xss"), _T(".txt"), _T(".ssf"), _T(".rt")
+ _T(".xss"), _T(".txt"), _T(".ssf"), _T(".rt"), _T(".sup")
},
{
_T(".*.srt"), _T(".*.sub"), _T(".*.smi"), _T(".*.psb"),
_T(".*.ssa"), _T(".*.ass"), _T(".*.dummyidx"), _T(".*.usf"),
- _T(".*.xss"), _T(".*.txt"), _T(".*.ssf"), _T(".*.rt")
+ _T(".*.xss"), _T(".*.txt"), _T(".*.ssf"), _T(".*.rt"), _T(".*.sup")
},
{
_T("-*.srt"), _T("-*.sub"), _T("-*.smi"), _T("-*.psb"),
_T("-*.ssa"), _T("-*.ass"), _T("-*.dummyidx"), _T("-*.usf"),
- _T("-*.xss"), _T("-*.txt"), _T("-*.ssf"), _T("-*.rt")
+ _T("-*.xss"), _T("-*.txt"), _T("-*.ssf"), _T("-*.rt"), _T("-*.sup")
},
};
diff --git a/src/subtitles/HdmvSub.cpp b/src/subtitles/HdmvSub.cpp index fe92e0c4e..d84a12226 100644 --- a/src/subtitles/HdmvSub.cpp +++ b/src/subtitles/HdmvSub.cpp @@ -215,6 +215,8 @@ void CHdmvSub::ParsePalette(CGolombBuffer* pGBuffer, USHORT nSize) // #497 int nNbEntry;
BYTE palette_id = pGBuffer->ReadByte();
BYTE palette_version_number = pGBuffer->ReadByte();
+ UNUSED_ALWAYS(palette_id);
+ UNUSED_ALWAYS(palette_version_number);
ASSERT ((nSize-2) % sizeof(HDMV_PALETTE) == 0);
nNbEntry = (nSize-2) / sizeof(HDMV_PALETTE);
@@ -235,6 +237,7 @@ void CHdmvSub::ParsePalette(CGolombBuffer* pGBuffer, USHORT nSize) // #497 void CHdmvSub::ParseObject(CGolombBuffer* pGBuffer, USHORT nUnitSize) // #498
{
SHORT object_id = pGBuffer->ReadShort();
+ UNUSED_ALWAYS(object_id);
BYTE m_sequence_desc;
ASSERT (m_pCurrentObject != NULL);
diff --git a/src/subtitles/RTS.cpp b/src/subtitles/RTS.cpp index 4f9be693d..ac2af7a30 100644 --- a/src/subtitles/RTS.cpp +++ b/src/subtitles/RTS.cpp @@ -386,6 +386,7 @@ void CWord::Transform_SSE2( CPoint &org ) {
switch(mPathPointsM4)
{
+ default:
case 0: continue;
case 1:
__pointx = _mm_set_ps(mpPathPoints[4 * i + 0].x, 0, 0, 0);
@@ -495,9 +496,8 @@ void CWord::Transform_SSE2( CPoint &org ) __m128 __tmpy;
if(m_style.fontShiftY!=0)
{
- __m128 __tmpy = _mm_mul_ps(__yshift, __pointx);
+ __tmpy = _mm_mul_ps(__yshift, __pointx);
__tmpy = _mm_add_ps(__tmpy, __pointy);
-
}
else
{
@@ -588,8 +588,6 @@ CText::CText(STSStyle& style, CStringW str, int ktype, int kstart, int kend) #endif
if(m_style.fontSpacing || (long)GetVersion() < 0)
{
- bool bFirstPath = true;
-
for(LPCWSTR s = m_str; *s; s++)
{
CSize extent;
@@ -708,15 +706,13 @@ CWord* CPolygon::Copy() bool CPolygon::Append(CWord* w)
{
- int width = m_width;
-
CPolygon* p = dynamic_cast<CPolygon*>(w);
if(!p) return(false);
// TODO
return(false);
- return(true);
+ //return(true);
}
bool CPolygon::GetLONG(CStringW& str, LONG& ret)
@@ -812,7 +808,6 @@ bool CPolygon::ParseStr() {
m_pathTypesOrg.Add(PT_BSPLINEPATCHTO);
m_pathPointsOrg.Add(p);
- j++;
}
break;
case 'c':
@@ -870,7 +865,7 @@ bool CPolygon::ParseStr() bool CPolygon::CreatePath()
{
- int len = m_pathTypesOrg.GetCount();
+ size_t len = m_pathTypesOrg.GetCount();
if(len == 0) return(false);
if(mPathPoints != len)
@@ -895,7 +890,11 @@ CClipper::CClipper(CStringW str, CSize size, double scalex, double scaley, bool m_size.cx = m_size.cy = 0;
m_pAlphaMask = NULL;
- if(size.cx < 0 || size.cy < 0 || !(m_pAlphaMask = DNew BYTE[size.cx*size.cy])) return;
+ if(size.cx < 0 || size.cy < 0)
+ {
+ m_pAlphaMask = DNew BYTE[size.cx*size.cy];
+ if (!m_pAlphaMask) return;
+ }
m_size = size;
m_inverse = inverse;
@@ -1041,7 +1040,7 @@ CRect CLine::PaintShadow(SubPicDesc& spd, CRect& clipRect, BYTE* pAlphaMask, CPo DWORD a = 0xff - w->m_style.alpha[3];
if(alpha > 0) a = MulDiv(a, 0xff - alpha, 0xff);
COLORREF shadow = revcolor(w->m_style.colors[3]) | (a<<24);
- DWORD sw[6] = {shadow, -1};
+ DWORD sw[6] = {shadow, (DWORD)-1};
#ifdef _VSMOD // patch m011. jitter
CPoint mod_jitter = w->m_style.mod_jitter.getOffset(rt);
@@ -1109,7 +1108,7 @@ CRect CLine::PaintOutline(SubPicDesc& spd, CRect& clipRect, BYTE* pAlphaMask, CP DWORD aoutline = w->m_style.alpha[2];
if(alpha > 0) aoutline += MulDiv(alpha, 0xff - w->m_style.alpha[2], 0xff);
COLORREF outline = revcolor(w->m_style.colors[2]) | ((0xff-aoutline)<<24);
- DWORD sw[6] = {outline, -1};
+ DWORD sw[6] = {outline, (DWORD)-1};
#ifdef _VSMOD // patch m011. jitter
CPoint mod_jitter = w->m_style.mod_jitter.getOffset(rt);
@@ -1220,6 +1219,7 @@ CRect CLine::PaintBody(SubPicDesc& spd, CRect& clipRect, BYTE* pAlphaMask, CPoin if (w->m_style.fBlur)
bluradjust += 8;
double tx = w->m_style.fontAngleZ;
+ UNUSED_ALWAYS(tx);
sw[4] = sw[2];
sw[5] = 0x00ffffff;
@@ -3242,12 +3242,14 @@ CSubtitle* CRenderedTextSubtitle::GetSubtitle(int entry) if(str[0] == '{' && (i = str.Find(L'}')) > 0)
{
- if(fParsed = ParseSSATag(sub, str.Mid(1, i-1), stss, orgstss))
+ fParsed = ParseSSATag(sub, str.Mid(1, i-1), stss, orgstss);
+ if(fParsed)
str = str.Mid(i+1);
}
else if(str[0] == '<' && (i = str.Find(L'>')) > 0)
{
- if(fParsed = ParseHtmlTag(sub, str.Mid(1, i-1), stss, orgstss))
+ fParsed = ParseHtmlTag(sub, str.Mid(1, i-1), stss, orgstss);
+ if(fParsed)
str = str.Mid(i+1);
}
@@ -3351,9 +3353,12 @@ STDMETHODIMP_(POSITION) CRenderedTextSubtitle::GetNext(POSITION pos) {
int iSegment = (int)pos;
- const STSSegment* stss;
- while((stss = GetSegment(iSegment)) && stss->subs.GetCount() == 0)
+ const STSSegment* stss = GetSegment(iSegment);
+ while(stss && stss->subs.GetCount() == 0)
+ {
iSegment++;
+ stss = GetSegment(iSegment);
+ }
return(stss ? (POSITION)(iSegment+1) : NULL);
}
@@ -3934,7 +3939,8 @@ STDMETHODIMP CRenderedTextSubtitle::GetStreamInfo(int iStream, WCHAR** ppName, L if(ppName)
{
- if(!(*ppName = (WCHAR*)CoTaskMemAlloc((m_name.GetLength()+1)*sizeof(WCHAR))))
+ *ppName = (WCHAR*)CoTaskMemAlloc((m_name.GetLength()+1)*sizeof(WCHAR));
+ if(!(*ppName))
return E_OUTOFMEMORY;
wcscpy(*ppName, CStringW(m_name));
diff --git a/src/subtitles/Rasterizer.cpp b/src/subtitles/Rasterizer.cpp index 5991d2d73..0800d466e 100644 --- a/src/subtitles/Rasterizer.cpp +++ b/src/subtitles/Rasterizer.cpp @@ -281,7 +281,7 @@ bool Rasterizer::EndPath(HDC hdc) mpPathTypes = (BYTE*)malloc(sizeof(BYTE) * mPathPoints);
mpPathPoints = (POINT*)malloc(sizeof(POINT) * mPathPoints);
- if(mPathPoints == GetPath(hdc, mpPathPoints, mpPathTypes, mPathPoints))
+ if(mPathPoints == (size_t)GetPath(hdc, mpPathPoints, mpPathTypes, mPathPoints))
return true;
}
@@ -354,7 +354,7 @@ bool Rasterizer::PartialEndPath(HDC hdc, long dx, long dy) bool Rasterizer::ScanConvert()
{
- size_t lastmoveto = -1;
+ size_t lastmoveto = (size_t)-1;
size_t i;
// Drop any outlines we may have.
@@ -508,7 +508,8 @@ bool Rasterizer::ScanConvert() std::vector<int>::iterator itX1 = heap.begin();
std::vector<int>::iterator itX2 = heap.end(); // begin() + heap.size();
- size_t x1, x2;
+ size_t x1 = 0;
+ size_t x2;
for(; itX1 != itX2; ++itX1)
{
@@ -849,6 +850,7 @@ static __forceinline void pixmix(DWORD *dst, DWORD color, DWORD alpha) a+=1;
DWORD tmp = (((((*dst>>8)&0x00ff0000)*ia)&0xff000000)>>24)&0xFF;
+ UNUSED_ALWAYS(tmp);
*dst = ((((*dst&0x00ff00ff)*ia + (color&0x00ff00ff)*a)&0xff00ff00)>>8)
| ((((*dst&0x0000ff00)*ia + (color&0x0000ff00)*a)&0x00ff0000)>>8)
| ((((*dst>>8)&0x00ff0000)*ia)&0xff000000);
@@ -1163,7 +1165,6 @@ void Rasterizer::Draw_noAlpha_spFF_Body_sse2(RasterizerNfo& rnfo) int h = rnfo.h;
int color = rnfo.color;
- const DWORD* sw = rnfo.sw;
byte* s = rnfo.s;
DWORD* dst = rnfo.dst;
// The <<6 is due to pixmix expecting the alpha parameter to be
@@ -1183,7 +1184,6 @@ void Rasterizer::Draw_noAlpha_spFF_noBody_sse2(RasterizerNfo& rnfo) int h = rnfo.h;
int color = rnfo.color;
- const DWORD* sw = rnfo.sw;
byte* src = rnfo.src;
DWORD* dst = rnfo.dst;
// src contains two different bitmaps, interlaced per pixel.
@@ -1358,6 +1358,7 @@ void Rasterizer::Draw_Alpha_sp_noBody_sse2(RasterizerNfo& rnfo) int gran = min(rnfo.sw[3]+1-rnfo.xo,rnfo.w);
int color2 = rnfo.sw[2];
+ UNUSED_ALWAYS(color2);
while(h--)
{
#ifdef _VSMOD // patch m006. moveable vector clip
diff --git a/src/subtitles/RenderedHdmvSubtitle.cpp b/src/subtitles/RenderedHdmvSubtitle.cpp index 749489789..3a82d0393 100644 --- a/src/subtitles/RenderedHdmvSubtitle.cpp +++ b/src/subtitles/RenderedHdmvSubtitle.cpp @@ -130,7 +130,8 @@ STDMETHODIMP CRenderedHdmvSubtitle::GetStreamInfo(int iStream, WCHAR** ppName, L if(ppName)
{
- if(!(*ppName = (WCHAR*)CoTaskMemAlloc((m_name.GetLength()+1)*sizeof(WCHAR))))
+ *ppName = (WCHAR*)CoTaskMemAlloc((m_name.GetLength()+1)*sizeof(WCHAR));
+ if(!(*ppName))
return E_OUTOFMEMORY;
wcscpy_s (*ppName, m_name.GetLength()+1, CStringW(m_name));
diff --git a/src/subtitles/SSF.cpp b/src/subtitles/SSF.cpp index 09fec9067..f928b9f54 100644 --- a/src/subtitles/SSF.cpp +++ b/src/subtitles/SSF.cpp @@ -209,7 +209,8 @@ namespace ssf if(ppName)
{
- if(!(*ppName = (WCHAR*)CoTaskMemAlloc((m_name.GetLength()+1)*sizeof(WCHAR))))
+ *ppName = (WCHAR*)CoTaskMemAlloc((m_name.GetLength()+1)*sizeof(WCHAR));
+ if(!(*ppName))
return E_OUTOFMEMORY;
wcscpy(*ppName, CStringW(m_name));
diff --git a/src/subtitles/STS.cpp b/src/subtitles/STS.cpp index 4e539cf6e..b679856d9 100644 --- a/src/subtitles/STS.cpp +++ b/src/subtitles/STS.cpp @@ -576,7 +576,10 @@ static bool OpenSubViewer(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet {
STSStyle def;
CStringW font, color, size;
- bool fBold, fItalic, fStriked, fUnderline;
+ bool fBold = false;
+ bool fItalic = false;
+ bool fStriked = false;
+ bool fUnderline = false;
CStringW buff;
while(file->ReadString(buff))
@@ -608,9 +611,9 @@ static bool OpenSubViewer(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet if(tag == L"font")
font = def.fontName.CompareNoCase(WToT(param)) ? param : L"";
else if(tag == L"colf")
- color = def.colors[0] != wcstol(((LPCWSTR)param)+2, 0, 16) ? param : L"";
+ color = def.colors[0] != (DWORD)wcstol(((LPCWSTR)param)+2, 0, 16) ? param : L"";
else if(tag == L"size")
- size = def.fontSize != wcstol(param, 0, 10) ? param : L"";
+ size = def.fontSize != (double)wcstol(param, 0, 10) ? param : L"";
else if(tag == L"style")
{
if(param.Find(L"no") >= 0)
@@ -1528,7 +1531,7 @@ static bool OpenSubStationAlpha(CTextFile* file, CSimpleTextSubtitle& ret, int C try
{
CString StyleName;
- int alpha;
+ int alpha = 0;
StyleName = WToT(GetStr(buff));
style->fontName = WToT(GetStr(buff));
diff --git a/src/subtitles/SubtitleInputPin.cpp b/src/subtitles/SubtitleInputPin.cpp index a315b3884..f339a7d15 100644 --- a/src/subtitles/SubtitleInputPin.cpp +++ b/src/subtitles/SubtitleInputPin.cpp @@ -27,6 +27,7 @@ #include "RenderedHdmvSubtitle.h"
#include <initguid.h>
+#include <uuids.h>
#include <moreuuids.h>
// our first format id
@@ -351,7 +352,7 @@ STDMETHODIMP CSubtitleInputPin::Receive(IMediaSample* pSample) CAtlList<CStringW> sl;
Explode(str, sl, ',', fields);
- if(sl.GetCount() == fields)
+ if(sl.GetCount() == (size_t)fields)
{
stse.readorder = wcstol(sl.RemoveHead(), NULL, 10);
stse.layer = wcstol(sl.RemoveHead(), NULL, 10);
diff --git a/src/subtitles/TextFile.cpp b/src/subtitles/TextFile.cpp index 1dfb62750..50cb6f121 100644 --- a/src/subtitles/TextFile.cpp +++ b/src/subtitles/TextFile.cpp @@ -23,6 +23,7 @@ #include <atlbase.h>
#include <afxinet.h>
#include "TextFile.h"
+#include "Utf8_16.h"
CTextFile::CTextFile(enc e)
{
diff --git a/src/subtitles/VobSubFileRipper.cpp b/src/subtitles/VobSubFileRipper.cpp index b006c9992..946484618 100644 --- a/src/subtitles/VobSubFileRipper.cpp +++ b/src/subtitles/VobSubFileRipper.cpp @@ -484,7 +484,7 @@ DWORD CVobSubFileRipper::ThreadProc() break;
default:
- Reply(E_FAIL);
+ Reply((DWORD)E_FAIL);
return (DWORD)-1;
}
@@ -547,7 +547,7 @@ bool CVobSubFileRipper::Create() CVobDec vd;
- __int64 SCR, PTS, tOffset = 0, tPrevOffset = 0, tTotal = 0, tStart = 0;
+ __int64 SCR, PTS = 0, tOffset = 0, tPrevOffset = 0, tTotal = 0, tStart = 0;
int vob = 0, cell = 0;
bool fDiscontinuity = false, fDiscontinuityFixApplied = false, fNavpackFound = false;
@@ -555,7 +555,7 @@ bool CVobSubFileRipper::Create() if(m_rd.fResetTime)
{
- for(size_t i = 0; i < angle.GetCount() && ((angle[i].vob<<16)|angle[i].cell) != m_rd.selvcs[0]; i++)
+ for(size_t i = 0; i < angle.GetCount() && (UINT)((angle[i].vob<<16)|angle[i].cell) != m_rd.selvcs[0]; i++)
tStart += angle[i].tTime;
Log(LOG_INFO, _T("Counting timestamps from %I64dms (v%02dc%02d)"),
@@ -899,7 +899,7 @@ bool CVobSubFileRipper::LoadChunks(CAtlArray<vcchunk>& chunks) fn += _T(".chunks");
DWORD chksum = 0, chunklen, version;
- __int64 voblen;
+ __int64 voblen = 0;
if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyNone))
return(false);
diff --git a/src/subtitles/VobSubImage.cpp b/src/subtitles/VobSubImage.cpp index c0cebde2e..33108a63b 100644 --- a/src/subtitles/VobSubImage.cpp +++ b/src/subtitles/VobSubImage.cpp @@ -618,6 +618,7 @@ static bool MinMaxCosfi(COutline& o, double& mincf, double& maxcf) // not really CPoint p = pa[len-1] - pa[0];
double l = vectlen(p);
+ UNUSED_ALWAYS(l);
for(ptrdiff_t i = 2; i < len-2; i++) // skip the endpoints, they aren't accurate
{
@@ -1164,6 +1165,8 @@ void CVobSubImage::Scale2x() DWORD A = x > 0 && y > 0 ? src[-w-1] : E;
DWORD B = y > 0 ? src[-w] : E;
DWORD C = x < w-1 && y > 0 ? src[-w+1] : E;
+ UNUSED_ALWAYS(A);
+ UNUSED_ALWAYS(C);
DWORD D = x > 0 ? src[-1] : E;;
DWORD F = x < w-1 ? src[+1] : E;;
@@ -1171,6 +1174,8 @@ void CVobSubImage::Scale2x() DWORD G = x > 0 && y < h-1 ? src[+w-1] : E;
DWORD H = y < h-1 ? src[+w] : E;
DWORD I = x < w-1 && y < h-1 ? src[+w+1] : E;
+ UNUSED_ALWAYS(G);
+ UNUSED_ALWAYS(I);
DWORD E0 = D == B && B != F && D != H ? D : E;
DWORD E1 = B == F && B != D && F != H ? F : E;
diff --git a/src/thirdparty/VirtualDub/Kasumi/Kasumi.vcproj b/src/thirdparty/VirtualDub/Kasumi/Kasumi.vcproj index 8eb656c51..1758bcfd2 100644 --- a/src/thirdparty/VirtualDub/Kasumi/Kasumi.vcproj +++ b/src/thirdparty/VirtualDub/Kasumi/Kasumi.vcproj @@ -52,6 +52,7 @@ InlineFunctionExpansion="1"
AdditionalIncludeDirectories="h;..\h"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;WIN32_LEAN_AND_MEAN;NOMINMAX"
+ WarningLevel="3"
DisableSpecificWarnings="4244;4267"
/>
<Tool
@@ -119,6 +120,7 @@ AdditionalIncludeDirectories="h;..\h"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;WIN32_LEAN_AND_MEAN;NOMINMAX"
EnableEnhancedInstructionSet="0"
+ WarningLevel="3"
DisableSpecificWarnings="4244;4267"
/>
<Tool
@@ -183,6 +185,7 @@ AdditionalOptions="/MP"
AdditionalIncludeDirectories="h;..\h"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;WIN32_LEAN_AND_MEAN;NOMINMAX"
+ WarningLevel="3"
DisableSpecificWarnings="4244;4267"
/>
<Tool
@@ -248,6 +251,7 @@ AdditionalOptions="/MP"
AdditionalIncludeDirectories="h;..\h"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;WIN32_LEAN_AND_MEAN;NOMINMAX"
+ WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4244;4267"
/>
diff --git a/src/thirdparty/VirtualDub/system/system.vcproj b/src/thirdparty/VirtualDub/system/system.vcproj index 0328804ea..32eef34d2 100644 --- a/src/thirdparty/VirtualDub/system/system.vcproj +++ b/src/thirdparty/VirtualDub/system/system.vcproj @@ -53,6 +53,7 @@ AdditionalIncludeDirectories="..\h,.\h"
PreprocessorDefinitions="NDEBUG;_LIB;WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN"
UsePrecompiledHeader="2"
+ WarningLevel="3"
DisableSpecificWarnings="4244;4267;4996"
/>
<Tool
@@ -121,6 +122,7 @@ PreprocessorDefinitions="NDEBUG;_LIB;WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="2"
+ WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4244;4267;4996"
/>
@@ -188,6 +190,7 @@ AdditionalIncludeDirectories="../h,.\h"
PreprocessorDefinitions="_DEBUG;_LIB;WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN"
UsePrecompiledHeader="2"
+ WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4244;4267;4996"
/>
@@ -256,6 +259,7 @@ AdditionalIncludeDirectories="../h,.\h"
PreprocessorDefinitions="_DEBUG;_LIB;WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN"
UsePrecompiledHeader="2"
+ WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4244;4267;4996"
/>
diff --git a/src/ui/CmdUI/CmdUI.cpp b/src/ui/CmdUI/CmdUI.cpp index c1bf6d16d..1e441d9f8 100644 --- a/src/ui/CmdUI/CmdUI.cpp +++ b/src/ui/CmdUI/CmdUI.cpp @@ -77,7 +77,7 @@ void CCmdUIDialog::OnKickIdle() // Q242577
-void CCmdUIDialog::OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu)
+void CCmdUIDialog::OnInitMenuPopup(CMenu *pPopupMenu, UINT /*nIndex*/, BOOL /*bSysMenu*/)
{
ASSERT(pPopupMenu != NULL);
// Check the enabled state of various menu items.
diff --git a/src/ui/TreePropSheet/PropPageFrame.cpp b/src/ui/TreePropSheet/PropPageFrame.cpp index 30f9f048b..2cc570d33 100644 --- a/src/ui/TreePropSheet/PropPageFrame.cpp +++ b/src/ui/TreePropSheet/PropPageFrame.cpp @@ -138,7 +138,7 @@ CRect CPropPageFrame::CalcMsgArea() }
-void CPropPageFrame::DrawMsg(CDC *pDc, CRect rect, LPCTSTR lpszMsg, DWORD dwFormat)
+void CPropPageFrame::DrawMsg(CDC *pDc, CRect rect, LPCTSTR /*lpszMsg*/, DWORD /*dwFormat*/)
{
CFont *pPrevFont = dynamic_cast<CFont*>(pDc->SelectStockObject(DEFAULT_GUI_FONT));
int nPrevBkMode = pDc->SetBkMode(TRANSPARENT);
@@ -165,7 +165,7 @@ CRect CPropPageFrame::CalcCaptionArea() }
-void CPropPageFrame::DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon)
+void CPropPageFrame::DrawCaption(CDC* /*pDc*/, CRect /*rect*/, LPCTSTR /*lpszCaption*/, HICON /*hIcon*/)
{
// should be implemented by specialized classes
}
diff --git a/src/ui/TreePropSheet/TreePropSheet.cpp b/src/ui/TreePropSheet/TreePropSheet.cpp index 750976305..866e0e423 100644 --- a/src/ui/TreePropSheet/TreePropSheet.cpp +++ b/src/ui/TreePropSheet/TreePropSheet.cpp @@ -953,7 +953,7 @@ void CTreePropSheet::OnPageTreeSelChanging(NMHDR *pNotifyStruct, LRESULT *plResu }
-void CTreePropSheet::OnPageTreeSelChanged(NMHDR *pNotifyStruct, LRESULT *plResult)
+void CTreePropSheet::OnPageTreeSelChanged(NMHDR* /*pNotifyStruct*/, LRESULT *plResult)
{
*plResult = 0;
|