AudRecordLib
Classes | Public Member Functions | Static Public Member Functions
AudRecord Class Reference

#include <AudRecordInt.h>

Inheritance diagram for AudRecord:
IAudRecord

List of all members.

Classes

struct  Attribute
struct  Formats

Public Member Functions

HRESULT WINAPI QueryInterface (REFIID iid, PVOID *ppObj)
ULONG WINAPI AddRef ()
ULONG WINAPI Release ()
HRESULT WINAPI Record (Endpoint *pClient)
HRESULT WINAPI ChangeCodec (CodecConfiguration *pNewCodec)
HRESULT WINAPI TogglePause (AudPausedState *pCurState)
HRESULT WINAPI QueryPause (AudPausedState *pCurState)
HRESULT WINAPI Stop ()
HRESULT WINAPI AddFileTarget (LPCWSTR pwszFileName, PVOID *ppCookie)
HRESULT WINAPI AddNetworkBroadcastTarget (DWORD *pPort, DWORD maxConnections, LPWSTR *ppwszUrl, PVOID *ppCookie)
HRESULT WINAPI AddCustomTarget (IWMWriterSink *pTarget, PVOID *ppCookie)
HRESULT WINAPI RemoveTarget (PVOID pCookie)
HRESULT WINAPI GetStatistics (AudRecordStats *pStats)

Static Public Member Functions

static HRESULT Create (IWMWriter *pWriter, CodecConfiguration *pCodecConfig, IAudRecord **ppRecord)

Detailed Description

Manages the recording of audio from a specific endpoint and writing it to optional file, network, and custom outputs in a specific codec format


Member Function Documentation

HRESULT WINAPI AudRecord::AddCustomTarget ( IWMWriterSink *  pTarget,
PVOID *  ppCookie 
)

Adds a raw target to the recording process

Creates a cookie for the interface, takes the lock and adds pTarget as a recording target

Parameters:
pTargetA raw IWMWriterSink interface pointer
[out]ppCookiePointer that receives the result of ObjectToCookie() for the pTarget pointer
Returns:
See IAudRecord::AddCustomTarget

Implements IAudRecord.

HRESULT WINAPI AudRecord::AddFileTarget ( LPCWSTR  pwszFileName,
PVOID *  ppCookie 
)

Adds a file output to the recording process

Creates a new Windows Media file sink and points it to pwszFileName. Then under the member lock, adds it as a recording target

Parameters:
pwszFileNameA file name, probably can be anything openable by CreateFile like pipes but I haven't tested anything but normal files
[out]ppCookiePointer that receives the result of ObjectToCookie() for the file sink pointer
Returns:
See IAudRecord::AddFileTarget()

Implements IAudRecord.

HRESULT WINAPI AudRecord::AddNetworkBroadcastTarget ( DWORD *  pPortNumber,
DWORD  maxClients,
LPWSTR *  ppwszUrl,
PVOID *  ppCookie 
)

Adds a network port to the recording process

Creates a new Windows Media network sink on the *pPortNumber port. Optionally gets the URL of connection for the caller, if this fails it is not considered an error. Then under the member lock, adds the sink as a recording target.

Parameters:
pPortNumberA pointer to the requested port, 0 or NULL lets the sink choose.
maxClientsNumber of clients who can connect, 5 is the default if 0 is given
[out]ppwszUrlOptional pointer to the connection URL retreived from the sink
[out]ppCookiePointer that receives the result of ObjectToCookie() for the network sink pointer
Returns:
See IAudRecord::AddFileTarget()

Implements IAudRecord.

ULONG WINAPI AudRecord::AddRef ( )

Increments the objects reference count

Returns:
The new reference count
HRESULT WINAPI AudRecord::ChangeCodec ( CodecConfiguration pNewCodec)

Changes the stream composition of the writer

Creates a new Windows Media profile, adds the specified codec stream configuration to it and sets it as the new profile for the writer to use. If recording is currently in progress it is stopped, before being restarted after the profile is changed.

