baseclasses: Move from unfree to 3rdparty

Update it to the version found at
https://github.com/Microsoft/Windows-classic-samples , which is in an
MIT licensed repo, and add the LICENSE file (edited to remove the SIL
Open Font LICENSE part since that doesn't apply).

Some modifications have been made to reduce the diff/stop git
complaining (not including any file that wasn't in the previous version
and removing the related header includes in streams.h, and fixing some
but not all of the whitespace issues).
This commit is contained in:
Jonathan Li 2018-04-28 17:52:15 +01:00
parent b84b2808f4
commit ab9bdb009b
61 changed files with 2160 additions and 2599 deletions

21
3rdparty/baseclasses/LICENSE vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -3,14 +3,14 @@
//
// Desc: DirectShow base classes - implements CRenderedInputPin class.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h" // DirectShow base class definitions
#include <streams.h> // DirectShow base class definitions
#include <mmsystem.h> // Needed for definition of timeGetTime
#include <limits.h> // Standard data type limit definitions
#include "measure.h" // Used for time critical log functions
#include <measure.h> // Used for time critical log functions
#include "amextra.h"
@ -18,22 +18,22 @@
// Implements CRenderedInputPin class
CRenderedInputPin::CRenderedInputPin(TCHAR *pObjectName,
CBaseFilter *pFilter,
CCritSec *pLock,
HRESULT *phr,
LPCWSTR pName) :
CRenderedInputPin::CRenderedInputPin(__in_opt LPCTSTR pObjectName,
__in CBaseFilter *pFilter,
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName) :
CBaseInputPin(pObjectName, pFilter, pLock, phr, pName),
m_bAtEndOfStream(FALSE),
m_bCompleteNotified(FALSE)
{
}
#ifdef UNICODE
CRenderedInputPin::CRenderedInputPin(CHAR *pObjectName,
CBaseFilter *pFilter,
CCritSec *pLock,
HRESULT *phr,
LPCWSTR pName) :
CRenderedInputPin::CRenderedInputPin(__in_opt LPCSTR pObjectName,
__in CBaseFilter *pFilter,
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName) :
CBaseInputPin(pObjectName, pFilter, pLock, phr, pName),
m_bAtEndOfStream(FALSE),
m_bCompleteNotified(FALSE)

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -22,17 +22,17 @@ class CRenderedInputPin : public CBaseInputPin
{
public:
CRenderedInputPin(TCHAR *pObjectName,
CBaseFilter *pFilter,
CCritSec *pLock,
HRESULT *phr,
LPCWSTR pName);
CRenderedInputPin(__in_opt LPCTSTR pObjectName,
__in CBaseFilter *pFilter,
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName);
#ifdef UNICODE
CRenderedInputPin(CHAR *pObjectName,
CBaseFilter *pFilter,
CCritSec *pLock,
HRESULT *phr,
LPCWSTR pName);
CRenderedInputPin(__in_opt LPCSTR pObjectName,
__in CBaseFilter *pFilter,
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName);
#endif
// Override methods to track end of stream state

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - efines class hierarchy for streams
// architecture.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -73,9 +73,9 @@ protected:
public:
CBaseMediaFilter(
const TCHAR *pName,
LPUNKNOWN pUnk,
CCritSec *pLock,
__in_opt LPCTSTR pName,
__inout_opt LPUNKNOWN pUnk,
__in CCritSec *pLock,
REFCLSID clsid);
virtual ~CBaseMediaFilter();
@ -83,21 +83,21 @@ public:
DECLARE_IUNKNOWN
// override this to say what interfaces we support where
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv);
//
// --- IPersist method ---
//
STDMETHODIMP GetClassID(CLSID *pClsID);
STDMETHODIMP GetClassID(__out CLSID *pClsID);
// --- IMediaFilter methods ---
STDMETHODIMP GetState(DWORD dwMSecs, FILTER_STATE *State);
STDMETHODIMP GetState(DWORD dwMSecs, __out FILTER_STATE *State);
STDMETHODIMP SetSyncSource(IReferenceClock *pClock);
STDMETHODIMP SetSyncSource(__inout_opt IReferenceClock *pClock);
STDMETHODIMP GetSyncSource(IReferenceClock **pClock);
STDMETHODIMP GetSyncSource(__deref_out_opt IReferenceClock **pClock);
// default implementation of Stop and Pause just record the
// state. Override to activate or de-activate your filter.
@ -168,37 +168,37 @@ protected:
public:
CBaseFilter(
const TCHAR *pName, // Object description
LPUNKNOWN pUnk, // IUnknown of delegating object
CCritSec *pLock, // Object who maintains lock
REFCLSID clsid); // The clsid to be used to serialize this filter
__in_opt LPCTSTR pName, // Object description
__inout_opt LPUNKNOWN pUnk, // IUnknown of delegating object
__in CCritSec *pLock, // Object who maintains lock
REFCLSID clsid); // The clsid to be used to serialize this filter
CBaseFilter(
TCHAR *pName, // Object description
LPUNKNOWN pUnk, // IUnknown of delegating object
CCritSec *pLock, // Object who maintains lock
REFCLSID clsid, // The clsid to be used to serialize this filter
HRESULT *phr); // General OLE return code
__in_opt LPCTSTR pName, // Object description
__in_opt LPUNKNOWN pUnk, // IUnknown of delegating object
__in CCritSec *pLock, // Object who maintains lock
REFCLSID clsid, // The clsid to be used to serialize this filter
__inout HRESULT *phr); // General OLE return code
#ifdef UNICODE
CBaseFilter(
const CHAR *pName, // Object description
LPUNKNOWN pUnk, // IUnknown of delegating object
CCritSec *pLock, // Object who maintains lock
REFCLSID clsid); // The clsid to be used to serialize this filter
__in_opt LPCSTR pName, // Object description
__in_opt LPUNKNOWN pUnk, // IUnknown of delegating object
__in CCritSec *pLock, // Object who maintains lock
REFCLSID clsid); // The clsid to be used to serialize this filter
CBaseFilter(
CHAR *pName, // Object description
LPUNKNOWN pUnk, // IUnknown of delegating object
CCritSec *pLock, // Object who maintains lock
REFCLSID clsid, // The clsid to be used to serialize this filter
HRESULT *phr); // General OLE return code
__in_opt LPCSTR pName, // Object description
__in_opt LPUNKNOWN pUnk, // IUnknown of delegating object
__in CCritSec *pLock, // Object who maintains lock
REFCLSID clsid, // The clsid to be used to serialize this filter
__inout HRESULT *phr); // General OLE return code
#endif
~CBaseFilter();
DECLARE_IUNKNOWN
// override this to say what interfaces we support where
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv);
#ifdef DEBUG
STDMETHODIMP_(ULONG) NonDelegatingRelease();
#endif
@ -207,15 +207,15 @@ public:
// --- IPersist method ---
//
STDMETHODIMP GetClassID(CLSID *pClsID);
STDMETHODIMP GetClassID(__out CLSID *pClsID);
// --- IMediaFilter methods ---
STDMETHODIMP GetState(DWORD dwMSecs, FILTER_STATE *State);
STDMETHODIMP GetState(DWORD dwMSecs, __out FILTER_STATE *State);
STDMETHODIMP SetSyncSource(IReferenceClock *pClock);
STDMETHODIMP SetSyncSource(__in_opt IReferenceClock *pClock);
STDMETHODIMP GetSyncSource(IReferenceClock **pClock);
STDMETHODIMP GetSyncSource(__deref_out_opt IReferenceClock **pClock);
// override Stop and Pause so we can activate the pins.
@ -253,27 +253,27 @@ public:
// pin enumerator
STDMETHODIMP EnumPins(
IEnumPins ** ppEnum);
__deref_out IEnumPins ** ppEnum);
// default behaviour of FindPin assumes pin ids are their names
STDMETHODIMP FindPin(
LPCWSTR Id,
IPin ** ppPin
__deref_out IPin ** ppPin
);
STDMETHODIMP QueryFilterInfo(
FILTER_INFO * pInfo);
__out FILTER_INFO * pInfo);
STDMETHODIMP JoinFilterGraph(
IFilterGraph * pGraph,
LPCWSTR pName);
__inout_opt IFilterGraph * pGraph,
__in_opt LPCWSTR pName);
// return a Vendor information string. Optional - may return E_NOTIMPL.
// memory returned should be freed using CoTaskMemFree
// default implementation returns E_NOTIMPL
STDMETHODIMP QueryVendorInfo(
LPWSTR* pVendorInfo
__deref_out LPWSTR* pVendorInfo
);
// --- helper methods ---
@ -287,7 +287,7 @@ public:
LONG_PTR EventParam2);
// return the filter graph we belong to
IFilterGraph *GetFilterGraph() {
__out_opt IFilterGraph *GetFilterGraph() {
return m_pGraph;
}
@ -295,7 +295,7 @@ public:
// pPin is the pin to reconnect
// pmt is the type to reconnect with - can be NULL
// Calls ReconnectEx on the filter graph
HRESULT ReconnectPin(IPin *pPin, AM_MEDIA_TYPE const *pmt);
HRESULT ReconnectPin(IPin *pPin, __in_opt AM_MEDIA_TYPE const *pmt);
// find out the current pin version (used by enumerators)
virtual LONG GetPinVersion();
@ -314,7 +314,7 @@ public:
// --- setup helper methods ---
// (override to return filters setup data)
virtual LPAMOVIESETUP_FILTER GetSetupData(){ return NULL; }
virtual __out_opt LPAMOVIESETUP_FILTER GetSetupData(){ return NULL; }
};
@ -376,8 +376,8 @@ protected:
// try all the media types in this enumerator - for each that
// we accept, try to connect using ReceiveConnection.
HRESULT TryMediaTypes(
IPin *pReceivePin, // connect to this pin
const CMediaType *pmt, // proposed type from Connect
IPin *pReceivePin, // connect to this pin
__in_opt const CMediaType *pmt, // proposed type from Connect
IEnumMediaTypes *pEnum); // try this enumerator
// establish a connection with a suitable mediatype. Needs to
@ -386,31 +386,31 @@ protected:
// enumerator until we find one that works.
HRESULT AgreeMediaType(
IPin *pReceivePin, // connect to this pin
const CMediaType *pmt); // proposed type from Connect
const CMediaType *pmt); // proposed type from Connect
public:
CBasePin(
TCHAR *pObjectName, // Object description
CBaseFilter *pFilter, // Owning filter who knows about pins
CCritSec *pLock, // Object who implements the lock
HRESULT *phr, // General OLE return code
LPCWSTR pName, // Pin name for us
__in_opt LPCTSTR pObjectName, // Object description
__in CBaseFilter *pFilter, // Owning filter who knows about pins
__in CCritSec *pLock, // Object who implements the lock
__inout HRESULT *phr, // General OLE return code
__in_opt LPCWSTR pName, // Pin name for us
PIN_DIRECTION dir); // Either PINDIR_INPUT or PINDIR_OUTPUT
#ifdef UNICODE
CBasePin(
CHAR *pObjectName, // Object description
CBaseFilter *pFilter, // Owning filter who knows about pins
CCritSec *pLock, // Object who implements the lock
HRESULT *phr, // General OLE return code
LPCWSTR pName, // Pin name for us
__in_opt LPCSTR pObjectName, // Object description
__in CBaseFilter *pFilter, // Owning filter who knows about pins
__in CCritSec *pLock, // Object who implements the lock
__inout HRESULT *phr, // General OLE return code
__in_opt LPCWSTR pName, // Pin name for us
PIN_DIRECTION dir); // Either PINDIR_INPUT or PINDIR_OUTPUT
#endif
virtual ~CBasePin();
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv);
STDMETHODIMP_(ULONG) NonDelegatingRelease();
STDMETHODIMP_(ULONG) NonDelegatingAddRef();
@ -421,7 +421,7 @@ public:
// (subtype or format type may be GUID_NULL).
STDMETHODIMP Connect(
IPin * pReceivePin,
const AM_MEDIA_TYPE *pmt // optional media type
__in_opt const AM_MEDIA_TYPE *pmt // optional media type
);
// (passive) accept a connection from another pin
@ -432,20 +432,20 @@ public:
STDMETHODIMP Disconnect();
STDMETHODIMP ConnectedTo(IPin **pPin);
STDMETHODIMP ConnectedTo(__deref_out IPin **pPin);
STDMETHODIMP ConnectionMediaType(AM_MEDIA_TYPE *pmt);
STDMETHODIMP ConnectionMediaType(__out AM_MEDIA_TYPE *pmt);
STDMETHODIMP QueryPinInfo(
PIN_INFO * pInfo
__out PIN_INFO * pInfo
);
STDMETHODIMP QueryDirection(
PIN_DIRECTION * pPinDir
__out PIN_DIRECTION * pPinDir
);
STDMETHODIMP QueryId(
LPWSTR * Id
__deref_out LPWSTR * Id
);
// does the pin support this media type
@ -455,7 +455,7 @@ public:
// return an enumerator for this pins preferred media types
STDMETHODIMP EnumMediaTypes(
IEnumMediaTypes **ppEnum
__deref_out IEnumMediaTypes **ppEnum
);
// return an array of IPin* - the pins that this pin internally connects to
@ -466,9 +466,9 @@ public:
// all visible output pins and vice versa.
// apPin can be NULL if nPin==0 (not otherwise).
STDMETHODIMP QueryInternalConnections(
IPin* *apPin, // array of IPin*
ULONG *nPin // on input, the number of slots
// on output the number of pins
__out_ecount_part(*nPin,*nPin) IPin* *apPin, // array of IPin*
__inout ULONG *nPin // on input, the number of slots
// on output the number of pins
) { return E_NOTIMPL; }
// Called when no more data will be sent
@ -534,7 +534,7 @@ public:
virtual HRESULT CompleteConnect(IPin *pReceivePin);
// returns the preferred formats for a pin
virtual HRESULT GetMediaType(int iPosition,CMediaType *pMediaType);
virtual HRESULT GetMediaType(int iPosition, __inout CMediaType *pMediaType);
// access to NewSegment values
REFERENCE_TIME CurrentStopTime() {
@ -616,26 +616,26 @@ class CEnumPins : public IEnumPins // The interface we support
public:
CEnumPins(
CBaseFilter *pFilter,
CEnumPins *pEnumPins);
__in CBaseFilter *pFilter,
__in_opt CEnumPins *pEnumPins);
virtual ~CEnumPins();
// IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP QueryInterface(REFIID riid, __deref_out void **ppv);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
// IEnumPins
STDMETHODIMP Next(
ULONG cPins, // place this many pins...
IPin ** ppPins, // ...in this array of IPin*
ULONG * pcFetched // actual count passed returned here
__out_ecount(cPins) IPin ** ppPins, // ...in this array of IPin*
__out_opt ULONG * pcFetched // actual count passed returned here
);
STDMETHODIMP Skip(ULONG cPins);
STDMETHODIMP Reset();
STDMETHODIMP Clone(IEnumPins **ppEnum);
STDMETHODIMP Clone(__deref_out IEnumPins **ppEnum);
};
@ -672,26 +672,26 @@ class CEnumMediaTypes : public IEnumMediaTypes // The interface we support
public:
CEnumMediaTypes(
CBasePin *pPin,
CEnumMediaTypes *pEnumMediaTypes);
__in CBasePin *pPin,
__in_opt CEnumMediaTypes *pEnumMediaTypes);
virtual ~CEnumMediaTypes();
// IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP QueryInterface(REFIID riid, __deref_out void **ppv);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
// IEnumMediaTypes
STDMETHODIMP Next(
ULONG cMediaTypes, // place this many pins...
AM_MEDIA_TYPE ** ppMediaTypes, // ...in this array
ULONG * pcFetched // actual count passed
__out_ecount(cMediaTypes) AM_MEDIA_TYPE ** ppMediaTypes, // ...in this array
__out_opt ULONG * pcFetched // actual count passed
);
STDMETHODIMP Skip(ULONG cMediaTypes);
STDMETHODIMP Reset();
STDMETHODIMP Clone(IEnumMediaTypes **ppEnum);
STDMETHODIMP Clone(__deref_out IEnumMediaTypes **ppEnum);
};
@ -721,25 +721,25 @@ protected:
public:
CBaseOutputPin(
TCHAR *pObjectName,
CBaseFilter *pFilter,
CCritSec *pLock,
HRESULT *phr,
LPCWSTR pName);
__in_opt LPCTSTR pObjectName,
__in CBaseFilter *pFilter,
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName);
#ifdef UNICODE
CBaseOutputPin(
CHAR *pObjectName,
CBaseFilter *pFilter,
CCritSec *pLock,
HRESULT *phr,
LPCWSTR pName);
__in_opt LPCSTR pObjectName,
__in CBaseFilter *pFilter,
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName);
#endif
// override CompleteConnect() so we can negotiate an allocator
virtual HRESULT CompleteConnect(IPin *pReceivePin);
// negotiate the allocator and its buffer size/count and other properties
// Calls DecideBufferSize to set properties
virtual HRESULT DecideAllocator(IMemInputPin * pPin, IMemAllocator ** pAlloc);
virtual HRESULT DecideAllocator(IMemInputPin * pPin, __deref_out IMemAllocator ** pAlloc);
// override this to set the buffer size and count. Return an error
// if the size/count is not to your liking.
@ -748,13 +748,13 @@ public:
// no preference on these.
virtual HRESULT DecideBufferSize(
IMemAllocator * pAlloc,
ALLOCATOR_PROPERTIES * ppropInputRequest
__inout ALLOCATOR_PROPERTIES * ppropInputRequest
) PURE;
// returns an empty sample buffer from the allocator
virtual HRESULT GetDeliveryBuffer(IMediaSample ** ppSample,
REFERENCE_TIME * pStartTime,
REFERENCE_TIME * pEndTime,
virtual HRESULT GetDeliveryBuffer(__deref_out IMediaSample ** ppSample,
__in_opt REFERENCE_TIME * pStartTime,
__in_opt REFERENCE_TIME * pEndTime,
DWORD dwFlags);
// deliver a filled-in sample to the connected input pin
@ -764,7 +764,7 @@ public:
virtual HRESULT Deliver(IMediaSample *);
// override this to control the connection
virtual HRESULT InitAllocator(IMemAllocator **ppAlloc);
virtual HRESULT InitAllocator(__deref_out IMemAllocator **ppAlloc);
HRESULT CheckConnect(IPin *pPin);
HRESULT BreakConnect();
@ -839,29 +839,29 @@ protected:
public:
CBaseInputPin(
TCHAR *pObjectName,
CBaseFilter *pFilter,
CCritSec *pLock,
HRESULT *phr,
LPCWSTR pName);
__in_opt LPCTSTR pObjectName,
__in CBaseFilter *pFilter,
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName);
#ifdef UNICODE
CBaseInputPin(
CHAR *pObjectName,
CBaseFilter *pFilter,
CCritSec *pLock,
HRESULT *phr,
LPCWSTR pName);
__in_opt LPCSTR pObjectName,
__in CBaseFilter *pFilter,
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName);
#endif
virtual ~CBaseInputPin();
DECLARE_IUNKNOWN
// override this to publicise our interfaces
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
// return the allocator interface that this input pin
// would like the output pin to use
STDMETHODIMP GetAllocator(IMemAllocator ** ppAllocator);
STDMETHODIMP GetAllocator(__deref_out IMemAllocator ** ppAllocator);
// tell the input pin which allocator the output pin is actually
// going to use.
@ -874,9 +874,9 @@ public:
// do something with these media samples
STDMETHODIMP ReceiveMultiple (
IMediaSample **pSamples,
__in_ecount(nSamples) IMediaSample **pSamples,
long nSamples,
long *nSamplesProcessed);
__out long *nSamplesProcessed);
// See if Receive() blocks
STDMETHODIMP ReceiveCanBlock();
@ -898,7 +898,7 @@ public:
// default implementation returns E_NOTIMPL. Override if you have
// specific alignment or prefix needs, but could use an upstream
// allocator
STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES*pProps);
STDMETHODIMP GetAllocatorRequirements(__out ALLOCATOR_PROPERTIES*pProps);
// Release the pin's allocator.
HRESULT BreakConnect();
@ -952,25 +952,25 @@ class CDynamicOutputPin : public CBaseOutputPin,
public:
#ifdef UNICODE
CDynamicOutputPin(
CHAR *pObjectName,
CBaseFilter *pFilter,
CCritSec *pLock,
HRESULT *phr,
LPCWSTR pName);
__in_opt LPCSTR pObjectName,
__in CBaseFilter *pFilter,
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName);
#endif
CDynamicOutputPin(
TCHAR *pObjectName,
CBaseFilter *pFilter,
CCritSec *pLock,
HRESULT *phr,
LPCWSTR pName);
__in_opt LPCTSTR pObjectName,
__in CBaseFilter *pFilter,
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName);
~CDynamicOutputPin();
// IUnknown Methods
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
// IPin Methods
STDMETHODIMP Disconnect(void);
@ -1083,14 +1083,14 @@ private:
class CAutoUsingOutputPin
{
public:
CAutoUsingOutputPin( CDynamicOutputPin* pOutputPin, HRESULT* phr );
CAutoUsingOutputPin( __in CDynamicOutputPin* pOutputPin, __inout HRESULT* phr );
~CAutoUsingOutputPin();
private:
CDynamicOutputPin* m_pOutputPin;
};
inline CAutoUsingOutputPin::CAutoUsingOutputPin( CDynamicOutputPin* pOutputPin, HRESULT* phr ) :
inline CAutoUsingOutputPin::CAutoUsingOutputPin( __in CDynamicOutputPin* pOutputPin, __inout HRESULT* phr ) :
m_pOutputPin(NULL)
{
// The caller should always pass in valid pointers.
@ -1213,7 +1213,7 @@ protected:
into the top word
*/
DWORD m_dwTypeSpecificFlags; /* Media type specific flags */
LPBYTE m_pBuffer; /* Pointer to the complete buffer */
__field_ecount_opt(m_cbBuffer) LPBYTE m_pBuffer; /* Pointer to the complete buffer */
LONG m_lActual; /* Length of data in this sample */
LONG m_cbBuffer; /* Size of the buffer */
CBaseAllocator *m_pAllocator; /* The allocator who owns us */
@ -1231,17 +1231,17 @@ public:
public:
CMediaSample(
TCHAR *pName,
CBaseAllocator *pAllocator,
HRESULT *phr,
LPBYTE pBuffer = NULL,
__in_opt LPCTSTR pName,
__in_opt CBaseAllocator *pAllocator,
__inout_opt HRESULT *phr,
__in_bcount_opt(length) LPBYTE pBuffer = NULL,
LONG length = 0);
#ifdef UNICODE
CMediaSample(
CHAR *pName,
CBaseAllocator *pAllocator,
HRESULT *phr,
LPBYTE pBuffer = NULL,
__in_opt LPCSTR pName,
__in_opt CBaseAllocator *pAllocator,
__inout_opt HRESULT *phr,
__in_bcount_opt(length) LPBYTE pBuffer = NULL,
LONG length = 0);
#endif
@ -1249,7 +1249,7 @@ public:
/* Note the media sample does not delegate to its owner */
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP QueryInterface(REFIID riid, __deref_out void **ppv);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
@ -1257,23 +1257,23 @@ public:
// want variable sized pointers or pointers into already-read data.
// This is only available through a CMediaSample* not an IMediaSample*
// and so cannot be changed by clients.
HRESULT SetPointer(BYTE * ptr, LONG cBytes);
HRESULT SetPointer(__in_bcount(cBytes) BYTE * ptr, LONG cBytes);
// Get me a read/write pointer to this buffer's memory.
STDMETHODIMP GetPointer(BYTE ** ppBuffer);
STDMETHODIMP GetPointer(__deref_out BYTE ** ppBuffer);
STDMETHODIMP_(LONG) GetSize(void);
// get the stream time at which this sample should start and finish.
STDMETHODIMP GetTime(
REFERENCE_TIME * pTimeStart, // put time here
REFERENCE_TIME * pTimeEnd
__out REFERENCE_TIME * pTimeStart, // put time here
__out REFERENCE_TIME * pTimeEnd
);
// Set the stream time at which this sample should start and finish.
STDMETHODIMP SetTime(
REFERENCE_TIME * pTimeStart, // put time here
REFERENCE_TIME * pTimeEnd
__in_opt REFERENCE_TIME * pTimeStart, // put time here
__in_opt REFERENCE_TIME * pTimeEnd
);
STDMETHODIMP IsSyncPoint(void);
STDMETHODIMP SetSyncPoint(BOOL bIsSyncPoint);
@ -1285,8 +1285,8 @@ public:
// these allow for limited format changes in band
STDMETHODIMP GetMediaType(AM_MEDIA_TYPE **ppMediaType);
STDMETHODIMP SetMediaType(AM_MEDIA_TYPE *pMediaType);
STDMETHODIMP GetMediaType(__deref_out AM_MEDIA_TYPE **ppMediaType);
STDMETHODIMP SetMediaType(__in_opt AM_MEDIA_TYPE *pMediaType);
// returns S_OK if there is a discontinuity in the data (this same is
// not a continuation of the previous stream of data
@ -1298,25 +1298,25 @@ public:
// get the media times for this sample
STDMETHODIMP GetMediaTime(
LONGLONG * pTimeStart,
LONGLONG * pTimeEnd
__out LONGLONG * pTimeStart,
__out LONGLONG * pTimeEnd
);
// Set the media times for this sample
STDMETHODIMP SetMediaTime(
LONGLONG * pTimeStart,
LONGLONG * pTimeEnd
__in_opt LONGLONG * pTimeStart,
__in_opt LONGLONG * pTimeEnd
);
// Set and get properties (IMediaSample2)
STDMETHODIMP GetProperties(
DWORD cbProperties,
BYTE * pbProperties
__out_bcount(cbProperties) BYTE * pbProperties
);
STDMETHODIMP SetProperties(
DWORD cbProperties,
const BYTE * pbProperties
__in_bcount(cbProperties) const BYTE * pbProperties
);
};
@ -1344,7 +1344,7 @@ class AM_NOVTABLE CBaseAllocator : public CUnknown,// A non delegating IUnknown
friend class CSampleList;
/* Trick to get at protected member in CMediaSample */
static CMediaSample * &NextSample(CMediaSample *pSample)
static CMediaSample * &NextSample(__in CMediaSample *pSample)
{
return pSample->m_pNext;
};
@ -1361,9 +1361,9 @@ class AM_NOVTABLE CBaseAllocator : public CUnknown,// A non delegating IUnknown
};
#endif
CMediaSample *Head() const { return m_List; };
CMediaSample *Next(CMediaSample *pSample) const { return CBaseAllocator::NextSample(pSample); };
CMediaSample *Next(__in CMediaSample *pSample) const { return CBaseAllocator::NextSample(pSample); };
int GetCount() const { return m_nOnList; };
void Add(CMediaSample *pSample)
void Add(__inout CMediaSample *pSample)
{
ASSERT(pSample != NULL);
CBaseAllocator::NextSample(pSample) = m_List;
@ -1379,7 +1379,7 @@ class AM_NOVTABLE CBaseAllocator : public CUnknown,// A non delegating IUnknown
}
return pSample;
};
void Remove(CMediaSample *pSample);
void Remove(__inout CMediaSample *pSample);
public:
CMediaSample *m_List;
@ -1455,11 +1455,11 @@ protected:
public:
CBaseAllocator(
TCHAR *, LPUNKNOWN, HRESULT *,
__in_opt LPCTSTR , __inout_opt LPUNKNOWN, __inout HRESULT *,
BOOL bEvent = TRUE, BOOL fEnableReleaseCallback = FALSE);
#ifdef UNICODE
CBaseAllocator(
CHAR *, LPUNKNOWN, HRESULT *,
__in_opt LPCSTR , __inout_opt LPUNKNOWN, __inout HRESULT *,
BOOL bEvent = TRUE, BOOL fEnableReleaseCallback = FALSE);
#endif
virtual ~CBaseAllocator();
@ -1467,15 +1467,15 @@ public:
DECLARE_IUNKNOWN
// override this to publicise our interfaces
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
STDMETHODIMP SetProperties(
ALLOCATOR_PROPERTIES* pRequest,
ALLOCATOR_PROPERTIES* pActual);
__in ALLOCATOR_PROPERTIES* pRequest,
__out ALLOCATOR_PROPERTIES* pActual);
// return the properties actually being used on this allocator
STDMETHODIMP GetProperties(
ALLOCATOR_PROPERTIES* pProps);
__out ALLOCATOR_PROPERTIES* pProps);
// override Commit to allocate memory. We handle the GetBuffer
//state changes
@ -1494,9 +1494,9 @@ public:
// bPrevFramesSkipped is not used (used only by the video renderer's
// allocator where it affects quality management in direct draw).
STDMETHODIMP GetBuffer(IMediaSample **ppBuffer,
REFERENCE_TIME * pStartTime,
REFERENCE_TIME * pEndTime,
STDMETHODIMP GetBuffer(__deref_out IMediaSample **ppBuffer,
__in_opt REFERENCE_TIME * pStartTime,
__in_opt REFERENCE_TIME * pEndTime,
DWORD dwFlags);
// final release of a CMediaSample will call this
@ -1505,7 +1505,7 @@ public:
STDMETHODIMP SetNotify(IMemAllocatorNotifyCallbackTemp *pNotify);
STDMETHODIMP GetFreeCount(LONG *plBuffersFree);
STDMETHODIMP GetFreeCount(__out LONG *plBuffersFree);
// Notify that a sample is available
void NotifySample();
@ -1532,7 +1532,7 @@ public:
//=====================================================================
// Make me one from quartz.dll
STDAPI CreateMemoryAllocator(IMemAllocator **ppAllocator);
STDAPI CreateMemoryAllocator(__deref_out IMemAllocator **ppAllocator);
class CMemAllocator : public CBaseAllocator
{
@ -1554,15 +1554,15 @@ protected:
public:
/* This goes in the factory template table to create new instances */
static CUnknown *CreateInstance(LPUNKNOWN, HRESULT *);
static CUnknown *CreateInstance(__inout_opt LPUNKNOWN, __inout HRESULT *);
STDMETHODIMP SetProperties(
ALLOCATOR_PROPERTIES* pRequest,
ALLOCATOR_PROPERTIES* pActual);
__in ALLOCATOR_PROPERTIES* pRequest,
__out ALLOCATOR_PROPERTIES* pActual);
CMemAllocator(TCHAR *, LPUNKNOWN, HRESULT *);
CMemAllocator(__in_opt LPCTSTR , __inout_opt LPUNKNOWN, __inout HRESULT *);
#ifdef UNICODE
CMemAllocator(CHAR *, LPUNKNOWN, HRESULT *);
CMemAllocator(__in_opt LPCSTR , __inout_opt LPUNKNOWN, __inout HRESULT *);
#endif
~CMemAllocator();
};

View File

@ -4,11 +4,11 @@
// Desc: DirectShow base classes - implements helper functions for
// bitmap formats.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include <streams.h>
#include <limits.h>
// These are bit field masks for true colour devices

View File

@ -56,7 +56,6 @@
<ClInclude Include="combase.h" />
<ClInclude Include="ctlutil.h" />
<ClInclude Include="ddmm.h" />
<ClInclude Include="dsschedule.h" />
<ClInclude Include="fourcc.h" />
<ClInclude Include="measure.h" />
<ClInclude Include="msgthrd.h" />
@ -109,10 +108,6 @@
<ClCompile Include="wxlist.cpp" />
<ClCompile Include="wxutil.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="activex.rcv" />
<None Include="activex.ver" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>
</Project>

View File

@ -36,9 +36,6 @@
<ClInclude Include="fourcc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="dsschedule.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="msgthrd.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -174,12 +171,4 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="activex.ver">
<Filter>Resource Files</Filter>
</None>
<None Include="activex.rcv">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes - efines a non-MFC generic cache class.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -54,11 +54,11 @@ private:
public:
CCache(TCHAR *pName,INT iItems);
CCache(__in_opt LPCTSTR pName,INT iItems);
virtual ~CCache();
/* Add an item to the cache */
CBaseObject *AddToCache(CBaseObject *pObject);
CBaseObject *AddToCache(__in CBaseObject *pObject);
/* Remove an item from the cache */
CBaseObject *RemoveFromCache();

View File

