AudRecordLib
Public Member Functions
TargetSinkWrap Class Reference

#include <InterfaceWrap.h>

List of all members.

Public Member Functions

 TargetSinkWrap (AudRecordCLI::ITargetSink^ pOrigSink)
HRESULT WINAPI QueryInterface (REFIID riid, PVOID *ppv)
ULONG WINAPI AddRef ()
ULONG WINAPI Release ()
HRESULT WINAPI OnHeader (INSSBuffer *pHeader)
HRESULT WINAPI IsRealTime (BOOL *pRealTime)
HRESULT WINAPI AllocateDataUnit (DWORD dataSize, INSSBuffer **ppBuffer)
HRESULT WINAPI OnDataUnit (INSSBuffer *pBuffer)
HRESULT WINAPI OnEndWriting ()

Detailed Description

Native wrapper around an ITargetSink interface which enables it to be passed to the AddCustomSink method exposed by IAudRecord


Constructor & Destructor Documentation

TargetSinkWrap::TargetSinkWrap ( AudRecordCLI::ITargetSink pOrigSink)

Constructs the wrapper around the specified target object

Parameters:
pOrigSinkThe target to wrap

Member Function Documentation

ULONG WINAPI TargetSinkWrap::AddRef ( )

Increments the objects reference count

Returns:
The new reference count
HRESULT WINAPI TargetSinkWrap::AllocateDataUnit ( DWORD  dataSize,
INSSBuffer **  ppBuffer 
)

Allocates a buffer of specified size and returns it to the caller

First the function calls the managed AllocateDataUnit to create a buffer in whichever way it sees fit. If it returns successfully, the IDataBuffer interface it returns is wrapped in a ManagedDataBufferWrap which is returned to the caller via its INSSBuffer interface

Parameters:
dataSizeNumber of bytes to allocate
ppBufferA pointer to an interface on the returned buffer
Returns:
S_OK on success, E_POINTER if ppBuffer is NULL, E_OUTOFMEMORY if the managed AllocateDataUnit returns null or wrapping it in a native wrapper fails, or E_FAIL if the managed code throws an exception
HRESULT WINAPI TargetSinkWrap::IsRealTime ( BOOL *  pRealTime)

Determines whether the wrapped sink wants realtime packet delivery

The function simply calls the managed IsRealTime and puts the returned value in the pointer parameter

Parameters:
pRealTimePointer that receives the value returned from ITargetSink::IsRealTime()
Returns:
S_OK on success, E_POINTER if pRealTime is NULL, or E_FAIL if calling the managed IsRealTime throws an exception
HRESULT WINAPI TargetSinkWrap::OnDataUnit ( INSSBuffer *  pBuffer)

Called when there's a buffer of data to be written.

The native buffer is wrapped into a managed IDataBuffer and passed to RaiseOnDataUnit which fires the event. Afterwards, the managed wrapper is deleted. Any exceptions arising from raising the event are caught, logged and cause the function to return E_FAIL

Parameters:
pBufferA native buffer that contains the data to be written
Returns:
S_OK on success, E_POINTER is pBuffer is NULL, or E_FAIL if raising the managed event throws an exception
HRESULT WINAPI TargetSinkWrap::OnEndWriting ( )

Called when writing has finished for this session

Simply raises the managed event of the same name

Returns:
S_OK on success, or E_FAIL if the managed event handler throws an exception
HRESULT WINAPI TargetSinkWrap::OnHeader ( INSSBuffer *  pHeader)

Called when there's a header to be written.

The native buffer is wrapped into a managed IDataBuffer and passed to RaiseOnHeader which fires the event. Afterwards, the managed wrapper is deleted. Any exceptions arising from raising the event are caught, logged and cause the function to return E_FAIL

Parameters:
pHeaderA native buffer that contains the header data
Returns:
S_OK on success, E_POINTER if pHeader is NULL or E_FAIL if raising the managed event throws an exception
HRESULT WINAPI TargetSinkWrap::QueryInterface ( REFIID  iid,
PVOID *  ppv 
)

Returns pointers for implemented interfaces on the object

Currently supported interfaces are IUnknown and IWMWriterSink

Parameters:
iidThe id of the requested interface
[out]ppvA pointer to a pointer that receives the interface pointer or NULL
Returns:
S_OK on success, E_NOINTERFACE for unsupported interfaces and E_POINTER if ppObj is NULL
ULONG WINAPI TargetSinkWrap::Release ( )

Drecreases the objects reference count

If the ref count reaches zero, the object is destroyed

Returns:
The new reference count

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Defines