AudRecordLib
|
#include <AudRecordInt.h>
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) |
Manages the recording of audio from a specific endpoint and writing it to optional file, network, and custom outputs in a specific codec format
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
pTarget | A raw IWMWriterSink interface pointer | |
[out] | ppCookie | Pointer that receives the result of ObjectToCookie() for the pTarget pointer |
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
pwszFileName | A file name, probably can be anything openable by CreateFile like pipes but I haven't tested anything but normal files | |
[out] | ppCookie | Pointer that receives the result of ObjectToCookie() for the file sink pointer |
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.
pPortNumber | A pointer to the requested port, 0 or NULL lets the sink choose. | |
maxClients | Number of clients who can connect, 5 is the default if 0 is given | |
[out] | ppwszUrl | Optional pointer to the connection URL retreived from the sink |
[out] | ppCookie | Pointer that receives the result of ObjectToCookie() for the network sink pointer |
Implements IAudRecord.
ULONG WINAPI AudRecord::AddRef | ( | ) |
Increments the objects 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.
pNewCodec | A codec configuration structure returned by GetWMACodecConfigs() that describes the new compression format |
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.
pWriter | A IWMWriter interface the AudRecord object will take a reference to | |
pCodecConfig | The initial output format of the writer | |
[out] | ppRecord | A pointer that recieves the IAudRecrd interface of the object |
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.
[out] | pStats | A 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
iid | The id of the requested interface | |
[out] | ppObj | A pointer to a pointer that receives the interface pointer or NULL |
HRESULT WINAPI AudRecord::QueryPause | ( | AudPausedState * | pCurState | ) |
Returns the current pause state of the recording session
[out] | pCurState | Pointer to a BOOL that receives a nonzero value if the stream is recording or zero if the stream is paused |
Implements IAudRecord.
HRESULT WINAPI AudRecord::Record | ( | Endpoint * | pDeviceEndpoint | ) |
Public entrypoint to BeginRecording
Checks whether recording is already in progress before calling BeginRecording()
pDeviceEndpoint | The endpoint to begin recording from |
Implements IAudRecord.
ULONG WINAPI AudRecord::Release | ( | ) |
Decreases the objects reference count
If the ref count reaches zero, the object is destroyed
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
pCookie | The cookie for the target to remove |
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
Implements IAudRecord.
HRESULT WINAPI AudRecord::TogglePause | ( | AudPausedState * | pCurState | ) |
Pauses or resumes the recording stream
[out] | pCurState | Optional 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 |
Implements IAudRecord.