@ -4,11 +4,11 @@
// Desc: DirectShow base classes - implements class hierarchy for creating
// COM objects.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include <streams.h>
#pragma warning( disable : 4514 ) // Disable warnings re unused inline functions
@ -19,7 +19,7 @@ LONG CBaseObject::m_cObjects = 0;
/* Constructor */
CBaseObject::CBaseObject(const TCHAR *pName)
CBaseObject::CBaseObject(__in_opt LPCTSTR pName)
{
/* Increment the number of active objects */
InterlockedIncrement(&m_cObjects);
@ -85,7 +85,7 @@ HINSTANCE LoadOLEAut32()
// We know we use "this" in the initialization list, we also know we don't modify *phr.
#pragma warning( disable : 4355 4100 )
CUnknown::CUnknown(const TCHAR *pName, LPUNKNOWN pUnk)
CUnknown::CUnknown(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN pUnk)
: CBaseObject(pName)
/* Start the object with a reference count of zero - when the */
/* object is queried for it's first interface this may be */
@ -107,7 +107,7 @@ CUnknown::CUnknown(const TCHAR *pName, LPUNKNOWN pUnk)
// This does the same as above except it has a useless HRESULT argument
// use the previous constructor, this is just left for compatibility...
CUnknown::CUnknown(TCHAR *pName, LPUNKNOWN pUnk,HRESULT *phr) :
CUnknown::CUnknown(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN pUnk, __inout_opt HRESULT *phr) :
CBaseObject(pName),
m_cRef(0),
m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>( static_cast<PNDUNKNOWN>(this) ) )
@ -115,12 +115,12 @@ CUnknown::CUnknown(TCHAR *pName, LPUNKNOWN pUnk,HRESULT *phr) :
}
#ifdef UNICODE
CUnknown::CUnknown(const CHAR *pName, LPUNKNOWN pUnk)
CUnknown::CUnknown(__in_opt LPCSTR pName, __in_opt LPUNKNOWN pUnk)
: CBaseObject(pName), m_cRef(0),
m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>( static_cast<PNDUNKNOWN>(this) ) )
{ }
CUnknown::CUnknown(CHAR *pName, LPUNKNOWN pUnk,HRESULT *phr) :
CUnknown::CUnknown(__in_opt LPCSTR pName, __in_opt LPUNKNOWN pUnk, __inout_opt HRESULT *phr) :
CBaseObject(pName), m_cRef(0),
m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>( static_cast<PNDUNKNOWN>(this) ) )
{ }
@ -132,7 +132,7 @@ CUnknown::CUnknown(CHAR *pName, LPUNKNOWN pUnk,HRESULT *phr) :
/* QueryInterface */
STDMETHODIMP CUnknown::NonDelegatingQueryInterface(REFIID riid, void ** ppv)
STDMETHODIMP CUnknown::NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv)
{
CheckPointer(ppv,E_POINTER);
ValidateReadWritePtr(ppv,sizeof(PVOID));
@ -200,7 +200,9 @@ STDMETHODIMP_(ULONG) CUnknown::NonDelegatingRelease()
delete this;
return ULONG(0);
} else {
return ourmax(ULONG(m_cRef), 1ul);
// Don't touch m_cRef again even in this leg as the object
// may have just been released on another thread too
return ourmax(ULONG(lRef), 1ul);
}
}
@ -208,7 +210,7 @@ STDMETHODIMP_(ULONG) CUnknown::NonDelegatingRelease()
/* Return an interface pointer to a requesting client
performing a thread safe AddRef as necessary */
STDAPI GetInterface(LPUNKNOWN pUnk, void **ppv)
STDAPI GetInterface(LPUNKNOWN pUnk, __out void **ppv)
{
CheckPointer(ppv, E_POINTER);
*ppv = pUnk;
@ -240,16 +242,23 @@ BOOL WINAPI IsEqualObject(IUnknown *pFirst, IUnknown *pSecond)
/* See if the IUnknown pointers match */
hr = pFirst->QueryInterface(IID_IUnknown,(void **) &pUnknown1);
ASSERT(SUCCEEDED(hr));
if (FAILED(hr)) {
return FALSE;
}
ASSERT(pUnknown1);
hr = pSecond->QueryInterface(IID_IUnknown,(void **) &pUnknown2);
ASSERT(SUCCEEDED(hr));
ASSERT(pUnknown2);
/* Release the extra interfaces we hold */
/* Release the extra interface we hold */
pUnknown1->Release();
hr = pSecond->QueryInterface(IID_IUnknown,(void **) &pUnknown2);
if (FAILED(hr)) {
return FALSE;
}
ASSERT(pUnknown2);
/* Release the extra interface we hold */
pUnknown2->Release();
return (pUnknown1 == pUnknown2);
}

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - defines a class hierarchy for creating
// COM objects.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -179,9 +179,9 @@ public:
/* These increment and decrement the number of active objects */
CBaseObject(const TCHAR *pName);
CBaseObject(__in_opt LPCTSTR pName);
#ifdef UNICODE
CBaseObject(const char *pName);
CBaseObject(__in_opt LPCSTR pName);
#endif
~CBaseObject();
@ -208,15 +208,15 @@ protected: /* So we can override NonDelegatingRelease() */
public:
CUnknown(const TCHAR *pName, LPUNKNOWN pUnk);
CUnknown(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN pUnk);
virtual ~CUnknown() {};
// This is redundant, just use the other constructor
// as we never touch the HRESULT in this anyway
CUnknown(TCHAR *pName, LPUNKNOWN pUnk,HRESULT *phr);
CUnknown(__in_opt LPCTSTR Name, __in_opt LPUNKNOWN pUnk, __inout_opt HRESULT *phr);
#ifdef UNICODE
CUnknown(const char *pName, LPUNKNOWN pUnk);
CUnknown(char *pName, LPUNKNOWN pUnk,HRESULT *phr);
CUnknown(__in_opt LPCSTR pName, __in_opt LPUNKNOWN pUnk);
CUnknown(__in_opt LPCSTR pName, __in_opt LPUNKNOWN pUnk,__inout_opt HRESULT *phr);
#endif
/* Return the owner of this object */
@ -232,33 +232,19 @@ public:
/* Non delegating unknown implementation */
STDMETHODIMP NonDelegatingQueryInterface(REFIID, void **);
STDMETHODIMP NonDelegatingQueryInterface(REFIID, __deref_out void **);
STDMETHODIMP_(ULONG) NonDelegatingAddRef();
STDMETHODIMP_(ULONG) NonDelegatingRelease();
};
#if (_MSC_VER <= 1200)
#pragma warning(disable:4211)
/* The standard InterlockedXXX functions won't take volatiles */
static inline LONG WINAPI InterlockedIncrement( volatile LONG * plong )
{ return InterlockedIncrement( const_cast<LONG*>( plong ) ); }
static inline LONG WINAPI InterlockedDecrement( volatile LONG * plong )
{ return InterlockedDecrement( const_cast<LONG*>( plong ) ); }
#pragma warning(default:4211)
#endif
/* Return an interface pointer to a requesting client
performing a thread safe AddRef as necessary */
STDAPI GetInterface(LPUNKNOWN pUnk, void **ppv);
STDAPI GetInterface(LPUNKNOWN pUnk, __out void **ppv);
/* A function that can create a new COM object */
typedef CUnknown *(CALLBACK *LPFNNewCOMObject)(LPUNKNOWN pUnkOuter, HRESULT *phr);
typedef CUnknown *(CALLBACK *LPFNNewCOMObject)(__in_opt LPUNKNOWN pUnkOuter, __inout_opt HRESULT *phr);
/* A function (can be NULL) which is called from the DLL entrypoint
routine for each factory template:
@ -285,7 +271,7 @@ public:
return (IsEqualCLSID(*m_ClsID,rclsid));
};
CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr) const {
CUnknown *CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout_opt HRESULT *phr) const {
CheckPointer(phr,NULL);
return m_lpfnNew(pUnk, phr);
};
@ -297,7 +283,7 @@ public:
class supports (the default implementation only supports IUnknown) */
#define DECLARE_IUNKNOWN \
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) { \
STDMETHODIMP QueryInterface(REFIID riid, __deref_out void **ppv) { \
return GetOwner()->QueryInterface(riid,ppv); \
}; \
STDMETHODIMP_(ULONG) AddRef() { \

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -33,20 +33,20 @@ public:
~CBaseDispatch();
/* IDispatch methods */
STDMETHODIMP GetTypeInfoCount(UINT * pctinfo);
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
REFIID riid,
UINT itinfo,
LCID lcid,
ITypeInfo ** pptinfo);
__deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
REFIID riid,
OLECHAR ** rgszNames,
__in_ecount(cNames) LPOLESTR * rgszNames,
UINT cNames,
LCID lcid,
DISPID * rgdispid);
__out_ecount(cNames) DISPID * rgdispid);
};
@ -63,32 +63,32 @@ public:
DECLARE_IUNKNOWN
// override this to publicise our interfaces
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
/* IDispatch methods */
STDMETHODIMP GetTypeInfoCount(UINT * pctinfo);
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
UINT itinfo,
LCID lcid,
ITypeInfo ** pptinfo);
__deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
REFIID riid,
OLECHAR ** rgszNames,
__in_ecount(cNames) LPOLESTR * rgszNames,
UINT cNames,
LCID lcid,
DISPID * rgdispid);
__out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
DISPID dispidMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS * pdispparams,
VARIANT * pvarResult,
EXCEPINFO * pexcepinfo,
UINT * puArgErr);
__in DISPPARAMS * pdispparams,
__out_opt VARIANT * pvarResult,
__out_opt EXCEPINFO * pexcepinfo,
__out_opt UINT * puArgErr);
};
@ -100,37 +100,37 @@ class AM_NOVTABLE CMediaEvent :
public:
CMediaEvent(const TCHAR *, LPUNKNOWN);
CMediaEvent(__in_opt LPCTSTR, __in_opt LPUNKNOWN);
DECLARE_IUNKNOWN
// override this to publicise our interfaces
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
/* IDispatch methods */
STDMETHODIMP GetTypeInfoCount(UINT * pctinfo);
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
UINT itinfo,
LCID lcid,
ITypeInfo ** pptinfo);
__deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
REFIID riid,
OLECHAR ** rgszNames,
__in_ecount(cNames) LPOLESTR * rgszNames,
UINT cNames,
LCID lcid,
DISPID * rgdispid);
__out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
DISPID dispidMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS * pdispparams,
VARIANT * pvarResult,
EXCEPINFO * pexcepinfo,
UINT * puArgErr);
__in DISPPARAMS * pdispparams,
__out_opt VARIANT * pvarResult,
__out_opt EXCEPINFO * pexcepinfo,
__out_opt UINT * puArgErr);
};
@ -143,38 +143,38 @@ class AM_NOVTABLE CMediaPosition :
public:
CMediaPosition(const TCHAR *, LPUNKNOWN);
CMediaPosition(const TCHAR *, LPUNKNOWN, HRESULT *phr);
CMediaPosition(__in_opt LPCTSTR, __in_opt LPUNKNOWN);
CMediaPosition(__in_opt LPCTSTR, __in_opt LPUNKNOWN, __inout HRESULT *phr);
DECLARE_IUNKNOWN
// override this to publicise our interfaces
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
/* IDispatch methods */
STDMETHODIMP GetTypeInfoCount(UINT * pctinfo);
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
UINT itinfo,
LCID lcid,
ITypeInfo ** pptinfo);
__deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
REFIID riid,
OLECHAR ** rgszNames,
__in_ecount(cNames) LPOLESTR * rgszNames,
UINT cNames,
LCID lcid,
DISPID * rgdispid);
__out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
DISPID dispidMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS * pdispparams,
VARIANT * pvarResult,
EXCEPINFO * pexcepinfo,
UINT * puArgErr);
__in DISPPARAMS * pdispparams,
__out_opt VARIANT * pvarResult,
__out_opt EXCEPINFO * pexcepinfo,
__out_opt UINT * puArgErr);
};
@ -275,7 +275,7 @@ private:
// Prevent bugs from constructing from LONG (which gets
// converted to double and then multiplied by 10000000
COARefTime(LONG);
int operator=(LONG);
LONG operator=(LONG);
};
@ -300,12 +300,12 @@ class CPosPassThru : public IMediaSeeking, public CMediaPosition
{
IPin *m_pPin;
HRESULT GetPeer(IMediaPosition **ppMP);
HRESULT GetPeerSeeking(IMediaSeeking **ppMS);
HRESULT GetPeer(__deref_out IMediaPosition **ppMP);
HRESULT GetPeerSeeking(__deref_out IMediaSeeking **ppMS);
public:
CPosPassThru(const TCHAR *, LPUNKNOWN, HRESULT*, IPin *);
CPosPassThru(__in_opt LPCTSTR, __in_opt LPUNKNOWN, __inout HRESULT*, IPin *);
DECLARE_IUNKNOWN
HRESULT ForceRefresh() {
@ -313,50 +313,52 @@ public:
};
// override to return an accurate current position
virtual HRESULT GetMediaTime(LONGLONG *pStartTime,LONGLONG *pEndTime) {
virtual HRESULT GetMediaTime(__out LONGLONG *pStartTime, __out_opt LONGLONG *pEndTime) {
return E_FAIL;
}
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,__deref_out void **ppv);
// IMediaSeeking methods
STDMETHODIMP GetCapabilities( DWORD * pCapabilities );
STDMETHODIMP CheckCapabilities( DWORD * pCapabilities );
STDMETHODIMP GetCapabilities( __out DWORD * pCapabilities );
STDMETHODIMP CheckCapabilities( __inout DWORD * pCapabilities );
STDMETHODIMP SetTimeFormat(const GUID * pFormat);
STDMETHODIMP GetTimeFormat(GUID *pFormat);
STDMETHODIMP GetTimeFormat(__out GUID *pFormat);
STDMETHODIMP IsUsingTimeFormat(const GUID * pFormat);
STDMETHODIMP IsFormatSupported( const GUID * pFormat);
STDMETHODIMP QueryPreferredFormat( GUID *pFormat);
STDMETHODIMP ConvertTimeFormat(LONGLONG * pTarget, const GUID * pTargetFormat,
LONGLONG Source, const GUID * pSourceFormat );
STDMETHODIMP SetPositions( LONGLONG * pCurrent, DWORD CurrentFlags
, LONGLONG * pStop, DWORD StopFlags );
STDMETHODIMP QueryPreferredFormat( __out GUID *pFormat);
STDMETHODIMP ConvertTimeFormat(__out LONGLONG * pTarget,
__in_opt const GUID * pTargetFormat,
LONGLONG Source,
__in_opt const GUID * pSourceFormat );
STDMETHODIMP SetPositions( __inout_opt LONGLONG * pCurrent, DWORD CurrentFlags
, __inout_opt LONGLONG * pStop, DWORD StopFlags );
STDMETHODIMP GetPositions( LONGLONG * pCurrent, LONGLONG * pStop );
STDMETHODIMP GetCurrentPosition( LONGLONG * pCurrent );
STDMETHODIMP GetStopPosition( LONGLONG * pStop );
STDMETHODIMP GetPositions( __out_opt LONGLONG * pCurrent, __out_opt LONGLONG * pStop );
STDMETHODIMP GetCurrentPosition( __out LONGLONG * pCurrent );
STDMETHODIMP GetStopPosition( __out LONGLONG * pStop );
STDMETHODIMP SetRate( double dRate);
STDMETHODIMP GetRate( double * pdRate);
STDMETHODIMP GetDuration( LONGLONG *pDuration);
STDMETHODIMP GetAvailable( LONGLONG *pEarliest, LONGLONG *pLatest );
STDMETHODIMP GetPreroll( LONGLONG *pllPreroll );
STDMETHODIMP GetRate( __out double * pdRate);
STDMETHODIMP GetDuration( __out LONGLONG *pDuration);
STDMETHODIMP GetAvailable( __out_opt LONGLONG *pEarliest, __out_opt LONGLONG *pLatest );
STDMETHODIMP GetPreroll( __out LONGLONG *pllPreroll );
// IMediaPosition properties
STDMETHODIMP get_Duration(REFTIME * plength);
STDMETHODIMP get_Duration(__out REFTIME * plength);
STDMETHODIMP put_CurrentPosition(REFTIME llTime);
STDMETHODIMP get_StopTime(REFTIME * pllTime);
STDMETHODIMP get_StopTime(__out REFTIME * pllTime);
STDMETHODIMP put_StopTime(REFTIME llTime);
STDMETHODIMP get_PrerollTime(REFTIME * pllTime);
STDMETHODIMP get_PrerollTime(__out REFTIME * pllTime);
STDMETHODIMP put_PrerollTime(REFTIME llTime);
STDMETHODIMP get_Rate(double * pdRate);
STDMETHODIMP get_Rate(__out double * pdRate);
STDMETHODIMP put_Rate(double dRate);
STDMETHODIMP get_CurrentPosition(REFTIME * pllTime);
STDMETHODIMP CanSeekForward(LONG *pCanSeekForward);
STDMETHODIMP CanSeekBackward(LONG *pCanSeekBackward);
STDMETHODIMP get_CurrentPosition(__out REFTIME * pllTime);
STDMETHODIMP CanSeekForward(__out LONG *pCanSeekForward);
STDMETHODIMP CanSeekBackward(__out LONG *pCanSeekBackward);
private:
HRESULT GetSeekingLongLong( HRESULT (__stdcall IMediaSeeking::*pMethod)( LONGLONG * ),
LONGLONG * pll );
__out LONGLONG * pll );
};
@ -373,19 +375,19 @@ public:
// Used to help with passing media times through graph
CRendererPosPassThru(const TCHAR *, LPUNKNOWN, HRESULT*, IPin *);
CRendererPosPassThru(__in_opt LPCTSTR, __in_opt LPUNKNOWN, __inout HRESULT*, IPin *);
HRESULT RegisterMediaTime(IMediaSample *pMediaSample);
HRESULT RegisterMediaTime(LONGLONG StartTime,LONGLONG EndTime);
HRESULT GetMediaTime(LONGLONG *pStartTime,LONGLONG *pEndTime);
HRESULT GetMediaTime(__out LONGLONG *pStartTime,__out_opt LONGLONG *pEndTime);
HRESULT ResetMediaTime();
HRESULT EOS();
};
STDAPI CreatePosPassThru(
LPUNKNOWN pAgg,
__in_opt LPUNKNOWN pAgg,
BOOL bRenderer,
IPin *pPin,
IUnknown **ppPassThru
__deref_out IUnknown **ppPassThru
);
// A class that handles the IDispatch part of IBasicAudio and leaves the
@ -397,37 +399,37 @@ class AM_NOVTABLE CBasicAudio : public IBasicAudio, public CUnknown
public:
CBasicAudio(const TCHAR *, LPUNKNOWN);
CBasicAudio(__in_opt LPCTSTR, __in_opt LPUNKNOWN);
DECLARE_IUNKNOWN
// override this to publicise our interfaces
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
/* IDispatch methods */
STDMETHODIMP GetTypeInfoCount(UINT * pctinfo);
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
UINT itinfo,
LCID lcid,
ITypeInfo ** pptinfo);
__deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
REFIID riid,
OLECHAR ** rgszNames,
__in_ecount(cNames) LPOLESTR * rgszNames,
UINT cNames,
LCID lcid,
DISPID * rgdispid);
__out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
DISPID dispidMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS * pdispparams,
VARIANT * pvarResult,
EXCEPINFO * pexcepinfo,
UINT * puArgErr);
__in DISPPARAMS * pdispparams,
__out_opt VARIANT * pvarResult,
__out_opt EXCEPINFO * pexcepinfo,
__out_opt UINT * puArgErr);
};
@ -440,41 +442,41 @@ class AM_NOVTABLE CBaseBasicVideo : public IBasicVideo2, public CUnknown
public:
CBaseBasicVideo(const TCHAR *, LPUNKNOWN);
CBaseBasicVideo(__in_opt LPCTSTR, __in_opt LPUNKNOWN);
DECLARE_IUNKNOWN
// override this to publicise our interfaces
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
/* IDispatch methods */
STDMETHODIMP GetTypeInfoCount(UINT * pctinfo);
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
UINT itinfo,
LCID lcid,
ITypeInfo ** pptinfo);
__deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
REFIID riid,
OLECHAR ** rgszNames,
__in_ecount(cNames) LPOLESTR * rgszNames,
UINT cNames,
LCID lcid,
DISPID * rgdispid);
__out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
DISPID dispidMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS * pdispparams,
VARIANT * pvarResult,
EXCEPINFO * pexcepinfo,
UINT * puArgErr);
__in DISPPARAMS * pdispparams,
__out_opt VARIANT * pvarResult,
__out_opt EXCEPINFO * pexcepinfo,
__out_opt UINT * puArgErr);
STDMETHODIMP GetPreferredAspectRatio(
long *plAspectX,
long *plAspectY)
__out long *plAspectX,
__out long *plAspectY)
{
return E_NOTIMPL;
}
@ -490,37 +492,37 @@ class AM_NOVTABLE CBaseVideoWindow : public IVideoWindow, public CUnknown
public:
CBaseVideoWindow(const TCHAR *, LPUNKNOWN);
CBaseVideoWindow(__in_opt LPCTSTR, __in_opt LPUNKNOWN);
DECLARE_IUNKNOWN
// override this to publicise our interfaces
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
/* IDispatch methods */
STDMETHODIMP GetTypeInfoCount(UINT * pctinfo);
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
UINT itinfo,
LCID lcid,
ITypeInfo ** pptinfo);
__deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
REFIID riid,
OLECHAR ** rgszNames,
__in_ecount(cNames) LPOLESTR * rgszNames,
UINT cNames,
LCID lcid,
DISPID * rgdispid);
__out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
DISPID dispidMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS * pdispparams,
VARIANT * pvarResult,
EXCEPINFO * pexcepinfo,
UINT * puArgErr);
__in DISPPARAMS * pdispparams,
__out_opt VARIANT * pvarResult,
__out_opt EXCEPINFO * pexcepinfo,
__out_opt UINT * puArgErr);
};
@ -533,22 +535,22 @@ class AM_NOVTABLE CSourcePosition : public CMediaPosition
{
public:
CSourcePosition(const TCHAR *, LPUNKNOWN, HRESULT*, CCritSec *);
CSourcePosition(__in_opt LPCTSTR, __in_opt LPUNKNOWN, __inout HRESULT*, __in CCritSec *);
// IMediaPosition methods
STDMETHODIMP get_Duration(REFTIME * plength);
STDMETHODIMP get_Duration(__out REFTIME * plength);
STDMETHODIMP put_CurrentPosition(REFTIME llTime);
STDMETHODIMP get_StopTime(REFTIME * pllTime);
STDMETHODIMP get_StopTime(__out REFTIME * pllTime);
STDMETHODIMP put_StopTime(REFTIME llTime);
STDMETHODIMP get_PrerollTime(REFTIME * pllTime);
STDMETHODIMP get_PrerollTime(__out REFTIME * pllTime);
STDMETHODIMP put_PrerollTime(REFTIME llTime);
STDMETHODIMP get_Rate(double * pdRate);
STDMETHODIMP get_Rate(__out double * pdRate);
STDMETHODIMP put_Rate(double dRate);
STDMETHODIMP CanSeekForward(LONG *pCanSeekForward);
STDMETHODIMP CanSeekBackward(LONG *pCanSeekBackward);
STDMETHODIMP CanSeekForward(__out LONG *pCanSeekForward);
STDMETHODIMP CanSeekBackward(__out LONG *pCanSeekBackward);
// override if you can return the data you are actually working on
STDMETHODIMP get_CurrentPosition(REFTIME * pllTime) {
STDMETHODIMP get_CurrentPosition(__out REFTIME * pllTime) {
return E_NOTIMPL;
};
@ -575,38 +577,40 @@ class AM_NOVTABLE CSourceSeeking :
public:
DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
// IMediaSeeking methods
STDMETHODIMP IsFormatSupported(const GUID * pFormat);
STDMETHODIMP QueryPreferredFormat(GUID *pFormat);
STDMETHODIMP QueryPreferredFormat(__out GUID *pFormat);
STDMETHODIMP SetTimeFormat(const GUID * pFormat);
STDMETHODIMP IsUsingTimeFormat(const GUID * pFormat);
STDMETHODIMP GetTimeFormat(GUID *pFormat);
STDMETHODIMP GetDuration(LONGLONG *pDuration);
STDMETHODIMP GetStopPosition(LONGLONG *pStop);
STDMETHODIMP GetCurrentPosition(LONGLONG *pCurrent);
STDMETHODIMP GetCapabilities( DWORD * pCapabilities );
STDMETHODIMP CheckCapabilities( DWORD * pCapabilities );
STDMETHODIMP ConvertTimeFormat( LONGLONG * pTarget, const GUID * pTargetFormat,
LONGLONG Source, const GUID * pSourceFormat );
STDMETHODIMP GetTimeFormat(__out GUID *pFormat);
STDMETHODIMP GetDuration(__out LONGLONG *pDuration);
STDMETHODIMP GetStopPosition(__out LONGLONG *pStop);
STDMETHODIMP GetCurrentPosition(__out LONGLONG *pCurrent);
STDMETHODIMP GetCapabilities( __out DWORD * pCapabilities );
STDMETHODIMP CheckCapabilities( __inout DWORD * pCapabilities );
STDMETHODIMP ConvertTimeFormat( __out LONGLONG * pTarget,
__in_opt const GUID * pTargetFormat,
LONGLONG Source,
__in_opt const GUID * pSourceFormat );
STDMETHODIMP SetPositions( LONGLONG * pCurrent, DWORD CurrentFlags
, LONGLONG * pStop, DWORD StopFlags );
STDMETHODIMP SetPositions( __inout_opt LONGLONG * pCurrent, DWORD CurrentFlags
, __inout_opt LONGLONG * pStop, DWORD StopFlags );
STDMETHODIMP GetPositions( LONGLONG * pCurrent, LONGLONG * pStop );
STDMETHODIMP GetPositions( __out_opt LONGLONG * pCurrent, __out_opt LONGLONG * pStop );
STDMETHODIMP GetAvailable( LONGLONG * pEarliest, LONGLONG * pLatest );
STDMETHODIMP GetAvailable( __out_opt LONGLONG * pEarliest, __out_opt LONGLONG * pLatest );
STDMETHODIMP SetRate( double dRate);
STDMETHODIMP GetRate( double * pdRate);
STDMETHODIMP GetPreroll(LONGLONG *pPreroll);
STDMETHODIMP GetRate( __out double * pdRate);
STDMETHODIMP GetPreroll(__out LONGLONG *pPreroll);
protected:
// ctor
CSourceSeeking(const TCHAR *, LPUNKNOWN, HRESULT*, CCritSec *);
CSourceSeeking(__in_opt LPCTSTR, __in_opt LPUNKNOWN, __inout HRESULT*, __in CCritSec *);
// we call this to notify changes. Override to handle them
virtual HRESULT ChangeStart() PURE;
@ -650,7 +654,7 @@ class CCmdQueue;
class CDispParams : public DISPPARAMS
{
public:
CDispParams(UINT nArgs, VARIANT* pArgs, HRESULT *phr = NULL);
CDispParams(UINT nArgs, __in_ecount(nArgs) VARIANT* pArgs, __inout_opt HRESULT *phr = NULL);
~CDispParams();
};
@ -668,34 +672,34 @@ class CDeferredCommand
public:
CDeferredCommand(
CCmdQueue * pQ,
LPUNKNOWN pUnk, // aggregation outer unk
HRESULT * phr,
LPUNKNOWN pUnkExecutor, // object that will execute this cmd
__inout CCmdQueue * pQ,
__in_opt LPUNKNOWN pUnk, // aggregation outer unk
__inout HRESULT * phr,
__in LPUNKNOWN pUnkExecutor, // object that will execute this cmd
REFTIME time,
GUID* iid,
__in GUID* iid,
long dispidMethod,
short wFlags,
long cArgs,
VARIANT* pDispParams,
VARIANT* pvarResult,
short* puArgErr,
__in_ecount(cArgs) VARIANT* pDispParams,
__out VARIANT* pvarResult,
__out short* puArgErr,
BOOL bStream
);
DECLARE_IUNKNOWN
// override this to publicise our interfaces
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __out void **ppv);
// IDeferredCommand methods
STDMETHODIMP Cancel();
STDMETHODIMP Confidence(
LONG* pConfidence);
__out LONG* pConfidence);
STDMETHODIMP Postpone(
REFTIME newtime);
STDMETHODIMP GetHResult(
HRESULT* phrResult);
__out HRESULT* phrResult);
// other public methods
@ -764,7 +768,7 @@ protected:
class AM_NOVTABLE CCmdQueue
{
public:
CCmdQueue();
CCmdQueue(__inout_opt HRESULT *phr = NULL);
virtual ~CCmdQueue();
// returns a new CDeferredCommand object that will be initialised with
@ -772,23 +776,23 @@ public:
// returns S_OK if successfully created otherwise an error and
// no object has been queued.
virtual HRESULT New(
CDeferredCommand **ppCmd,
LPUNKNOWN pUnk,
__out CDeferredCommand **ppCmd,
__in LPUNKNOWN pUnk,
REFTIME time,
GUID* iid,
__in GUID* iid,
long dispidMethod,
short wFlags,
long cArgs,
VARIANT* pDispParams,
VARIANT* pvarResult,
short* puArgErr,
__in_ecount(cArgs) VARIANT* pDispParams,
__out VARIANT* pvarResult,
__out short* puArgErr,
BOOL bStream
);
// called by the CDeferredCommand object to add and remove itself
// from the queue
virtual HRESULT Insert(CDeferredCommand* pCmd);
virtual HRESULT Remove(CDeferredCommand* pCmd);
virtual HRESULT Insert(__in CDeferredCommand* pCmd);
virtual HRESULT Remove(__in CDeferredCommand* pCmd);
// Command-Due Checking
//
@ -827,7 +831,7 @@ public:
// queue object.
// set the clock used for timing
virtual HRESULT SetSyncSource(IReferenceClock*);
virtual HRESULT SetSyncSource(__in_opt IReferenceClock*);
// switch to run mode. Streamtime to Presentation time mapping known.
virtual HRESULT Run(REFERENCE_TIME tStreamTimeOffset);
@ -841,7 +845,7 @@ public:
// The command remains queued until invoked or cancelled.
// Returns E_ABORT if timeout occurs, otherwise S_OK (or other error).
// Returns an AddRef-ed object
virtual HRESULT GetDueCommand(CDeferredCommand ** ppCmd, long msTimeout);
virtual HRESULT GetDueCommand(__out CDeferredCommand ** ppCmd, long msTimeout);
// return the event handle that will be signalled whenever
// there are deferred commands due for execution (when GetDueCommand
@ -857,7 +861,7 @@ public:
// This method will not block. It will report VFW_E_NOT_FOUND if there
// are no commands due yet.
// Returns an AddRef-ed object
virtual HRESULT GetCommandDueFor(REFERENCE_TIME tStream, CDeferredCommand**ppCmd);
virtual HRESULT GetCommandDueFor(REFERENCE_TIME tStream, __out CDeferredCommand**ppCmd);
// check if a given time is due (TRUE if it is due yet)
BOOL CheckTime(CRefTime time, BOOL bStream) {

View File

@ -4,13 +4,12 @@
// Desc: DirectShow base classes - implements routines for using DirectDraw
// on a multimonitor system.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1995-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
//#include <strsafe.h>
#include <strmif.h>
#include <mmsystem.h>
#include <streams.h>
#include <ddraw.h>
#include "ddmm.h"
/*
@ -23,7 +22,7 @@ typedef struct {
BOOL fFound;
} FindDeviceData;
BOOL CALLBACK FindDeviceCallback(GUID* lpGUID, LPSTR szName, LPSTR szDevice, LPVOID lParam)
BOOL CALLBACK FindDeviceCallback(__in_opt GUID* lpGUID, __in LPSTR szName, __in LPSTR szDevice, __in LPVOID lParam)
{
FindDeviceData *p = (FindDeviceData*)lParam;
@ -41,7 +40,7 @@ BOOL CALLBACK FindDeviceCallback(GUID* lpGUID, LPSTR szName, LPSTR szDevice, LPV
}
BOOL CALLBACK FindDeviceCallbackEx(GUID* lpGUID, LPSTR szName, LPSTR szDevice, LPVOID lParam, HMONITOR hMonitor)
BOOL CALLBACK FindDeviceCallbackEx(__in_opt GUID* lpGUID, __in LPSTR szName, __in LPSTR szDevice, __in LPVOID lParam, HMONITOR hMonitor)
{
FindDeviceData *p = (FindDeviceData*)lParam;
@ -64,7 +63,7 @@ BOOL CALLBACK FindDeviceCallbackEx(GUID* lpGUID, LPSTR szName, LPSTR szDevice, L
*
* create a DirectDraw object for a particular device
*/
IDirectDraw * DirectDrawCreateFromDevice(LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, PDRAWENUM DirectDrawEnumerateP)
IDirectDraw * DirectDrawCreateFromDevice(__in_opt LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, PDRAWENUM DirectDrawEnumerateP)
{
IDirectDraw* pdd = NULL;
FindDeviceData find;
@ -99,7 +98,7 @@ IDirectDraw * DirectDrawCreateFromDevice(LPSTR szDevice, PDRAWCREATE DirectDrawC
*
* create a DirectDraw object for a particular device
*/
IDirectDraw * DirectDrawCreateFromDeviceEx(LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, LPDIRECTDRAWENUMERATEEXA DirectDrawEnumerateExP)
IDirectDraw * DirectDrawCreateFromDeviceEx(__in_opt LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, LPDIRECTDRAWENUMERATEEXA DirectDrawEnumerateExP)
{
IDirectDraw* pdd = NULL;
FindDeviceData find;

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - efines routines for using DirectDraw
// on a multimonitor system.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1995-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -20,8 +20,8 @@ extern "C" { /* Assume C declarations for C++ */
typedef HRESULT (*PDRAWCREATE)(IID *,LPDIRECTDRAW *,LPUNKNOWN);
typedef HRESULT (*PDRAWENUM)(LPDDENUMCALLBACKA, LPVOID);
IDirectDraw * DirectDrawCreateFromDevice(LPSTR, PDRAWCREATE, PDRAWENUM);
IDirectDraw * DirectDrawCreateFromDeviceEx(LPSTR, PDRAWCREATE, LPDIRECTDRAWENUMERATEEXA);
IDirectDraw * DirectDrawCreateFromDevice(__in_opt LPSTR, PDRAWCREATE, PDRAWENUM);
IDirectDraw * DirectDrawCreateFromDeviceEx(__in_opt LPSTR, PDRAWCREATE, LPDIRECTDRAWENUMERATEEXA);
#ifdef __cplusplus
}

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -159,7 +159,7 @@ void WINAPI Msr_Terminate(void);
// Call this to get an Id for an "incident" that you can pass to Start, Stop or Note
// everything that's logged is called an "incident".
int WINAPI Msr_Register(LPTSTR Incident);
int WINAPI Msr_Register(__in LPTSTR Incident);
// Reset the statistical counts for an incident

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - provides support for a worker thread
// class to which one can asynchronously post messages.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -17,7 +17,7 @@ public:
LPVOID lpParam;
CAMEvent *pEvent;
CMsg(UINT u, DWORD dw, LPVOID lp, CAMEvent *pEvnt)
CMsg(UINT u, DWORD dw, __inout_opt LPVOID lp, __in_opt CAMEvent *pEvnt)
: uMsg(u), dwFlags(dw), lpParam(lp), pEvent(pEvnt) {}
CMsg()
@ -31,7 +31,7 @@ public:
//
class AM_NOVTABLE CMsgThread {
private:
static DWORD WINAPI DefaultThreadProc(LPVOID lpParam);
static DWORD WINAPI DefaultThreadProc(__inout LPVOID lpParam);
DWORD m_ThreadId;
HANDLE m_hThread;
@ -58,7 +58,7 @@ public:
~CMsgThread();
// override this if you want to block on other things as well
// as the message loop
void virtual GetThreadMsg(CMsg *msg);
void virtual GetThreadMsg(__out CMsg *msg);
// override this if you want to do something on thread startup
virtual void OnThreadInit() {
@ -66,7 +66,7 @@ public:
BOOL CreateThread();
BOOL WaitForThreadExit(LPDWORD lpdwExitCode) {
BOOL WaitForThreadExit(__out LPDWORD lpdwExitCode) {
if (m_hThread != NULL) {
WaitForSingleObject(m_hThread, INFINITE);
return GetExitCodeThread(m_hThread, lpdwExitCode);
@ -100,7 +100,7 @@ public:
void PutThreadMsg(UINT uMsg, DWORD dwMsgFlags,
LPVOID lpMsgParam, CAMEvent *pEvent = NULL) {
__in_opt LPVOID lpMsgParam, __in_opt CAMEvent *pEvent = NULL) {
CAutoLock lck(&m_Lock);
CMsg* pMsg = new CMsg(uMsg, dwMsgFlags, lpMsgParam, pEvent);
m_ThreadQueue.AddTail(pMsg);
@ -115,6 +115,6 @@ public:
// the creator thread.
//
virtual LRESULT ThreadMessageProc(
UINT uMsg, DWORD dwFlags, LPVOID lpParam, CAMEvent *pEvent) = 0;
UINT uMsg, DWORD dwFlags, __inout_opt LPVOID lpParam, __in_opt CAMEvent *pEvent) = 0;
};

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - implements a class that holds and
// manages media type information.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -12,7 +12,7 @@
// types etc. Has same data members as the struct AM_MEDIA_TYPE defined
// in the streams IDL file, but also has (non-virtual) functions
#include "streams.h"
#include <streams.h>
#include <mmreg.h>
CMediaType::~CMediaType(){
@ -35,7 +35,7 @@ CMediaType::CMediaType(const GUID * type)
// copy constructor does a deep copy of the format block
CMediaType::CMediaType(const AM_MEDIA_TYPE& rt, HRESULT* phr)
CMediaType::CMediaType(const AM_MEDIA_TYPE& rt, __out_opt HRESULT* phr)
{
HRESULT hr = CopyMediaType(this, &rt);
if (FAILED(hr) && (NULL != phr)) {
@ -44,7 +44,7 @@ CMediaType::CMediaType(const AM_MEDIA_TYPE& rt, HRESULT* phr)
}
CMediaType::CMediaType(const CMediaType& rt, HRESULT* phr)
CMediaType::CMediaType(const CMediaType& rt, __out_opt HRESULT* phr)
{
HRESULT hr = CopyMediaType(this, &rt);
if (FAILED(hr) && (NULL != phr)) {
@ -87,6 +87,7 @@ CMediaType::operator == (const CMediaType& rt) const
(IsEqualGUID(formattype,rt.formattype) == TRUE) &&
(cbFormat == rt.cbFormat) &&
( (cbFormat == 0) ||
pbFormat != NULL && rt.pbFormat != NULL &&
(memcmp(pbFormat, rt.pbFormat, cbFormat) == 0)));
}
@ -179,7 +180,7 @@ CMediaType::SetTemporalCompression(BOOL bCompressed) {
}
BOOL
CMediaType::SetFormat(BYTE * pformat, ULONG cb)
CMediaType::SetFormat(__in_bcount(cb) BYTE * pformat, ULONG cb)
{
if (NULL == AllocFormatBuffer(cb))
return(FALSE);
@ -349,7 +350,7 @@ CMediaType::MatchesPartial(const CMediaType* ppartial) const
// implementation allocates the structures which you must later delete
// the format block may also be a pointer to an interface to release
void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pmt)
void WINAPI DeleteMediaType(__inout_opt AM_MEDIA_TYPE *pmt)
{
// allow NULL pointers for coding simplicity
@ -393,7 +394,7 @@ AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc)
// Copy 1 media type to another
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource)
HRESULT WINAPI CopyMediaType(__out AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource)
{
// We'll leak if we copy onto one that already exists - there's one
// case we can check like that - copying to itself.
@ -419,7 +420,7 @@ HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtS
// Free an existing media type (ie free resources it holds)
void WINAPI FreeMediaType(AM_MEDIA_TYPE& mt)
void WINAPI FreeMediaType(__inout AM_MEDIA_TYPE& mt)
{
if (mt.cbFormat != 0) {
CoTaskMemFree((PVOID)mt.pbFormat);
@ -438,7 +439,7 @@ void WINAPI FreeMediaType(AM_MEDIA_TYPE& mt)
STDAPI CreateAudioMediaType(
const WAVEFORMATEX *pwfx,
AM_MEDIA_TYPE *pmt,
__out AM_MEDIA_TYPE *pmt,
BOOL bSetFormat
)
{

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - defines a class that holds and manages
// media type information.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -22,8 +22,8 @@ public:
~CMediaType();
CMediaType();
CMediaType(const GUID * majortype);
CMediaType(const AM_MEDIA_TYPE&, HRESULT* phr = NULL);
CMediaType(const CMediaType&, HRESULT* phr = NULL);
CMediaType(const AM_MEDIA_TYPE&, __out_opt HRESULT* phr = NULL);
CMediaType(const CMediaType&, __out_opt HRESULT* phr = NULL);
CMediaType& operator=(const CMediaType&);
CMediaType& operator=(const AM_MEDIA_TYPE&);
@ -57,7 +57,7 @@ public:
void SetFormatType(const GUID *);
const GUID *FormatType() const {return &formattype; };
BOOL SetFormat(BYTE *pFormat, ULONG length);
BOOL SetFormat(__in_bcount(length) BYTE *pFormat, ULONG length);
void ResetFormatBuffer();
BYTE* AllocFormatBuffer(ULONG length);
BYTE* ReallocFormatBuffer(ULONG length);
@ -73,16 +73,16 @@ public:
structure which is useful when using the IEnumMediaFormats interface as
the implementation allocates the structures which you must later delete */
void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pmt);
void WINAPI DeleteMediaType(__inout_opt AM_MEDIA_TYPE *pmt);
AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc);
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource);
void WINAPI FreeMediaType(AM_MEDIA_TYPE& mt);
HRESULT WINAPI CopyMediaType(__out AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource);
void WINAPI FreeMediaType(__inout AM_MEDIA_TYPE& mt);
// Initialize a media type from a WAVEFORMATEX
STDAPI CreateAudioMediaType(
const WAVEFORMATEX *pwfx,
AM_MEDIA_TYPE *pmt,
__out AM_MEDIA_TYPE *pmt,
BOOL bSetFormat);
#endif /* __MTYPE__ */

View File

@ -6,11 +6,11 @@
// separate thread and sometimes call Receive() directly on the input
// pin.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include <streams.h>
//
@ -42,7 +42,7 @@
//
COutputQueue::COutputQueue(
IPin *pInputPin, // Pin to send stuff to
HRESULT *phr, // 'Return code'
__inout HRESULT *phr, // 'Return code'
BOOL bAuto, // Ask pin if queue or not
BOOL bQueue, // Send through queue
LONG lBatchSize, // Batch
@ -58,6 +58,7 @@ COutputQueue::COutputQueue(
m_pPin(pInputPin),
m_ppSamples(NULL),
m_lWaiting(0),
m_evFlushComplete(FALSE, phr),
m_pInputPin(NULL),
m_bSendAnyway(FALSE),
m_nBatched(0),
@ -178,7 +179,7 @@ COutputQueue::~COutputQueue()
//
// Call the real thread proc as a member function
//
DWORD WINAPI COutputQueue::InitialThreadProc(LPVOID pv)
DWORD WINAPI COutputQueue::InitialThreadProc(__in LPVOID pv)
{
HRESULT hrCoInit = CAMThread::CoInitializeHelper();
@ -591,10 +592,14 @@ HRESULT COutputQueue::Receive(IMediaSample *pSample)
//
HRESULT COutputQueue::ReceiveMultiple (
IMediaSample **ppSamples,
__in_ecount(nSamples) IMediaSample **ppSamples,
long nSamples,
long *nSamplesProcessed)
__out long *nSamplesProcessed)
{
if (nSamples < 0) {
return E_INVALIDARG;
}
CAutoLock lck(this);
// Either call directly or queue up the samples
@ -632,7 +637,7 @@ HRESULT COutputQueue::ReceiveMultiple (
// Loop processing the samples in batches
LONG iLost = 0;
long iDone;
long iDone = 0;
for (iDone = 0;
iDone < nSamples || (m_nBatched != 0 && m_bSendAnyway);
) {
@ -698,9 +703,11 @@ void COutputQueue::Reset()
if (!IsQueued()) {
m_hr = S_OK;
} else {
CAutoLock lck(this);
QueueSample(RESET_PACKET);
NotifyThread();
{
CAutoLock lck(this);
QueueSample(RESET_PACKET);
NotifyThread();
}
m_evFlushComplete.Wait();
}
}

View File

@ -5,7 +5,7 @@
// makes a queue of samples and sends them to an output pin. The
// class will optionally send the samples to the pin directly.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -16,7 +16,7 @@ class COutputQueue : public CCritSec
public:
// Constructor
COutputQueue(IPin *pInputPin, // Pin to send stuff to
HRESULT *phr, // 'Return code'
__inout HRESULT *phr, // 'Return code'
BOOL bAuto = TRUE, // Ask pin if blocks
BOOL bQueue = TRUE, // Send through queue (ignored if
// bAuto set)
@ -50,9 +50,9 @@ public:
// do something with these media samples
HRESULT ReceiveMultiple (
IMediaSample **pSamples,
__in_ecount(nSamples) IMediaSample **pSamples,
long nSamples,
long *nSamplesProcessed);
__out long *nSamplesProcessed);
void Reset(); // Reset m_hr ready for more data
@ -63,12 +63,12 @@ public:
void SetPopEvent(HANDLE hEvent);
protected:
static DWORD WINAPI InitialThreadProc(LPVOID pv);
static DWORD WINAPI InitialThreadProc(__in LPVOID pv);
DWORD ThreadProc();
BOOL IsQueued()
{
return m_List != NULL;
}
};
// The critical section MUST be held when this is called
void QueueSample(IMediaSample *pSample);
@ -76,7 +76,7 @@ protected:
BOOL IsSpecialSample(IMediaSample *pSample)
{
return (DWORD_PTR)pSample > (DWORD_PTR)(LONG_PTR)(-16);
}
};
// Remove and Release() batched and queued samples
void FreeSamples();
@ -109,8 +109,8 @@ protected:
HANDLE m_hSem;
CAMEvent m_evFlushComplete;
HANDLE m_hThread;
IMediaSample ** m_ppSamples;
LONG m_nBatched;
__field_ecount_opt(m_lBatchSize) IMediaSample ** m_ppSamples;
__range(0, m_lBatchSize) LONG m_nBatched;
// Wait optimization
LONG m_lWaiting;
@ -129,7 +129,7 @@ protected:
BOOL m_bSendAnyway;
// Deferred 'return code'
BOOL volatile m_hr;
HRESULT volatile m_hr;
// an event that can be fired after every deliver
HANDLE m_hEventPop;

View File

@ -3,21 +3,22 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include <streams.h>
#include <strsafe.h>
#ifdef PERF
#include <measure.h>
#endif
// #include "pstream.h" in streams.h
//
// Constructor
//
CPersistStream::CPersistStream(IUnknown *punk, HRESULT *phr)
CPersistStream::CPersistStream(IUnknown *punk, __inout HRESULT *phr)
: mPS_fDirty(FALSE)
{
mPS_dwFileVersion = GetSoftwareVersion();
@ -38,10 +39,10 @@ SAMPLE CODE TO COPY - not active at the moment
// NonDelegatingQueryInterface
//
// This object supports IPersist & IPersistStream
STDMETHODIMP CPersistStream::NonDelegatingQueryInterface(REFIID riid, void **ppv)
STDMETHODIMP CPersistStream::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
if (riid == IID_IPersist) {
return GetInterface((IPersist *) this, ppv);
return GetInterface((IPersist *) this, ppv); // ???
}
else if (riid == IID_IPersistStream) {
return GetInterface((IPersistStream *) this, ppv);
@ -128,7 +129,7 @@ STDMETHODIMP CPersistStream::Save(LPSTREAM pStm, BOOL fClearDirty)
STDAPI WriteInt(IStream *pIStream, int n)
{
WCHAR Buff[13]; // Allows for trailing null that we don't write
(void)StringCchPrintfW(Buff, NUMELMS(Buff), L"%011d ",n);
(void)StringCchPrintfW(Buff, NUMELMS(Buff),L"%011d ",n);
return pIStream->Write(&(Buff[0]), 12*sizeof(WCHAR), NULL);
} // WriteInt
@ -140,7 +141,7 @@ STDAPI WriteInt(IStream *pIStream, int n)
// where the value isn't actually truncated by squeezing it into 32 bits
// Striped down subset of what sscanf can do (without dragging in the C runtime)
STDAPI_(int) ReadInt(IStream *pIStream, HRESULT &hr)
STDAPI_(int) ReadInt(IStream *pIStream, __out HRESULT &hr)
{
int Sign = 1;

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - defines a class for persistent properties
// of filters.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -61,13 +61,13 @@ class CPersistStream : public IPersistStream {
{return (mPS_fDirty ? S_OK : S_FALSE);} // note FALSE means clean
STDMETHODIMP Load(LPSTREAM pStm);
STDMETHODIMP Save(LPSTREAM pStm, BOOL fClearDirty);
STDMETHODIMP GetSizeMax(ULARGE_INTEGER * pcbSize)
STDMETHODIMP GetSizeMax(__out ULARGE_INTEGER * pcbSize)
// Allow 24 bytes for version.
{ pcbSize->QuadPart = 12*sizeof(WCHAR)+SizeMax(); return NOERROR; }
// implementation
CPersistStream(IUnknown *punk, HRESULT *phr);
CPersistStream(IUnknown *punk, __inout HRESULT *phr);
~CPersistStream();
HRESULT SetDirty(BOOL fDirty)
@ -80,7 +80,7 @@ class CPersistStream : public IPersistStream {
// --- IPersist ---
// You must override this to provide your own class id
STDMETHODIMP GetClassID(CLSID *pClsid) PURE;
STDMETHODIMP GetClassID(__out CLSID *pClsid) PURE;
// overrideable if you want
// file version number. Override it if you ever change format
@ -109,6 +109,6 @@ class CPersistStream : public IPersistStream {
STDAPI WriteInt(IStream *pIStream, int n);
// inverse of WriteInt
STDAPI_(int) ReadInt(IStream *pIStream, HRESULT &hr);
STDAPI_(int) ReadInt(IStream *pIStream, __out HRESULT &hr);
#endif // __PSTREAM__

View File

@ -4,13 +4,16 @@
// Desc: DirectShow base classes - implements CPullPin class that pulls data
// from IAsyncReader.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include <streams.h>
#include "pullpin.h"
#ifdef DXMPERF
#include "dxmperf.h"
#endif // DXMPERF
CPullPin::CPullPin()
@ -18,11 +21,20 @@ CPullPin::CPullPin()
m_pAlloc(NULL),
m_State(TM_Exit)
{
#ifdef DXMPERF
PERFLOG_CTOR( L"CPullPin", this );
#endif // DXMPERF
}
CPullPin::~CPullPin()
{
Disconnect();
#ifdef DXMPERF
PERFLOG_DTOR( L"CPullPin", this );
#endif // DXMPERF
}
// returns S_OK if successfully connected to an IAsyncReader interface
@ -40,12 +52,28 @@ CPullPin::Connect(IUnknown* pUnk, IMemAllocator* pAlloc, BOOL bSync)
HRESULT hr = pUnk->QueryInterface(IID_IAsyncReader, (void**)&m_pReader);
if (FAILED(hr)) {
#ifdef DXMPERF
{
AM_MEDIA_TYPE * pmt = NULL;
PERFLOG_CONNECT( this, pUnk, hr, pmt );
}
#endif // DXMPERF
return(hr);
}
hr = DecideAllocator(pAlloc, NULL);
if (FAILED(hr)) {
Disconnect();
#ifdef DXMPERF
{
AM_MEDIA_TYPE * pmt = NULL;
PERFLOG_CONNECT( this, pUnk, hr, pmt );
}
#endif // DXMPERF
return hr;
}
@ -53,6 +81,14 @@ CPullPin::Connect(IUnknown* pUnk, IMemAllocator* pAlloc, BOOL bSync)
hr = m_pReader->Length(&llTotal, &llAvail);
if (FAILED(hr)) {
Disconnect();
#ifdef DXMPERF
{
AM_MEDIA_TYPE * pmt = NULL;
PERFLOG_CONNECT( this, pUnk, hr, pmt );
}
#endif
return hr;
}
@ -63,6 +99,14 @@ CPullPin::Connect(IUnknown* pUnk, IMemAllocator* pAlloc, BOOL bSync)
m_bSync = bSync;
#ifdef DXMPERF
{
AM_MEDIA_TYPE * pmt = NULL;
PERFLOG_CONNECT( this, pUnk, S_OK, pmt );
}
#endif // DXMPERF
return S_OK;
}
@ -74,6 +118,12 @@ CPullPin::Disconnect()
StopThread();
#ifdef DXMPERF
PERFLOG_DISCONNECT( this, m_pReader, S_OK );
#endif // DXMPERF
if (m_pReader) {
m_pReader->Release();
m_pReader = NULL;
@ -95,7 +145,7 @@ CPullPin::Disconnect()
HRESULT
CPullPin::DecideAllocator(
IMemAllocator * pAlloc,
ALLOCATOR_PROPERTIES * pProps)
__inout_opt ALLOCATOR_PROPERTIES * pProps)
{
ALLOCATOR_PROPERTIES *pRequest;
ALLOCATOR_PROPERTIES Request;
@ -157,7 +207,7 @@ CPullPin::Seek(REFERENCE_TIME tStart, REFERENCE_TIME tStop)
}
HRESULT
CPullPin::Duration(REFERENCE_TIME* ptDuration)
CPullPin::Duration(__out REFERENCE_TIME* ptDuration)
{
*ptDuration = m_tDuration;
return S_OK;
@ -284,7 +334,7 @@ CPullPin::ThreadProc(void)
HRESULT
CPullPin::QueueSample(
REFERENCE_TIME& tCurrent,
__inout REFERENCE_TIME& tCurrent,
REFERENCE_TIME tAlignStop,
BOOL bDiscontinuity
)
@ -352,16 +402,27 @@ CPullPin::DeliverSample(
{
// fix up sample if past actual stop (for sector alignment)
REFERENCE_TIME t1, t2;
pSample->GetTime(&t1, &t2);
if (t2 > tStop) {
t2 = tStop;
if (S_OK == pSample->GetTime(&t1, &t2)) {
if (t2 > tStop) {
t2 = tStop;
}
// adjust times to be relative to (aligned) start time
t1 -= tStart;
t2 -= tStart;
HRESULT hr = pSample->SetTime(&t1, &t2);
if (FAILED(hr)) {
return hr;
}
}
// adjust times to be relative to (aligned) start time
t1 -= tStart;
t2 -= tStart;
pSample->SetTime(&t1, &t2);
#ifdef DXMPERF
{
AM_MEDIA_TYPE * pmt = NULL;
pSample->GetMediaType( &pmt );
PERFLOG_RECEIVE( L"CPullPin", m_pReader, this, pSample, pmt );
}
#endif
HRESULT hr = Receive(pSample);
pSample->Release();

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes - defines CPullPin class.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -57,7 +57,7 @@ class CPullPin : public CAMThread
// called from ProcessAsync to queue and collect requests
HRESULT QueueSample(
REFERENCE_TIME& tCurrent,
__inout REFERENCE_TIME& tCurrent,
REFERENCE_TIME tAlignStop,
BOOL bDiscontinuity);
@ -95,14 +95,14 @@ public:
// but no error occurs if it can't be met.
virtual HRESULT DecideAllocator(
IMemAllocator* pAlloc,
ALLOCATOR_PROPERTIES * pProps);
__inout_opt ALLOCATOR_PROPERTIES * pProps);
// set start and stop position. if active, will start immediately at
// the new position. Default is 0 to duration
HRESULT Seek(REFERENCE_TIME tStart, REFERENCE_TIME tStop);
// return the total duration
HRESULT Duration(REFERENCE_TIME* ptDuration);
HRESULT Duration(__out REFERENCE_TIME* ptDuration);
// start pulling data
HRESULT Active(void);

View File

@ -3,13 +3,16 @@
//
// Desc: DirectShow base classes - implements the IReferenceClock interface.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include <streams.h>
#include <limits.h>
#ifdef DXMPERF
#include "dxmperf.h"
#endif // DXMPERF
// 'this' used in constructor list
@ -18,7 +21,7 @@
STDMETHODIMP CBaseReferenceClock::NonDelegatingQueryInterface(
REFIID riid,
void ** ppv)
__deref_out void ** ppv)
{
HRESULT hr;
@ -26,6 +29,10 @@ STDMETHODIMP CBaseReferenceClock::NonDelegatingQueryInterface(
{
hr = GetInterface((IReferenceClock *) this, ppv);
}
else if (riid == IID_IReferenceClockTimerControl)
{
hr = GetInterface((IReferenceClockTimerControl *) this, ppv);
}
else
{
hr = CUnknown::NonDelegatingQueryInterface(riid, ppv);
@ -35,10 +42,16 @@ STDMETHODIMP CBaseReferenceClock::NonDelegatingQueryInterface(
CBaseReferenceClock::~CBaseReferenceClock()
{
#ifdef DXMPERF
PERFLOG_DTOR( L"CBaseReferenceClock", (IReferenceClock *) this );
#endif // DXMPERF
if (m_TimerResolution) timeEndPeriod(m_TimerResolution);
m_pSchedule->DumpLinkedList();
if (m_pSchedule)
{
m_pSchedule->DumpLinkedList();
}
if (m_hThread)
{
@ -55,7 +68,10 @@ CBaseReferenceClock::~CBaseReferenceClock()
// A derived class may supply a hThreadEvent if it has its own thread that will take care
// of calling the schedulers Advise method. (Refere to CBaseReferenceClock::AdviseThread()
// to see what such a thread has to do.)
CBaseReferenceClock::CBaseReferenceClock( TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr, CAMSchedule * pShed )
CBaseReferenceClock::CBaseReferenceClock( __in_opt LPCTSTR pName,
__inout_opt LPUNKNOWN pUnk,
__inout HRESULT *phr,
__inout_opt CAMSchedule * pShed )
: CUnknown( pName, pUnk )
, m_rtLastGotTime(0)
, m_TimerResolution(0)
@ -64,51 +80,55 @@ CBaseReferenceClock::CBaseReferenceClock( TCHAR *pName, LPUNKNOWN pUnk, HRESULT
, m_hThread(0)
{
#ifdef DXMPERF
PERFLOG_CTOR( pName ? pName : L"CBaseReferenceClock", (IReferenceClock *) this );
#endif // DXMPERF
ASSERT(m_pSchedule);
if (!m_pSchedule)
{
*phr = E_OUTOFMEMORY;
*phr = E_OUTOFMEMORY;
}
else
{
// Set up the highest resolution timer we can manage
TIMECAPS tc;
m_TimerResolution = (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(tc)))
? tc.wPeriodMin
: 1;
// Set up the highest resolution timer we can manage
TIMECAPS tc;
m_TimerResolution = (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(tc)))
? tc.wPeriodMin
: 1;
timeBeginPeriod(m_TimerResolution);
timeBeginPeriod(m_TimerResolution);
/* Initialise our system times - the derived clock should set the right values */
m_dwPrevSystemTime = timeGetTime();
m_rtPrivateTime = (UNITS / MILLISECONDS) * m_dwPrevSystemTime;
/* Initialise our system times - the derived clock should set the right values */
m_dwPrevSystemTime = timeGetTime();
m_rtPrivateTime = (UNITS / MILLISECONDS) * m_dwPrevSystemTime;
#ifdef PERF
m_idGetSystemTime = MSR_REGISTER(TEXT("CBaseReferenceClock::GetTime"));
#endif
#ifdef PERF
m_idGetSystemTime = MSR_REGISTER(TEXT("CBaseReferenceClock::GetTime"));
#endif
if ( !pShed )
{
DWORD ThreadID;
m_hThread = ::CreateThread(NULL, // Security attributes
(DWORD) 0, // Initial stack size
AdviseThreadFunction, // Thread start address
(LPVOID) this, // Thread parameter
(DWORD) 0, // Creation flags
&ThreadID); // Thread identifier
if ( !pShed )
{
DWORD ThreadID;
m_hThread = ::CreateThread(NULL, // Security attributes
(DWORD) 0, // Initial stack size
AdviseThreadFunction, // Thread start address
(LPVOID) this, // Thread parameter
(DWORD) 0, // Creation flags
&ThreadID); // Thread identifier
if (m_hThread)
{
SetThreadPriority( m_hThread, THREAD_PRIORITY_TIME_CRITICAL );
}
else
{
*phr = E_FAIL;
EXECUTE_ASSERT( CloseHandle(m_pSchedule->GetEvent()) );
delete m_pSchedule;
}
}
if (m_hThread)
{
SetThreadPriority( m_hThread, THREAD_PRIORITY_TIME_CRITICAL );
}
else
{
*phr = E_FAIL;
EXECUTE_ASSERT( CloseHandle(m_pSchedule->GetEvent()) );
delete m_pSchedule;
m_pSchedule = NULL;
}
}
}
}
@ -119,7 +139,7 @@ void CBaseReferenceClock::Restart (IN REFERENCE_TIME rtMinTime)
Unlock();
}
STDMETHODIMP CBaseReferenceClock::GetTime(REFERENCE_TIME *pTime)
STDMETHODIMP CBaseReferenceClock::GetTime(__out REFERENCE_TIME *pTime)
{
HRESULT hr;
if (pTime)
@ -139,6 +159,11 @@ STDMETHODIMP CBaseReferenceClock::GetTime(REFERENCE_TIME *pTime)
*pTime = m_rtLastGotTime;
Unlock();
MSR_INTEGER(m_idGetSystemTime, LONG((*pTime) / (UNITS/MILLISECONDS)) );
#ifdef DXMPERF
PERFLOG_GETTIME( (IReferenceClock *) this, *pTime );
#endif // DXMPERF
}
else hr = E_POINTER;
@ -150,8 +175,8 @@ STDMETHODIMP CBaseReferenceClock::GetTime(REFERENCE_TIME *pTime)
STDMETHODIMP CBaseReferenceClock::AdviseTime(
REFERENCE_TIME baseTime, // base reference time
REFERENCE_TIME streamTime, // stream offset time
HEVENT hEvent, // advise via this event
DWORD_PTR *pdwAdviseCookie) // where your cookie goes
HEVENT hEvent, // advise via this event
__out DWORD_PTR *pdwAdviseCookie)// where your cookie goes
{
CheckPointer(pdwAdviseCookie, E_POINTER);
*pdwAdviseCookie = 0;
@ -180,8 +205,8 @@ STDMETHODIMP CBaseReferenceClock::AdviseTime(
STDMETHODIMP CBaseReferenceClock::AdvisePeriodic(
REFERENCE_TIME StartTime, // starting at this time
REFERENCE_TIME PeriodTime, // time between notifications
HSEMAPHORE hSemaphore, // advise via a semaphore
DWORD_PTR *pdwAdviseCookie) // where your cookie goes
HSEMAPHORE hSemaphore, // advise via a semaphore
__out DWORD_PTR *pdwAdviseCookie) // where your cookie goes
{
CheckPointer(pdwAdviseCookie, E_POINTER);
*pdwAdviseCookie = 0;
@ -291,7 +316,7 @@ STDMETHODIMP CBaseReferenceClock::SetTimeDelta(const REFERENCE_TIME & TimeDelta)
// Thread stuff
DWORD __stdcall CBaseReferenceClock::AdviseThreadFunction(LPVOID p)
DWORD __stdcall CBaseReferenceClock::AdviseThreadFunction(__in LPVOID p)
{
return DWORD(reinterpret_cast<CBaseReferenceClock*>(p)->AdviseThread());
}
@ -338,3 +363,40 @@ HRESULT CBaseReferenceClock::AdviseThread()
};
return NOERROR;
}
HRESULT CBaseReferenceClock::SetDefaultTimerResolution(
REFERENCE_TIME timerResolution // in 100ns
)
{
CAutoLock cObjectLock(this);
if( 0 == timerResolution ) {
if( m_TimerResolution ) {
timeEndPeriod( m_TimerResolution );
m_TimerResolution = 0;
}
} else {
TIMECAPS tc;
DWORD dwMinResolution = (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(tc)))
? tc.wPeriodMin
: 1;
DWORD dwResolution = max( dwMinResolution, DWORD(timerResolution / 10000) );
if( dwResolution != m_TimerResolution ) {
timeEndPeriod(m_TimerResolution);
m_TimerResolution = dwResolution;
timeBeginPeriod( m_TimerResolution );
}
}
return S_OK;
}
HRESULT CBaseReferenceClock::GetDefaultTimerResolution(
__out REFERENCE_TIME* pTimerResolution // in 100ns
)
{
if( !pTimerResolution ) {
return E_POINTER;
}
CAutoLock cObjectLock(this);
*pTimerResolution = m_TimerResolution * 10000;
return S_OK;
}

View File

@ -3,14 +3,14 @@
//
// Desc: DirectShow base classes - defines the IReferenceClock interface.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#ifndef __BASEREFCLOCK__
#define __BASEREFCLOCK__
#include "dsschedule.h"
#include <Schedule.h>
const UINT RESOLUTION = 1; /* High resolution timer */
const INT ADVISE_CACHE = 4; /* Default cache size */
@ -37,9 +37,9 @@ inline LONGLONG WINAPI ConvertToMilliseconds(const REFERENCE_TIME& RT)
* whatever source) have to be derived from this class.
*
* The abstract class provides implementations for:
* CUnknown support
* CUnknown support
* locking support (CCritSec)
* client advise code (creates a thread)
* client advise code (creates a thread)
*
* Question: what can we do about quality? Change the timer
* resolution to lower the system load? Up the priority of the
@ -72,14 +72,17 @@ inline LONGLONG WINAPI ConvertToMilliseconds(const REFERENCE_TIME& RT)
*/
class CBaseReferenceClock
: public CUnknown, public IReferenceClock, public CCritSec
: public CUnknown, public IReferenceClock, public CCritSec, public IReferenceClockTimerControl
{
protected:
virtual ~CBaseReferenceClock(); // Don't let me be created on the stack!
public:
CBaseReferenceClock(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr, CAMSchedule * pSched = 0 );
CBaseReferenceClock(__in_opt LPCTSTR pName,
__inout_opt LPUNKNOWN pUnk,
__inout HRESULT *phr,
__inout_opt CAMSchedule * pSched = 0 );
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void ** ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv);
DECLARE_IUNKNOWN
@ -90,7 +93,7 @@ public:
// clock has gone backwards and GetTime time has halted until internal
// time has caught up. (Don't know if this will be much use to folk,
// but it seems odd not to use the return code for something useful.)
STDMETHODIMP GetTime(REFERENCE_TIME *pTime);
STDMETHODIMP GetTime(__out REFERENCE_TIME *pTime);
// When this is called, it sets m_rtLastGotTime to the time it returns.
/* Provide standard mechanisms for scheduling events */
@ -100,7 +103,7 @@ public:
REFERENCE_TIME baseTime, // base reference time
REFERENCE_TIME streamTime, // stream offset time
HEVENT hEvent, // advise via this event
DWORD_PTR *pdwAdviseCookie // where your cookie goes
__out DWORD_PTR *pdwAdviseCookie// where your cookie goes
);
/* Ask for an asynchronous periodic notification that a time has elapsed */
@ -108,7 +111,7 @@ public:
REFERENCE_TIME StartTime, // starting at this time
REFERENCE_TIME PeriodTime, // time between notifications
HSEMAPHORE hSemaphore, // advise via a semaphore
DWORD_PTR *pdwAdviseCookie // where your cookie goes
__out DWORD_PTR *pdwAdviseCookie// where your cookie goes
);
/* Cancel a request for notification(s) - if the notification was
@ -135,6 +138,16 @@ public:
CAMSchedule * GetSchedule() const { return m_pSchedule; }
// IReferenceClockTimerControl methods
//
// Setting a default of 0 disables the default of 1ms
STDMETHODIMP SetDefaultTimerResolution(
REFERENCE_TIME timerResolution // in 100ns
);
STDMETHODIMP GetDefaultTimerResolution(
__out REFERENCE_TIME* pTimerResolution // in 100ns
);
private:
REFERENCE_TIME m_rtPrivateTime; // Current best estimate of time
DWORD m_dwPrevSystemTime; // Last vaule we got from timeGetTime
@ -148,9 +161,9 @@ private:
// Thread stuff
public:
void TriggerThread() // Wakes thread up. Need to do this if
{ // time to next advise needs reevaluating.
EXECUTE_ASSERT(SetEvent(m_pSchedule->GetEvent()));
void TriggerThread() // Wakes thread up. Need to do this if
{ // time to next advise needs reevaluating.
EXECUTE_ASSERT(SetEvent(m_pSchedule->GetEvent()));
}
@ -159,10 +172,10 @@ private:
HANDLE m_hThread; // Thread handle
HRESULT AdviseThread(); // Method in which the advise thread runs
static DWORD __stdcall AdviseThreadFunction(LPVOID); // Function used to get there
static DWORD __stdcall AdviseThreadFunction(__in LPVOID); // Function used to get there
protected:
CAMSchedule * const m_pSchedule;
CAMSchedule * m_pSchedule;
void Restart (IN REFERENCE_TIME rtMinTime = 0I64) ;
};

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - defines CRefTime, a class that manages
// reference times.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------

View File

@ -3,14 +3,14 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h" // DirectShow base class definitions
#include <streams.h> // DirectShow base class definitions
#include <mmsystem.h> // Needed for definition of timeGetTime
#include <limits.h> // Standard data type limit definitions
#include "measure.h" // Used for time critical log functions
#include <measure.h> // Used for time critical log functions
#pragma warning(disable:4355)
@ -28,15 +28,16 @@ int inline TimeDiff(REFERENCE_TIME rt)
// Implements the CBaseRenderer class
CBaseRenderer::CBaseRenderer(REFCLSID RenderClass, // CLSID for this renderer
TCHAR *pName, // Debug ONLY description
LPUNKNOWN pUnk, // Aggregated owner object
HRESULT *phr) : // General OLE return code
__in_opt LPCTSTR pName, // Debug ONLY description
__inout_opt LPUNKNOWN pUnk, // Aggregated owner object
__inout HRESULT *phr) : // General OLE return code
CBaseFilter(pName,pUnk,&m_InterfaceLock,RenderClass),
m_evComplete(TRUE),
m_evComplete(TRUE, phr),
m_RenderEvent(FALSE, phr),
m_bAbort(FALSE),
m_pPosition(NULL),
m_ThreadSignal(TRUE),
m_ThreadSignal(TRUE, phr),
m_bStreaming(FALSE),
m_bEOS(FALSE),
m_bEOSDelivered(FALSE),
@ -49,12 +50,14 @@ CBaseRenderer::CBaseRenderer(REFCLSID RenderClass, // CLSID for this renderer
m_bInReceive(FALSE),
m_EndOfStreamTimer(0)
{
Ready();
if (SUCCEEDED(*phr)) {
Ready();
#ifdef PERF
m_idBaseStamp = MSR_REGISTER(TEXT("BaseRenderer: sample time stamp"));
m_idBaseRenderTime = MSR_REGISTER(TEXT("BaseRenderer: draw time (msec)"));
m_idBaseAccuracy = MSR_REGISTER(TEXT("BaseRenderer: Accuracy (msec)"));
m_idBaseStamp = MSR_REGISTER(TEXT("BaseRenderer: sample time stamp"));
m_idBaseRenderTime = MSR_REGISTER(TEXT("BaseRenderer: draw time (msec)"));
m_idBaseAccuracy = MSR_REGISTER(TEXT("BaseRenderer: Accuracy (msec)"));
#endif
}
}
@ -93,13 +96,18 @@ CBaseRenderer::~CBaseRenderer()
// This returns the IMediaPosition and IMediaSeeking interfaces
HRESULT CBaseRenderer::GetMediaPositionInterface(REFIID riid,void **ppv)
HRESULT CBaseRenderer::GetMediaPositionInterface(REFIID riid, __deref_out void **ppv)
{
CAutoLock cObjectCreationLock(&m_ObjectCreationLock);
if (m_pPosition) {
return m_pPosition->NonDelegatingQueryInterface(riid,ppv);
}
CBasePin *pPin = GetPin(0);
if (NULL == pPin) {
return E_OUTOFMEMORY;
}
HRESULT hr = NOERROR;
// Create implementation of this dynamically since sometimes we may
@ -110,7 +118,7 @@ HRESULT CBaseRenderer::GetMediaPositionInterface(REFIID riid,void **ppv)
m_pPosition = new CRendererPosPassThru(NAME("Renderer CPosPassThru"),
CBaseFilter::GetOwner(),
(HRESULT *) &hr,
GetPin(0));
pPin);
if (m_pPosition == NULL) {
return E_OUTOFMEMORY;
}
@ -126,7 +134,7 @@ HRESULT CBaseRenderer::GetMediaPositionInterface(REFIID riid,void **ppv)
// Overriden to say what interfaces we support and where
STDMETHODIMP CBaseRenderer::NonDelegatingQueryInterface(REFIID riid,void **ppv)
STDMETHODIMP CBaseRenderer::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
// Do we have this interface
@ -287,7 +295,7 @@ void CBaseRenderer::WaitForReceiveToComplete()
}
MSG msg;
// Receive all interthread sendmessages
// Receive all interthread snedmessages
PeekMessage(&msg, NULL, WM_NULL, WM_NULL, PM_NOREMOVE);
Sleep(1);
@ -582,7 +590,11 @@ STDMETHODIMP CBaseRenderer::Run(REFERENCE_TIME StartTime)
int CBaseRenderer::GetPinCount()
{
return 1;
if (m_pInputPin == NULL) {
// Try to create it
(void)GetPin(0);
}
return m_pInputPin != NULL ? 1 : 0;
}
@ -625,14 +637,17 @@ CBasePin *CBaseRenderer::GetPin(int n)
// If "In" then return the IPin for our input pin, otherwise NULL and error
STDMETHODIMP CBaseRenderer::FindPin(LPCWSTR Id, IPin **ppPin)
STDMETHODIMP CBaseRenderer::FindPin(LPCWSTR Id, __deref_out IPin **ppPin)
{
CheckPointer(ppPin,E_POINTER);
if (0==lstrcmpW(Id,L"In")) {
*ppPin = GetPin(0);
ASSERT(*ppPin);
(*ppPin)->AddRef();
if (*ppPin) {
(*ppPin)->AddRef();
} else {
return E_OUTOFMEMORY;
}
} else {
*ppPin = NULL;
return VFW_E_NOT_FOUND;
@ -814,8 +829,8 @@ HRESULT CBaseRenderer::BreakConnect()
// which case the object should simply render the sample data immediately
HRESULT CBaseRenderer::GetSampleTimes(IMediaSample *pMediaSample,
REFERENCE_TIME *pStartTime,
REFERENCE_TIME *pEndTime)
__out REFERENCE_TIME *pStartTime,
__out REFERENCE_TIME *pEndTime)
{
ASSERT(m_dwAdvise == 0);
ASSERT(pMediaSample);
@ -849,8 +864,8 @@ HRESULT CBaseRenderer::GetSampleTimes(IMediaSample *pMediaSample,
// by the derived video renderer class in its quality management.
HRESULT CBaseRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
REFERENCE_TIME *ptrStart,
REFERENCE_TIME *ptrEnd)
__out REFERENCE_TIME *ptrStart,
__out REFERENCE_TIME *ptrEnd)
{
return S_FALSE;
}
@ -1544,9 +1559,9 @@ void CBaseRenderer::OnRenderEnd(IMediaSample *pMediaSample)
// Constructor must be passed the base renderer object
CRendererInputPin::CRendererInputPin(CBaseRenderer *pRenderer,
HRESULT *phr,
LPCWSTR pPinName) :
CRendererInputPin::CRendererInputPin(__inout CBaseRenderer *pRenderer,
__inout HRESULT *phr,
__in_opt LPCWSTR pPinName) :
CBaseInputPin(NAME("Renderer pin"),
pRenderer,
&pRenderer->m_InterfaceLock,
@ -1685,16 +1700,17 @@ HRESULT CRendererInputPin::CompleteConnect(IPin *pReceivePin)
// Give the pin id of our one and only pin
STDMETHODIMP CRendererInputPin::QueryId(LPWSTR *Id)
STDMETHODIMP CRendererInputPin::QueryId(__deref_out LPWSTR *Id)
{
CheckPointer(Id,E_POINTER);
const size_t len = 4;
*Id = (LPWSTR)CoTaskMemAlloc(len * sizeof(WCHAR));
const WCHAR szIn[] = L"In";
*Id = (LPWSTR)CoTaskMemAlloc(sizeof(szIn));
if (*Id == NULL) {
return E_OUTOFMEMORY;
}
(void)StringCchCopyW(*Id, len, L"In");
CopyMemory(*Id, szIn, sizeof(szIn));
return NOERROR;
}
@ -1753,9 +1769,9 @@ const TCHAR DRAWLATEFRAMES[] = TEXT("DrawLateFrames");
CBaseVideoRenderer::CBaseVideoRenderer(
REFCLSID RenderClass, // CLSID for this renderer
TCHAR *pName, // Debug ONLY description
LPUNKNOWN pUnk, // Aggregated owner object
HRESULT *phr) : // General OLE return code
__in_opt LPCTSTR pName, // Debug ONLY description
__inout_opt LPUNKNOWN pUnk, // Aggregated owner object
__inout HRESULT *phr) : // General OLE return code
CBaseRenderer(RenderClass,pName,pUnk,phr),
m_cFramesDropped(0),
@ -1834,8 +1850,8 @@ HRESULT CBaseVideoRenderer::ResetStreamingTimes()
m_iTotAcc = 0;
m_iSumSqAcc = 0;
m_iSumSqFrameTime = 0;
m_trFrame = 0; // hygiene - not really needed
m_trLate = 0; // hygiene - not really needed
m_trFrame = 0; // hygeine - not really needed
m_trLate = 0; // hygeine - not really needed
m_iSumFrameTime = 0;
m_nNormal = 0;
m_trEarliness = 0;
@ -2282,8 +2298,8 @@ HRESULT CBaseVideoRenderer::SendQuality(REFERENCE_TIME trLate,
// to make the decision
HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
REFERENCE_TIME *ptrStart,
REFERENCE_TIME *ptrEnd)
__inout REFERENCE_TIME *ptrStart,
__inout REFERENCE_TIME *ptrEnd)
{
// Don't call us unless there's a clock interface to synchronise with
@ -2618,7 +2634,7 @@ BOOL CBaseVideoRenderer::ScheduleSample(IMediaSample *pMediaSample)
// our IQualProp interface. The AddRef and Release are handled automatically
// by the base class and will be passed on to the appropriate outer object
STDMETHODIMP CBaseVideoRenderer::get_FramesDroppedInRenderer(int *pcFramesDropped)
STDMETHODIMP CBaseVideoRenderer::get_FramesDroppedInRenderer(__out int *pcFramesDropped)
{
CheckPointer(pcFramesDropped,E_POINTER);
CAutoLock cVideoLock(&m_InterfaceLock);
@ -2669,7 +2685,7 @@ STDMETHODIMP CBaseVideoRenderer::get_AvgFrameRate( int *piAvgFrameRate)
// in mSec. The sync offset is the time in mSec between when the frame
// should have been drawn and when the frame was actually drawn.
STDMETHODIMP CBaseVideoRenderer::get_AvgSyncOffset( int *piAvg)
STDMETHODIMP CBaseVideoRenderer::get_AvgSyncOffset(__out int *piAvg)
{
CheckPointer(piAvg,E_POINTER);
CAutoLock cVideoLock(&m_InterfaceLock);
@ -2737,7 +2753,7 @@ int isqrt(int x)
//
HRESULT CBaseVideoRenderer::GetStdDev(
int nSamples,
int *piResult,
__out int *piResult,
LONGLONG llSumSq,
LONGLONG iTot
)
@ -2774,7 +2790,7 @@ HRESULT CBaseVideoRenderer::GetStdDev(
// Set *piDev to the standard deviation in mSec of the sync offset
// of each frame since streaming started.
STDMETHODIMP CBaseVideoRenderer::get_DevSyncOffset( int *piDev)
STDMETHODIMP CBaseVideoRenderer::get_DevSyncOffset(__out int *piDev)
{
// First frames have invalid stamps, so we get no stats for them
// So we need 2 frames to get 1 datum, so N is cFramesDrawn-1
@ -2788,7 +2804,7 @@ STDMETHODIMP CBaseVideoRenderer::get_DevSyncOffset( int *piDev)
// Set *piJitter to the standard deviation in mSec of the inter-frame time
// of frames since streaming started.
STDMETHODIMP CBaseVideoRenderer::get_Jitter( int *piJitter)
STDMETHODIMP CBaseVideoRenderer::get_Jitter(__out int *piJitter)
{
// First frames have invalid stamps, so we get no stats for them
// So second frame gives invalid inter-frame time
@ -2803,7 +2819,7 @@ STDMETHODIMP CBaseVideoRenderer::get_Jitter( int *piJitter)
// Overidden to return our IQualProp interface
STDMETHODIMP
CBaseVideoRenderer::NonDelegatingQueryInterface(REFIID riid,VOID **ppv)
CBaseVideoRenderer::NonDelegatingQueryInterface(REFIID riid,__deref_out VOID **ppv)
{
// We return IQualProp and delegate everything else
@ -2820,7 +2836,7 @@ CBaseVideoRenderer::NonDelegatingQueryInterface(REFIID riid,VOID **ppv)
// the graph we can send an EC_WINDOW_DESTROYED event
STDMETHODIMP
CBaseVideoRenderer::JoinFilterGraph(IFilterGraph *pGraph,LPCWSTR pName)
CBaseVideoRenderer::JoinFilterGraph(__inout_opt IFilterGraph *pGraph, __in_opt LPCWSTR pName)
{
// Since we send EC_ACTIVATE, we also need to ensure
// we send EC_WINDOW_DESTROYED or the resource manager may be
@ -2829,10 +2845,8 @@ CBaseVideoRenderer::JoinFilterGraph(IFilterGraph *pGraph,LPCWSTR pName)
// We were in a graph and now we're not
// Do this properly in case we are aggregated
IBaseFilter* pFilter;
QueryInterface(IID_IBaseFilter,(void **) &pFilter);
IBaseFilter* pFilter = this;
NotifyEvent(EC_WINDOW_DESTROYED, (LPARAM) pFilter, 0);
pFilter->Release();
}
return CBaseFilter::JoinFilterGraph(pGraph, pName);
}

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - defines a generic ActiveX base renderer
// class.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -27,9 +27,9 @@ protected:
public:
CRendererInputPin(CBaseRenderer *pRenderer,
HRESULT *phr,
LPCWSTR Name);
CRendererInputPin(__inout CBaseRenderer *pRenderer,
__inout HRESULT *phr,
__in_opt LPCWSTR Name);
// Overriden from the base pin classes
@ -42,7 +42,7 @@ public:
// Add rendering behaviour to interface functions
STDMETHODIMP QueryId(LPWSTR *Id);
STDMETHODIMP QueryId(__deref_out LPWSTR *Id);
STDMETHODIMP EndOfStream();
STDMETHODIMP BeginFlush();
STDMETHODIMP EndFlush();
@ -97,16 +97,16 @@ protected:
public:
CBaseRenderer(REFCLSID RenderClass, // CLSID for this renderer
TCHAR *pName, // Debug ONLY description
LPUNKNOWN pUnk, // Aggregated owner object
HRESULT *phr); // General OLE return code
__in_opt LPCTSTR pName, // Debug ONLY description
__inout_opt LPUNKNOWN pUnk, // Aggregated owner object
__inout HRESULT *phr); // General OLE return code
~CBaseRenderer();
// Overriden to say what interfaces we support and where
virtual HRESULT GetMediaPositionInterface(REFIID riid,void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID, void **);
virtual HRESULT GetMediaPositionInterface(REFIID riid, __deref_out void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID, __deref_out void **);
virtual HRESULT SourceThreadCanWait(BOOL bCanWait);
@ -145,8 +145,8 @@ public:
STDMETHODIMP Stop();
STDMETHODIMP Pause();
STDMETHODIMP Run(REFERENCE_TIME StartTime);
STDMETHODIMP GetState(DWORD dwMSecs,FILTER_STATE *State);
STDMETHODIMP FindPin(LPCWSTR Id, IPin **ppPin);
STDMETHODIMP GetState(DWORD dwMSecs, __out FILTER_STATE *State);
STDMETHODIMP FindPin(LPCWSTR Id, __deref_out IPin **ppPin);
// These are available for a quality management implementation
@ -170,12 +170,12 @@ public:
virtual BOOL ScheduleSample(IMediaSample *pMediaSample);
virtual HRESULT GetSampleTimes(IMediaSample *pMediaSample,
REFERENCE_TIME *pStartTime,
REFERENCE_TIME *pEndTime);
__out REFERENCE_TIME *pStartTime,
__out REFERENCE_TIME *pEndTime);
virtual HRESULT ShouldDrawSampleNow(IMediaSample *pMediaSample,
REFERENCE_TIME *ptrStart,
REFERENCE_TIME *ptrEnd);
__out REFERENCE_TIME *ptrStart,
__out REFERENCE_TIME *ptrEnd);
// Lots of end of stream complexities
@ -408,9 +408,9 @@ public:
CBaseVideoRenderer(REFCLSID RenderClass, // CLSID for this renderer
TCHAR *pName, // Debug ONLY description
LPUNKNOWN pUnk, // Aggregated owner object
HRESULT *phr); // General OLE return code
__in_opt LPCTSTR pName, // Debug ONLY description
__inout_opt LPUNKNOWN pUnk, // Aggregated owner object
__inout HRESULT *phr); // General OLE return code
~CBaseVideoRenderer();
@ -437,11 +437,11 @@ public:
virtual HRESULT ResetStreamingTimes();
BOOL ScheduleSample(IMediaSample *pMediaSample);
HRESULT ShouldDrawSampleNow(IMediaSample *pMediaSample,
REFERENCE_TIME *ptrStart,
REFERENCE_TIME *ptrEnd);
__inout REFERENCE_TIME *ptrStart,
__inout REFERENCE_TIME *ptrEnd);
virtual HRESULT SendQuality(REFERENCE_TIME trLate, REFERENCE_TIME trRealStream);
STDMETHODIMP JoinFilterGraph(IFilterGraph * pGraph, LPCWSTR pName);
STDMETHODIMP JoinFilterGraph(__inout_opt IFilterGraph * pGraph, __in_opt LPCWSTR pName);
//
// Do estimates for standard deviations for per-frame
@ -453,7 +453,7 @@ public:
//
HRESULT GetStdDev(
int nSamples,
int *piResult,
__out int *piResult,
LONGLONG llSumSq,
LONGLONG iTot
);
@ -461,17 +461,17 @@ public:
// IQualProp property page support
STDMETHODIMP get_FramesDroppedInRenderer(int *cFramesDropped);
STDMETHODIMP get_FramesDrawn(int *pcFramesDrawn);
STDMETHODIMP get_AvgFrameRate(int *piAvgFrameRate);
STDMETHODIMP get_Jitter(int *piJitter);
STDMETHODIMP get_AvgSyncOffset(int *piAvg);
STDMETHODIMP get_DevSyncOffset(int *piDev);
STDMETHODIMP get_FramesDroppedInRenderer(__out int *cFramesDropped);
STDMETHODIMP get_FramesDrawn(__out int *pcFramesDrawn);
STDMETHODIMP get_AvgFrameRate(__out int *piAvgFrameRate);
STDMETHODIMP get_Jitter(__out int *piJitter);
STDMETHODIMP get_AvgSyncOffset(__out int *piAvg);
STDMETHODIMP get_DevSyncOffset(__out int *piDev);
// Implement an IUnknown interface and expose IQualProp
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,VOID **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,__deref_out VOID **ppv);
};
#endif // __RENBASE__

View File

@ -3,11 +3,11 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include <streams.h>
// DbgLog values (all on LOG_TIMING):
//
@ -117,11 +117,8 @@ HRESULT CAMSchedule::Unadvise(DWORD_PTR dwAdviseCookie)
CAdvisePacket * p_prev = &head;
CAdvisePacket * p_n;
m_Serialize.Lock();
while (1) // The Next() method returns NULL when it hits z
while ( p_n = p_prev->Next() ) // The Next() method returns NULL when it hits z
{
p_n = p_prev->Next();
if (!p_n) break;
if ( p_n->m_dwAdviseCookie == dwAdviseCookie )
{
Delete( p_prev->RemoveNext() );
@ -190,7 +187,7 @@ REFERENCE_TIME CAMSchedule::Advise( const REFERENCE_TIME & rtTime )
/* Private methods */
DWORD_PTR CAMSchedule::AddAdvisePacket( CAdvisePacket * pPacket )
DWORD_PTR CAMSchedule::AddAdvisePacket( __inout CAdvisePacket * pPacket )
{
ASSERT(pPacket->m_rtEventTime >= 0 && pPacket->m_rtEventTime < MAX_TIME);
ASSERT(CritCheckIn(&m_Serialize));
@ -217,7 +214,7 @@ DWORD_PTR CAMSchedule::AddAdvisePacket( CAdvisePacket * pPacket )
return Result;
}
void CAMSchedule::Delete( CAdvisePacket * pPacket )
void CAMSchedule::Delete( __inout CAdvisePacket * pPacket )
{
if ( m_dwCacheCount >= dwCacheMax ) delete pPacket;
else

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -50,10 +50,10 @@ private:
HANDLE m_hNotify; // Handle to event or semephore
BOOL m_bPeriodic; // TRUE => Periodic event
CAdvisePacket( CAdvisePacket * next, LONGLONG time ) : m_next(next), m_rtEventTime(time)
CAdvisePacket( __inout_opt CAdvisePacket * next, LONGLONG time ) : m_next(next), m_rtEventTime(time)
{}
void InsertAfter( CAdvisePacket * p )
void InsertAfter( __inout CAdvisePacket * p )
{
p->m_next = m_next;
m_next = p;
@ -99,7 +99,7 @@ private:
CCritSec m_Serialize;
// AddAdvisePacket: adds the packet, returns the cookie (0 if failed)
DWORD_PTR AddAdvisePacket( CAdvisePacket * pPacket );
DWORD_PTR AddAdvisePacket( __inout CAdvisePacket * pPacket );
// Event that we should set if the packed added above will be the next to fire.
const HANDLE m_ev;
@ -113,7 +113,7 @@ private:
DWORD m_dwCacheCount;
enum { dwCacheMax = 5 }; // Don't bother caching more than five
void Delete( CAdvisePacket * pLink );// This "Delete" will cache the Link
void Delete( __inout CAdvisePacket * pLink );// This "Delete" will cache the Link
// Attributes and methods for debugging
public:

View File

@ -3,11 +3,11 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include <streams.h>
#include "seekpt.h"
//==================================================================
@ -17,13 +17,13 @@
// and save it in a static variable so that forever after we can return that.
//==================================================================
CUnknown * CSeekingPassThru::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr)
CUnknown * CSeekingPassThru::CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
{
return new CSeekingPassThru(NAME("Seeking PassThru"),pUnk, phr);
}
STDMETHODIMP CSeekingPassThru::NonDelegatingQueryInterface(REFIID riid, void ** ppv)
STDMETHODIMP CSeekingPassThru::NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv)
{
if (riid == IID_ISeekingPassThru) {
return GetInterface((ISeekingPassThru *) this, ppv);
@ -39,7 +39,7 @@ STDMETHODIMP CSeekingPassThru::NonDelegatingQueryInterface(REFIID riid, void **
}
CSeekingPassThru::CSeekingPassThru( TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr )
CSeekingPassThru::CSeekingPassThru( __in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr )
: CUnknown(pName, pUnk, phr),
m_pPosPassThru(NULL)
{

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -14,12 +14,12 @@
class CSeekingPassThru : public ISeekingPassThru, public CUnknown
{
public:
static CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr);
CSeekingPassThru(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr);
static CUnknown *CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr);
CSeekingPassThru(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr);
~CSeekingPassThru();
DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv);
STDMETHODIMP Init(BOOL bSupportRendering, IPin *pPin);

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - implements CSource, which is a Quartz
// source filter 'template.'
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -18,7 +18,7 @@
// the threads processing loop, when it is safe to get the filter critical
// section from within FillBuffer().
#include "streams.h"
#include <streams.h>
//
@ -26,14 +26,14 @@
//
// Initialise the pin count for the filter. The user will create the pins in
// the derived class.
CSource::CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid)
CSource::CSource(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid)
: CBaseFilter(pName, lpunk, &m_cStateLock, clsid),
m_iPins(0),
m_paStreams(NULL)
{
}
CSource::CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr)
CSource::CSource(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid, __inout HRESULT *phr)
: CBaseFilter(pName, lpunk, &m_cStateLock, clsid),
m_iPins(0),
m_paStreams(NULL)
@ -42,14 +42,14 @@ CSource::CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr)
}
#ifdef UNICODE
CSource::CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid)
CSource::CSource(__in_opt LPCSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid)
: CBaseFilter(pName, lpunk, &m_cStateLock, clsid),
m_iPins(0),
m_paStreams(NULL)
{
}
CSource::CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr)
CSource::CSource(__in_opt LPCSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid, __inout HRESULT *phr)
: CBaseFilter(pName, lpunk, &m_cStateLock, clsid),
m_iPins(0),
m_paStreams(NULL)
@ -76,7 +76,7 @@ CSource::~CSource()
//
// Add a new pin
//
HRESULT CSource::AddPin(CSourceStream *pStream)
HRESULT CSource::AddPin(__in CSourceStream *pStream)
{
CAutoLock lock(&m_cStateLock);
@ -100,7 +100,7 @@ HRESULT CSource::AddPin(CSourceStream *pStream)
//
// Remove a pin - pStream is NOT deleted
//
HRESULT CSource::RemovePin(CSourceStream *pStream)
HRESULT CSource::RemovePin(__in CSourceStream *pStream)
{
int i;
for (i = 0; i < m_iPins; i++) {
@ -125,7 +125,7 @@ HRESULT CSource::RemovePin(CSourceStream *pStream)
//
// Set *ppPin to the IPin* that has the id Id.
// or to NULL if the Id cannot be matched.
STDMETHODIMP CSource::FindPin(LPCWSTR Id, IPin **ppPin)
STDMETHODIMP CSource::FindPin(LPCWSTR Id, __deref_out IPin **ppPin)
{
CheckPointer(ppPin,E_POINTER);
ValidateReadWritePtr(ppPin,sizeof(IPin *));
@ -145,7 +145,7 @@ STDMETHODIMP CSource::FindPin(LPCWSTR Id, IPin **ppPin)
// FindPinNumber
//
// return the number of the pin with this IPin* or -1 if none
int CSource::FindPinNumber(IPin *iPin) {
int CSource::FindPinNumber(__in IPin *iPin) {
int i;
for (i=0; i<m_iPins; ++i) {
if ((IPin *)(m_paStreams[i])==iPin) {
@ -196,7 +196,7 @@ CBasePin *CSource::GetPin(int n) {
//
// Set Id to point to a CoTaskMemAlloc'd
STDMETHODIMP CSourceStream::QueryId(LPWSTR *Id) {
STDMETHODIMP CSourceStream::QueryId(__deref_out LPWSTR *Id) {
CheckPointer(Id,E_POINTER);
ValidateReadWritePtr(Id,sizeof(LPWSTR));
@ -204,11 +204,11 @@ STDMETHODIMP CSourceStream::QueryId(LPWSTR *Id) {
// FindPinNumber returns -1 for an invalid pin
int i = 1+ m_pFilter->FindPinNumber(this);
if (i<1) return VFW_E_NOT_FOUND;
*Id = (LPWSTR)CoTaskMemAlloc(4*sizeof(WCHAR));
*Id = (LPWSTR)CoTaskMemAlloc(sizeof(WCHAR) * 12);
if (*Id==NULL) {
return E_OUTOFMEMORY;
}
IntToWstr(i, *Id, 4);
IntToWstr(i, *Id);
return NOERROR;
}
@ -219,10 +219,10 @@ STDMETHODIMP CSourceStream::QueryId(LPWSTR *Id) {
//
// increments the number of pins present on the filter
CSourceStream::CSourceStream(
TCHAR *pObjectName,
HRESULT *phr,
CSource *ps,
LPCWSTR pPinName)
__in_opt LPCTSTR pObjectName,
__inout HRESULT *phr,
__inout CSource *ps,
__in_opt LPCWSTR pPinName)
: CBaseOutputPin(pObjectName, ps, ps->pStateLock(), phr, pPinName),
m_pFilter(ps) {
@ -231,10 +231,10 @@ CSourceStream::CSourceStream(
#ifdef UNICODE
CSourceStream::CSourceStream(
char *pObjectName,
HRESULT *phr,
CSource *ps,
LPCWSTR pPinName)
__in_opt LPCSTR pObjectName,
__inout HRESULT *phr,
__inout CSource *ps,
__in_opt LPCWSTR pPinName)
: CBaseOutputPin(pObjectName, ps, ps->pStateLock(), phr, pPinName),
m_pFilter(ps) {
@ -275,7 +275,7 @@ HRESULT CSourceStream::CheckMediaType(const CMediaType *pMediaType) {
//
// By default we support only one type
// iPosition indexes are 0-n
HRESULT CSourceStream::GetMediaType(int iPosition, CMediaType *pMediaType) {
HRESULT CSourceStream::GetMediaType(int iPosition, __inout CMediaType *pMediaType) {
CAutoLock lock(m_pFilter->pStateLock());

View File

@ -5,7 +5,7 @@
// ActiveX source filters that support continuous generation of data.
// No support is provided for IMediaControl or IMediaPosition.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -43,11 +43,11 @@ class CSourceStream; // The class that will handle each pin
class CSource : public CBaseFilter {
public:
CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr);
CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid);
CSource(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid, __inout HRESULT *phr);
CSource(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid);
#ifdef UNICODE
CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr);
CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid);
CSource(__in_opt LPCSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid, __inout HRESULT *phr);
CSource(__in_opt LPCSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid);
#endif
~CSource();
@ -58,15 +58,15 @@ public:
CCritSec* pStateLock(void) { return &m_cStateLock; } // provide our critical section
HRESULT AddPin(CSourceStream *);
HRESULT RemovePin(CSourceStream *);
HRESULT AddPin(__in CSourceStream *);
HRESULT RemovePin(__in CSourceStream *);
STDMETHODIMP FindPin(
LPCWSTR Id,
IPin ** ppPin
__deref_out IPin ** ppPin
);
int FindPinNumber(IPin *iPin);
int FindPinNumber(__in IPin *iPin);
protected:
@ -88,15 +88,15 @@ protected:
class CSourceStream : public CAMThread, public CBaseOutputPin {
public:
CSourceStream(TCHAR *pObjectName,
HRESULT *phr,
CSource *pms,
LPCWSTR pName);
CSourceStream(__in_opt LPCTSTR pObjectName,
__inout HRESULT *phr,
__inout CSource *pms,
__in_opt LPCWSTR pName);
#ifdef UNICODE
CSourceStream(CHAR *pObjectName,
HRESULT *phr,
CSource *pms,
LPCWSTR pName);
CSourceStream(__in_opt LPCSTR pObjectName,
__inout HRESULT *phr,
__inout CSource *pms,
__in_opt LPCWSTR pName);
#endif
virtual ~CSourceStream(void); // virtual destructor ensures derived class destructors are called too.
@ -155,16 +155,16 @@ protected:
// If you support more than one media type then override these 2 functions
virtual HRESULT CheckMediaType(const CMediaType *pMediaType);
virtual HRESULT GetMediaType(int iPosition, CMediaType *pMediaType); // List pos. 0-n
virtual HRESULT GetMediaType(int iPosition, __inout CMediaType *pMediaType); // List pos. 0-n
// If you support only one type then override this fn.
// This will only be called by the default implementations
// of CheckMediaType and GetMediaType(int, CMediaType*)
// You must override this fn. or the above 2!
virtual HRESULT GetMediaType(CMediaType *pMediaType) {return E_UNEXPECTED;}
virtual HRESULT GetMediaType(__inout CMediaType *pMediaType) {return E_UNEXPECTED;}
STDMETHODIMP QueryId(
LPWSTR * Id
__deref_out LPWSTR * Id
);
};

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes - defines overall streams architecture.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -13,13 +13,10 @@
#ifdef _MSC_VER
// disable some level-4 warnings, use #pragma warning(enable:###) to re-enable
#pragma warning(disable:4100) // warning C4100: unreferenced formal parameter
#pragma warning(disable:4127) // warning C4127: conditional expression is constant
#pragma warning(disable:4189) // warning C4189: local variable is initialized but not referenced
#pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
#pragma warning(disable:4511) // warning C4511: copy constructor could not be generated
#pragma warning(disable:4512) // warning C4512: assignment operator could not be generated
#pragma warning(disable:4514) // warning C4514: unreferenced inline function has been removed
#pragma warning(disable:4710) // warning C4710: 'function' not inlined
#pragma warning(disable:4514) // warning C4514: "unreferenced inline function has been removed"
#if _MSC_VER>=1100
#define AM_NOVTABLE __declspec(novtable)
@ -28,6 +25,7 @@
#endif
#endif // MSC_VER
// Because of differences between Visual C++ and older Microsoft SDKs,
// you may have defined _DEBUG without defining DEBUG. This logic
// ensures that both will be set if Visual C++ sets _DEBUG.
@ -37,18 +35,20 @@
#endif
#endif
#include <windows.h>
#include <windowsx.h>
#include <olectl.h>
// Disable warning message for C4201 - use of nameless struct/union
// Otherwise, strmif.h will generate warnings for Win32 debug builds
#pragma warning( disable : 4201 )
#include <ddraw.h>
#include <mmsystem.h>
#ifndef NUMELMS
#if _WIN32_WINNT < 0x0600
#define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0]))
#else
#define NUMELMS(aa) ARRAYSIZE(aa)
#endif
#endif
///////////////////////////////////////////////////////////////////////////
@ -123,64 +123,69 @@ typedef struct {
#ifndef DWLP_USER
#define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC)
#endif
#pragma warning(push)
#pragma warning(disable: 4312 4244)
// _GetWindowLongPtr
// Templated version of GetWindowLongPtr, to suppress spurious compiler warning.
template <class T>
T _GetWindowLongPtr(HWND hwnd, int nIndex)
{
return (T)GetWindowLongPtr(hwnd, nIndex);
}
// _SetWindowLongPtr
// Templated version of SetWindowLongPtr, to suppress spurious compiler warning.
template <class T>
LONG_PTR _SetWindowLongPtr(HWND hwnd, int nIndex, T p)
{
return SetWindowLongPtr(hwnd, nIndex, (LONG_PTR)p);
}
#pragma warning(pop)
///////////////////////////////////////////////////////////////////////////
// End Platform SDK definitions
///////////////////////////////////////////////////////////////////////////
#include <initguid.h>
#pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
#include <strmif.h> // Generated IDL header file for streams interfaces
#include <intsafe.h> // required by amvideo.h
#include "reftime.h" // Helper class for REFERENCE_TIME management
#include "wxdebug.h" // Debug support for logging and ASSERTs
#include "amvideo.h" // ActiveMovie video interfaces and definitions
//include amaudio.h explicitly if you need it. it requires the DirectX SDK.
//#include "amaudio.h" // ActiveMovie audio interfaces and definitions
#include "wxutil.h" // General helper classes for threads etc
#include "combase.h" // Base COM classes to support IUnknown
//#include "dllsetup.h" // Filter registration support functions
#include "measure.h" // Performance measurement
#include "comlite.h" // Light weight com function prototypes
#include <reftime.h> // Helper class for REFERENCE_TIME management
#include <wxdebug.h> // Debug support for logging and ASSERTs
#include <amvideo.h> // ActiveMovie video interfaces and definitions
//include amaudio.h explicitly if you need it. it requires the DX SDK.
//#include <amaudio.h> // ActiveMovie audio interfaces and definitions
#include <wxutil.h> // General helper classes for threads etc
#include <combase.h> // Base COM classes to support IUnknown
#include <measure.h> // Performance measurement
#include <comlite.h> // Light weight com function prototypes
#include "cache.h" // Simple cache container class
#include "wxlist.h" // Non MFC generic list class
#include "msgthrd.h" // CMsgThread
#include "mtype.h" // Helper class for managing media types
#include "fourcc.h" // conversions between FOURCCs and GUIDs
#include "control.h" // generated from control.odl
#include "ctlutil.h" // control interface utility classes
#include "evcode.h" // event code definitions
#include "amfilter.h" // Main streams architecture class hierachy
#include "transfrm.h" // Generic transform filter
#include "transip.h" // Generic transform-in-place filter
#include "uuids.h" // declaration of type GUIDs and well-known clsids
#include "source.h" // Generic source filter
#include "outputq.h" // Output pin queueing
#include "errors.h" // HRESULT status and error definitions
#include "renbase.h" // Base class for writing ActiveX renderers
//#include "winutil.h" // Helps with filters that manage windows
//#include "winctrl.h" // Implements the IVideoWindow interface
//#include "videoctl.h" // Specifically video related classes
#include "refclock.h" // Base clock class
#include "sysclock.h" // System clock
#include "pstream.h" // IPersistStream helper class
#include "vtrans.h" // Video Transform Filter base class
#include "amextra.h"
//#include "cprop.h" // Base property page class
#include "strmctl.h" // IAMStreamControl support
#include "edevdefs.h" // External device control interface defines
#include "audevcod.h" // audio filter device error event codes
#include <tchar.h>
#define NO_SHLWAPI_STRFCNS
//#include <atlbase.h>
#include <strsafe.h>
#ifndef NUMELMS
#define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0]))
#endif
#include <cache.h> // Simple cache container class
#include <wxlist.h> // Non MFC generic list class
#include <msgthrd.h> // CMsgThread
#include <mtype.h> // Helper class for managing media types
#include <fourcc.h> // conversions between FOURCCs and GUIDs
#include <control.h> // generated from control.odl
#include <ctlutil.h> // control interface utility classes
#include <evcode.h> // event code definitions
#include <amfilter.h> // Main streams architecture class hierachy
#include <transfrm.h> // Generic transform filter
#include <transip.h> // Generic transform-in-place filter
#include <uuids.h> // declaration of type GUIDs and well-known clsids
#include <source.h> // Generic source filter
#include <outputq.h> // Output pin queueing
#include <errors.h> // HRESULT status and error definitions
#include <renbase.h> // Base class for writing ActiveX renderers
#include <refclock.h> // Base clock class
#include <sysclock.h> // System clock
#include <pstream.h> // IPersistStream helper class
#include <vtrans.h> // Video Transform Filter base class
#include <amextra.h>
#include <strmctl.h> // IAMStreamControl support
#include <edevdefs.h> // External device control interface defines
#include <audevcod.h> // audio filter device error event codes

View File

@ -3,18 +3,19 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include "strmctl.h"
#include <streams.h>
#include <strmctl.h>
CBaseStreamControl::CBaseStreamControl()
CBaseStreamControl::CBaseStreamControl(__inout HRESULT *phr)
: m_StreamState(STREAM_FLOWING)
, m_StreamStateOnStop(STREAM_FLOWING) // means no pending stop
, m_tStartTime(MAX_TIME)
, m_tStopTime(MAX_TIME)
, m_StreamEvent(FALSE, phr)
, m_dwStartCookie(0)
, m_dwStopCookie(0)
, m_pRefClock(NULL)
@ -120,7 +121,7 @@ STDMETHODIMP CBaseStreamControl::StartAt
}
// Retrieve information about current settings
STDMETHODIMP CBaseStreamControl::GetInfo(AM_STREAM_INFO *pInfo)
STDMETHODIMP CBaseStreamControl::GetInfo(__out AM_STREAM_INFO *pInfo)
{
if (pInfo == NULL)
return E_POINTER;
@ -231,7 +232,7 @@ void CBaseStreamControl::CancelStart()
enum CBaseStreamControl::StreamControlState CBaseStreamControl::CheckSampleTimes
( const REFERENCE_TIME * pSampleStart, const REFERENCE_TIME * pSampleStop )
( __in const REFERENCE_TIME * pSampleStart, __in const REFERENCE_TIME * pSampleStop )
{
CAutoLock lck(&m_CritSec);

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -71,15 +71,15 @@ private:
// expires, throw the sample away. If the event
// fires, call me back - I've changed my mind.
//
enum StreamControlState CheckSampleTimes( const REFERENCE_TIME * pSampleStart,
const REFERENCE_TIME * pSampleStop );
enum StreamControlState CheckSampleTimes( __in const REFERENCE_TIME * pSampleStart,
__in const REFERENCE_TIME * pSampleStop );
public:
// You don't have to tell us much when we're created, but there are other
// obligations that must be met. See SetSyncSource & NotifyFilterState
// below.
//
CBaseStreamControl();
CBaseStreamControl(__inout_opt HRESULT *phr = NULL);
~CBaseStreamControl();
// If you want this class to work properly, there are thing you need to
@ -134,7 +134,7 @@ public:
DWORD dwCookie = 0 );
STDMETHODIMP StartAt( const REFERENCE_TIME * ptStart = NULL,
DWORD dwCookie = 0 );
STDMETHODIMP GetInfo( AM_STREAM_INFO *pInfo);
STDMETHODIMP GetInfo( __out AM_STREAM_INFO *pInfo);
// Helper function for pin's receive method. Call this with
// the sample and we'll tell you what to do with it. We'll do a

View File

@ -4,11 +4,11 @@
// Desc: DirectShow base classes - implements a system clock based on
// IReferenceClock.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include <streams.h>
#include <limits.h>
@ -27,20 +27,20 @@ int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
#endif
/* This goes in the factory template table to create new instances */
CUnknown * WINAPI CSystemClock::CreateInstance(LPUNKNOWN pUnk,HRESULT *phr)
CUnknown * WINAPI CSystemClock::CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
{
return new CSystemClock(NAME("System reference clock"),pUnk, phr);
}
CSystemClock::CSystemClock(TCHAR *pName,LPUNKNOWN pUnk,HRESULT *phr) :
CSystemClock::CSystemClock(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr) :
CBaseReferenceClock(pName, pUnk, phr)
{
}
STDMETHODIMP CSystemClock::NonDelegatingQueryInterface(
REFIID riid,
void ** ppv)
__deref_out void ** ppv)
{
if (riid == IID_IPersist)
{
@ -58,7 +58,7 @@ STDMETHODIMP CSystemClock::NonDelegatingQueryInterface(
/* Return the clock's clsid */
STDMETHODIMP
CSystemClock::GetClassID(CLSID *pClsID)
CSystemClock::GetClassID(__out CLSID *pClsID)
{
CheckPointer(pClsID,E_POINTER);
ValidateReadWritePtr(pClsID,sizeof(CLSID));

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - defines a system clock implementation of
// IReferenceClock.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -21,16 +21,16 @@ class CSystemClock : public CBaseReferenceClock, public IAMClockAdjust, public I
{
public:
// We must be able to create an instance of ourselves
static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *phr);
CSystemClock(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr);
static CUnknown * WINAPI CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr);
CSystemClock(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr);
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void ** ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv);
// Yield up our class id so that we can be persisted
// Implement required Ipersist method
STDMETHODIMP GetClassID(CLSID *pClsID);
STDMETHODIMP GetClassID(__out CLSID *pClsID);
// IAMClockAdjust methods
STDMETHODIMP SetClockDelta(REFERENCE_TIME rtDelta);

View File

@ -4,20 +4,20 @@
// Desc: DirectShow base classes - implements class for simple transform
// filters such as video decompressors.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include "measure.h"
#include <streams.h>
#include <measure.h>
// =================================================================
// Implements the CTransformFilter class
// =================================================================
CTransformFilter::CTransformFilter(TCHAR *pName,
LPUNKNOWN pUnk,
CTransformFilter::CTransformFilter(__in_opt LPCTSTR pName,
__inout_opt LPUNKNOWN pUnk,
REFCLSID clsid) :
CBaseFilter(pName,pUnk,&m_csFilter, clsid),
m_pInput(NULL),
@ -32,8 +32,8 @@ CTransformFilter::CTransformFilter(TCHAR *pName,
}
#ifdef UNICODE
CTransformFilter::CTransformFilter(char *pName,
LPUNKNOWN pUnk,
CTransformFilter::CTransformFilter(__in_opt LPCSTR pName,
__inout_opt LPUNKNOWN pUnk,
REFCLSID clsid) :
CBaseFilter(pName,pUnk,&m_csFilter, clsid),
m_pInput(NULL),
@ -140,7 +140,7 @@ CTransformFilter::GetPin(int n)
// If Id is In or Out then return the IPin* for that pin
// creating the pin if need be. Otherwise return NULL with an error.
STDMETHODIMP CTransformFilter::FindPin(LPCWSTR Id, IPin **ppPin)
STDMETHODIMP CTransformFilter::FindPin(LPCWSTR Id, __deref_out IPin **ppPin)
{
CheckPointer(ppPin,E_POINTER);
ValidateReadWritePtr(ppPin,sizeof(IPin *));
@ -185,7 +185,7 @@ CTransformFilter::StopStreaming()
// override this to grab extra interfaces on connection
HRESULT
CTransformFilter::CheckConnect(PIN_DIRECTION dir,IPin *pPin)
CTransformFilter::CheckConnect(PIN_DIRECTION dir, IPin *pPin)
{
UNREFERENCED_PARAMETER(dir);
UNREFERENCED_PARAMETER(pPin);
@ -227,7 +227,7 @@ CTransformFilter::SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt)
// Set up our output sample
HRESULT
CTransformFilter::InitializeOutputSample(IMediaSample *pSample, IMediaSample **ppOutSample)
CTransformFilter::InitializeOutputSample(IMediaSample *pSample, __deref_out IMediaSample **ppOutSample)
{
IMediaSample *pOutSample;
@ -578,10 +578,10 @@ CTransformInputPin::CheckStreaming()
// constructor
CTransformInputPin::CTransformInputPin(
TCHAR *pObjectName,
CTransformFilter *pTransformFilter,
HRESULT * phr,
LPCWSTR pName)
__in_opt LPCTSTR pObjectName,
__inout CTransformFilter *pTransformFilter,
__inout HRESULT * phr,
__in_opt LPCWSTR pName)
: CBaseInputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pName)
{
DbgLog((LOG_TRACE,2,TEXT("CTransformInputPin::CTransformInputPin")));
@ -590,10 +590,10 @@ CTransformInputPin::CTransformInputPin(
#ifdef UNICODE
CTransformInputPin::CTransformInputPin(
CHAR *pObjectName,
CTransformFilter *pTransformFilter,
HRESULT * phr,
LPCWSTR pName)
__in_opt LPCSTR pObjectName,
__inout CTransformFilter *pTransformFilter,
__inout HRESULT * phr,
__in_opt LPCWSTR pName)
: CBaseInputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pName)
{
DbgLog((LOG_TRACE,2,TEXT("CTransformInputPin::CTransformInputPin")));
@ -791,10 +791,10 @@ CTransformInputPin::NewSegment(
// constructor
CTransformOutputPin::CTransformOutputPin(
TCHAR *pObjectName,
CTransformFilter *pTransformFilter,
HRESULT * phr,
LPCWSTR pPinName)
__in_opt LPCTSTR pObjectName,
__inout CTransformFilter *pTransformFilter,
__inout HRESULT * phr,
__in_opt LPCWSTR pPinName)
: CBaseOutputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pPinName),
m_pPosition(NULL)
{
@ -805,10 +805,10 @@ CTransformOutputPin::CTransformOutputPin(
#ifdef UNICODE
CTransformOutputPin::CTransformOutputPin(
CHAR *pObjectName,
CTransformFilter *pTransformFilter,
HRESULT * phr,
LPCWSTR pPinName)
__in_opt LPCSTR pObjectName,
__inout CTransformFilter *pTransformFilter,
__inout HRESULT * phr,
__in_opt LPCWSTR pPinName)
: CBaseOutputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pPinName),
m_pPosition(NULL)
{
@ -831,7 +831,7 @@ CTransformOutputPin::~CTransformOutputPin()
// overriden to expose IMediaPosition and IMediaSeeking control interfaces
STDMETHODIMP
CTransformOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
CTransformOutputPin::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
CheckPointer(ppv,E_POINTER);
ValidateReadWritePtr(ppv,sizeof(PVOID));
@ -958,7 +958,7 @@ CTransformOutputPin::SetMediaType(const CMediaType* pmtOut)
HRESULT
CTransformOutputPin::DecideBufferSize(
IMemAllocator * pAllocator,
ALLOCATOR_PROPERTIES* pProp)
__inout ALLOCATOR_PROPERTIES* pProp)
{
return m_pTransformFilter->DecideBufferSize(pAllocator, pProp);
}
@ -970,7 +970,7 @@ CTransformOutputPin::DecideBufferSize(
HRESULT
CTransformOutputPin::GetMediaType(
int iPosition,
CMediaType *pMediaType)
__inout CMediaType *pMediaType)
{
ASSERT(m_pTransformFilter->m_pInput != NULL);

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - defines classes from which simple
// transform codecs may be derived.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -41,19 +41,19 @@ protected:
public:
CTransformInputPin(
TCHAR *pObjectName,
CTransformFilter *pTransformFilter,
HRESULT * phr,
LPCWSTR pName);
__in_opt LPCTSTR pObjectName,
__inout CTransformFilter *pTransformFilter,
__inout HRESULT * phr,
__in_opt LPCWSTR pName);
#ifdef UNICODE
CTransformInputPin(
char *pObjectName,
CTransformFilter *pTransformFilter,
HRESULT * phr,
LPCWSTR pName);
__in_opt LPCSTR pObjectName,
__inout CTransformFilter *pTransformFilter,
__inout HRESULT * phr,
__in_opt LPCWSTR pName);
#endif
STDMETHODIMP QueryId(LPWSTR * Id)
STDMETHODIMP QueryId(__deref_out LPWSTR * Id)
{
return AMGetWideString(L"In", Id);
}
@ -118,25 +118,25 @@ public:
IUnknown * m_pPosition;
CTransformOutputPin(
TCHAR *pObjectName,
CTransformFilter *pTransformFilter,
HRESULT * phr,
LPCWSTR pName);
__in_opt LPCTSTR pObjectName,
__inout CTransformFilter *pTransformFilter,
__inout HRESULT * phr,
__in_opt LPCWSTR pName);
#ifdef UNICODE
CTransformOutputPin(
CHAR *pObjectName,
CTransformFilter *pTransformFilter,
HRESULT * phr,
LPCWSTR pName);
__in_opt LPCSTR pObjectName,
__inout CTransformFilter *pTransformFilter,
__inout HRESULT * phr,
__in_opt LPCWSTR pName);
#endif
~CTransformOutputPin();
// override to expose IMediaPosition
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
// --- CBaseOutputPin ------------
STDMETHODIMP QueryId(LPWSTR * Id)
STDMETHODIMP QueryId(__deref_out LPWSTR * Id)
{
return AMGetWideString(L"Out", Id);
}
@ -157,10 +157,10 @@ public:
// the count and size of buffers we need.
HRESULT DecideBufferSize(
IMemAllocator * pAlloc,
ALLOCATOR_PROPERTIES *pProp);
__inout ALLOCATOR_PROPERTIES *pProp);
// returns the preferred formats for a pin
HRESULT GetMediaType(int iPosition,CMediaType *pMediaType);
HRESULT GetMediaType(int iPosition, __inout CMediaType *pMediaType);
// inherited from IQualityControl via CBasePin
STDMETHODIMP Notify(IBaseFilter * pSender, Quality q);
@ -181,7 +181,7 @@ public:
virtual int GetPinCount();
virtual CBasePin * GetPin(int n);
STDMETHODIMP FindPin(LPCWSTR Id, IPin **ppPin);
STDMETHODIMP FindPin(LPCWSTR Id, __deref_out IPin **ppPin);
// override state changes to allow derived transform filter
// to control streaming start/stop
@ -190,9 +190,9 @@ public:
public:
CTransformFilter(TCHAR *, LPUNKNOWN, REFCLSID clsid);
CTransformFilter(__in_opt LPCTSTR , __inout_opt LPUNKNOWN, REFCLSID clsid);
#ifdef UNICODE
CTransformFilter(CHAR *, LPUNKNOWN, REFCLSID clsid);
CTransformFilter(__in_opt LPCSTR , __inout_opt LPUNKNOWN, REFCLSID clsid);
#endif
~CTransformFilter();
@ -211,15 +211,15 @@ public:
virtual HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut) PURE;
// this goes in the factory template table to create new instances
// static CCOMObject * CreateInstance(LPUNKNOWN, HRESULT *);
// static CCOMObject * CreateInstance(__inout_opt LPUNKNOWN, HRESULT *);
// call the SetProperties function with appropriate arguments
virtual HRESULT DecideBufferSize(
IMemAllocator * pAllocator,
ALLOCATOR_PROPERTIES *pprop) PURE;
__inout ALLOCATOR_PROPERTIES *pprop) PURE;
// override to suggest OUTPUT pin media types
virtual HRESULT GetMediaType(int iPosition, CMediaType *pMediaType) PURE;
virtual HRESULT GetMediaType(int iPosition, __inout CMediaType *pMediaType) PURE;
@ -246,7 +246,7 @@ public:
virtual HRESULT Receive(IMediaSample *pSample);
// Standard setup for output sample
HRESULT InitializeOutputSample(IMediaSample *pSample, IMediaSample **ppOutSample);
HRESULT InitializeOutputSample(IMediaSample *pSample, __deref_out IMediaSample **ppOutSample);
// if you override Receive, you may need to override these three too
virtual HRESULT EndOfStream(void);

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - implements class for simple Transform-
// In-Place filters such as audio.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -251,9 +251,9 @@
// And that's IT!! Any further (essentially spurious) reconnects peter out
// with no change in the chain.
#include "streams.h"
#include "measure.h"
#include "transip.h"
#include <streams.h>
#include <measure.h>
#include <transip.h>
// =================================================================
@ -261,10 +261,10 @@
// =================================================================
CTransInPlaceFilter::CTransInPlaceFilter
( TCHAR *pName,
LPUNKNOWN pUnk,
( __in_opt LPCTSTR pName,
__inout_opt LPUNKNOWN pUnk,
REFCLSID clsid,
HRESULT *phr,
__inout HRESULT *phr,
bool bModifiesData
)
: CTransformFilter(pName, pUnk, clsid),
@ -278,10 +278,10 @@ CTransInPlaceFilter::CTransInPlaceFilter
#ifdef UNICODE
CTransInPlaceFilter::CTransInPlaceFilter
( CHAR *pName,
LPUNKNOWN pUnk,
( __in_opt LPCSTR pName,
__inout_opt LPUNKNOWN pUnk,
REFCLSID clsid,
HRESULT *phr,
__inout HRESULT *phr,
bool bModifiesData
)
: CTransformFilter(pName, pUnk, clsid),
@ -359,7 +359,7 @@ CTransInPlaceFilter::GetPin(int n)
// dir is the direction of our pin.
// pReceivePin is the pin we are connecting to.
HRESULT CTransInPlaceFilter::CompleteConnect(PIN_DIRECTION dir,IPin *pReceivePin)
HRESULT CTransInPlaceFilter::CompleteConnect(PIN_DIRECTION dir, IPin *pReceivePin)
{
UNREFERENCED_PARAMETER(pReceivePin);
ASSERT(m_pInput);
@ -414,7 +414,7 @@ HRESULT CTransInPlaceFilter::CompleteConnect(PIN_DIRECTION dir,IPin *pReceivePin
HRESULT CTransInPlaceFilter::DecideBufferSize
( IMemAllocator *pAlloc
, ALLOCATOR_PROPERTIES *pProperties
, __inout ALLOCATOR_PROPERTIES *pProperties
)
{
ALLOCATOR_PROPERTIES Request, Actual;
@ -431,8 +431,8 @@ HRESULT CTransInPlaceFilter::DecideBufferSize
return hr;
}
} else {
// We're reduced to blind guessing. Let's guess one byte and if
// this isn't enough then when the other pin does get connected
// Propose one byte
// If this isn't enough then when the other pin does get connected
// we can revise it.
ZeroMemory(&Request, sizeof(Request));
Request.cBuffers = 1;
@ -479,7 +479,7 @@ HRESULT CTransInPlaceFilter::DecideBufferSize
// Copy
//
// return a pointer to an identical copy of pSample
IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource)
__out_opt IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource)
{
IMediaSample * pDest;
@ -502,11 +502,11 @@ IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource)
ASSERT(pDest);
IMediaSample2 *pSample2;
if (SUCCEEDED(pDest->QueryInterface(IID_IMediaSample2, (void **)&pSample2))) {
HRESULT hr = pSample2->SetProperties(
HRESULT hrProps = pSample2->SetProperties(
FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer),
(PBYTE)m_pInput->SampleProps());
pSample2->Release();
if (FAILED(hr)) {
if (FAILED(hrProps)) {
pDest->Release();
return NULL;
}
@ -545,7 +545,10 @@ IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource)
// Copy the actual data length and the actual data.
{
const long lDataLength = pSource->GetActualDataLength();
pDest->SetActualDataLength(lDataLength);
if (FAILED(pDest->SetActualDataLength(lDataLength))) {
pDest->Release();
return NULL;
}
// Copy the sample data
{
@ -555,8 +558,13 @@ IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource)
ASSERT(lDestSize >= lSourceSize && lDestSize >= lDataLength);
pSource->GetPointer(&pSourceBuffer);
pDest->GetPointer(&pDestBuffer);
if (FAILED(pSource->GetPointer(&pSourceBuffer)) ||
FAILED(pDest->GetPointer(&pDestBuffer)) ||
lDestSize < lDataLength ||
lDataLength < 0) {
pDest->Release();
return NULL;
}
ASSERT(lDestSize == 0 || pSourceBuffer != NULL && pDestBuffer != NULL);
CopyMemory( (PVOID) pDestBuffer, (PVOID) pSourceBuffer, lDataLength );
@ -651,10 +659,10 @@ CTransInPlaceFilter::Receive(IMediaSample *pSample)
// constructor
CTransInPlaceInputPin::CTransInPlaceInputPin
( TCHAR *pObjectName
, CTransInPlaceFilter *pFilter
, HRESULT *phr
, LPCWSTR pName
( __in_opt LPCTSTR pObjectName
, __inout CTransInPlaceFilter *pFilter
, __inout HRESULT *phr
, __in_opt LPCWSTR pName
)
: CTransformInputPin(pObjectName,
pFilter,
@ -683,7 +691,7 @@ CTransInPlaceInputPin::CTransInPlaceInputPin
// ) or it could mean offering the one from downstream
// Else fail to offer any allocator at all.
STDMETHODIMP CTransInPlaceInputPin::GetAllocator(IMemAllocator ** ppAllocator)
STDMETHODIMP CTransInPlaceInputPin::GetAllocator(__deref_out IMemAllocator ** ppAllocator)
{
CheckPointer(ppAllocator,E_POINTER);
ValidateReadWritePtr(ppAllocator,sizeof(IMemAllocator *));
@ -807,7 +815,7 @@ CTransInPlaceInputPin::NotifyAllocator(
// EnumMediaTypes
// - pass through to our downstream filter
STDMETHODIMP CTransInPlaceInputPin::EnumMediaTypes( IEnumMediaTypes **ppEnum )
STDMETHODIMP CTransInPlaceInputPin::EnumMediaTypes( __deref_out IEnumMediaTypes **ppEnum )
{
// Can only pass through if connected
if( !m_pTIPFilter->m_pOutput->IsConnected() )
@ -839,7 +847,7 @@ HRESULT CTransInPlaceInputPin::CheckMediaType(const CMediaType *pmt )
// If upstream asks us what our requirements are, we will try to ask downstream
// if that doesn't work, we'll just take the defaults.
STDMETHODIMP
CTransInPlaceInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps)
CTransInPlaceInputPin::GetAllocatorRequirements(__out ALLOCATOR_PROPERTIES *pProps)
{
if( m_pTIPFilter->m_pOutput->IsConnected() )
@ -875,10 +883,10 @@ CTransInPlaceInputPin::CompleteConnect(IPin *pReceivePin)
// constructor
CTransInPlaceOutputPin::CTransInPlaceOutputPin(
TCHAR *pObjectName,
CTransInPlaceFilter *pFilter,
HRESULT * phr,
LPCWSTR pPinName)
__in_opt LPCTSTR pObjectName,
__inout CTransInPlaceFilter *pFilter,
__inout HRESULT * phr,
__in_opt LPCWSTR pPinName)
: CTransformOutputPin( pObjectName
, pFilter
, phr
@ -893,7 +901,7 @@ CTransInPlaceOutputPin::CTransInPlaceOutputPin(
// EnumMediaTypes
// - pass through to our upstream filter
STDMETHODIMP CTransInPlaceOutputPin::EnumMediaTypes( IEnumMediaTypes **ppEnum )
STDMETHODIMP CTransInPlaceOutputPin::EnumMediaTypes( __deref_out IEnumMediaTypes **ppEnum )
{
// Can only pass through if connected.
if( ! m_pTIPFilter->m_pInput->IsConnected() )

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - defines classes from which simple
// Transform-In-Place filters may be derived.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -49,21 +49,21 @@ protected:
public:
CTransInPlaceInputPin(
TCHAR *pObjectName,
CTransInPlaceFilter *pFilter,
HRESULT *phr,
LPCWSTR pName);
__in_opt LPCTSTR pObjectName,
__inout CTransInPlaceFilter *pFilter,
__inout HRESULT *phr,
__in_opt LPCWSTR pName);
// --- IMemInputPin -----
// Provide an enumerator for media types by getting one from downstream
STDMETHODIMP EnumMediaTypes( IEnumMediaTypes **ppEnum );
STDMETHODIMP EnumMediaTypes( __deref_out IEnumMediaTypes **ppEnum );
// Say whether media type is acceptable.
HRESULT CheckMediaType(const CMediaType* pmt);
// Return our upstream allocator
STDMETHODIMP GetAllocator(IMemAllocator ** ppAllocator);
STDMETHODIMP GetAllocator(__deref_out IMemAllocator ** ppAllocator);
// get told which allocator the upstream output pin is actually
// going to use.
@ -72,11 +72,11 @@ public:
// Allow the filter to see what allocator we have
// N.B. This does NOT AddRef
IMemAllocator * PeekAllocator() const
__out IMemAllocator * PeekAllocator() const
{ return m_pAllocator; }
// Pass this on downstream if it ever gets called.
STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps);
STDMETHODIMP GetAllocatorRequirements(__out ALLOCATOR_PROPERTIES *pProps);
HRESULT CompleteConnect(IPin *pReceivePin);
@ -98,10 +98,10 @@ protected:
public:
CTransInPlaceOutputPin(
TCHAR *pObjectName,
CTransInPlaceFilter *pFilter,
HRESULT *phr,
LPCWSTR pName);
__in_opt LPCTSTR pObjectName,
__inout CTransInPlaceFilter *pFilter,
__inout HRESULT *phr,
__in_opt LPCWSTR pName);
// --- CBaseOutputPin ------------
@ -113,7 +113,7 @@ public:
// virtual HRESULT DecideAllocator(IMemInputPin * pPin, IMemAllocator ** pAlloc);
// Provide a media type enumerator. Get it from upstream.
STDMETHODIMP EnumMediaTypes( IEnumMediaTypes **ppEnum );
STDMETHODIMP EnumMediaTypes( __deref_out IEnumMediaTypes **ppEnum );
// Say whether media type is acceptable.
HRESULT CheckMediaType(const CMediaType* pmt);
@ -122,12 +122,12 @@ public:
// Also called by input pin's GetAllocator()
void SetAllocator(IMemAllocator * pAllocator);
IMemInputPin * ConnectedIMemInputPin()
__out_opt IMemInputPin * ConnectedIMemInputPin()
{ return m_pInputPin; }
// Allow the filter to see what allocator we have
// N.B. This does NOT AddRef
IMemAllocator * PeekAllocator() const
__out IMemAllocator * PeekAllocator() const
{ return m_pAllocator; }
HRESULT CompleteConnect(IPin *pReceivePin);
@ -151,10 +151,10 @@ public:
// not modify the data samples (for instance it's just copying
// them somewhere else or looking at the timestamps).
CTransInPlaceFilter(TCHAR *, LPUNKNOWN, REFCLSID clsid, HRESULT *,
CTransInPlaceFilter(__in_opt LPCTSTR, __inout_opt LPUNKNOWN, REFCLSID clsid, __inout HRESULT *,
bool bModifiesData = true);
#ifdef UNICODE
CTransInPlaceFilter(CHAR *, LPUNKNOWN, REFCLSID clsid, HRESULT *,
CTransInPlaceFilter(__in_opt LPCSTR, __inout_opt LPUNKNOWN, REFCLSID clsid, __inout HRESULT *,
bool bModifiesData = true);
#endif
// The following are defined to avoid undefined pure virtuals.
@ -162,13 +162,13 @@ public:
// We override EnumMediaTypes to bypass the transform class enumerator
// which would otherwise call this.
HRESULT GetMediaType(int iPosition, CMediaType *pMediaType)
HRESULT GetMediaType(int iPosition, __inout CMediaType *pMediaType)
{ DbgBreak("CTransInPlaceFilter::GetMediaType should never be called");
return E_UNEXPECTED;
}
// This is called when we actually have to provide out own allocator.
HRESULT DecideBufferSize(IMemAllocator*, ALLOCATOR_PROPERTIES *);
// This is called when we actually have to provide our own allocator.
HRESULT DecideBufferSize(IMemAllocator*, __inout ALLOCATOR_PROPERTIES *);
// The functions which call this in CTransform are overridden in this
// class to call CheckInputType with the assumption that the type
@ -211,7 +211,7 @@ public:
protected:
IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource);
__out_opt IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource);
#ifdef PERF
int m_idTransInPlace; // performance measuring id
@ -223,11 +223,11 @@ protected:
friend class CTransInPlaceInputPin;
friend class CTransInPlaceOutputPin;
CTransInPlaceInputPin *InputPin() const
__out CTransInPlaceInputPin *InputPin() const
{
return (CTransInPlaceInputPin *)m_pInput;
};
CTransInPlaceOutputPin *OutputPin() const
__out CTransInPlaceOutputPin *OutputPin() const
{
return (CTransInPlaceOutputPin *)m_pOutput;
};

View File

@ -3,16 +3,16 @@
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include "measure.h"
#include <streams.h>
#include <measure.h>
// #include <vtransfr.h> // now in precomp file streams.h
CVideoTransformFilter::CVideoTransformFilter
( TCHAR *pName, LPUNKNOWN pUnk, REFCLSID clsid)
( __in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, REFCLSID clsid)
: CTransformFilter(pName, pUnk, clsid)
, m_itrLate(0)
, m_nKeyFramePeriod(0) // No QM until we see at least 2 key frames

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes - defines a video transform class.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -15,7 +15,7 @@ class CVideoTransformFilter : public CTransformFilter
{
public:
CVideoTransformFilter(TCHAR *, LPUNKNOWN, REFCLSID clsid);
CVideoTransformFilter(__in_opt LPCTSTR, __inout_opt LPUNKNOWN, REFCLSID clsid);
~CVideoTransformFilter();
HRESULT EndFlush();

View File

@ -4,13 +4,15 @@
// Desc: DirectShow base classes - implements ActiveX system debugging
// facilities.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include <streams.h>
#include <stdarg.h>
#include <stdio.h>
#include <dvdmedia.h>
#ifdef DEBUG
#ifdef UNICODE
@ -20,7 +22,12 @@
#endif // UNICODE
#endif // DEBUG
#include <tchar.h>
#include <strsafe.h>
#ifdef DEBUG
static void DisplayBITMAPINFO(const BITMAPINFOHEADER* pbmi);
static void DisplayRECT(LPCTSTR szLabel, const RECT& rc);
// The Win32 wsprintf() function writes a maximum of 1024 characters to it's output buffer.
// See the documentation for wsprintf()'s lpOut parameter for more information.
@ -33,7 +40,7 @@ const INT iDEBUGINFO = 1024; // Used to format strings
HKEY_LOCAL_MACHINE\SOFTWARE\Debug\<Module Name>\<KeyName> key values
NOTE these must be in the same order as their enumeration definition */
TCHAR *pKeyNames[] = {
const LPCTSTR pKeyNames[] = {
TEXT("TIMING"), // Timing and performance measurements
TEXT("TRACE"), // General step point call tracing
TEXT("MEMORY"), // Memory and object allocation/destruction
@ -66,11 +73,11 @@ bool g_fUseKASSERT = false; // don't create messagebox
bool g_fDbgInDllEntryPoint = false;
bool g_fAutoRefreshLevels = false;
const TCHAR *pBaseKey = TEXT("SOFTWARE\\Debug");
const TCHAR *pGlobalKey = TEXT("GLOBAL");
LPCTSTR pBaseKey = TEXT("SOFTWARE\\Microsoft\\DirectShow\\Debug");
LPCTSTR pGlobalKey = TEXT("GLOBAL");
static CHAR *pUnknownName = "UNKNOWN";
TCHAR *TimeoutName = TEXT("TIMEOUT");
LPCTSTR TimeoutName = TEXT("TIMEOUT");
/* This sets the instance handle that the debug library uses to find
the module's file name from the Win32 GetModuleFileName function */
@ -146,7 +153,7 @@ void WINAPI DbgInitKeyLevels(HKEY hKey, bool fTakeMax)
sizeof(DWORD)); // Size of the field buffer
if (lReturn != ERROR_SUCCESS) {
DbgLog((LOG_ERROR,0,TEXT("Could not create subkey %s"),pKeyNames[lKeyPos]));
DbgLog((LOG_ERROR,1,TEXT("Could not create subkey %s"),pKeyNames[lKeyPos]));
dwKeyValue = 0;
}
}
@ -188,7 +195,7 @@ void WINAPI DbgInitKeyLevels(HKEY hKey, bool fTakeMax)
sizeof(DWORD)); // Size of the field buffer
if (lReturn != ERROR_SUCCESS) {
DbgLog((LOG_ERROR,0,TEXT("Could not create subkey %s"),TimeoutName));
DbgLog((LOG_ERROR,1,TEXT("Could not create subkey %s"),pKeyNames[lKeyPos]));
dwWaitTimeout = INFINITE;
}
}
@ -211,6 +218,49 @@ void WINAPI DbgOutString(LPCTSTR psz)
}
}
HRESULT DbgUniqueProcessName(LPCTSTR inName, LPTSTR outName)
{
HRESULT hr = S_OK;
const TCHAR *pIn = inName;
int dotPos = -1;
//scan the input and record the last '.' position
while (*pIn && (pIn - inName) < MAX_PATH)
{
if ( TEXT('.') == *pIn )
dotPos = (int)(pIn-inName);
++pIn;
}
if (*pIn) //input should be zero-terminated within MAX_PATH
return E_INVALIDARG;
DWORD dwProcessId = GetCurrentProcessId();
if (dotPos < 0)
{
//no extension in the input, appending process id to the input
hr = StringCchPrintf(outName, MAX_PATH, TEXT("%s_%d"), inName, dwProcessId);
}
else
{
TCHAR pathAndBasename[MAX_PATH] = {0};
//there's an extension - zero-terminate the path and basename first by copying
hr = StringCchCopyN(pathAndBasename, MAX_PATH, inName, (size_t)dotPos);
//re-combine path, basename and extension with processId appended to a basename
if (SUCCEEDED(hr))
hr = StringCchPrintf(outName, MAX_PATH, TEXT("%s_%d%s"), pathAndBasename, dwProcessId, inName + dotPos);
}
return hr;
}
/* Called by DbgInitGlobalSettings to setup alternate logging destinations
*/
@ -271,12 +321,27 @@ void WINAPI DbgInitLogTo (
NULL, OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (INVALID_HANDLE_VALUE != m_hOutput)
{
if (INVALID_HANDLE_VALUE == m_hOutput &&
GetLastError() == ERROR_SHARING_VIOLATION)
{
TCHAR uniqueName[MAX_PATH] = {0};
if (SUCCEEDED(DbgUniqueProcessName(szFile, uniqueName)))
{
m_hOutput = CreateFile(uniqueName, GENERIC_WRITE,
FILE_SHARE_READ,
NULL, OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
}
}
if (INVALID_HANDLE_VALUE != m_hOutput)
{
static const TCHAR cszBar[] = TEXT("\r\n\r\n=====DbgInitialize()=====\r\n\r\n");
SetFilePointer (m_hOutput, 0, NULL, FILE_END);
DbgOutString (cszBar);
}
}
}
}
}
@ -303,13 +368,24 @@ void WINAPI DbgInitGlobalSettings(bool fTakeMax)
(DWORD) 0, // Reserved value
NULL, // Address of class name
(DWORD) 0, // Special options flags
KEY_ALL_ACCESS, // Desired security access
GENERIC_READ | GENERIC_WRITE, // Desired security access
NULL, // Key security descriptor
&hGlobalKey, // Opened handle buffer
NULL); // What really happened
if (lReturn != ERROR_SUCCESS) {
DbgLog((LOG_ERROR,0,TEXT("Could not access GLOBAL module key")));
lReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Handle of an open key
szInfo, // Address of subkey name
(DWORD) 0, // Reserved value
NULL, // Address of class name
(DWORD) 0, // Special options flags
GENERIC_READ, // Desired security access
NULL, // Key security descriptor
&hGlobalKey, // Opened handle buffer
NULL); // What really happened
if (lReturn != ERROR_SUCCESS) {
DbgLog((LOG_ERROR,1,TEXT("Could not access GLOBAL module key")));
}
return;
}
@ -331,7 +407,7 @@ void WINAPI DbgInitModuleSettings(bool fTakeMax)
HKEY hModuleKey; // Module key handle
/* Construct the base key name */
(void)StringCchPrintf(szInfo,NUMELMS(szInfo), TEXT("%s\\%s"),pBaseKey,m_ModuleName);
(void)StringCchPrintf(szInfo,NUMELMS(szInfo),TEXT("%s\\%s"),pBaseKey,m_ModuleName);
/* Create or open the key for this module */
lReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Handle of an open key
@ -339,13 +415,24 @@ void WINAPI DbgInitModuleSettings(bool fTakeMax)
(DWORD) 0, // Reserved value
NULL, // Address of class name
(DWORD) 0, // Special options flags
KEY_ALL_ACCESS, // Desired security access
GENERIC_READ | GENERIC_WRITE, // Desired security access
NULL, // Key security descriptor
&hModuleKey, // Opened handle buffer
NULL); // What really happened
if (lReturn != ERROR_SUCCESS) {
DbgLog((LOG_ERROR,0,TEXT("Could not access module key")));
lReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Handle of an open key
szInfo, // Address of subkey name
(DWORD) 0, // Reserved value
NULL, // Address of class name
(DWORD) 0, // Special options flags
GENERIC_READ, // Desired security access
NULL, // Key security descriptor
&hModuleKey, // Opened handle buffer
NULL); // What really happened
if (lReturn != ERROR_SUCCESS) {
DbgLog((LOG_ERROR,1,TEXT("Could not access module key")));
}
return;
}
@ -360,7 +447,7 @@ void WINAPI DbgInitModuleSettings(bool fTakeMax)
void WINAPI DbgInitModuleName()
{
TCHAR FullName[iDEBUGINFO]; // Load the full path and module name
TCHAR *pName; // Searches from the end for a backslash
LPTSTR pName; // Searches from the end for a backslash
GetModuleFileName(m_hInst,FullName,iDEBUGINFO);
pName = _tcsrchr(FullName,'\\');
@ -375,8 +462,8 @@ void WINAPI DbgInitModuleName()
struct MsgBoxMsg
{
HWND hwnd;
TCHAR *szTitle;
TCHAR *szMessage;
LPCTSTR szTitle;
LPCTSTR szMessage;
DWORD dwFlags;
INT iResult;
};
@ -386,7 +473,7 @@ struct MsgBoxMsg
// random threads at bad times can confuse the host (eg IE).
//
DWORD WINAPI MsgBoxThread(
LPVOID lpParameter // thread data
__inout LPVOID lpParameter // thread data
)
{
MsgBoxMsg *pmsg = (MsgBoxMsg *)lpParameter;
@ -401,15 +488,17 @@ DWORD WINAPI MsgBoxThread(
INT MessageBoxOtherThread(
HWND hwnd,
TCHAR *szTitle,
TCHAR *szMessage,
LPCTSTR szTitle,
LPCTSTR szMessage,
DWORD dwFlags)
{
if(g_fDbgInDllEntryPoint)
{
// can't wait on another thread because we have the loader
// lock held in the dll entry point.
return MessageBox(hwnd, szTitle, szMessage, dwFlags);
// This can crash sometimes so just skip it
// return MessageBox(hwnd, szTitle, szMessage, dwFlags);
return IDCANCEL;
}
else
{
@ -436,7 +525,7 @@ INT MessageBoxOtherThread(
/* Displays a message box if the condition evaluated to FALSE */
void WINAPI DbgAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine)
void WINAPI DbgAssert(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine)
{
if(g_fUseKASSERT)
{
@ -447,7 +536,7 @@ void WINAPI DbgAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine)
TCHAR szInfo[iDEBUGINFO];
(void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"),
(void)StringCchPrintf(szInfo, NUMELMS(szInfo),TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"),
pCondition, iLine, pFileName);
INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("ASSERT Failed"),
@ -475,7 +564,7 @@ void WINAPI DbgAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine)
/* Displays a message box at a break point */
void WINAPI DbgBreakPoint(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine)
void WINAPI DbgBreakPoint(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine)
{
if(g_fUseKASSERT)
{
@ -485,7 +574,7 @@ void WINAPI DbgBreakPoint(const TCHAR *pCondition,const TCHAR *pFileName,INT iLi
{
TCHAR szInfo[iDEBUGINFO];
(void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"),
(void)StringCchPrintf(szInfo, NUMELMS(szInfo),TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"),
pCondition, iLine, pFileName);
INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("Hard coded break point"),
@ -511,7 +600,7 @@ void WINAPI DbgBreakPoint(const TCHAR *pCondition,const TCHAR *pFileName,INT iLi
}
}
void WINAPI DbgBreakPoint(const TCHAR *pFileName,INT iLine,const TCHAR* szFormatString,...)
void WINAPI DbgBreakPoint(LPCTSTR pFileName,INT iLine,__format_string LPCTSTR szFormatString,...)
{
// A debug break point message can have at most 2000 characters if
// ANSI or UNICODE characters are being used. A debug break point message
@ -522,17 +611,15 @@ void WINAPI DbgBreakPoint(const TCHAR *pFileName,INT iLine,const TCHAR* szFormat
TCHAR szBreakPointMessage[MAX_BREAK_POINT_MESSAGE_SIZE];
const DWORD MAX_CHARS_IN_BREAK_POINT_MESSAGE = sizeof(szBreakPointMessage) / sizeof(TCHAR);
va_list va;
va_start( va, szFormatString );
HRESULT hr = StringCchVPrintf( szBreakPointMessage, MAX_CHARS_IN_BREAK_POINT_MESSAGE, szFormatString, va );
HRESULT hr = StringCchVPrintf( szBreakPointMessage, NUMELMS(szBreakPointMessage), szFormatString, va );
va_end(va);
if( S_OK != hr ) {
DbgBreak( "ERROR in DbgBreakPoint(). The variable length debug message could not be displayed because _vsnprintf() failed." );
if( FAILED(hr) ) {
DbgBreak( "ERROR in DbgBreakPoint(). The variable length debug message could not be displayed because StringCchVPrintf() failed." );
return;
}
@ -620,7 +707,7 @@ void WINAPI DbgSetAutoRefreshLevels(bool fAuto)
// warning -- this function is implemented twice for ansi applications
// linking to the unicode library
//
void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const CHAR *pFormat,...)
void WINAPI DbgLogInfo(DWORD Type,DWORD Level,__format_string LPCSTR pFormat,...)
{
/* Check the current level for this type combination */
@ -636,20 +723,16 @@ void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const CHAR *pFormat,...)
va_list va;
va_start(va, pFormat);
(void)StringCchCopy(szInfo,NUMELMS(szInfo),m_ModuleName);
size_t len = lstrlen(szInfo);
(void)StringCchPrintf(szInfo + len,
NUMELMS(szInfo) - len,
TEXT("(tid %x) %8d : "),
(void)StringCchPrintf(szInfo, NUMELMS(szInfo),
TEXT("%s(tid %x) %8d : "),
m_ModuleName,
GetCurrentThreadId(), timeGetTime() - dwTimeOffset);
CHAR szInfoA[2000];
WideCharToMultiByte(CP_ACP, 0, szInfo, -1, szInfoA, NUMELMS(szInfoA), 0, 0);
len = lstrlenA(szInfoA);
(void)StringCchVPrintfA(szInfoA + len, NUMELMS(szInfoA) - len, pFormat, va);
len = lstrlenA(szInfoA);
(void)StringCchCatA(szInfoA, NUMELMS(szInfoA) - len, "\r\n");
(void)StringCchVPrintfA(szInfoA + lstrlenA(szInfoA), NUMELMS(szInfoA) - lstrlenA(szInfoA), pFormat, va);
(void)StringCchCatA(szInfoA, NUMELMS(szInfoA), "\r\n");
WCHAR wszOutString[2000];
MultiByteToWideChar(CP_ACP, 0, szInfoA, -1, wszOutString, NUMELMS(wszOutString));
@ -658,8 +741,7 @@ void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const CHAR *pFormat,...)
va_end(va);
}
void WINAPI DbgAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLine)
void WINAPI DbgAssert(LPCSTR pCondition,LPCSTR pFileName,INT iLine)
{
if(g_fUseKASSERT)
{
@ -670,7 +752,7 @@ void WINAPI DbgAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLine)
TCHAR szInfo[iDEBUGINFO];
(void)StringCchPrintf(szInfo, NUMELMS(szInfo),TEXT("%S \nAt line %d of %S\nContinue? (Cancel to debug)"),
(void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("%hs \nAt line %d of %hs\nContinue? (Cancel to debug)"),
pCondition, iLine, pFileName);
INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("ASSERT Failed"),
@ -698,7 +780,7 @@ void WINAPI DbgAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLine)
/* Displays a message box at a break point */
void WINAPI DbgBreakPoint(const CHAR *pCondition,const CHAR *pFileName,INT iLine)
void WINAPI DbgBreakPoint(LPCSTR pCondition,LPCSTR pFileName,INT iLine)
{
if(g_fUseKASSERT)
{
@ -708,7 +790,7 @@ void WINAPI DbgBreakPoint(const CHAR *pCondition,const CHAR *pFileName,INT iLine
{
TCHAR szInfo[iDEBUGINFO];
(void)StringCchPrintf(szInfo, NUMELMS(szInfo),TEXT("%S \nAt line %d of %S\nContinue? (Cancel to debug)"),
(void)StringCchPrintf(szInfo, NUMELMS(szInfo),TEXT("%hs \nAt line %d of %hs\nContinue? (Cancel to debug)"),
pCondition, iLine, pFileName);
INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("Hard coded break point"),
@ -734,7 +816,7 @@ void WINAPI DbgBreakPoint(const CHAR *pCondition,const CHAR *pFileName,INT iLine
}
}
void WINAPI DbgKernelAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLine)
void WINAPI DbgKernelAssert(LPCSTR pCondition,LPCSTR pFileName,INT iLine)
{
DbgLog((LOG_ERROR,0,TEXT("Assertion FAILED (%hs) at line %d in file %hs"),
pCondition, iLine, pFileName));
@ -752,7 +834,7 @@ void WINAPI DbgKernelAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLi
// warning -- this function is implemented twice for ansi applications
// linking to the unicode library
//
void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const TCHAR *pFormat,...)
void WINAPI DbgLogInfo(DWORD Type,DWORD Level,LPCTSTR pFormat,...)
{
/* Check the current level for this type combination */
@ -769,15 +851,12 @@ void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const TCHAR *pFormat,...)
va_list va;
va_start(va, pFormat);
(void)StringCchCopy(szInfo, NUMELMS(szInfo), m_ModuleName);
size_t len = lstrlen(szInfo);
(void)StringCchPrintf(szInfo + len, NUMELMS(szInfo) - len,
TEXT("(tid %x) %8d : "),
(void)StringCchPrintf(szInfo, NUMELMS(szInfo),
TEXT("%s(tid %x) %8d : "),
m_ModuleName,
GetCurrentThreadId(), timeGetTime() - dwTimeOffset);
len = lstrlen(szInfo);
(void)StringCchVPrintf(szInfo + len, NUMELMS(szInfo) - len, pFormat, va);
(void)StringCchVPrintf(szInfo + lstrlen(szInfo), NUMELMS(szInfo) - lstrlen(szInfo), pFormat, va);
(void)StringCchCat(szInfo, NUMELMS(szInfo), TEXT("\r\n"));
DbgOutString(szInfo);
@ -789,7 +868,7 @@ void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const TCHAR *pFormat,...)
boxes to the user, this provides an alternative which puts the error
condition on the debugger output with a suitable eye catching message */
void WINAPI DbgKernelAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine)
void WINAPI DbgKernelAssert(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine)
{
DbgLog((LOG_ERROR,0,TEXT("Assertion FAILED (%s) at line %d in file %s"),
pCondition, iLine, pFileName));
@ -804,8 +883,8 @@ void WINAPI DbgKernelAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT i
uses to identify the object when it is destroyed later on. We update the
total number of active objects in the DLL mainly for debugging purposes */
DWORD WINAPI DbgRegisterObjectCreation(const CHAR *szObjectName,
const WCHAR *wszObjectName)
DWORD WINAPI DbgRegisterObjectCreation(LPCSTR szObjectName,
LPCWSTR wszObjectName)
{
/* If this fires you have a mixed DEBUG/RETAIL build */
@ -937,22 +1016,9 @@ void WINAPI DbgDumpObjectRegister()
while (pObject) {
if(pObject->m_wszName) {
#ifdef UNICODE
LPCTSTR FORMAT_STRING = TEXT("%5d (%8x) %30s");
#else
LPCTSTR FORMAT_STRING = TEXT("%5d (%8x) %30S");
#endif
(void)StringCchPrintf(szInfo,NUMELMS(szInfo), FORMAT_STRING, pObject->m_dwCookie, &pObject, pObject->m_wszName);
(void)StringCchPrintf(szInfo,NUMELMS(szInfo),TEXT("%5d (%p) %30ls"),pObject->m_dwCookie, &pObject, pObject->m_wszName);
} else {
#ifdef UNICODE
LPCTSTR FORMAT_STRING = TEXT("%5d (%8x) %30S");
#else
LPCTSTR FORMAT_STRING = TEXT("%5d (%8x) %30s");
#endif
(void)StringCchPrintf(szInfo,NUMELMS(szInfo),FORMAT_STRING,pObject->m_dwCookie, &pObject, pObject->m_szName);
(void)StringCchPrintf(szInfo,NUMELMS(szInfo),TEXT("%5d (%p) %30hs"),pObject->m_dwCookie, &pObject, pObject->m_szName);
}
DbgLog((LOG_MEMORY,2,szInfo));
pObject = pObject->m_pNext;
@ -975,7 +1041,7 @@ DWORD WINAPI DbgWaitForSingleObject(HANDLE h)
return dwWaitResult;
}
DWORD WINAPI DbgWaitForMultipleObjects(DWORD nCount,
CONST HANDLE *lpHandles,
__in_ecount(nCount) CONST HANDLE *lpHandles,
BOOL bWaitAll)
{
DWORD dwWaitResult;
@ -1051,7 +1117,7 @@ CDisp::CDisp(LONGLONG ll, int Format)
li.QuadPart /= 10;
temp[--pos] = (TCHAR) digit+L'0';
} while (li.QuadPart);
(void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("%s"), temp+pos);
(void)StringCchCopy(m_String, NUMELMS(m_String), temp+pos);
break;
}
case CDISP_HEX:
@ -1062,55 +1128,40 @@ CDisp::CDisp(LONGLONG ll, int Format)
CDisp::CDisp(REFCLSID clsid)
{
WCHAR strClass[CHARS_IN_GUID+1];
StringFromGUID2(clsid, strClass, sizeof(strClass) / sizeof(strClass[0]));
ASSERT(sizeof(m_String)/sizeof(m_String[0]) >= CHARS_IN_GUID+1);
#ifdef UNICODE
(void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("%s"), strClass);
#else
(void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("%S"), strClass);
#endif
#ifdef UNICODE
(void)StringFromGUID2(clsid, m_String, NUMELMS(m_String));
#else
WCHAR wszTemp[50];
(void)StringFromGUID2(clsid, wszTemp, NUMELMS(wszTemp));
(void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("%S"), wszTemp);
#endif
};
#ifdef __STREAMS__
/* Display stuff */
CDisp::CDisp(CRefTime llTime)
{
LPTSTR lpsz = m_String;
size_t len = NUMELMS(m_String);
LONGLONG llDiv;
if (llTime < 0) {
llTime = -llTime;
(void)StringCchPrintf(lpsz, len, TEXT("-"));
size_t t = lstrlen(lpsz);
lpsz += t;
len -= t;
(void)StringCchCopy(m_String, NUMELMS(m_String), TEXT("-"));
}
llDiv = (LONGLONG)24 * 3600 * 10000000;
if (llTime >= llDiv) {
(void)StringCchPrintf(lpsz, len, TEXT("%d days "), (LONG)(llTime / llDiv));
size_t t = lstrlen(lpsz);
lpsz += t;
len -= t;
(void)StringCchPrintf(m_String + lstrlen(m_String), NUMELMS(m_String) - lstrlen(m_String), TEXT("%d days "), (LONG)(llTime / llDiv));
llTime = llTime % llDiv;
}
llDiv = (LONGLONG)3600 * 10000000;
if (llTime >= llDiv) {
(void)StringCchPrintf(lpsz, len, TEXT("%d hrs "), (LONG)(llTime / llDiv));
size_t t = lstrlen(lpsz);
lpsz += t;
len -= t;
(void)StringCchPrintf(m_String + lstrlen(m_String), NUMELMS(m_String) - lstrlen(m_String), TEXT("%d hrs "), (LONG)(llTime / llDiv));
llTime = llTime % llDiv;
}
llDiv = (LONGLONG)60 * 10000000;
if (llTime >= llDiv) {
(void)StringCchPrintf(lpsz, len, TEXT("%d mins "), (LONG)(llTime / llDiv));
size_t t = lstrlen(lpsz);
lpsz += t;
len -= t;
(void)StringCchPrintf(m_String + lstrlen(m_String), NUMELMS(m_String) - lstrlen(m_String), TEXT("%d mins "), (LONG)(llTime / llDiv));
llTime = llTime % llDiv;
}
(void)StringCchPrintf(lpsz, len, TEXT("%d.%3.3d sec"),
(void)StringCchPrintf(m_String + lstrlen(m_String), NUMELMS(m_String) - lstrlen(m_String), TEXT("%d.%3.3d sec"),
(LONG)llTime / 10000000,
(LONG)((llTime % 10000000) / 10000));
};
@ -1139,19 +1190,12 @@ CDisp::CDisp(IPin *pPin)
(void)StringCchCopy(str, NUMELMS(str), TEXT("NULL IPin"));
}
size_t len = lstrlen(str)+64;
m_pString = (TCHAR*) new TCHAR[len];
m_pString = (PTCHAR) new TCHAR[lstrlen(str)+64];
if (!m_pString) {
return;
}
#ifdef UNICODE
LPCTSTR FORMAT_STRING = TEXT("%S(%s)");
#else
LPCTSTR FORMAT_STRING = TEXT("%s(%s)");
#endif
(void)StringCchPrintf(m_pString, len, FORMAT_STRING, GuidNames[clsid], str);
(void)StringCchPrintf(m_pString, lstrlen(str) + 64, TEXT("%hs(%s)"), GuidNames[clsid], str);
}
/* Display filter or pin */
@ -1168,16 +1212,15 @@ CDisp::CDisp(IUnknown *pUnk)
QueryFilterInfoReleaseGraph(fi);
size_t len = lstrlenW(fi.achName) + 1;
m_pString = new TCHAR[len];
if(m_pString)
{
#ifdef UNICODE
LPCTSTR FORMAT_STRING = TEXT("%s");
#else
LPCTSTR FORMAT_STRING = TEXT("%S");
#endif
(void)StringCchPrintf(m_pString, len, FORMAT_STRING, fi.achName);
#ifdef UNICODE
(void)StringCchCopy(m_pString, len, fi.achName);
#else
(void)StringCchPrintf(m_pString, len, "%S", fi.achName);
#endif
}
}
@ -1210,11 +1253,7 @@ CDispBasic::~CDispBasic()
CDisp::CDisp(double d)
{
#ifdef DEBUG
(void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("%.16g"), d);
#else
(void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("%d.%03d"), (int) d, (int) ((d - (int) d) * 1000));
#endif
}
@ -1225,100 +1264,116 @@ CDisp::CDisp(double d)
succeed as we do not accept input types unless the format is big enough */
#ifdef DEBUG
void WINAPI DisplayType(LPTSTR label, const AM_MEDIA_TYPE *pmtIn, DWORD dwLevel)
void WINAPI DisplayType(LPCTSTR label, const AM_MEDIA_TYPE *pmtIn)
{
/* Dump the GUID types and a short description */
DbgLog((LOG_TRACE,dwLevel,TEXT("")));
DbgLog((LOG_TRACE,dwLevel,TEXT("%s M type %hs S type %hs"), label,
DbgLog((LOG_TRACE,5,TEXT("")));
DbgLog((LOG_TRACE,2,TEXT("%s M type %hs S type %hs"), label,
GuidNames[pmtIn->majortype],
GuidNames[pmtIn->subtype]));
DbgLog((LOG_TRACE,dwLevel,TEXT("Subtype description %s"),GetSubtypeName(&pmtIn->subtype)));
DbgLog((LOG_TRACE,5,TEXT("Subtype description %s"),GetSubtypeName(&pmtIn->subtype)));
/* Dump the generic media types */
if (pmtIn->bTemporalCompression) {
DbgLog((LOG_TRACE,dwLevel,TEXT("Temporally compressed")));
DbgLog((LOG_TRACE,5,TEXT("Temporally compressed")));
} else {
DbgLog((LOG_TRACE,dwLevel,TEXT("Not temporally compressed")));
DbgLog((LOG_TRACE,5,TEXT("Not temporally compressed")));
}
if (pmtIn->bFixedSizeSamples) {
DbgLog((LOG_TRACE,dwLevel,TEXT("Sample size %d"),pmtIn->lSampleSize));
DbgLog((LOG_TRACE,5,TEXT("Sample size %d"),pmtIn->lSampleSize));
} else {
DbgLog((LOG_TRACE,dwLevel,TEXT("Variable size samples")));
DbgLog((LOG_TRACE,5,TEXT("Variable size samples")));
}
if (pmtIn->formattype == FORMAT_VideoInfo) {
/* Dump the contents of the BITMAPINFOHEADER structure */
BITMAPINFOHEADER *pbmi = HEADER(pmtIn->pbFormat);
VIDEOINFOHEADER *pVideoInfo = (VIDEOINFOHEADER *)pmtIn->pbFormat;
DbgLog((LOG_TRACE,dwLevel,TEXT("Source rectangle (Left %d Top %d Right %d Bottom %d)"),
pVideoInfo->rcSource.left,
pVideoInfo->rcSource.top,
pVideoInfo->rcSource.right,
pVideoInfo->rcSource.bottom));
VIDEOINFOHEADER *pVideoInfo = (VIDEOINFOHEADER *)pmtIn->pbFormat;
DbgLog((LOG_TRACE,dwLevel,TEXT("Target rectangle (Left %d Top %d Right %d Bottom %d)"),
pVideoInfo->rcTarget.left,
pVideoInfo->rcTarget.top,
pVideoInfo->rcTarget.right,
pVideoInfo->rcTarget.bottom));
DisplayRECT(TEXT("Source rectangle"),pVideoInfo->rcSource);
DisplayRECT(TEXT("Target rectangle"),pVideoInfo->rcTarget);
DisplayBITMAPINFO(HEADER(pmtIn->pbFormat));
DbgLog((LOG_TRACE,dwLevel,TEXT("Size of BITMAPINFO structure %d"),pbmi->biSize));
if (pbmi->biCompression < 256) {
DbgLog((LOG_TRACE,dwLevel,TEXT("%dx%dx%d bit (%d)"),
pbmi->biWidth, pbmi->biHeight,
pbmi->biBitCount, pbmi->biCompression));
} else {
DbgLog((LOG_TRACE,dwLevel,TEXT("%dx%dx%d bit '%4.4hs'"),
pbmi->biWidth, pbmi->biHeight,
pbmi->biBitCount, &pbmi->biCompression));
}
} if (pmtIn->formattype == FORMAT_VideoInfo2) {
DbgLog((LOG_TRACE,dwLevel,TEXT("Image size %d"),pbmi->biSizeImage));
DbgLog((LOG_TRACE,dwLevel,TEXT("Planes %d"),pbmi->biPlanes));
DbgLog((LOG_TRACE,dwLevel,TEXT("X Pels per metre %d"),pbmi->biXPelsPerMeter));
DbgLog((LOG_TRACE,dwLevel,TEXT("Y Pels per metre %d"),pbmi->biYPelsPerMeter));
DbgLog((LOG_TRACE,dwLevel,TEXT("Colours used %d"),pbmi->biClrUsed));
VIDEOINFOHEADER2 *pVideoInfo2 = (VIDEOINFOHEADER2 *)pmtIn->pbFormat;
DisplayRECT(TEXT("Source rectangle"),pVideoInfo2->rcSource);
DisplayRECT(TEXT("Target rectangle"),pVideoInfo2->rcTarget);
DbgLog((LOG_TRACE, 5, TEXT("Aspect Ratio: %d:%d"),
pVideoInfo2->dwPictAspectRatioX,
pVideoInfo2->dwPictAspectRatioY));
DisplayBITMAPINFO(&pVideoInfo2->bmiHeader);
} else if (pmtIn->majortype == MEDIATYPE_Audio) {
DbgLog((LOG_TRACE,dwLevel,TEXT(" Format type %hs"),
GuidNames[pmtIn->formattype]));
DbgLog((LOG_TRACE,dwLevel,TEXT(" Subtype %hs"),
GuidNames[pmtIn->subtype]));
DbgLog((LOG_TRACE,2,TEXT(" Format type %hs"),
GuidNames[pmtIn->formattype]));
DbgLog((LOG_TRACE,2,TEXT(" Subtype %hs"),
GuidNames[pmtIn->subtype]));
if ((pmtIn->subtype != MEDIASUBTYPE_MPEG1Packet)
&& (pmtIn->cbFormat >= sizeof(PCMWAVEFORMAT)))
{
/* Dump the contents of the WAVEFORMATEX type-specific format structure */
if ((pmtIn->subtype != MEDIASUBTYPE_MPEG1Packet)
&& (pmtIn->cbFormat >= sizeof(PCMWAVEFORMAT)))
{
/* Dump the contents of the WAVEFORMATEX type-specific format structure */
WAVEFORMATEX *pwfx = (WAVEFORMATEX *) pmtIn->pbFormat;
DbgLog((LOG_TRACE,dwLevel,TEXT("wFormatTag %u"), pwfx->wFormatTag));
DbgLog((LOG_TRACE,dwLevel,TEXT("nChannels %u"), pwfx->nChannels));
DbgLog((LOG_TRACE,dwLevel,TEXT("nSamplesPerSec %lu"), pwfx->nSamplesPerSec));
DbgLog((LOG_TRACE,dwLevel,TEXT("nAvgBytesPerSec %lu"), pwfx->nAvgBytesPerSec));
DbgLog((LOG_TRACE,dwLevel,TEXT("nBlockAlign %u"), pwfx->nBlockAlign));
DbgLog((LOG_TRACE,dwLevel,TEXT("wBitsPerSample %u"), pwfx->wBitsPerSample));
WAVEFORMATEX *pwfx = (WAVEFORMATEX *) pmtIn->pbFormat;
DbgLog((LOG_TRACE,2,TEXT("wFormatTag %u"), pwfx->wFormatTag));
DbgLog((LOG_TRACE,2,TEXT("nChannels %u"), pwfx->nChannels));
DbgLog((LOG_TRACE,2,TEXT("nSamplesPerSec %lu"), pwfx->nSamplesPerSec));
DbgLog((LOG_TRACE,2,TEXT("nAvgBytesPerSec %lu"), pwfx->nAvgBytesPerSec));
DbgLog((LOG_TRACE,2,TEXT("nBlockAlign %u"), pwfx->nBlockAlign));
DbgLog((LOG_TRACE,2,TEXT("wBitsPerSample %u"), pwfx->wBitsPerSample));
/* PCM uses a WAVEFORMAT and does not have the extra size field */
if (pmtIn->cbFormat >= sizeof(WAVEFORMATEX)) {
DbgLog((LOG_TRACE,dwLevel,TEXT("cbSize %u"), pwfx->cbSize));
DbgLog((LOG_TRACE,2,TEXT("cbSize %u"), pwfx->cbSize));
}
} else {
}
} else {
}
} else {
DbgLog((LOG_TRACE,dwLevel,TEXT(" Format type %hs"),
GuidNames[pmtIn->formattype]));
// !!!! should add code to dump wave format, others
DbgLog((LOG_TRACE,2,TEXT(" Format type %hs"),
GuidNames[pmtIn->formattype]));
}
}
void DisplayBITMAPINFO(const BITMAPINFOHEADER* pbmi)
{
DbgLog((LOG_TRACE,5,TEXT("Size of BITMAPINFO structure %d"),pbmi->biSize));
if (pbmi->biCompression < 256) {
DbgLog((LOG_TRACE,2,TEXT("%dx%dx%d bit (%d)"),
pbmi->biWidth, pbmi->biHeight,
pbmi->biBitCount, pbmi->biCompression));
} else {
DbgLog((LOG_TRACE,2,TEXT("%dx%dx%d bit '%4.4hs'"),
pbmi->biWidth, pbmi->biHeight,
pbmi->biBitCount, &pbmi->biCompression));
}
DbgLog((LOG_TRACE,2,TEXT("Image size %d"),pbmi->biSizeImage));
DbgLog((LOG_TRACE,5,TEXT("Planes %d"),pbmi->biPlanes));
DbgLog((LOG_TRACE,5,TEXT("X Pels per metre %d"),pbmi->biXPelsPerMeter));
DbgLog((LOG_TRACE,5,TEXT("Y Pels per metre %d"),pbmi->biYPelsPerMeter));
DbgLog((LOG_TRACE,5,TEXT("Colours used %d"),pbmi->biClrUsed));
}
void DisplayRECT(LPCTSTR szLabel, const RECT& rc)
{
DbgLog((LOG_TRACE,5,TEXT("%s (Left %d Top %d Right %d Bottom %d)"),
szLabel,
rc.left,
rc.top,
rc.right,
rc.bottom));
}
void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel)
{
if( !pGraph )
@ -1340,13 +1395,13 @@ void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel)
FILTER_INFO info;
if (FAILED(pFilter->QueryFilterInfo(&info))) {
DbgLog((LOG_TRACE,dwLevel,TEXT(" Filter [%x] -- failed QueryFilterInfo"), pFilter));
DbgLog((LOG_TRACE,dwLevel,TEXT(" Filter [%p] -- failed QueryFilterInfo"), pFilter));
} else {
QueryFilterInfoReleaseGraph(info);
// !!! should QueryVendorInfo here!
DbgLog((LOG_TRACE,dwLevel,TEXT(" Filter [%x] '%ls'"), pFilter, info.achName));
DbgLog((LOG_TRACE,dwLevel,TEXT(" Filter [%p] '%ls'"), pFilter, info.achName));
IEnumPins *pins;
@ -1356,29 +1411,29 @@ void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel)
IPin *pPin;
while (pins->Next(1, &pPin, &n) == S_OK) {
PIN_INFO info;
PIN_INFO pinInfo;
if (FAILED(pPin->QueryPinInfo(&info))) {
if (FAILED(pPin->QueryPinInfo(&pinInfo))) {
DbgLog((LOG_TRACE,dwLevel,TEXT(" Pin [%x] -- failed QueryPinInfo"), pPin));
} else {
QueryPinInfoReleaseFilter(info);
QueryPinInfoReleaseFilter(pinInfo);
IPin *pPinConnected = NULL;
HRESULT hr = pPin->ConnectedTo(&pPinConnected);
if (pPinConnected) {
DbgLog((LOG_TRACE,dwLevel,TEXT(" Pin [%x] '%ls' [%sput]")
TEXT(" Connected to pin [%x]"),
pPin, info.achName,
info.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out"),
DbgLog((LOG_TRACE,dwLevel,TEXT(" Pin [%p] '%ls' [%sput]")
TEXT(" Connected to pin [%p]"),
pPin, pinInfo.achName,
pinInfo.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out"),
pPinConnected));
pPinConnected->Release();
// perhaps we should really dump the type both ways as a sanity
// check?
if (info.dir == PINDIR_OUTPUT) {
if (pinInfo.dir == PINDIR_OUTPUT) {
AM_MEDIA_TYPE mt;
hr = pPin->ConnectionMediaType(&mt);
@ -1392,8 +1447,8 @@ void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel)
} else {
DbgLog((LOG_TRACE,dwLevel,
TEXT(" Pin [%x] '%ls' [%sput]"),
pPin, info.achName,
info.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out")));
pPin, pinInfo.achName,
pinInfo.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out")));
}
}

View File

@ -3,7 +3,7 @@
//
// Desc: DirectShow base classes - provides debugging facilities.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -64,8 +64,8 @@ enum { CDISP_HEX = 0x01,
// we have registered so that we can dump a list of remaining objects
typedef struct tag_ObjectDesc {
const CHAR *m_szName;
const WCHAR *m_wszName;
LPCSTR m_szName;
LPCWSTR m_wszName;
DWORD m_dwCookie;
tag_ObjectDesc *m_pNext;
} ObjectDesc;
@ -84,7 +84,7 @@ typedef struct tag_ObjectDesc {
void WINAPI DbgInitModuleSettings(bool fTakeMax);
void WINAPI DbgInitModuleName();
DWORD WINAPI DbgRegisterObjectCreation(
const CHAR *szObjectName, const WCHAR *wszObjectName);
LPCSTR szObjectName, LPCWSTR wszObjectName);
BOOL WINAPI DbgRegisterObjectDestruction(DWORD dwCookie);
@ -103,30 +103,30 @@ typedef struct tag_ObjectDesc {
// Display error and logging to the user
void WINAPI DbgAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine);
void WINAPI DbgBreakPoint(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine);
void WINAPI DbgBreakPoint(const TCHAR *pFileName,INT iLine,const TCHAR* szFormatString,...);
void WINAPI DbgAssert(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine);
void WINAPI DbgBreakPoint(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine);
void WINAPI DbgBreakPoint(LPCTSTR pFileName,INT iLine,__format_string LPCTSTR szFormatString,...);
void WINAPI DbgKernelAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine);
void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const TCHAR *pFormat,...);
void WINAPI DbgKernelAssert(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine);
void WINAPI DbgLogInfo(DWORD Type,DWORD Level,__format_string LPCTSTR pFormat,...);
#ifdef UNICODE
void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const CHAR *pFormat,...);
void WINAPI DbgAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLine);
void WINAPI DbgBreakPoint(const CHAR *pCondition,const CHAR *pFileName,INT iLine);
void WINAPI DbgKernelAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLine);
void WINAPI DbgLogInfo(DWORD Type,DWORD Level,__format_string LPCSTR pFormat,...);
void WINAPI DbgAssert(LPCSTR pCondition,LPCSTR pFileName,INT iLine);
void WINAPI DbgBreakPoint(LPCSTR pCondition,LPCSTR pFileName,INT iLine);
void WINAPI DbgKernelAssert(LPCSTR pCondition,LPCSTR pFileName,INT iLine);
#endif
void WINAPI DbgOutString(LPCTSTR psz);
// Debug infinite wait stuff
DWORD WINAPI DbgWaitForSingleObject(HANDLE h);
DWORD WINAPI DbgWaitForMultipleObjects(DWORD nCount,
CONST HANDLE *lpHandles,
__in_ecount(nCount) CONST HANDLE *lpHandles,
BOOL bWaitAll);
void WINAPI DbgSetWaitTimeout(DWORD dwTimeout);
#ifdef __strmif_h__
// Display a media type: Terse at level 2, verbose at level 5
void WINAPI DisplayType(LPTSTR label, const AM_MEDIA_TYPE *pmtIn, DWORD dwLevel = 5);
void WINAPI DisplayType(LPCTSTR label, const AM_MEDIA_TYPE *pmtIn);
// Dump lots of information about a filter graph
void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel);
@ -176,7 +176,7 @@ typedef struct tag_ObjectDesc {
// (public entry points compile to nothing) so if you go trying to call
// any of the private entry points in your source they won't compile
#define NAME(_x_) ((TCHAR *) NULL)
#define NAME(_x_) ((LPTSTR) NULL)
#define DbgInitialise(hInst)
#define DbgTerminate()
@ -236,46 +236,12 @@ typedef struct tag_ObjectDesc {
// CheckPointer(pBar,FALSE)
// }
// These validate pointers when symbol VFWROBUST is defined
// This will normally be defined in debug not retail builds
#ifdef DEBUG
#define VFWROBUST
#endif
#ifdef VFWROBUST
#define ValidateReadPtr(p,cb) \
{if(IsBadReadPtr((PVOID)p,cb) == TRUE) \
DbgBreak("Invalid read pointer");}
#define ValidateWritePtr(p,cb) \
{if(IsBadWritePtr((PVOID)p,cb) == TRUE) \
DbgBreak("Invalid write pointer");}
#define ValidateReadWritePtr(p,cb) \
{ValidateReadPtr(p,cb) ValidateWritePtr(p,cb)}
#define ValidateStringPtr(p) \
{if(IsBadStringPtr((LPCTSTR)p,INFINITE) == TRUE) \
DbgBreak("Invalid string pointer");}
#define ValidateStringPtrA(p) \
{if(IsBadStringPtrA((LPCSTR)p,INFINITE) == TRUE) \
DbgBreak("Invalid ANSI string pointer");}
#define ValidateStringPtrW(p) \
{if(IsBadStringPtrW((LPCWSTR)p,INFINITE) == TRUE) \
DbgBreak("Invalid UNICODE string pointer");}
#else
#define ValidateReadPtr(p,cb) 0
#define ValidateWritePtr(p,cb) 0
#define ValidateReadWritePtr(p,cb) 0
#define ValidateStringPtr(p) 0
#define ValidateStringPtrA(p) 0
#define ValidateStringPtrW(p) 0
#endif
#define ValidateReadPtr(p,cb) 0
#define ValidateWritePtr(p,cb) 0
#define ValidateReadWritePtr(p,cb) 0
#define ValidateStringPtr(p) 0
#define ValidateStringPtrA(p) 0
#define ValidateStringPtrW(p) 0
#ifdef _OBJBASE_H_
@ -326,7 +292,7 @@ public:
CDispBasic() { m_pString = m_String; };
~CDispBasic();
protected:
TCHAR* m_pString; // normally points to m_String... unless too much data
PTCHAR m_pString; // normally points to m_String... unless too much data
TCHAR m_String[50];
};
class CDisp : public CDispBasic
@ -356,12 +322,12 @@ public:
class CAutoTrace
{
private:
const TCHAR* _szBlkName;
LPCTSTR _szBlkName;
const int _level;
static const TCHAR _szEntering[];
static const TCHAR _szLeaving[];
public:
CAutoTrace(const TCHAR* szBlkName, const int level = 15)
CAutoTrace(LPCTSTR szBlkName, const int level = 15)
: _szBlkName(szBlkName), _level(level)
{DbgLog((LOG_TRACE, _level, _szEntering, _szBlkName));}

View File

@ -3,8 +3,7 @@
//
// Desc: DirectShow base classes - implements a non-MFC based generic list
// template class.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -51,7 +50,7 @@
*/
#include "streams.h"
#include <streams.h>
/* set cursor to the position of each element of list in turn */
#define INTERNALTRAVERSELIST(list, cursor) \
@ -78,7 +77,7 @@ for ( cursor = (list).GetTailPositionI() \
cache but no event object so the list cannot be used in calls
to WaitForSingleObject
*/
CBaseList::CBaseList(TCHAR *pName, // Descriptive list name
CBaseList::CBaseList(__in_opt LPCTSTR pName, // Descriptive list name
INT iItems) : // Node cache size
#ifdef DEBUG
CBaseObject(pName),
@ -90,7 +89,7 @@ CBaseList::CBaseList(TCHAR *pName, // Descriptive list name
{
} // constructor
CBaseList::CBaseList(TCHAR *pName) : // Descriptive list name
CBaseList::CBaseList(__in_opt LPCTSTR pName) : // Descriptive list name
#ifdef DEBUG
CBaseObject(pName),
#endif
@ -102,7 +101,7 @@ CBaseList::CBaseList(TCHAR *pName) : // Descriptive list name
} // constructor
#ifdef UNICODE
CBaseList::CBaseList(CHAR *pName, // Descriptive list name
CBaseList::CBaseList(__in_opt LPCSTR pName, // Descriptive list name
INT iItems) : // Node cache size
#ifdef DEBUG
CBaseObject(pName),
@ -114,7 +113,7 @@ CBaseList::CBaseList(CHAR *pName, // Descriptive list name
{
} // constructor
CBaseList::CBaseList(CHAR *pName) : // Descriptive list name
CBaseList::CBaseList(__in_opt LPCSTR pName) : // Descriptive list name
#ifdef DEBUG
CBaseObject(pName),
#endif
@ -181,16 +180,16 @@ void CBaseList::RemoveAll()
enumerators that you have may be invalid (since the node
may be gone).
*/
WXLIST_POSITION CBaseList::GetHeadPositionI() const
__out_opt POSITION CBaseList::GetHeadPositionI() const
{
return (WXLIST_POSITION) m_pFirst;
return (POSITION) m_pFirst;
} // GetHeadPosition
WXLIST_POSITION CBaseList::GetTailPositionI() const
__out_opt POSITION CBaseList::GetTailPositionI() const
{
return (WXLIST_POSITION) m_pLast;
return (POSITION) m_pLast;
} // GetTailPosition
@ -215,7 +214,7 @@ int CBaseList::GetCountI() const
You may still call this function once we return NULL but
we will continue to return a NULL position value
*/
void *CBaseList::GetNextI(WXLIST_POSITION& rp) const
__out void *CBaseList::GetNextI(__inout POSITION& rp) const
{
/* have we reached the end of the list */
@ -231,7 +230,7 @@ void *CBaseList::GetNextI(WXLIST_POSITION& rp) const
CNode *pn = (CNode *) rp;
ASSERT(pn != NULL);
rp = (WXLIST_POSITION) pn->Next();
rp = (POSITION) pn->Next();
/* Get the object at the original position from the list */
@ -249,7 +248,7 @@ void *CBaseList::GetNextI(WXLIST_POSITION& rp) const
then locking would only result in a change from one bad
behaviour to another.
*/
void *CBaseList::GetI(WXLIST_POSITION p) const
__out_opt void *CBaseList::GetI(__in_opt POSITION p) const
{
if (p == NULL) {
return NULL;
@ -261,14 +260,21 @@ void *CBaseList::GetI(WXLIST_POSITION p) const
return pObject;
} //Get
__out void *CBaseList::GetValidI(__in POSITION p) const
{
CNode * pn = (CNode *) p;
void *pObject = pn->GetData();
// ASSERT(pObject != NULL); // NULL pointers in the list are allowed.
return pObject;
} //Get
/* Return the first position in the list which holds the given pointer.
Return NULL if it's not found.
*/
WXLIST_POSITION CBaseList::FindI( void * pObj) const
__out_opt POSITION CBaseList::FindI( __in void * pObj) const
{
WXLIST_POSITION pn;
POSITION pn;
INTERNALTRAVERSELIST(*this, pn){
if (GetI(pn)==pObj) {
return pn;
@ -283,7 +289,7 @@ WXLIST_POSITION CBaseList::FindI( void * pObj) const
from the list, does not free the object itself).
Return the pointer to its object or NULL if empty
*/
void *CBaseList::RemoveHeadI()
__out_opt void *CBaseList::RemoveHeadI()
{
/* All we do is get the head position and ask for that to be deleted.
We could special case this since some of the code path checking
@ -292,7 +298,7 @@ void *CBaseList::RemoveHeadI()
added complexity
*/
return RemoveI((WXLIST_POSITION)m_pFirst);
return RemoveI((POSITION)m_pFirst);
} // RemoveHead
@ -301,7 +307,7 @@ void *CBaseList::RemoveHeadI()
from the list, does not free the object itself).
Return the pointer to its object or NULL if empty
*/
void *CBaseList::RemoveTailI()
__out_opt void *CBaseList::RemoveTailI()
{
/* All we do is get the tail position and ask for that to be deleted.
We could special case this since some of the code path checking
@ -310,7 +316,7 @@ void *CBaseList::RemoveTailI()
added complexity
*/
return RemoveI((WXLIST_POSITION)m_pLast);
return RemoveI((POSITION)m_pLast);
} // RemoveTail
@ -323,7 +329,7 @@ void *CBaseList::RemoveTailI()
it can be used again.
Remove(NULL) is a harmless no-op - but probably is a wart.
*/
void *CBaseList::RemoveI(WXLIST_POSITION pos)
__out_opt void *CBaseList::RemoveI(__in_opt POSITION pos)
{
/* Lock the critical section before continuing */
@ -384,7 +390,7 @@ void *CBaseList::RemoveI(WXLIST_POSITION pos)
Return the new tail position.
*/
WXLIST_POSITION CBaseList::AddTailI(void *pObject)
__out_opt POSITION CBaseList::AddTailI(__in void *pObject)
{
/* Lock the critical section before continuing */
@ -427,7 +433,7 @@ WXLIST_POSITION CBaseList::AddTailI(void *pObject)
m_pLast = pNode;
++m_Count;
return (WXLIST_POSITION) pNode;
return (POSITION) pNode;
} // AddTail(object)
@ -435,7 +441,7 @@ WXLIST_POSITION CBaseList::AddTailI(void *pObject)
/* Add this object to the head end of our list
Return the new head position.
*/
WXLIST_POSITION CBaseList::AddHeadI(void *pObject)
__out_opt POSITION CBaseList::AddHeadI(__in void *pObject)
{
CNode *pNode;
// ASSERT(pObject); // NULL pointers in the list are allowed.
@ -473,7 +479,7 @@ WXLIST_POSITION CBaseList::AddHeadI(void *pObject)
++m_Count;
return (WXLIST_POSITION) pNode;
return (POSITION) pNode;
} // AddHead(object)
@ -482,14 +488,14 @@ WXLIST_POSITION CBaseList::AddHeadI(void *pObject)
Return TRUE if it all worked, FALSE if it didn't.
If it fails some elements may have been added.
*/
BOOL CBaseList::AddTail(CBaseList *pList)
BOOL CBaseList::AddTail(__in CBaseList *pList)
{
/* lock the object before starting then enumerate
each entry in the source list and add them one by one to
our list (while still holding the object lock)
Lock the other list too.
*/
WXLIST_POSITION pos = pList->GetHeadPositionI();
POSITION pos = pList->GetHeadPositionI();
while (pos) {
if (NULL == AddTailI(pList->GetNextI(pos))) {
@ -505,7 +511,7 @@ BOOL CBaseList::AddTail(CBaseList *pList)
Return TRUE if it all worked, FALSE if it didn't.
If it fails some elements may have been added.
*/
BOOL CBaseList::AddHead(CBaseList *pList)
BOOL CBaseList::AddHead(__in CBaseList *pList)
{
/* lock the object before starting then enumerate
each entry in the source list and add them one by one to
@ -515,10 +521,10 @@ BOOL CBaseList::AddHead(CBaseList *pList)
To avoid reversing the list, traverse it backwards.
*/
WXLIST_POSITION pos;
POSITION pos;
INTERNALREVERSETRAVERSELIST(*pList, pos) {
if (NULL== AddHeadI(pList->GetI(pos))){
if (NULL== AddHeadI(pList->GetValidI(pos))){
return FALSE;
}
}
@ -532,7 +538,7 @@ BOOL CBaseList::AddHead(CBaseList *pList)
AddAfter(NULL,x) adds x to the start - same as AddHead
Return the position of the new object, NULL if it failed
*/
WXLIST_POSITION CBaseList::AddAfterI(WXLIST_POSITION pos, void * pObj)
__out_opt POSITION CBaseList::AddAfterI(__in_opt POSITION pos, __in void * pObj)
{
if (pos==NULL)
return AddHeadI(pObj);
@ -578,18 +584,18 @@ WXLIST_POSITION CBaseList::AddAfterI(WXLIST_POSITION pos, void * pObj)
++m_Count;
return (WXLIST_POSITION) pNode;
return (POSITION) pNode;
} // AddAfter(object)
BOOL CBaseList::AddAfter(WXLIST_POSITION p, CBaseList *pList)
BOOL CBaseList::AddAfter(__in_opt POSITION p, __in CBaseList *pList)
{
WXLIST_POSITION pos;
POSITION pos;
INTERNALTRAVERSELIST(*pList, pos) {
/* p follows along the elements being added */
p = AddAfterI(p, pList->GetI(pos));
p = AddAfterI(p, pList->GetValidI(pos));
if (p==NULL) return FALSE;
}
return TRUE;
@ -602,7 +608,7 @@ BOOL CBaseList::AddAfter(WXLIST_POSITION p, CBaseList *pList)
p is still valid after the operation.
AddBefore(NULL,x) adds x to the end - same as AddTail
*/
WXLIST_POSITION CBaseList::AddBeforeI(WXLIST_POSITION pos, void * pObj)
__out_opt POSITION CBaseList::AddBeforeI(__in_opt POSITION pos, __in void * pObj)
{
if (pos==NULL)
return AddTailI(pObj);
@ -646,18 +652,18 @@ WXLIST_POSITION CBaseList::AddBeforeI(WXLIST_POSITION pos, void * pObj)
++m_Count;
return (WXLIST_POSITION) pNode;
return (POSITION) pNode;
} // Addbefore(object)
BOOL CBaseList::AddBefore(WXLIST_POSITION p, CBaseList *pList)
BOOL CBaseList::AddBefore(__in_opt POSITION p, __in CBaseList *pList)
{
WXLIST_POSITION pos;
POSITION pos;
INTERNALREVERSETRAVERSELIST(*pList, pos) {
/* p follows along the elements being added */
p = AddBeforeI(p, pList->GetI(pos));
p = AddBeforeI(p, pList->GetValidI(pos));
if (p==NULL) return FALSE;
}
return TRUE;
@ -682,7 +688,7 @@ BOOL CBaseList::AddBefore(WXLIST_POSITION p, CBaseList *pList)
MoveElementsFromHeadThroughPositionToOtherTail
*/
BOOL CBaseList::MoveToTail
(WXLIST_POSITION pos, CBaseList *pList)
(__in_opt POSITION pos, __in CBaseList *pList)
{
/* Algorithm:
Note that the elements (including their order) in the concatenation
@ -756,7 +762,7 @@ BOOL CBaseList::MoveToTail
concatenates foo onto the start of bar and empties foo.
*/
BOOL CBaseList::MoveToHead
(WXLIST_POSITION pos, CBaseList *pList)
(__in_opt POSITION pos, __in CBaseList *pList)
{
/* See the comments on the algorithm in MoveToTail */

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - defines a non-MFC generic template list
// class.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -49,8 +49,10 @@
This definition is the same as the POSITION type for MFCs, so we must
avoid defining it twice.
*/
struct __WXLIST_POSITION { int unused; };
typedef __WXLIST_POSITION* WXLIST_POSITION;
#ifndef __AFX_H__
struct __POSITION { int unused; };
typedef __POSITION* POSITION;
#endif
const int DEFAULTCACHE = 10; /* Default node object cache size */
@ -93,27 +95,27 @@ public:
/* Return the previous node before this one */
CNode *Prev() const { return m_pPrev; };
__out CNode *Prev() const { return m_pPrev; };
/* Return the next node after this one */
CNode *Next() const { return m_pNext; };
__out CNode *Next() const { return m_pNext; };
/* Set the previous node before this one */
void SetPrev(CNode *p) { m_pPrev = p; };
void SetPrev(__in_opt CNode *p) { m_pPrev = p; };
/* Set the next node after this one */
void SetNext(CNode *p) { m_pNext = p; };
void SetNext(__in_opt CNode *p) { m_pNext = p; };
/* Get the pointer to the object for this node */
void *GetData() const { return m_pObject; };
__out void *GetData() const { return m_pObject; };
/* Set the pointer to the object for this node */
void SetData(void *p) { m_pObject = p; };
void SetData(__in void *p) { m_pObject = p; };
};
class CNodeCache
@ -131,7 +133,7 @@ public:
delete pCurrent;
}
};
void AddToCache(CNode *pNode)
void AddToCache(__inout CNode *pNode)
{
if (m_iUsed < m_iCacheSize) {
pNode->SetNext(m_pHead);
@ -187,15 +189,15 @@ private:
public:
CBaseList(TCHAR *pName,
CBaseList(__in_opt LPCTSTR pName,
INT iItems);
CBaseList(TCHAR *pName);
CBaseList(__in_opt LPCTSTR pName);
#ifdef UNICODE
CBaseList(CHAR *pName,
CBaseList(__in_opt LPCSTR pName,
INT iItems);
CBaseList(CHAR *pName);
CBaseList(__in_opt LPCSTR pName);
#endif
~CBaseList();
@ -204,11 +206,11 @@ public:
/* Return a cursor which identifies the first element of *this */
WXLIST_POSITION GetHeadPositionI() const;
__out_opt POSITION GetHeadPositionI() const;
/* Return a cursor which identifies the last element of *this */
WXLIST_POSITION GetTailPositionI() const;
__out_opt POSITION GetTailPositionI() const;
/* Return the number of objects in *this */
@ -222,13 +224,14 @@ protected:
GetPrev is not implemented.
Use Next, Prev and Get separately.
*/
void *GetNextI(WXLIST_POSITION& rp) const;
__out void *GetNextI(__inout POSITION& rp) const;
/* Return a pointer to the object at p
Asking for the object at NULL will return NULL harmlessly.
*/
void *GetI(WXLIST_POSITION p) const;
__out_opt void *GetI(__in_opt POSITION p) const;
__out void *GetValidI(__in POSITION p) const;
public:
/* return the next / prev position in *this
@ -246,32 +249,32 @@ public:
2. If you are keeping a list sorted (fairly common) and you
search forward for an element to insert before and don't
find it you finish up with NULL as the element before which
to insert. You then want that NULL to be a valid WXLIST_POSITION
to insert. You then want that NULL to be a valid POSITION
so that you can insert before it and you want that insertion
point to mean the (n+1)-th one that doesn't have a WXLIST_POSITION.
point to mean the (n+1)-th one that doesn't have a POSITION.
(symmetrically if you are working backwards through the list).
3. It simplifies the algebra which the methods generate.
e.g. AddBefore(p,x) is identical to AddAfter(Prev(p),x)
in ALL cases. All the other arguments probably are reflections
of the algebraic point.
*/
WXLIST_POSITION Next(WXLIST_POSITION pos) const
__out_opt POSITION Next(__in_opt POSITION pos) const
{
if (pos == NULL) {
return (WXLIST_POSITION) m_pFirst;
return (POSITION) m_pFirst;
}
CNode *pn = (CNode *) pos;
return (WXLIST_POSITION) pn->Next();
return (POSITION) pn->Next();
} //Next
// See Next
WXLIST_POSITION Prev(WXLIST_POSITION pos) const
__out_opt POSITION Prev(__in_opt POSITION pos) const
{
if (pos == NULL) {
return (WXLIST_POSITION) m_pLast;
return (POSITION) m_pLast;
}
CNode *pn = (CNode *) pos;
return (WXLIST_POSITION) pn->Prev();
return (POSITION) pn->Prev();
} //Prev
@ -279,14 +282,20 @@ public:
pointer. Return NULL if the pointer was not not found.
*/
protected:
WXLIST_POSITION FindI( void * pObj) const;
__out_opt POSITION FindI( __in void * pObj) const;
// ??? Should there be (or even should there be only)
// ??? POSITION FindNextAfter(void * pObj, POSITION p)
// ??? And of course FindPrevBefore too.
// ??? List.Find(&Obj) then becomes List.FindNextAfter(&Obj, NULL)
/* Remove the first node in *this (deletes the pointer to its
object from the list, does not free the object itself).
Return the pointer to its object.
If *this was already empty it will harmlessly return NULL.
*/
void *RemoveHeadI();
__out_opt void *RemoveHeadI();
/* Remove the last node in *this (deletes the pointer to its
@ -294,7 +303,7 @@ protected:
Return the pointer to its object.
If *this was already empty it will harmlessly return NULL.
*/
void *RemoveTailI();
__out_opt void *RemoveTailI();
/* Remove the node identified by p from the list (deletes the pointer
@ -302,14 +311,14 @@ protected:
Asking to Remove the object at NULL will harmlessly return NULL.
Return the pointer to the object removed.
*/
void *RemoveI(WXLIST_POSITION p);
__out_opt void *RemoveI(__in_opt POSITION p);
/* Add single object *pObj to become a new last element of the list.
Return the new tail position, NULL if it fails.
If you are adding a COM objects, you might want AddRef it first.
Other existing POSITIONs in *this are still valid
*/
WXLIST_POSITION AddTailI(void * pObj);
__out_opt POSITION AddTailI(__in void * pObj);
public:
@ -324,7 +333,7 @@ public:
If you actually want to MOVE the elements, use MoveToTail instead.
*/
BOOL AddTail(CBaseList *pList);
BOOL AddTail(__in CBaseList *pList);
/* Mirror images of AddHead: */
@ -334,7 +343,7 @@ public:
Existing POSITIONs in *this are still valid
*/
protected:
WXLIST_POSITION AddHeadI(void * pObj);
__out_opt POSITION AddHeadI(__in void * pObj);
public:
/* Add all the elements in *pList to the head of *this.
@ -344,7 +353,7 @@ public:
If you actually want to MOVE the elements, use MoveToHead instead.
*/
BOOL AddHead(CBaseList *pList);
BOOL AddHead(__in CBaseList *pList);
/* Add the object *pObj to *this after position p in *this.
@ -353,7 +362,7 @@ public:
Existing POSITIONs in *this are undisturbed, including p.
*/
protected:
WXLIST_POSITION AddAfterI(WXLIST_POSITION p, void * pObj);
__out_opt POSITION AddAfterI(__in_opt POSITION p, __in void * pObj);
public:
/* Add the list *pList to *this after position p in *this
@ -362,7 +371,7 @@ public:
If it fails, some of the objects may be added
Existing POSITIONs in *this are undisturbed, including p.
*/
BOOL AddAfter(WXLIST_POSITION p, CBaseList *pList);
BOOL AddAfter(__in_opt POSITION p, __in CBaseList *pList);
/* Mirror images:
@ -372,7 +381,7 @@ public:
Existing POSITIONs in *this are undisturbed, including p.
*/
protected:
WXLIST_POSITION AddBeforeI(WXLIST_POSITION p, void * pObj);
__out_opt POSITION AddBeforeI(__in_opt POSITION p, __in void * pObj);
public:
/* Add the list *pList to *this before position p in *this
@ -381,7 +390,7 @@ public:
If it fails, some of the objects may be added
Existing POSITIONs in *this are undisturbed, including p.
*/
BOOL AddBefore(WXLIST_POSITION p, CBaseList *pList);
BOOL AddBefore(__in_opt POSITION p, __in CBaseList *pList);
/* Note that AddAfter(p,x) is equivalent to AddBefore(Next(p),x)
@ -425,7 +434,7 @@ public:
(and quite a few no-ops)
!!WARNING!! The type checking won't buy you much if you get list
positions muddled up - e.g. use a WXLIST_POSITION that's in a different
positions muddled up - e.g. use a POSITION that's in a different
list and see what a mess you get!
*/
@ -445,7 +454,7 @@ public:
A better, except excessively long name might be
MoveElementsFromHeadThroughPositionToOtherTail
*/
BOOL MoveToTail(WXLIST_POSITION pos, CBaseList *pList);
BOOL MoveToTail(__in_opt POSITION pos, __in CBaseList *pList);
/* Mirror image:
@ -461,7 +470,7 @@ public:
foo->MoveToHead(foo->GetHeadPosition, bar);
concatenates foo onto the start of bar and empties foo.
*/
BOOL MoveToHead(WXLIST_POSITION pos, CBaseList *pList);
BOOL MoveToHead(__in_opt POSITION pos, __in CBaseList *pList);
/* Reverse the order of the [pointers to] objects in *this
@ -491,7 +500,7 @@ public:
template<class OBJECT> class CGenericList : public CBaseList
{
public:
CGenericList(TCHAR *pName,
CGenericList(__in_opt LPCTSTR pName,
INT iItems,
BOOL bLock = TRUE,
BOOL bAlert = FALSE) :
@ -499,37 +508,38 @@ public:
UNREFERENCED_PARAMETER(bAlert);
UNREFERENCED_PARAMETER(bLock);
};
CGenericList(TCHAR *pName) :
CGenericList(__in_opt LPCTSTR pName) :
CBaseList(pName) {
};
WXLIST_POSITION GetHeadPosition() const { return (WXLIST_POSITION)m_pFirst; }
WXLIST_POSITION GetTailPosition() const { return (WXLIST_POSITION)m_pLast; }
__out_opt POSITION GetHeadPosition() const { return (POSITION)m_pFirst; }
__out_opt POSITION GetTailPosition() const { return (POSITION)m_pLast; }
int GetCount() const { return m_Count; }
OBJECT *GetNext(WXLIST_POSITION& rp) const { return (OBJECT *) GetNextI(rp); }
__out OBJECT *GetNext(__inout POSITION& rp) const { return (OBJECT *) GetNextI(rp); }
OBJECT *Get(WXLIST_POSITION p) const { return (OBJECT *) GetI(p); }
OBJECT *GetHead() const { return Get(GetHeadPosition()); }
__out_opt OBJECT *Get(__in_opt POSITION p) const { return (OBJECT *) GetI(p); }
__out OBJECT *GetValid(__in POSITION p) const { return (OBJECT *) GetValidI(p); }
__out_opt OBJECT *GetHead() const { return Get(GetHeadPosition()); }
OBJECT *RemoveHead() { return (OBJECT *) RemoveHeadI(); }
__out_opt OBJECT *RemoveHead() { return (OBJECT *) RemoveHeadI(); }
OBJECT *RemoveTail() { return (OBJECT *) RemoveTailI(); }
__out_opt OBJECT *RemoveTail() { return (OBJECT *) RemoveTailI(); }
OBJECT *Remove(WXLIST_POSITION p) { return (OBJECT *) RemoveI(p); }
WXLIST_POSITION AddBefore(WXLIST_POSITION p, OBJECT * pObj) { return AddBeforeI(p, pObj); }
WXLIST_POSITION AddAfter(WXLIST_POSITION p, OBJECT * pObj) { return AddAfterI(p, pObj); }
WXLIST_POSITION AddHead(OBJECT * pObj) { return AddHeadI(pObj); }
WXLIST_POSITION AddTail(OBJECT * pObj) { return AddTailI(pObj); }
BOOL AddTail(CGenericList<OBJECT> *pList)
__out_opt OBJECT *Remove(__in_opt POSITION p) { return (OBJECT *) RemoveI(p); }
__out_opt POSITION AddBefore(__in_opt POSITION p, __in OBJECT * pObj) { return AddBeforeI(p, pObj); }
__out_opt POSITION AddAfter(__in_opt POSITION p, __in OBJECT * pObj) { return AddAfterI(p, pObj); }
__out_opt POSITION AddHead(__in OBJECT * pObj) { return AddHeadI(pObj); }
__out_opt POSITION AddTail(__in OBJECT * pObj) { return AddTailI(pObj); }
BOOL AddTail(__in CGenericList<OBJECT> *pList)
{ return CBaseList::AddTail((CBaseList *) pList); }
BOOL AddHead(CGenericList<OBJECT> *pList)
BOOL AddHead(__in CGenericList<OBJECT> *pList)
{ return CBaseList::AddHead((CBaseList *) pList); }
BOOL AddAfter(WXLIST_POSITION p, CGenericList<OBJECT> *pList)
BOOL AddAfter(__in_opt POSITION p, __in CGenericList<OBJECT> *pList)
{ return CBaseList::AddAfter(p, (CBaseList *) pList); };
BOOL AddBefore(WXLIST_POSITION p, CGenericList<OBJECT> *pList)
BOOL AddBefore(__in_opt POSITION p, __in CGenericList<OBJECT> *pList)
{ return CBaseList::AddBefore(p, (CBaseList *) pList); };
WXLIST_POSITION Find( OBJECT * pObj) const { return FindI(pObj); }
__out_opt POSITION Find( __in OBJECT * pObj) const { return FindI(pObj); }
}; // end of class declaration

View File

@ -4,69 +4,34 @@
// Desc: DirectShow base classes - implements helper classes for building
// multimedia filters.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "streams.h"
#include <streams.h>
#define STRSAFE_NO_DEPRECATE
#include <strsafe.h>
//
// Declare function from largeint.h we need so that PPC can build
//
//
// Enlarged integer divide - 64-bits / 32-bits > 32-bits
//
#ifndef _X86_
#define LLtoU64(x) (*(unsigned __int64*)(void*)(&(x)))
__inline
ULONG
WINAPI
EnlargedUnsignedDivide (
IN ULARGE_INTEGER Dividend,
IN ULONG Divisor,
IN PULONG Remainder
)
{
// return remainder if necessary
if (Remainder != NULL)
*Remainder = (ULONG)(LLtoU64(Dividend) % Divisor);
return (ULONG)(LLtoU64(Dividend) / Divisor);
}
#else
__inline
ULONG
WINAPI
EnlargedUnsignedDivide (
IN ULARGE_INTEGER Dividend,
IN ULONG Divisor,
IN PULONG Remainder
)
{
ULONG ulResult;
_asm {
mov eax,Dividend.LowPart
mov edx,Dividend.HighPart
mov ecx,Remainder
div Divisor
or ecx,ecx
jz short label
mov [ecx],edx
label:
mov ulResult,eax
}
return ulResult;
}
#endif
// --- CAMEvent -----------------------
CAMEvent::CAMEvent(BOOL fManualReset)
CAMEvent::CAMEvent(BOOL fManualReset, __inout_opt HRESULT *phr)
{
m_hEvent = CreateEvent(NULL, fManualReset, FALSE, NULL);
if (NULL == m_hEvent) {
if (NULL != phr && SUCCEEDED(*phr)) {
*phr = E_OUTOFMEMORY;
}
}
}
CAMEvent::CAMEvent(__inout_opt HRESULT *phr)
{
m_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
if (NULL == m_hEvent) {
if (NULL != phr && SUCCEEDED(*phr)) {
*phr = E_OUTOFMEMORY;
}
}
}
CAMEvent::~CAMEvent()
@ -80,6 +45,10 @@ CAMEvent::~CAMEvent()
// --- CAMMsgEvent -----------------------
// One routine. The rest is handled in CAMEvent
CAMMsgEvent::CAMMsgEvent(__inout_opt HRESULT *phr) : CAMEvent(FALSE, phr)
{
}
BOOL CAMMsgEvent::WaitMsg(DWORD dwTimeout)
{
// wait for the event to be signalled, or for the
@ -127,8 +96,9 @@ BOOL CAMMsgEvent::WaitMsg(DWORD dwTimeout)
// --- CAMThread ----------------------
CAMThread::CAMThread()
: m_EventSend(TRUE) // must be manual-reset for CheckRequest()
CAMThread::CAMThread(__inout_opt HRESULT *phr)
: m_EventSend(TRUE, phr), // must be manual-reset for CheckRequest()
m_EventComplete(FALSE, phr)
{
m_hThread = NULL;
}
@ -141,7 +111,7 @@ CAMThread::~CAMThread() {
// when the thread starts, it calls this function. We unwrap the 'this'
//pointer and call ThreadProc.
DWORD WINAPI
CAMThread::InitialThreadProc(LPVOID pv)
CAMThread::InitialThreadProc(__inout LPVOID pv)
{
HRESULT hrCoInit = CAMThread::CoInitializeHelper();
if(FAILED(hrCoInit)) {
@ -218,7 +188,7 @@ CAMThread::GetRequest()
// is there a request?
BOOL
CAMThread::CheckRequest(DWORD * pParam)
CAMThread::CheckRequest(__out_opt DWORD * pParam)
{
if (!m_EventSend.Check()) {
return FALSE;
@ -296,7 +266,7 @@ CMsgThread::~CMsgThread()
EXECUTE_ASSERT(CloseHandle(m_hThread));
}
WXLIST_POSITION pos = m_ThreadQueue.GetHeadPosition();
POSITION pos = m_ThreadQueue.GetHeadPosition();
while (pos) {
CMsg * pMsg = m_ThreadQueue.GetNext(pos);
delete pMsg;
@ -330,7 +300,7 @@ CMsgThread::CreateThread(
DWORD WINAPI
CMsgThread::DefaultThreadProc(
LPVOID lpParam
__inout LPVOID lpParam
)
{
CMsgThread *lpThis = (CMsgThread *)lpParam;
@ -359,7 +329,7 @@ CMsgThread::DefaultThreadProc(
// Block until the next message is placed on the list m_ThreadQueue.
// copies the message to the message pointed to by *pmsg
void
CMsgThread::GetThreadMsg(CMsg *msg)
CMsgThread::GetThreadMsg(__out CMsg *msg)
{
CMsg * pmsg = NULL;
@ -385,207 +355,24 @@ CMsgThread::GetThreadMsg(CMsg *msg)
}
// NOTE: as we need to use the same binaries on Win95 as on NT this code should
// be compiled WITHOUT unicode being defined. Otherwise we will not pick up
// these internal routines and the binary will not run on Win95.
#ifndef UNICODE
// Windows 95 doesn't implement this, so we provide an implementation.
// LPWSTR
// WINAPI
// lstrcpyWInternal(
// LPWSTR lpString1,
// LPCWSTR lpString2
// )
// {
// LPWSTR lpReturn = lpString1;
// while (*lpString1++ = *lpString2++);
//
// return lpReturn;
// }
// Windows 95 doesn't implement this, so we provide an implementation.
LPWSTR
WINAPI
lstrcpynWInternal(
LPWSTR lpString1,
LPCWSTR lpString2,
int iMaxLength
)
{
ASSERT(iMaxLength);
LPWSTR lpReturn = lpString1;
if (iMaxLength) {
while (--iMaxLength) {
if (!*lpString2) break;
*lpString1++ = *lpString2++;
};
// If we ran out of room (which will be the case if
// iMaxLength is now 0) we still need to terminate the
// string.
if (!iMaxLength) *lpString1 = L'\0';
}
return lpReturn;
}
int
WINAPI
lstrcmpWInternal(
LPCWSTR lpString1,
LPCWSTR lpString2
)
{
do {
WCHAR c1 = *lpString1;
WCHAR c2 = *lpString2;
if (c1 != c2)
return (int) c1 - (int) c2;
} while (*lpString1++ && *lpString2++);
return 0;
}
int
WINAPI
lstrcmpiWInternal(
LPCWSTR lpString1,
LPCWSTR lpString2
)
{
do {
WCHAR c1 = *lpString1;
WCHAR c2 = *lpString2;
if (c1 >= L'A' && c1 <= L'Z')
c1 -= (WCHAR) (L'A' - L'a');
if (c2 >= L'A' && c2 <= L'Z')
c2 -= (WCHAR) (L'A' - L'a');
if (c1 != c2)
return (int) c1 - (int) c2;
} while (*lpString1++ && *lpString2++);
return 0;
}
int
WINAPI
lstrlenWInternal(
LPCWSTR lpString
)
{
int i = -1;
while (*(lpString+(++i)))
;
return i;
}
// int WINAPIV wsprintfWInternal(LPWSTR wszOut, LPCWSTR pszFmt, ...)
// {
// char fmt[256]; // !!!
// char ach[256]; // !!!
// int i;
//
// va_list va;
// va_start(va, pszFmt);
// WideCharToMultiByte(GetACP(), 0, pszFmt, -1, fmt, 256, NULL, NULL);
// (void)StringCchVPrintf(ach, NUMELMS(ach), fmt, va);
// i = lstrlenA(ach);
// va_end(va);
//
// MultiByteToWideChar(CP_ACP, 0, ach, -1, wszOut, i+1);
//
// return i;
// }
#else
// need to provide the implementations in unicode for non-unicode
// builds linking with the unicode strmbase.lib
//LPWSTR WINAPI lstrcpyWInternal(
// LPWSTR lpString1,
// LPCWSTR lpString2
// )
//{
// return lstrcpyW(lpString1, lpString2);
//}
LPWSTR WINAPI lstrcpynWInternal(
LPWSTR lpString1,
LPCWSTR lpString2,
int iMaxLength
)
{
return lstrcpynW(lpString1, lpString2, iMaxLength);
}
int WINAPI lstrcmpWInternal(
LPCWSTR lpString1,
LPCWSTR lpString2
)
{
return lstrcmpW(lpString1, lpString2);
}
int WINAPI lstrcmpiWInternal(
LPCWSTR lpString1,
LPCWSTR lpString2
)
{
return lstrcmpiW(lpString1, lpString2);
}
int WINAPI lstrlenWInternal(
LPCWSTR lpString
)
{
return lstrlenW(lpString);
}
//int WINAPIV wsprintfWInternal(
// LPWSTR wszOut, LPCWSTR pszFmt, ...)
//{
// va_list va;
// va_start(va, pszFmt);
// int i = wvsprintfW(wszOut, pszFmt, va);
// va_end(va);
// return i;
//}
#endif
// Helper function - convert int to WSTR
void WINAPI IntToWstr(int i, LPWSTR wstr, size_t len)
void WINAPI IntToWstr(int i, __out_ecount(12) LPWSTR wstr)
{
#ifdef UNICODE
(void)StringCchPrintf(wstr, len, L"%d", i);
if (FAILED(StringCchPrintf(wstr, 12, L"%d", i))) {
wstr[0] = 0;
}
#else
TCHAR temp[32];
(void)StringCchPrintf(temp, NUMELMS(temp), "%d", i);
MultiByteToWideChar(CP_ACP, 0, temp, -1, wstr, int(len) );
TCHAR temp[12];
if (FAILED(StringCchPrintf(temp, NUMELMS(temp), "%d", i))) {
wstr[0] = 0;
} else {
MultiByteToWideChar(CP_ACP, 0, temp, -1, wstr, 12);
}
#endif
} // IntToWstr
#if 0
void * memchrInternal(const void *pv, int c, size_t sz)
{
BYTE *pb = (BYTE *) pv;
while (sz--) {
if (*pb == c)
return (void *) pb;
pb++;
}
return NULL;
}
#endif
#define MEMORY_ALIGNMENT 4
#define MEMORY_ALIGNMENT_LOG2 2
#define MEMORY_ALIGNMENT_MASK MEMORY_ALIGNMENT - 1
@ -642,301 +429,33 @@ memmove_done:
return ret;
}
/* Arithmetic functions to help with time format conversions
*/
#ifdef _M_ALPHA
// work around bug in version 12.00.8385 of the alpha compiler where
// UInt32x32To64 sign-extends its arguments (?)
#undef UInt32x32To64
#define UInt32x32To64(a, b) (((ULONGLONG)((ULONG)(a)) & 0xffffffff) * ((ULONGLONG)((ULONG)(b)) & 0xffffffff))
#endif
/* Compute (a * b + d) / c */
LONGLONG WINAPI llMulDiv(LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG d)
HRESULT AMSafeMemMoveOffset(
__in_bcount(dst_size) void * dst,
__in size_t dst_size,
__in DWORD cb_dst_offset,
__in_bcount(src_size) const void * src,
__in size_t src_size,
__in DWORD cb_src_offset,
__in size_t count)
{
/* Compute the absolute values to avoid signed arithmetic problems */
ULARGE_INTEGER ua, ub;
DWORDLONG uc;
ua.QuadPart = (DWORDLONG)(a >= 0 ? a : -a);
ub.QuadPart = (DWORDLONG)(b >= 0 ? b : -b);
uc = (DWORDLONG)(c >= 0 ? c : -c);
BOOL bSign = (a < 0) ^ (b < 0);
/* Do long multiplication */
ULARGE_INTEGER p[2];
p[0].QuadPart = UInt32x32To64(ua.LowPart, ub.LowPart);
/* This next computation cannot overflow into p[1].HighPart because
the max number we can compute here is:
(2 ** 32 - 1) * (2 ** 32 - 1) + // ua.LowPart * ub.LowPart
(2 ** 32) * (2 ** 31) * (2 ** 32 - 1) * 2 // x.LowPart * y.HighPart * 2
== 2 ** 96 - 2 ** 64 + (2 ** 64 - 2 ** 33 + 1)
== 2 ** 96 - 2 ** 33 + 1
< 2 ** 96
*/
ULARGE_INTEGER x;
x.QuadPart = UInt32x32To64(ua.LowPart, ub.HighPart) +
UInt32x32To64(ua.HighPart, ub.LowPart) +
p[0].HighPart;
p[0].HighPart = x.LowPart;
p[1].QuadPart = UInt32x32To64(ua.HighPart, ub.HighPart) + x.HighPart;
if (d != 0) {
ULARGE_INTEGER ud[2];
if (bSign) {
ud[0].QuadPart = (DWORDLONG)(-d);
if (d > 0) {
/* -d < 0 */
ud[1].QuadPart = (DWORDLONG)(LONGLONG)-1;
} else {
ud[1].QuadPart = (DWORDLONG)0;
}
} else {
ud[0].QuadPart = (DWORDLONG)d;
if (d < 0) {
ud[1].QuadPart = (DWORDLONG)(LONGLONG)-1;
} else {
ud[1].QuadPart = (DWORDLONG)0;
}
}
/* Now do extended addition */
ULARGE_INTEGER uliTotal;
/* Add ls DWORDs */
uliTotal.QuadPart = (DWORDLONG)ud[0].LowPart + p[0].LowPart;
p[0].LowPart = uliTotal.LowPart;
/* Propagate carry */
uliTotal.LowPart = uliTotal.HighPart;
uliTotal.HighPart = 0;
/* Add 2nd most ls DWORDs */
uliTotal.QuadPart += (DWORDLONG)ud[0].HighPart + p[0].HighPart;
p[0].HighPart = uliTotal.LowPart;
/* Propagate carry */
uliTotal.LowPart = uliTotal.HighPart;
uliTotal.HighPart = 0;
/* Add MS DWORDLONGs - no carry expected */
p[1].QuadPart += ud[1].QuadPart + uliTotal.QuadPart;
/* Now see if we got a sign change from the addition */
if ((LONG)p[1].HighPart < 0) {
bSign = !bSign;
/* Negate the current value (ugh!) */
p[0].QuadPart = ~p[0].QuadPart;
p[1].QuadPart = ~p[1].QuadPart;
p[0].QuadPart += 1;
p[1].QuadPart += (p[0].QuadPart == 0);
}
// prevent read overruns
if( count + cb_src_offset < count || // prevent integer overflow
count + cb_src_offset > src_size) // prevent read overrun
{
return E_INVALIDARG;
}
/* Now for the division */
if (c < 0) {
bSign = !bSign;
// prevent write overruns
if( count + cb_dst_offset < count || // prevent integer overflow
count + cb_dst_offset > dst_size) // prevent write overrun
{
return E_INVALIDARG;
}
/* This will catch c == 0 and overflow */
if (uc <= p[1].QuadPart) {
return bSign ? (LONGLONG)0x8000000000000000 :
(LONGLONG)0x7FFFFFFFFFFFFFFF;
}
DWORDLONG ullResult;
/* Do the division */
/* If the dividend is a DWORD_LONG use the compiler */
if (p[1].QuadPart == 0) {
ullResult = p[0].QuadPart / uc;
return bSign ? -(LONGLONG)ullResult : (LONGLONG)ullResult;
}
/* If the divisor is a DWORD then its simpler */
ULARGE_INTEGER ulic;
ulic.QuadPart = uc;
if (ulic.HighPart == 0) {
ULARGE_INTEGER uliDividend;
ULARGE_INTEGER uliResult;
DWORD dwDivisor = (DWORD)uc;
// ASSERT(p[1].HighPart == 0 && p[1].LowPart < dwDivisor);
uliDividend.HighPart = p[1].LowPart;
uliDividend.LowPart = p[0].HighPart;
#ifndef USE_LARGEINT
uliResult.HighPart = (DWORD)(uliDividend.QuadPart / dwDivisor);
p[0].HighPart = (DWORD)(uliDividend.QuadPart % dwDivisor);
uliResult.LowPart = 0;
uliResult.QuadPart = p[0].QuadPart / dwDivisor + uliResult.QuadPart;
#else
/* NOTE - this routine will take exceptions if
the result does not fit in a DWORD
*/
if (uliDividend.QuadPart >= (DWORDLONG)dwDivisor) {
uliResult.HighPart = EnlargedUnsignedDivide(
uliDividend,
dwDivisor,
&p[0].HighPart);
} else {
uliResult.HighPart = 0;
}
uliResult.LowPart = EnlargedUnsignedDivide(
p[0],
dwDivisor,
NULL);
#endif
return bSign ? -(LONGLONG)uliResult.QuadPart :
(LONGLONG)uliResult.QuadPart;
}
ullResult = 0;
/* OK - do long division */
for (int i = 0; i < 64; i++) {
ullResult <<= 1;
/* Shift 128 bit p left 1 */
p[1].QuadPart <<= 1;
if ((p[0].HighPart & 0x80000000) != 0) {
p[1].LowPart++;
}
p[0].QuadPart <<= 1;
/* Compare */
if (uc <= p[1].QuadPart) {
p[1].QuadPart -= uc;
ullResult += 1;
}
}
return bSign ? - (LONGLONG)ullResult : (LONGLONG)ullResult;
memmoveInternal( (BYTE *)dst+cb_dst_offset, (BYTE *)src+cb_src_offset, count);
return S_OK;
}
LONGLONG WINAPI Int64x32Div32(LONGLONG a, LONG b, LONG c, LONG d)
{
ULARGE_INTEGER ua;
DWORD ub;
DWORD uc;
/* Compute the absolute values to avoid signed arithmetic problems */
ua.QuadPart = (DWORDLONG)(a >= 0 ? a : -a);
ub = (DWORD)(b >= 0 ? b : -b);
uc = (DWORD)(c >= 0 ? c : -c);
BOOL bSign = (a < 0) ^ (b < 0);
/* Do long multiplication */
ULARGE_INTEGER p0;
DWORD p1;
p0.QuadPart = UInt32x32To64(ua.LowPart, ub);
if (ua.HighPart != 0) {
ULARGE_INTEGER x;
x.QuadPart = UInt32x32To64(ua.HighPart, ub) + p0.HighPart;
p0.HighPart = x.LowPart;
p1 = x.HighPart;
} else {
p1 = 0;
}
if (d != 0) {
ULARGE_INTEGER ud0;
DWORD ud1;
if (bSign) {
//
// Cast d to LONGLONG first otherwise -0x80000000 sign extends
// incorrectly
//
ud0.QuadPart = (DWORDLONG)(-(LONGLONG)d);
if (d > 0) {
/* -d < 0 */
ud1 = (DWORD)-1;
} else {
ud1 = (DWORD)0;
}
} else {
ud0.QuadPart = (DWORDLONG)d;
if (d < 0) {
ud1 = (DWORD)-1;
} else {
ud1 = (DWORD)0;
}
}
/* Now do extended addition */
ULARGE_INTEGER uliTotal;
/* Add ls DWORDs */
uliTotal.QuadPart = (DWORDLONG)ud0.LowPart + p0.LowPart;
p0.LowPart = uliTotal.LowPart;
/* Propagate carry */
uliTotal.LowPart = uliTotal.HighPart;
uliTotal.HighPart = 0;
/* Add 2nd most ls DWORDs */
uliTotal.QuadPart += (DWORDLONG)ud0.HighPart + p0.HighPart;
p0.HighPart = uliTotal.LowPart;
/* Add MS DWORDLONGs - no carry expected */
p1 += ud1 + uliTotal.HighPart;
/* Now see if we got a sign change from the addition */
if ((LONG)p1 < 0) {
bSign = !bSign;
/* Negate the current value (ugh!) */
p0.QuadPart = ~p0.QuadPart;
p1 = ~p1;
p0.QuadPart += 1;
p1 += (p0.QuadPart == 0);
}
}
/* Now for the division */
if (c < 0) {
bSign = !bSign;
}
/* This will catch c == 0 and overflow */
if (uc <= p1) {
return bSign ? (LONGLONG)0x8000000000000000 :
(LONGLONG)0x7FFFFFFFFFFFFFFF;
}
/* Do the division */
/* If the divisor is a DWORD then its simpler */
ULARGE_INTEGER uliDividend;
ULARGE_INTEGER uliResult;
DWORD dwDivisor = uc;
uliDividend.HighPart = p1;
uliDividend.LowPart = p0.HighPart;
/* NOTE - this routine will take exceptions if
the result does not fit in a DWORD
*/
if (uliDividend.QuadPart >= (DWORDLONG)dwDivisor) {
uliResult.HighPart = EnlargedUnsignedDivide(
uliDividend,
dwDivisor,
&p0.HighPart);
} else {
uliResult.HighPart = 0;
}
uliResult.LowPart = EnlargedUnsignedDivide(
p0,
dwDivisor,
NULL);
return bSign ? -(LONGLONG)uliResult.QuadPart :
(LONGLONG)uliResult.QuadPart;
}
#ifdef DEBUG
/******************************Public*Routine******************************\
@ -950,10 +469,9 @@ LONGLONG WINAPI Int64x32Div32(LONGLONG a, LONG b, LONG c, LONG d)
*
\**************************************************************************/
CCritSec::CCritSec(DWORD id)
CCritSec::CCritSec()
{
InitializeCriticalSection(&m_CritSec);
m_id = id;
m_currentOwner = m_lockCount = 0;
m_fTrace = FALSE;
}
@ -979,9 +497,7 @@ void CCritSec::Lock()
// critical section
}
}
EnterCriticalSection(&m_CritSec);
EnterCriticalSection(&m_CritSec);
if (0 == m_lockCount++) {
// we now own it for the first time. Set owner information
m_currentOwner = us;
@ -1031,7 +547,7 @@ BOOL WINAPI CritCheckOut(const CCritSec * pcCrit)
#endif
STDAPI WriteBSTR(BSTR *pstrDest, LPCWSTR szSrc)
STDAPI WriteBSTR(__deref_out BSTR *pstrDest, LPCWSTR szSrc)
{
*pstrDest = SysAllocString( szSrc );
if( !(*pstrDest) ) return E_OUTOFMEMORY;
@ -1039,9 +555,9 @@ STDAPI WriteBSTR(BSTR *pstrDest, LPCWSTR szSrc)
}
STDAPI FreeBSTR(BSTR* pstr)
STDAPI FreeBSTR(__deref_in BSTR* pstr)
{
if( *pstr == NULL ) return S_FALSE;
if( (PVOID)*pstr == NULL ) return S_FALSE;
SysFreeString( *pstr );
return NOERROR;
}
@ -1052,16 +568,21 @@ STDAPI FreeBSTR(BSTR* pstr)
// S_OK - no error
// E_POINTER - ppszReturn == NULL
// E_OUTOFMEMORY - can't allocate memory for returned string
STDAPI AMGetWideString(LPCWSTR psz, LPWSTR *ppszReturn)
STDAPI AMGetWideString(LPCWSTR psz, __deref_out LPWSTR *ppszReturn)
{
CheckPointer(ppszReturn, E_POINTER);
ValidateReadWritePtr(ppszReturn, sizeof(LPWSTR));
DWORD nameLen = sizeof(WCHAR) * (lstrlenW(psz)+1);
*ppszReturn = (LPWSTR)CoTaskMemAlloc(nameLen);
*ppszReturn = NULL;
size_t nameLen;
HRESULT hr = StringCbLengthW(psz, 100000, &nameLen);
if (FAILED(hr)) {
return hr;
}
*ppszReturn = (LPWSTR)CoTaskMemAlloc(nameLen + sizeof(WCHAR));
if (*ppszReturn == NULL) {
return E_OUTOFMEMORY;
}
CopyMemory(*ppszReturn, psz, nameLen);
CopyMemory(*ppszReturn, psz, nameLen + sizeof(WCHAR));
return NOERROR;
}
@ -1079,8 +600,8 @@ DWORD WINAPI WaitDispatchingMessages(
{
BOOL bPeeked = FALSE;
DWORD dwResult;
DWORD dwStart = 0;
DWORD dwThreadPriority = 0;
DWORD dwStart;
DWORD dwThreadPriority;
static UINT uMsgId = 0;
@ -1177,7 +698,7 @@ HRESULT AmGetLastErrorToHResult()
}
}
IUnknown* QzAtlComPtrAssign(IUnknown** pp, IUnknown* lp)
IUnknown* QzAtlComPtrAssign(__deref_inout_opt IUnknown** pp, __in_opt IUnknown* lp)
{
if (lp != NULL)
lp->AddRef();
@ -1204,7 +725,7 @@ Return Value:
the Platform SDK for more information.
******************************************************************************/
MMRESULT CompatibleTimeSetEvent( UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent )
MMRESULT CompatibleTimeSetEvent( UINT uDelay, UINT uResolution, __in LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent )
{
#if WINVER >= 0x0501
{

View File

@ -4,7 +4,7 @@
// Desc: DirectShow base classes - defines helper classes and functions for
// building multimedia filters.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
@ -26,12 +26,11 @@ class CCritSec {
#ifdef DEBUG
public:
DWORD m_id;
DWORD m_currentOwner;
DWORD m_lockCount;
BOOL m_fTrace; // Trace this one
public:
CCritSec(DWORD id = 0);
CCritSec();
~CCritSec();
void Lock();
void Unlock();
@ -117,7 +116,8 @@ class CAMEvent
protected:
HANDLE m_hEvent;
public:
CAMEvent(BOOL fManualReset = FALSE);
CAMEvent(BOOL fManualReset = FALSE, __inout_opt HRESULT *phr = NULL);
CAMEvent(__inout_opt HRESULT *phr);
~CAMEvent();
// Cast to HANDLE - we don't support this as an lvalue
@ -141,6 +141,8 @@ class CAMMsgEvent : public CAMEvent
public:
CAMMsgEvent(__inout_opt HRESULT *phr = NULL);
// Allow SEND messages to be processed while waiting
BOOL WaitMsg(DWORD dwTimeout = INFINITE);
};
@ -150,6 +152,7 @@ public:
// support for a worker thread
#ifdef AM_NOVTABLE
// simple thread class supports creation of worker thread, synchronization
// and communication. Can be derived to simplify parameter passing
class AM_NOVTABLE CAMThread {
@ -173,7 +176,7 @@ protected:
virtual DWORD ThreadProc() = 0;
public:
CAMThread();
CAMThread(__inout_opt HRESULT *phr = NULL);
virtual ~CAMThread();
CCritSec m_AccessLock; // locks access by client threads
@ -181,7 +184,7 @@ public:
// thread initially runs this. param is actually 'this'. function
// just gets this and calls ThreadProc
static DWORD WINAPI InitialThreadProc(LPVOID pv);
static DWORD WINAPI InitialThreadProc(__inout LPVOID pv);
// start thread running - error if already running
BOOL Create();
@ -193,13 +196,12 @@ public:
// accessor thread calls this when done with thread (having told thread
// to exit)
void Close() {
#pragma warning( push )
// C4312: 'type cast' : conversion from 'LONG' to 'PVOID' of greater size
//
// This code works correctly on 32-bit and 64-bit systems.
#pragma warning( disable : 4312 )
// Disable warning: Conversion from LONG to PVOID of greater size
#pragma warning(push)
#pragma warning(disable: 4312)
HANDLE hThread = (HANDLE)InterlockedExchangePointer(&m_hThread, 0);
#pragma warning( pop )
#pragma warning(pop)
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
@ -222,7 +224,7 @@ public:
DWORD GetRequest();
// is there a request?
BOOL CheckRequest(DWORD * pParam);
BOOL CheckRequest(__out_opt DWORD * pParam);
// reply to the request
void Reply(DWORD);
@ -238,6 +240,7 @@ public:
// available. S_FALSE means it's not available.
static HRESULT CoInitializeHelper();
};
#endif // AM_NOVTABLE
// CQueue
@ -334,52 +337,27 @@ public:
}
};
// miscellaneous string conversion functions
// NOTE: as we need to use the same binaries on Win95 as on NT this code should
// be compiled WITHOUT unicode being defined. Otherwise we will not pick up
// these internal routines and the binary will not run on Win95.
// int WINAPIV wsprintfWInternal(LPWSTR, LPCWSTR, ...);
//LPWSTR
//WINAPI
//lstrcpyWInternal(
// LPWSTR lpString1,
// LPCWSTR lpString2
// );
LPWSTR
WINAPI
lstrcpynWInternal(
LPWSTR lpString1,
LPCWSTR lpString2,
int iMaxLength
);
int
WINAPI
lstrcmpWInternal(
LPCWSTR lpString1,
LPCWSTR lpString2
);
int
WINAPI
lstrcmpiWInternal(
LPCWSTR lpString1,
LPCWSTR lpString2
);
int
WINAPI
lstrlenWInternal(
LPCWSTR lpString
);
#ifndef UNICODE
#define wsprintfW wsprintfWInternal
#define lstrcpyW lstrcpyWInternal
#define lstrcpynW lstrcpynWInternal
#define lstrcmpW lstrcmpWInternal
#define lstrcmpiW lstrcmpiWInternal
#define lstrlenW lstrlenWInternal
#endif
// Ensures that memory is not read past the length source buffer
// and that memory is not written past the length of the dst buffer
// dst - buffer to copy to
// dst_size - total size of destination buffer
// cb_dst_offset - offset, first byte copied to dst+cb_dst_offset
// src - buffer to copy from
// src_size - total size of source buffer
// cb_src_offset - offset, first byte copied from src+cb_src_offset
// count - number of bytes to copy
//
// Returns:
// S_OK - no error
// E_INVALIDARG - values passed would lead to overrun
HRESULT AMSafeMemMoveOffset(
__in_bcount(dst_size) void * dst,
__in size_t dst_size,
__in DWORD cb_dst_offset,
__in_bcount(src_size) const void * src,
__in size_t src_size,
__in DWORD cb_src_offset,
__in size_t count);
extern "C"
void * __stdcall memmoveInternal(void *, const void *, size_t);
@ -413,7 +391,7 @@ exit_memchr:
#endif
}
void WINAPI IntToWstr(int i, LPWSTR wstr, size_t len);
void WINAPI IntToWstr(int i, __out_ecount(12) LPWSTR wstr);
#define WstrToInt(sz) _wtoi(sz)
#define atoiW(sz) _wtoi(sz)
@ -447,8 +425,11 @@ STDAPI_(WCHAR *) GetSubtypeNameW(const GUID *pSubtype);
STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader);
STDAPI_(DWORD) GetBitmapSize(const BITMAPINFOHEADER *pHeader);
#ifdef __AMVIDEO__
STDAPI_(BOOL) ContainsPalette(const VIDEOINFOHEADER *pVideoInfo);
STDAPI_(const RGBQUAD *) GetBitmapPalette(const VIDEOINFOHEADER *pVideoInfo);
#endif // __AMVIDEO__
// Compares two interfaces and returns TRUE if they are on the same object
@ -466,15 +447,15 @@ LONGLONG WINAPI Int64x32Div32(LONGLONG a, LONG b, LONG c, LONG rnd);
// Avoids us dyna-linking to SysAllocString to copy BSTR strings
STDAPI WriteBSTR(BSTR * pstrDest, LPCWSTR szSrc);
STDAPI FreeBSTR(BSTR* pstr);
STDAPI WriteBSTR(__deref_out BSTR * pstrDest, LPCWSTR szSrc);
STDAPI FreeBSTR(__deref_in BSTR* pstr);
// Return a wide string - allocating memory for it
// Returns:
// S_OK - no error
// E_POINTER - ppszReturn == NULL
// E_OUTOFMEMORY - can't allocate memory for returned string
STDAPI AMGetWideString(LPCWSTR pszString, LPWSTR *ppszReturn);
STDAPI AMGetWideString(LPCWSTR pszString, __deref_out LPWSTR *ppszReturn);
// Special wait for objects owning windows
DWORD WINAPI WaitDispatchingMessages(
@ -496,7 +477,7 @@ HRESULT AmGetLastErrorToHResult(void);
// duplicate of ATL's CComPtr to avoid linker conflicts.
IUnknown* QzAtlComPtrAssign(IUnknown** pp, IUnknown* lp);
IUnknown* QzAtlComPtrAssign(__deref_inout_opt IUnknown** pp, __in_opt IUnknown* lp);
template <class T>
class QzCComPtr
@ -535,7 +516,17 @@ public:
T* p;
};
MMRESULT CompatibleTimeSetEvent( UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent );
MMRESULT CompatibleTimeSetEvent( UINT uDelay, UINT uResolution, __in LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent );
bool TimeKillSynchronousFlagAvailable( void );
// Helper to replace lstrcpmi
__inline int lstrcmpiLocaleIndependentW(LPCWSTR lpsz1, LPCWSTR lpsz2)
{
return CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, lpsz1, -1, lpsz2, -1) - CSTR_EQUAL;
}
__inline int lstrcmpiLocaleIndependentA(LPCSTR lpsz1, LPCSTR lpsz2)
{
return CompareStringA(LOCALE_INVARIANT, NORM_IGNORECASE, lpsz1, -1, lpsz2, -1) - CSTR_EQUAL;
}
#endif /* __WXUTIL__ */

View File

@ -82,7 +82,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "3rdparty\libpng\p
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthreads4w", "3rdparty\pthreads4w\build\pthreads4w.vcxproj", "{0FAE817D-9A32-4830-857E-81DA57246E16}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "baseclasses", "unfree\baseclasses\baseclasses.vcxproj", "{27F17499-A372-4408-8AFA-4F9F4584FBD3}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "baseclasses", "3rdparty\baseclasses\baseclasses.vcxproj", "{27F17499-A372-4408-8AFA-4F9F4584FBD3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetype", "3rdparty\freetype\builds\windows\freetype.vcxproj", "{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}"
EndProject

View File

@ -23,7 +23,7 @@
#include "GSDialog.h"
#include "resource.h"
#include "baseclasses/streams.h"
#include <streams.h>
class GSCaptureDlg : public GSDialog
{

View File

@ -323,7 +323,7 @@
<ProjectReference Include="..\..\3rdparty\xz\liblzma.vcxproj">
<Project>{12728250-16ec-4dc6-94d7-e21dd88947f8}</Project>
</ProjectReference>
<ProjectReference Include="..\..\unfree\baseclasses\baseclasses.vcxproj">
<ProjectReference Include="..\..\3rdparty\baseclasses\baseclasses.vcxproj">
<Project>{27f17499-a372-4408-8afa-4f9f4584fbd3}</Project>
</ProjectReference>
</ItemGroup>

View File

@ -13,7 +13,7 @@
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4456;4458;4996;4995;4324;4100;4101;4201;4556;4127;4512;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(VTUNE_AMPLIFIER_XE_2015_DIR)include;$(ProjectDir);$(SolutionDir)unfree;$(SolutionDir)3rdparty;$(SolutionDir)3rdparty\freetype\include;$(SolutionDir)3rdparty\libpng;$(SolutionDir)3rdparty\opencl;$(SolutionDir)3rdparty\xz\xz\src\liblzma\api;$(SolutionDir)3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(VTUNE_AMPLIFIER_XE_2015_DIR)include;$(ProjectDir);$(SolutionDir)3rdparty\baseclasses;$(SolutionDir)3rdparty;$(SolutionDir)3rdparty\freetype\include;$(SolutionDir)3rdparty\libpng;$(SolutionDir)3rdparty\opencl;$(SolutionDir)3rdparty\xz\xz\src\liblzma\api;$(SolutionDir)3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>LZMA_API_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>

View File

@ -1,142 +0,0 @@
//------------------------------------------------------------------------------
// File: Activex.rcv
//
// Desc: DirectShow base classes - this file defines the version resource
// used for the application.
//
// NOTE: All strings MUST have an explicit \0 for termination!
//
// For a complete description of the Version Resource, search the
// Microsoft Developer's Network (MSDN) CD-ROM for 'version resource'..
//
// Copyright (c) 1992 - 2002, Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#ifndef _ACTIVEX_RCV_
#define _ACTIVEX_RCV_
#ifndef WIN32
#define WIN32
#endif
#include <winver.h>
#ifndef _ACTIVEX_VER_
#include <activex.ver>
#endif
//
// Version flags.
//
// OFFICIAL and FINAL should be defined when appropriate.
//
#ifndef OFFICIAL
#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD
#else
#define VER_PRIVATEBUILD 0
#endif
#ifndef FINAL
#define VER_PRERELEASE VS_FF_PRERELEASE
#else
#define VER_PRERELEASE 0
#endif
#ifdef DEBUG
#define VER_DEBUG VS_FF_DEBUG
#else
#define VER_DEBUG 0
#endif
//
// Version definitions
//
#define VERSION_RES_FLAGSMASK 0x0030003FL
#define VERSION_RES_FLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
#ifndef VERSION_RES_OS
#define VERSION_RES_OS VOS__WINDOWS32
#endif
#ifndef VERSION_RES_TYPE
#define VERSION_RES_TYPE VFT_DLL
#endif
#ifndef VERSION_RES_SUBTYPE
#define VERSION_RES_SUBTYPE VFT2_UNKNOWN
#endif
#define VERSION_RES_LANGUAGE 0x409
#ifndef VERSION_RES_CHARSET
#ifdef UNICODE
#define VERSION_RES_CHARSET 1200
#else
#define VERSION_RES_CHARSET 1252
#endif
#endif
#ifndef VERSION_RES_ACTIVEX
#define VERSION_RES_ACTIVEX "Filter dll\0"
#endif
#ifdef AMOVIE_SELF_REGISTER
#ifndef OLE_SELF_REGISTER
#define OLE_SELF_REGISTER
#endif
#endif
#ifdef OLE_SELF_REGISTER
#ifdef AMOVIE_SELF_REGISTER
#define VERSION_RES_SELFREGISTER "AM20\0"
#else
#define VERSION_RES_SELFREGISTER "\0"
#endif
#endif
//
// Version resource
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_RES_MAJOR_VER, VERSION_RES_MINOR_VER, 0, VERSION_RES_BUILD
PRODUCTVERSION VERSION_RES_MAJOR_VER, VERSION_RES_MINOR_VER, 0, VERSION_RES_BUILD
FILEFLAGSMASK VERSION_RES_FLAGSMASK
FILEFLAGS VERSION_RES_FLAGS
FILEOS VERSION_RES_OS
FILETYPE VERSION_RES_TYPE
FILESUBTYPE VERSION_RES_SUBTYPE
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VERSION_RES_COMPANY_NAME
VALUE "Comment", VERSION_RES_COMMENT
VALUE "FileDescription", VERSION_RES_BIN_DESCRIPTION
VALUE "FileVersion", VERSION_RES_STRING
VALUE "InternalName", VERSION_RES_BIN_NAME
VALUE "LegalCopyright", VERSION_RES_COPYRIGHT
VALUE "OriginalFilename", VERSION_RES_BIN_NAME
VALUE "ProductName", VERSION_RES_PRODUCT_NAME
#ifdef DEBUG
VALUE "ProductVersion", VERSION_RES_STRING_D
#else
VALUE "ProductVersion", VERSION_RES_STRING
#endif
VALUE "ActiveMovie", VERSION_RES_ACTIVEX
#ifdef OLE_SELF_REGISTER
VALUE "OLESelfRegister", VERSION_RES_SELFREGISTER
#endif
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", VERSION_RES_LANGUAGE, VERSION_RES_CHARSET
END
END
#endif
// _ACTIVEX_RCV_

View File

@ -1,56 +0,0 @@
//------------------------------------------------------------------------------
// File: Activex.ver
//
// Desc: DirectShow base classes - common versioning information for
// ACTIVEX binaries.
//
// Copyright (c) 1996-2002, Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#ifndef _ACTIVEX_VER_
#define _ACTIVEX_VER_
// NOTE: all string resources that will be used in ACTIVEX.RCV for the
// version resource information *MUST* have an explicit \0 terminator!
#define VERSION_RES_MAJOR_VER 9
#define VERSION_RES_MINOR_VER 0
#define VERSION_RES_BUILD 0
#define VERSION_RES_STRING_D "9.00 (Debug)\0"
#define VERSION_RES_STRING "9.00\0"
#define VERSION_RES_PRODUCT_NAME "DirectX 9.0 Sample\0"
#define VERSION_RES_COMMENT "DirectShow Sample\0"
#define VERSION_RES_COMPANY_NAME "Microsoft Corporation\0"
#define VERSION_RES_COPYRIGHT "Copyright (C) 1992-2002 Microsoft Corporation\0"
// The following defines are required on a file-by-file basis
//
// #define VERSION_RES_BIN_NAME "sample.ax\0"
// #define VERSION_RES_BIN_DESCRIPTION "Sample Filter\0"
//
// Also required, if you don't want the defaults, are
//
// #define VERSION_RES_ACTIVEX "Filter dll\0" (the default value)
//
// A string defining the type of component.
//
// #define VERSION_RES_TYPE VFT_DLL (default)
// VFT_APP
// VFT_VXD
// VFT_DRV
// VFT_FONT
// VFT_STATIC_LIB
// VFT_UNKNOWN
//
// #define VERSION_RES_SUBTYPE VFT2_UNKNOWN (default)
// VFT2_DRV_INSTALLABLE
// VFT2_DRV_SOUND
// <several other options>
//
// See winver.h for further details
#endif

View File

@ -1,128 +0,0 @@
//------------------------------------------------------------------------------
// File: DSSchedule.h (replaces DirectX 8's schedule.h)
//
// Desc: DirectShow base classes.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#ifndef __CAMSchedule__
#define __CAMSchedule__
class CAMSchedule : private CBaseObject
{
public:
virtual ~CAMSchedule();
// ev is the event we should fire if the advise time needs re-evaluating
CAMSchedule( HANDLE ev );
DWORD GetAdviseCount();
REFERENCE_TIME GetNextAdviseTime();
// We need a method for derived classes to add advise packets, we return the cookie
DWORD_PTR AddAdvisePacket( const REFERENCE_TIME & time1, const REFERENCE_TIME & time2, HANDLE h, BOOL periodic );
// And a way to cancel
HRESULT Unadvise(DWORD_PTR dwAdviseCookie);
// Tell us the time please, and we'll dispatch the expired events. We return the time of the next event.
// NB: The time returned will be "useless" if you start adding extra Advises. But that's the problem of
// whoever is using this helper class (typically a clock).
REFERENCE_TIME Advise( const REFERENCE_TIME & rtTime );
// Get the event handle which will be set if advise time requires re-evaluation.
HANDLE GetEvent() const { return m_ev; }
private:
// We define the nodes that will be used in our singly linked list
// of advise packets. The list is ordered by time, with the
// elements that will expire first at the front.
class CAdvisePacket
{
public:
CAdvisePacket()
{}
CAdvisePacket * m_next;
DWORD_PTR m_dwAdviseCookie;
REFERENCE_TIME m_rtEventTime; // Time at which event should be set
REFERENCE_TIME m_rtPeriod; // Periodic time
HANDLE m_hNotify; // Handle to event or semephore
BOOL m_bPeriodic; // TRUE => Periodic event
CAdvisePacket( CAdvisePacket * next, LONGLONG time ) : m_next(next), m_rtEventTime(time)
{}
void InsertAfter( CAdvisePacket * p )
{
p->m_next = m_next;
m_next = p;
}
int IsZ() const // That is, is it the node that represents the end of the list
{ return m_next == 0; }
CAdvisePacket * RemoveNext()
{
CAdvisePacket *const next = m_next;
CAdvisePacket *const new_next = next->m_next;
m_next = new_next;
return next;
}
void DeleteNext()
{
delete RemoveNext();
}
CAdvisePacket * Next() const
{
CAdvisePacket * result = m_next;
if (result->IsZ()) result = 0;
return result;
}
DWORD_PTR Cookie() const
{ return m_dwAdviseCookie; }
};
// Structure is:
// head -> elmt1 -> elmt2 -> z -> null
// So an empty list is: head -> z -> null
// Having head & z as links makes insertaion,
// deletion and shunting much easier.
CAdvisePacket head, z; // z is both a tail and a sentry
volatile DWORD_PTR m_dwNextCookie; // Strictly increasing
volatile DWORD m_dwAdviseCount; // Number of elements on list
CCritSec m_Serialize;
// AddAdvisePacket: adds the packet, returns the cookie (0 if failed)
DWORD_PTR AddAdvisePacket( CAdvisePacket * pPacket );
// Event that we should set if the packed added above will be the next to fire.
const HANDLE m_ev;
// A Shunt is where we have changed the first element in the
// list and want it re-evaluating (i.e. repositioned) in
// the list.
void ShuntHead();
// Rather than delete advise packets, we cache them for future use
CAdvisePacket * m_pAdviseCache;
DWORD m_dwCacheCount;
enum { dwCacheMax = 5 }; // Don't bother caching more than five
void Delete( CAdvisePacket * pLink );// This "Delete" will cache the Link
// Attributes and methods for debugging
public:
#ifdef DEBUG
void DumpLinkedList();
#else
void DumpLinkedList() {}
#endif
};
#endif // __CAMSchedule__