5#include <freerdp/codec/audio.h>
9static BOOL test_format_compatible(
void)
11 const AUDIO_FORMAT pcm = { .wFormatTag = WAVE_FORMAT_PCM,
13 .nSamplesPerSec = 44100,
14 .nAvgBytesPerSec = 176400,
16 .wBitsPerSample = 16 };
18 alaw.wFormatTag = WAVE_FORMAT_ALAW;
20 broken.nSamplesPerSec = 0;
23 const AUDIO_FORMAT onlyPcm = { .wFormatTag = WAVE_FORMAT_PCM };
24 const AUDIO_FORMAT only48k = { .nSamplesPerSec = 48000 };
26 noTag.wFormatTag = WAVE_FORMAT_UNKNOWN;
27 noTag.wBitsPerSample = 0;
37 {
"no filter, PCM", &any, &pcm, TRUE },
38 {
"no filter, A-law", &any, &alaw, TRUE },
39 {
"PCM filter, PCM", &onlyPcm, &pcm, TRUE },
40 {
"PCM filter, A-law", &onlyPcm, &alaw, FALSE },
41 {
"48 kHz filter, 44.1 kHz", &only48k, &pcm, FALSE },
42 {
"no tag, same rate", &noTag, &alaw, TRUE },
43 {
"same format", &pcm, &pcm, TRUE },
44 {
"no filter, no sample rate", &any, &broken, FALSE },
46 for (
size_t i = 0; i < ARRAYSIZE(cases); i++)
48 const BOOL got = audio_format_compatible(cases[i].with, cases[i].format);
49 if (got != cases[i].expected)
51 (void)fprintf(stderr,
"[%s] %s: got %d, expected %d\n", __func__, cases[i].what, got,
59int TestFreeRDPCodecAudio(WINPR_ATTR_UNUSED
int argc, WINPR_ATTR_UNUSED
char* argv[])
61 if (!test_format_compatible())