Archived
1
0
This repository has been archived on 2024-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
winamp/Src/Plugins/Input/in_wmvdrm/AudioFormat.h

45 lines
1004 B
C
Raw Normal View History

2024-09-24 12:54:57 +00:00
#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