AudRecordLib
|
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< InputFormat > | FormatVector |
Functions | |
HRESULT | GetCodecAndProfileDescriptions (CodecConfigs *&pConfigs) |
void | FreeCodecAndProfileDescriptions (CodecConfigs *pCodecConfigs) |
HRESULT | MatchCodecInputFormat (IWMWriter *pWriter, const WAVEFORMATEX &sourceFormat, WAVEFORMATEX &codecFormat) |
HRESULT | CreateAudRecordObject (CodecConfiguration *pCodecConfig, IAudRecord **ppAudRecord) |
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.
HRESULT CreateAudRecordObject | ( | CodecConfiguration * | pCodecConfig, |
IAudRecord ** | ppAudRecord | ||
) |
Creates a IWMWriter interface then creates an AudRecord object
pCodecConfig | Initial codec configuration for the recording stream | |
[out] | ppAudRecord | Pointer that receives the new interface pointer |
void FreeCodecAndProfileDescriptions | ( | CodecConfigs * | pCodecConfigs | ) |
Frees the memory and references associasted with the codecs and their configurations
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
[out] | pConfigs | On success, a pointer that is set to a struct containing information about the codecs and their info |
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
pWriter | The Windows Media writer whose codec input formats are to be used |
sourceFormat | Source format to try and match |
codecFormat | Closest match returned by the function |