Parameters:
pNewCodecA codec configuration structure returned by GetWMACodecConfigs() that describes the new compression format
Returns:
S_OK on success, E_POINTER if pNewCodec or pNewCodec->pConfig is NULL, or a NS_E_* error from the WMA functions and interfaces.

Implements IAudRecord.

HRESULT AudRecord::Create ( IWMWriter *  pWriter,
CodecConfiguration pCodecConfig,
IAudRecord **  ppRecord 
) [static]

Creates an AudRecord object using the specified writer and configuration

Queries the writer for its IWMWriterAdvanced interface then allocates a new AudRecord object passing in both interfaces. ChangeCodec is then called on the new object to set the requested configuration.

Parameters:
pWriterA IWMWriter interface the AudRecord object will take a reference to
pCodecConfigThe initial output format of the writer
[out]ppRecordA pointer that recieves the IAudRecrd interface of the object
Returns:
S_OK on success, E_OUTOFMEMORY if new throws an exception, or a value from ChangeCodec otherwise
HRESULT AudRecord::GetStatistics ( AudRecordStats pStats)

Gets current writing statistics from the codec

Calls the GetStatistics method of IWMWriterAdvanced interface. If it succeeds the filled in WM_WRITER_STATISTICS structure is copied to *pStats as the structures are identical.

Parameters:
[out]pStatsA pointer that receives statistics from the writing codec

Implements IAudRecord.

HRESULT WINAPI AudRecord::QueryInterface ( REFIID  iid,
PVOID *  ppObj 
)

Returns pointers for implemented interfaces on the object

Currently supported interfaces are IUnknown and IAudRecord

Parameters:
iidThe id of the requested interface
[out]ppObjA 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
HRESULT WINAPI AudRecord::QueryPause ( AudPausedState pCurState)

Returns the current pause state of the recording session

Parameters:
[out]pCurStatePointer to a BOOL that receives a nonzero value if the stream is recording or zero if the stream is paused
Returns:
S_OK on success, E_UNEXPECTED if recording isn't currently active and E_POINTER if pCurState is NULL

Implements IAudRecord.

HRESULT WINAPI AudRecord::Record ( Endpoint pDeviceEndpoint)

Public entrypoint to BeginRecording

Checks whether recording is already in progress before calling BeginRecording()

Parameters:
pDeviceEndpointThe endpoint to begin recording from
Returns:
S_OK on success, E_POINTER if pDeviceEndpoint is NULL, E_UNEXPECTED if recording is already in progress or a value returned by BeginRecording()

Implements IAudRecord.

ULONG WINAPI AudRecord::Release ( )

Decreases the objects reference count

If the ref count reaches zero, the object is destroyed

Returns:
The new reference count
HRESULT WINAPI AudRecord::RemoveTarget ( PVOID  pCookie)

Removes the target referred to by pCookie from the recording process

Translates the cookie back into an object value, AddRef's the interface so it won't be destroyed after removing it as a Writer target. The object is tested to see if it is a Windows Media Network sink, if so the port it opened is closed. The object is then released and destroyed

Parameters:
pCookieThe cookie for the target to remove
Returns:
See IAudRecord::RemoveTarget

Implements IAudRecord.

HRESULT WINAPI AudRecord::Stop ( )

Stops the recording process

Stops the recording loop, stops all writing to the targets, releases the audio and capture client interfaces and ends the capture thread

Returns:
S_OK

Implements IAudRecord.

HRESULT WINAPI AudRecord::TogglePause ( AudPausedState pCurState)

Pauses or resumes the recording stream

Parameters:
[out]pCurStateOptional pointer to a BOOL that receives a nonzero value if the stream is recording or zero if the stream is paused as a result of this function
Returns:
S_OK on success or E_UNEXPECTED if recording isn't currently active

Implements IAudRecord.


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