Fix compilation on windows

This commit is contained in:
Pierre Krieger 2016-11-16 08:17:11 +01:00
parent d6f22f4ceb
commit a26a9f5337
1 changed files with 17 additions and 4 deletions

View File

@ -185,10 +185,23 @@ impl Endpoint {
channels
};
let format = match (*format_ptr).SubFormat {
winapi::KSDATAFORMAT_SUBTYPE_IEEE_FLOAT => SampleFormat::F32,
winapi::KSDATAFORMAT_SUBTYPE_PCM => SampleFormat::I16,
g => panic!("Unknown SubFormat GUID returned by GetMixFormat: {:?}", g)
let format = {
fn cmp_guid(a: &winapi::GUID, b: &winapi::GUID) -> bool {
a.Data1 == b.Data1 && a.Data2 == b.Data2 &&
a.Data3 == b.Data3 && a.Data4 == b.Data4
}
if cmp_guid(&(*format_ptr).SubFormat,
&winapi::KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)
{
SampleFormat::F32
} else if cmp_guid(&(*format_ptr).SubFormat,
&winapi::KSDATAFORMAT_SUBTYPE_PCM)
{
SampleFormat::I16
} else {
panic!("Unknown SubFormat GUID returned by GetMixFormat: {:?}",
(*format_ptr).SubFormat)
}
};
(channels, format)