On 4/27/22 01:42, Anton Baskanov wrote:
+static const WAVEFORMATEX pcm8_format = +{
- .wFormatTag = WAVE_FORMAT_PCM,
- .nChannels = 1,
- .nSamplesPerSec = 32000,
- .wBitsPerSample = 8,
- .nBlockAlign = 1,
- .nAvgBytesPerSec = 32000,
+};
+static const AM_MEDIA_TYPE pcm8_mt = +{
- /* MEDIATYPE_Audio, MEDIASUBTYPE_PCM, FORMAT_WaveFormatEx */
- .majortype = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
- .subtype = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
- .bFixedSizeSamples = TRUE,
- .lSampleSize = 1,
- .formattype = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
- .cbFormat = sizeof(WAVEFORMATEX),
- .pbFormat = (BYTE *)&pcm8_format,
+};
This works, but it occurs to me that a helper like
static void init_pcm_mt(AM_MEDIA_TYPE *mt, WAVEFORMATEX *format, unsigned int channels, unsigned int sample_rate, unsigned int depth)
would save some space.