AudRecordLib
Classes | Typedefs | Functions
wmfunctions.cpp File Reference

Implements that which uses the Windows Media SDK codec, profile, and information functions such as enumeration of codecs and their formats and matching mixer audio formats to codec inputs. More...

#include "stdafx.h"
#include "wmfunctions.h"
#include "exports.h"
#include <wmsdk.h>
#include <map>
#include "AudRecordInt.h"
#include "misc.h"

Classes

struct  CodecConfigTemp
struct  InputFormat

Typedefs

typedef std::vector
< CodecConfigTemp
CodecConfigList
typedef CodecConfigList::iterator CodecConfigIter
typedef
CodecConfigList::const_iterator 
CodecConfigConstIter
typedef std::map< std::wstring,
CodecConfigList > 
CodecInformation
typedef CodecInformation::iterator CodecInfoIter
typedef
CodecInformation::const_iterator 
CodecInfoConstIter
typedef std::vector< InputFormatFormatVector

Functions

HRESULT GetCodecAndProfileDescriptions (CodecConfigs *&pConfigs)
void FreeCodecAndProfileDescriptions (CodecConfigs *pCodecConfigs)
HRESULT MatchCodecInputFormat (IWMWriter *pWriter, const WAVEFORMATEX &sourceFormat, WAVEFORMATEX &codecFormat)
HRESULT CreateAudRecordObject (CodecConfiguration *pCodecConfig, IAudRecord **ppAudRecord)

Detailed Description

Implements that which uses the Windows Media SDK codec, profile, and information functions such as enumeration of codecs and their formats and matching mixer audio formats to codec inputs.


Function Documentation

HRESULT CreateAudRecordObject ( CodecConfiguration pCodecConfig,
IAudRecord **  ppAudRecord 
)

Creates a IWMWriter interface then creates an AudRecord object

Parameters:
pCodecConfigInitial codec configuration for the recording stream
[out]ppAudRecordPointer that receives the new interface pointer
Returns:
The value returned by AudRecord::Create()
void FreeCodecAndProfileDescriptions ( CodecConfigs pCodecConfigs)

Frees the memory and references associasted with the codecs and their configurations

Returns:
pCodecConfigs Codec configurations to release
HRESULT GetCodecAndProfileDescriptions ( CodecConfigs *&  pConfigs)

Enumerates all codecs available for use on the system and their CBR and VBR configurations.

Loops through all the codecs getting their name and configurations and stores them in a map. The map is then serialised into one big memory block by SerializeCodecConfigs(). The references

Parameters:
[out]pConfigsOn success, a pointer that is set to a struct containing information about the codecs and their info
Returns:
S_OK on success, COM or NS_E_* error code on failure
HRESULT MatchCodecInputFormat ( IWMWriter *  pWriter,
const WAVEFORMATEX &  sourceFormat,
WAVEFORMATEX &  codecFormat 
)

Finds the closest codec input wave format for a source wave format

Enumerates all input formats available on the writer, then tries to match the number of channels, sample rate, and bits per sample of the input format. If there isn't an exact match, the algorithm to find a match uses the following steps: Bits per sample is continually degraded by 8 bits until there's a match Sample format is set to integer PCM then step 1 is retried again Number of channels is reduced to 2, then step 2 is retried again Gives up

Parameters:
pWriterThe Windows Media writer whose codec input formats are to be used
sourceFormatSource format to try and match
codecFormatClosest match returned by the function
Returns:
S_OK if a match was found, NS_E_INVALID_INPUT_FORMAT if a match couldn't be found or a standard COM or NS_E_* error on other failure
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Defines