blob: 81aceb397f5121e8da881e9a00fa7f70ee4e0b2f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#ifndef NULLSOFT_IN_WMVDRM_AUDIOFORMAT_H
#define NULLSOFT_IN_WMVDRM_AUDIOFORMAT_H
#include <mmreg.h>
#include <wmsdk.h>
class AudioFormat
{
public:
AudioFormat() : waveFormat(0)
{
}
~AudioFormat()
{
delete [] waveFormat;
}
unsigned long AudioBytesToSamples(unsigned long bytes);
unsigned long AudioSamplesToBytes(unsigned long samples);
unsigned long AudioBytesToMilliseconds(unsigned long bytes);
unsigned long AudioMillisecondsToBytes(DWORD milliseconds);
unsigned long AudioDurationToBytes(QWORD duration);
unsigned long AudioSamplesToMilliseconds(unsigned long samples);
long Channels();
long ValidBits();
long BitSize();
long SampleRate();
//protected:
void Open(WM_MEDIA_TYPE *mediaType)
{
delete[] waveFormat;
waveFormat = (WAVEFORMATEXTENSIBLE *) new unsigned char[mediaType->cbFormat];
memcpy(waveFormat, mediaType->pbFormat, mediaType->cbFormat);
}
void Close()
{
delete [] waveFormat;
waveFormat=0;
}
private:
WAVEFORMATEXTENSIBLE *waveFormat;
};
#endif
|