mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 18:53:33 +00:00
[MMIXER]
- Open all filters before starting enumeration. The advantage is that some filters are not opened twice - Query the Mixer Name from Registry by opening the device interface registry key and querying for the value of FriendlyName. If it cannot be found, try to find the key under the sub key 'Device Parameters' svn path=/trunk/; revision=44646
This commit is contained in:
parent
f814e48ad5
commit
82dfe03d66
5 changed files with 214 additions and 47 deletions
|
@ -667,6 +667,7 @@ MMixerAddMixerSourceLines(
|
||||||
MIXER_STATUS
|
MIXER_STATUS
|
||||||
MMixerHandlePhysicalConnection(
|
MMixerHandlePhysicalConnection(
|
||||||
IN PMIXER_CONTEXT MixerContext,
|
IN PMIXER_CONTEXT MixerContext,
|
||||||
|
IN PMIXER_LIST MixerList,
|
||||||
IN OUT LPMIXER_INFO MixerInfo,
|
IN OUT LPMIXER_INFO MixerInfo,
|
||||||
IN ULONG bInput,
|
IN ULONG bInput,
|
||||||
IN PKSPIN_PHYSICALCONNECTION OutConnection)
|
IN PKSPIN_PHYSICALCONNECTION OutConnection)
|
||||||
|
@ -674,47 +675,41 @@ MMixerHandlePhysicalConnection(
|
||||||
PULONG PinsRef = NULL, PinConnectionIndex = NULL, PinsSrcRef;
|
PULONG PinsRef = NULL, PinConnectionIndex = NULL, PinsSrcRef;
|
||||||
ULONG PinsRefCount, Index, PinConnectionIndexCount;
|
ULONG PinsRefCount, Index, PinConnectionIndexCount;
|
||||||
MIXER_STATUS Status;
|
MIXER_STATUS Status;
|
||||||
HANDLE hDevice = NULL;
|
|
||||||
PKSMULTIPLE_ITEM NodeTypes = NULL;
|
PKSMULTIPLE_ITEM NodeTypes = NULL;
|
||||||
PKSMULTIPLE_ITEM NodeConnections = NULL;
|
PKSMULTIPLE_ITEM NodeConnections = NULL;
|
||||||
PULONG MixerControls;
|
PULONG MixerControls;
|
||||||
ULONG MixerControlsCount;
|
ULONG MixerControlsCount;
|
||||||
|
LPMIXER_DATA MixerData;
|
||||||
|
|
||||||
|
|
||||||
// open the connected filter
|
// open the connected filter
|
||||||
Status = MixerContext->Open(OutConnection->SymbolicLinkName, &hDevice);
|
OutConnection->SymbolicLinkName[1] = L'\\';
|
||||||
if (Status != MM_STATUS_SUCCESS)
|
MixerData = MMixerGetDataByDeviceName(MixerList, OutConnection->SymbolicLinkName);
|
||||||
{
|
ASSERT(MixerData);
|
||||||
DPRINT("OpenDevice failed with %x\n", Status);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get connected filter pin count
|
// get connected filter pin count
|
||||||
PinsRefCount = MMixerGetFilterPinCount(MixerContext, hDevice);
|
PinsRefCount = MMixerGetFilterPinCount(MixerContext, MixerData->hDevice);
|
||||||
ASSERT(PinsRefCount);
|
ASSERT(PinsRefCount);
|
||||||
|
|
||||||
PinsRef = (PULONG)MixerContext->Alloc(sizeof(ULONG) * PinsRefCount);
|
PinsRef = (PULONG)MixerContext->Alloc(sizeof(ULONG) * PinsRefCount);
|
||||||
if (!PinsRef)
|
if (!PinsRef)
|
||||||
{
|
{
|
||||||
// no memory
|
// no memory
|
||||||
MixerContext->Close(hDevice);
|
|
||||||
return MM_STATUS_UNSUCCESSFUL;
|
return MM_STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get topology node types
|
// get topology node types
|
||||||
Status = MMixerGetFilterTopologyProperty(MixerContext, hDevice, KSPROPERTY_TOPOLOGY_NODES, &NodeTypes);
|
Status = MMixerGetFilterTopologyProperty(MixerContext, MixerData->hDevice, KSPROPERTY_TOPOLOGY_NODES, &NodeTypes);
|
||||||
if (Status != MM_STATUS_SUCCESS)
|
if (Status != MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
MixerContext->Close(hDevice);
|
|
||||||
MixerContext->Free(PinsRef);
|
MixerContext->Free(PinsRef);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get topology connections
|
// get topology connections
|
||||||
Status = MMixerGetFilterTopologyProperty(MixerContext, hDevice, KSPROPERTY_TOPOLOGY_CONNECTIONS, &NodeConnections);
|
Status = MMixerGetFilterTopologyProperty(MixerContext, MixerData->hDevice, KSPROPERTY_TOPOLOGY_CONNECTIONS, &NodeConnections);
|
||||||
if (Status != MM_STATUS_SUCCESS)
|
if (Status != MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
MixerContext->Close(hDevice);
|
|
||||||
MixerContext->Free(PinsRef);
|
MixerContext->Free(PinsRef);
|
||||||
MixerContext->Free(NodeTypes);
|
MixerContext->Free(NodeTypes);
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -725,7 +720,6 @@ MMixerHandlePhysicalConnection(
|
||||||
Status = MMixerGetNodeIndexes(MixerContext, NodeConnections, OutConnection->Pin, FALSE, !bInput, &PinConnectionIndexCount, &PinConnectionIndex);
|
Status = MMixerGetNodeIndexes(MixerContext, NodeConnections, OutConnection->Pin, FALSE, !bInput, &PinConnectionIndexCount, &PinConnectionIndex);
|
||||||
if (Status != MM_STATUS_SUCCESS)
|
if (Status != MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
MixerContext->Close(hDevice);
|
|
||||||
MixerContext->Free(PinsRef);
|
MixerContext->Free(PinsRef);
|
||||||
MixerContext->Free(NodeTypes);
|
MixerContext->Free(NodeTypes);
|
||||||
MixerContext->Free(NodeConnections);
|
MixerContext->Free(NodeConnections);
|
||||||
|
@ -739,7 +733,6 @@ MMixerHandlePhysicalConnection(
|
||||||
Status = MMixerGetTargetPinsByNodeConnectionIndex(MixerContext, NodeConnections, NodeTypes, FALSE, PinConnectionIndex[0], PinsRef);
|
Status = MMixerGetTargetPinsByNodeConnectionIndex(MixerContext, NodeConnections, NodeTypes, FALSE, PinConnectionIndex[0], PinsRef);
|
||||||
if (Status != MM_STATUS_SUCCESS)
|
if (Status != MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
MixerContext->Close(hDevice);
|
|
||||||
MixerContext->Free(PinsRef);
|
MixerContext->Free(PinsRef);
|
||||||
MixerContext->Free(NodeTypes);
|
MixerContext->Free(NodeTypes);
|
||||||
MixerContext->Free(NodeConnections);
|
MixerContext->Free(NodeConnections);
|
||||||
|
@ -767,7 +760,6 @@ MMixerHandlePhysicalConnection(
|
||||||
if (!PinsSrcRef)
|
if (!PinsSrcRef)
|
||||||
{
|
{
|
||||||
/* no memory */
|
/* no memory */
|
||||||
MixerContext->Close(hDevice);
|
|
||||||
MixerContext->Free(PinsRef);
|
MixerContext->Free(PinsRef);
|
||||||
MixerContext->Free(NodeTypes);
|
MixerContext->Free(NodeTypes);
|
||||||
MixerContext->Free(NodeConnections);
|
MixerContext->Free(NodeConnections);
|
||||||
|
@ -781,7 +773,6 @@ MMixerHandlePhysicalConnection(
|
||||||
if (Status != MM_STATUS_SUCCESS)
|
if (Status != MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
// failed */
|
// failed */
|
||||||
MixerContext->Close(hDevice);
|
|
||||||
MixerContext->Free(PinsRef);
|
MixerContext->Free(PinsRef);
|
||||||
MixerContext->Free(NodeTypes);
|
MixerContext->Free(NodeTypes);
|
||||||
MixerContext->Free(NodeConnections);
|
MixerContext->Free(NodeConnections);
|
||||||
|
@ -800,7 +791,7 @@ MMixerHandlePhysicalConnection(
|
||||||
}
|
}
|
||||||
PinsSrcRef[OutConnection->Pin] = TRUE;
|
PinsSrcRef[OutConnection->Pin] = TRUE;
|
||||||
|
|
||||||
Status = MMixerAddMixerSourceLines(MixerContext, MixerInfo, hDevice, NodeConnections, NodeTypes, PinsRefCount, OutConnection->Pin, Index, PinsSrcRef);
|
Status = MMixerAddMixerSourceLines(MixerContext, MixerInfo, MixerData->hDevice, NodeConnections, NodeTypes, PinsRefCount, OutConnection->Pin, Index, PinsSrcRef);
|
||||||
|
|
||||||
MixerContext->Free(MixerControls);
|
MixerContext->Free(MixerControls);
|
||||||
MixerContext->Free(PinsSrcRef);
|
MixerContext->Free(PinsSrcRef);
|
||||||
|
@ -815,8 +806,7 @@ MIXER_STATUS
|
||||||
MMixerInitializeFilter(
|
MMixerInitializeFilter(
|
||||||
IN PMIXER_CONTEXT MixerContext,
|
IN PMIXER_CONTEXT MixerContext,
|
||||||
IN PMIXER_LIST MixerList,
|
IN PMIXER_LIST MixerList,
|
||||||
IN HANDLE hMixer,
|
IN LPMIXER_DATA MixerData,
|
||||||
IN LPWSTR DeviceName,
|
|
||||||
IN PKSMULTIPLE_ITEM NodeTypes,
|
IN PKSMULTIPLE_ITEM NodeTypes,
|
||||||
IN PKSMULTIPLE_ITEM NodeConnections,
|
IN PKSMULTIPLE_ITEM NodeConnections,
|
||||||
IN ULONG PinCount,
|
IN ULONG PinCount,
|
||||||
|
@ -847,13 +837,14 @@ MMixerInitializeFilter(
|
||||||
MixerInfo->MixCaps.vDriverVersion = 1; //FIXME
|
MixerInfo->MixCaps.vDriverVersion = 1; //FIXME
|
||||||
MixerInfo->MixCaps.fdwSupport = 0;
|
MixerInfo->MixCaps.fdwSupport = 0;
|
||||||
MixerInfo->MixCaps.cDestinations = 1;
|
MixerInfo->MixCaps.cDestinations = 1;
|
||||||
MixerInfo->hMixer = hMixer;
|
MixerInfo->hMixer = MixerData->hDevice;
|
||||||
|
|
||||||
|
// get mixer name
|
||||||
|
MMixerGetDeviceName(MixerContext, MixerInfo, MixerData->hDeviceInterfaceKey);
|
||||||
|
|
||||||
// initialize line list
|
// initialize line list
|
||||||
InitializeListHead(&MixerInfo->LineList);
|
InitializeListHead(&MixerInfo->LineList);
|
||||||
|
|
||||||
/* FIXME find mixer name */
|
|
||||||
|
|
||||||
// now allocate an array which will receive the indices of the pin
|
// now allocate an array which will receive the indices of the pin
|
||||||
// which has a ADC / DAC nodetype in its path
|
// which has a ADC / DAC nodetype in its path
|
||||||
Pins = (PULONG)MixerContext->Alloc(PinCount * sizeof(ULONG));
|
Pins = (PULONG)MixerContext->Alloc(PinCount * sizeof(ULONG));
|
||||||
|
@ -880,7 +871,7 @@ MMixerInitializeFilter(
|
||||||
Pin.Property.Id = KSPROPERTY_PIN_NAME;
|
Pin.Property.Id = KSPROPERTY_PIN_NAME;
|
||||||
|
|
||||||
/* try get pin name size */
|
/* try get pin name size */
|
||||||
Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), NULL, 0, &BytesReturned);
|
Status = MixerContext->Control(MixerData->hDevice, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), NULL, 0, &BytesReturned);
|
||||||
|
|
||||||
if (Status == MM_STATUS_MORE_ENTRIES)
|
if (Status == MM_STATUS_MORE_ENTRIES)
|
||||||
{
|
{
|
||||||
|
@ -888,7 +879,7 @@ MMixerInitializeFilter(
|
||||||
if (Buffer)
|
if (Buffer)
|
||||||
{
|
{
|
||||||
/* try get pin name */
|
/* try get pin name */
|
||||||
Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), (PVOID)Buffer, BytesReturned, &BytesReturned);
|
Status = MixerContext->Control(MixerData->hDevice, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), (PVOID)Buffer, BytesReturned, &BytesReturned);
|
||||||
if (Status != MM_STATUS_SUCCESS)
|
if (Status != MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
MixerContext->Free((PVOID)Buffer);
|
MixerContext->Free((PVOID)Buffer);
|
||||||
|
@ -945,11 +936,11 @@ MMixerInitializeFilter(
|
||||||
if (Pins[Index])
|
if (Pins[Index])
|
||||||
{
|
{
|
||||||
// check if the pin has a physical connection
|
// check if the pin has a physical connection
|
||||||
Status = MMixerGetPhysicalConnection(MixerContext, hMixer, Index, &OutConnection);
|
Status = MMixerGetPhysicalConnection(MixerContext, MixerData->hDevice, Index, &OutConnection);
|
||||||
if (Status == MM_STATUS_SUCCESS)
|
if (Status == MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
// the pin has a physical connection
|
// the pin has a physical connection
|
||||||
Status = MMixerHandlePhysicalConnection(MixerContext, MixerInfo, bInputMixer, OutConnection);
|
Status = MMixerHandlePhysicalConnection(MixerContext, MixerList, MixerInfo, bInputMixer, OutConnection);
|
||||||
DPRINT("MMixerHandlePhysicalConnection status %u\n", Status);
|
DPRINT("MMixerHandlePhysicalConnection status %u\n", Status);
|
||||||
MixerContext->Free(OutConnection);
|
MixerContext->Free(OutConnection);
|
||||||
bUsed = TRUE;
|
bUsed = TRUE;
|
||||||
|
@ -957,7 +948,7 @@ MMixerInitializeFilter(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// filter exposes the topology on the same filter
|
// filter exposes the topology on the same filter
|
||||||
MMixerAddMixerSourceLine(MixerContext, MixerInfo, hMixer, NodeConnections, NodeTypes, Index, FALSE, FALSE);
|
MMixerAddMixerSourceLine(MixerContext, MixerInfo, MixerData->hDevice, NodeConnections, NodeTypes, Index, FALSE, FALSE);
|
||||||
bUsed = TRUE;
|
bUsed = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -994,9 +985,8 @@ MIXER_STATUS
|
||||||
MMixerSetupFilter(
|
MMixerSetupFilter(
|
||||||
IN PMIXER_CONTEXT MixerContext,
|
IN PMIXER_CONTEXT MixerContext,
|
||||||
IN PMIXER_LIST MixerList,
|
IN PMIXER_LIST MixerList,
|
||||||
IN HANDLE hMixer,
|
IN LPMIXER_DATA MixerData,
|
||||||
IN PULONG DeviceCount,
|
IN PULONG DeviceCount)
|
||||||
IN LPWSTR DeviceName)
|
|
||||||
{
|
{
|
||||||
PKSMULTIPLE_ITEM NodeTypes, NodeConnections;
|
PKSMULTIPLE_ITEM NodeTypes, NodeConnections;
|
||||||
MIXER_STATUS Status;
|
MIXER_STATUS Status;
|
||||||
|
@ -1004,12 +994,12 @@ MMixerSetupFilter(
|
||||||
ULONG NodeIndex;
|
ULONG NodeIndex;
|
||||||
|
|
||||||
// get number of pins
|
// get number of pins
|
||||||
PinCount = MMixerGetFilterPinCount(MixerContext, hMixer);
|
PinCount = MMixerGetFilterPinCount(MixerContext, MixerData->hDevice);
|
||||||
ASSERT(PinCount);
|
ASSERT(PinCount);
|
||||||
DPRINT("NumOfPins: %lu\n", PinCount);
|
DPRINT("NumOfPins: %lu\n", PinCount);
|
||||||
|
|
||||||
// get filter node types
|
// get filter node types
|
||||||
Status = MMixerGetFilterTopologyProperty(MixerContext, hMixer, KSPROPERTY_TOPOLOGY_NODES, &NodeTypes);
|
Status = MMixerGetFilterTopologyProperty(MixerContext, MixerData->hDevice, KSPROPERTY_TOPOLOGY_NODES, &NodeTypes);
|
||||||
if (Status != MM_STATUS_SUCCESS)
|
if (Status != MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
// failed
|
// failed
|
||||||
|
@ -1017,7 +1007,7 @@ MMixerSetupFilter(
|
||||||
}
|
}
|
||||||
|
|
||||||
// get filter node connections
|
// get filter node connections
|
||||||
Status = MMixerGetFilterTopologyProperty(MixerContext, hMixer, KSPROPERTY_TOPOLOGY_CONNECTIONS, &NodeConnections);
|
Status = MMixerGetFilterTopologyProperty(MixerContext, MixerData->hDevice, KSPROPERTY_TOPOLOGY_CONNECTIONS, &NodeConnections);
|
||||||
if (Status != MM_STATUS_SUCCESS)
|
if (Status != MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
// failed
|
// failed
|
||||||
|
@ -1030,7 +1020,7 @@ MMixerSetupFilter(
|
||||||
if (NodeIndex != MAXULONG)
|
if (NodeIndex != MAXULONG)
|
||||||
{
|
{
|
||||||
// it has
|
// it has
|
||||||
Status = MMixerInitializeFilter(MixerContext, MixerList, hMixer, DeviceName, NodeTypes, NodeConnections, PinCount, NodeIndex, FALSE);
|
Status = MMixerInitializeFilter(MixerContext, MixerList, MixerData, NodeTypes, NodeConnections, PinCount, NodeIndex, FALSE);
|
||||||
DPRINT("MMixerInitializeFilter Status %u\n", Status);
|
DPRINT("MMixerInitializeFilter Status %u\n", Status);
|
||||||
// check for success
|
// check for success
|
||||||
if (Status == MM_STATUS_SUCCESS)
|
if (Status == MM_STATUS_SUCCESS)
|
||||||
|
@ -1046,7 +1036,7 @@ MMixerSetupFilter(
|
||||||
if (NodeIndex != MAXULONG)
|
if (NodeIndex != MAXULONG)
|
||||||
{
|
{
|
||||||
// it has
|
// it has
|
||||||
Status = MMixerInitializeFilter(MixerContext, MixerList, hMixer, DeviceName, NodeTypes, NodeConnections, PinCount, NodeIndex, TRUE);
|
Status = MMixerInitializeFilter(MixerContext, MixerList, MixerData, NodeTypes, NodeConnections, PinCount, NodeIndex, TRUE);
|
||||||
DPRINT("MMixerInitializeFilter Status %u\n", Status);
|
DPRINT("MMixerInitializeFilter Status %u\n", Status);
|
||||||
// check for success
|
// check for success
|
||||||
if (Status == MM_STATUS_SUCCESS)
|
if (Status == MM_STATUS_SUCCESS)
|
||||||
|
|
|
@ -409,10 +409,12 @@ MMixerInitialize(
|
||||||
IN PVOID EnumContext)
|
IN PVOID EnumContext)
|
||||||
{
|
{
|
||||||
MIXER_STATUS Status;
|
MIXER_STATUS Status;
|
||||||
HANDLE hMixer;
|
HANDLE hMixer, hKey;
|
||||||
ULONG DeviceIndex, Count;
|
ULONG DeviceIndex, Count;
|
||||||
LPWSTR DeviceName;
|
LPWSTR DeviceName;
|
||||||
|
LPMIXER_DATA MixerData;
|
||||||
PMIXER_LIST MixerList;
|
PMIXER_LIST MixerList;
|
||||||
|
PLIST_ENTRY Entry;
|
||||||
|
|
||||||
if (!MixerContext || !EnumFunction || !EnumContext)
|
if (!MixerContext || !EnumFunction || !EnumContext)
|
||||||
{
|
{
|
||||||
|
@ -420,7 +422,8 @@ MMixerInitialize(
|
||||||
return MM_STATUS_INVALID_PARAMETER;
|
return MM_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MixerContext->Alloc || !MixerContext->Control || !MixerContext->Free || !MixerContext->Open || !MixerContext->Close)
|
if (!MixerContext->Alloc || !MixerContext->Control || !MixerContext->Free || !MixerContext->Open ||
|
||||||
|
!MixerContext->Close || !MixerContext->OpenKey || !MixerContext->QueryKeyValue || !MixerContext->CloseKey)
|
||||||
{
|
{
|
||||||
// invalid parameter
|
// invalid parameter
|
||||||
return MM_STATUS_INVALID_PARAMETER;
|
return MM_STATUS_INVALID_PARAMETER;
|
||||||
|
@ -436,7 +439,9 @@ MMixerInitialize(
|
||||||
|
|
||||||
//initialize mixer list
|
//initialize mixer list
|
||||||
MixerList->MixerListCount = 0;
|
MixerList->MixerListCount = 0;
|
||||||
|
MixerList->MixerDataCount = 0;
|
||||||
InitializeListHead(&MixerList->MixerList);
|
InitializeListHead(&MixerList->MixerList);
|
||||||
|
InitializeListHead(&MixerList->MixerData);
|
||||||
|
|
||||||
// store mixer list
|
// store mixer list
|
||||||
MixerContext->MixerContext = (PVOID)MixerList;
|
MixerContext->MixerContext = (PVOID)MixerList;
|
||||||
|
@ -445,12 +450,10 @@ MMixerInitialize(
|
||||||
Count = 0;
|
Count = 0;
|
||||||
DeviceIndex = 0;
|
DeviceIndex = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// enumerate a device
|
// enumerate a device
|
||||||
Status = EnumFunction(EnumContext, DeviceIndex, &DeviceName, &hMixer);
|
Status = EnumFunction(EnumContext, DeviceIndex, &DeviceName, &hMixer, &hKey);
|
||||||
|
|
||||||
if (Status != MM_STATUS_SUCCESS)
|
if (Status != MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -463,13 +466,26 @@ MMixerInitialize(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MMixerSetupFilter(MixerContext, MixerList, hMixer, &Count, DeviceName);
|
// create a mixer data entry
|
||||||
|
Status = MMixerCreateMixerData(MixerContext, MixerList, DeviceIndex, DeviceName, hMixer, hKey);
|
||||||
|
if (Status != MM_STATUS_SUCCESS)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// increment device index
|
// increment device index
|
||||||
DeviceIndex++;
|
DeviceIndex++;
|
||||||
}while(TRUE);
|
}while(TRUE);
|
||||||
|
|
||||||
|
//now all filters have been pre-opened
|
||||||
|
// lets enumerate the filters
|
||||||
|
Entry = MixerList->MixerData.Flink;
|
||||||
|
while(Entry != &MixerList->MixerData)
|
||||||
|
{
|
||||||
|
MixerData = (LPMIXER_DATA)CONTAINING_RECORD(Entry, MIXER_DATA, Entry);
|
||||||
|
MMixerSetupFilter(MixerContext, MixerList, MixerData, &Count);
|
||||||
|
Entry = Entry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
// done
|
// done
|
||||||
return MM_STATUS_SUCCESS;
|
return MM_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@ typedef MIXER_STATUS (*PMIXER_ENUM)(
|
||||||
IN PVOID EnumContext,
|
IN PVOID EnumContext,
|
||||||
IN ULONG DeviceIndex,
|
IN ULONG DeviceIndex,
|
||||||
OUT LPWSTR * DeviceName,
|
OUT LPWSTR * DeviceName,
|
||||||
OUT PHANDLE OutHandle);
|
OUT PHANDLE OutHandle,
|
||||||
|
OUT PHANDLE OutDevInterfaceKey);
|
||||||
|
|
||||||
typedef MIXER_STATUS(*PMIXER_DEVICE_CONTROL)(
|
typedef MIXER_STATUS(*PMIXER_DEVICE_CONTROL)(
|
||||||
IN HANDLE hMixer,
|
IN HANDLE hMixer,
|
||||||
|
@ -44,6 +45,9 @@ typedef MIXER_STATUS(*PMIXER_OPEN)(
|
||||||
typedef MIXER_STATUS(*PMIXER_CLOSE)(
|
typedef MIXER_STATUS(*PMIXER_CLOSE)(
|
||||||
IN HANDLE hDevice);
|
IN HANDLE hDevice);
|
||||||
|
|
||||||
|
typedef MIXER_STATUS(*PMIXER_CLOSEKEY)(
|
||||||
|
IN HANDLE hKey);
|
||||||
|
|
||||||
typedef VOID (*PMIXER_EVENT)(
|
typedef VOID (*PMIXER_EVENT)(
|
||||||
IN PVOID MixerEvent);
|
IN PVOID MixerEvent);
|
||||||
|
|
||||||
|
@ -52,6 +56,18 @@ typedef VOID (*PMIXER_COPY)(
|
||||||
IN PVOID Src,
|
IN PVOID Src,
|
||||||
IN ULONG Length);
|
IN ULONG Length);
|
||||||
|
|
||||||
|
typedef MIXER_STATUS(*PMIXER_QUERY_KEY_VALUE)(
|
||||||
|
IN HANDLE hKey,
|
||||||
|
IN LPWSTR KeyName,
|
||||||
|
OUT PVOID * ResultBuffer,
|
||||||
|
OUT PULONG ResultLength,
|
||||||
|
OUT PULONG KeyType);
|
||||||
|
|
||||||
|
typedef MIXER_STATUS(*PMIXER_OPEN_KEY)(
|
||||||
|
IN HANDLE hKey,
|
||||||
|
IN LPWSTR SubKey,
|
||||||
|
IN ULONG DesiredAccess,
|
||||||
|
OUT PHANDLE OutKey);
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -64,6 +80,9 @@ typedef struct
|
||||||
PMIXER_OPEN Open;
|
PMIXER_OPEN Open;
|
||||||
PMIXER_CLOSE Close;
|
PMIXER_CLOSE Close;
|
||||||
PMIXER_COPY Copy;
|
PMIXER_COPY Copy;
|
||||||
|
PMIXER_OPEN_KEY OpenKey;
|
||||||
|
PMIXER_QUERY_KEY_VALUE QueryKeyValue;
|
||||||
|
PMIXER_CLOSEKEY CloseKey;
|
||||||
}MIXER_CONTEXT, *PMIXER_CONTEXT;
|
}MIXER_CONTEXT, *PMIXER_CONTEXT;
|
||||||
|
|
||||||
MIXER_STATUS
|
MIXER_STATUS
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include "mmixer.h"
|
#include "mmixer.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -53,10 +55,21 @@ typedef struct
|
||||||
PLONG Values;
|
PLONG Values;
|
||||||
}MIXERVOLUME_DATA, *LPMIXERVOLUME_DATA;
|
}MIXERVOLUME_DATA, *LPMIXERVOLUME_DATA;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
LIST_ENTRY Entry;
|
||||||
|
ULONG DeviceId;
|
||||||
|
HANDLE hDevice;
|
||||||
|
HANDLE hDeviceInterfaceKey;
|
||||||
|
LPWSTR DeviceName;
|
||||||
|
}MIXER_DATA, *LPMIXER_DATA;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
ULONG MixerListCount;
|
ULONG MixerListCount;
|
||||||
LIST_ENTRY MixerList;
|
LIST_ENTRY MixerList;
|
||||||
|
ULONG MixerDataCount;
|
||||||
|
LIST_ENTRY MixerData;
|
||||||
}MIXER_LIST, *PMIXER_LIST;
|
}MIXER_LIST, *PMIXER_LIST;
|
||||||
|
|
||||||
#define DESTINATION_LINE 0xFFFF0000
|
#define DESTINATION_LINE 0xFFFF0000
|
||||||
|
@ -133,9 +146,8 @@ MIXER_STATUS
|
||||||
MMixerSetupFilter(
|
MMixerSetupFilter(
|
||||||
IN PMIXER_CONTEXT MixerContext,
|
IN PMIXER_CONTEXT MixerContext,
|
||||||
IN PMIXER_LIST MixerList,
|
IN PMIXER_LIST MixerList,
|
||||||
IN HANDLE hMixer,
|
IN LPMIXER_DATA MixerData,
|
||||||
IN PULONG DeviceCount,
|
IN PULONG DeviceCount);
|
||||||
IN LPWSTR DeviceName);
|
|
||||||
|
|
||||||
MIXER_STATUS
|
MIXER_STATUS
|
||||||
MMixerGetTargetPinsByNodeConnectionIndex(
|
MMixerGetTargetPinsByNodeConnectionIndex(
|
||||||
|
@ -206,4 +218,29 @@ MMixerSetGetControlDetails(
|
||||||
IN ULONG Channel,
|
IN ULONG Channel,
|
||||||
IN PLONG InputValue);
|
IN PLONG InputValue);
|
||||||
|
|
||||||
|
LPMIXER_DATA
|
||||||
|
MMixerGetDataByDeviceId(
|
||||||
|
IN PMIXER_LIST MixerList,
|
||||||
|
IN ULONG DeviceId);
|
||||||
|
|
||||||
|
LPMIXER_DATA
|
||||||
|
MMixerGetDataByDeviceName(
|
||||||
|
IN PMIXER_LIST MixerList,
|
||||||
|
IN LPWSTR DeviceName);
|
||||||
|
|
||||||
|
MIXER_STATUS
|
||||||
|
MMixerCreateMixerData(
|
||||||
|
IN PMIXER_CONTEXT MixerContext,
|
||||||
|
IN PMIXER_LIST MixerList,
|
||||||
|
IN ULONG DeviceId,
|
||||||
|
IN LPWSTR DeviceName,
|
||||||
|
IN HANDLE hDevice,
|
||||||
|
IN HANDLE hKey);
|
||||||
|
|
||||||
|
MIXER_STATUS
|
||||||
|
MMixerGetDeviceName(
|
||||||
|
IN PMIXER_CONTEXT MixerContext,
|
||||||
|
IN LPMIXER_INFO MixerInfo,
|
||||||
|
IN HANDLE hKey);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,7 +37,8 @@ MMixerVerifyContext(
|
||||||
if (MixerContext->SizeOfStruct != sizeof(MIXER_CONTEXT))
|
if (MixerContext->SizeOfStruct != sizeof(MIXER_CONTEXT))
|
||||||
return MM_STATUS_INVALID_PARAMETER;
|
return MM_STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (!MixerContext->Alloc || !MixerContext->Control || !MixerContext->Free || !MixerContext->Open || !MixerContext->Close)
|
if (!MixerContext->Alloc || !MixerContext->Control || !MixerContext->Free || !MixerContext->Open ||
|
||||||
|
!MixerContext->Close || !MixerContext->OpenKey || !MixerContext->QueryKeyValue || !MixerContext->CloseKey)
|
||||||
return MM_STATUS_INVALID_PARAMETER;
|
return MM_STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (!MixerContext->MixerContext)
|
if (!MixerContext->MixerContext)
|
||||||
|
@ -530,6 +531,7 @@ MMixerSetGetVolumeControlDetails(
|
||||||
/* set control details */
|
/* set control details */
|
||||||
if (bSet)
|
if (bSet)
|
||||||
{
|
{
|
||||||
|
/* TODO */
|
||||||
Status = MMixerSetGetControlDetails(MixerContext, hMixer, NodeId, bSet, KSPROPERTY_AUDIO_VOLUMELEVEL, 0, &Value);
|
Status = MMixerSetGetControlDetails(MixerContext, hMixer, NodeId, bSet, KSPROPERTY_AUDIO_VOLUMELEVEL, 0, &Value);
|
||||||
Status = MMixerSetGetControlDetails(MixerContext, hMixer, NodeId, bSet, KSPROPERTY_AUDIO_VOLUMELEVEL, 1, &Value);
|
Status = MMixerSetGetControlDetails(MixerContext, hMixer, NodeId, bSet, KSPROPERTY_AUDIO_VOLUMELEVEL, 1, &Value);
|
||||||
}
|
}
|
||||||
|
@ -550,3 +552,106 @@ MMixerSetGetVolumeControlDetails(
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LPMIXER_DATA
|
||||||
|
MMixerGetDataByDeviceId(
|
||||||
|
IN PMIXER_LIST MixerList,
|
||||||
|
IN ULONG DeviceId)
|
||||||
|
{
|
||||||
|
PLIST_ENTRY Entry;
|
||||||
|
LPMIXER_DATA MixerData;
|
||||||
|
|
||||||
|
Entry = MixerList->MixerData.Flink;
|
||||||
|
while(Entry != &MixerList->MixerData)
|
||||||
|
{
|
||||||
|
MixerData = (LPMIXER_DATA)CONTAINING_RECORD(Entry, MIXER_DATA, Entry);
|
||||||
|
if (MixerData->DeviceId == DeviceId)
|
||||||
|
{
|
||||||
|
return MixerData;
|
||||||
|
}
|
||||||
|
Entry = Entry->Flink;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
LPMIXER_DATA
|
||||||
|
MMixerGetDataByDeviceName(
|
||||||
|
IN PMIXER_LIST MixerList,
|
||||||
|
IN LPWSTR DeviceName)
|
||||||
|
{
|
||||||
|
PLIST_ENTRY Entry;
|
||||||
|
LPMIXER_DATA MixerData;
|
||||||
|
|
||||||
|
Entry = MixerList->MixerData.Flink;
|
||||||
|
while(Entry != &MixerList->MixerData)
|
||||||
|
{
|
||||||
|
MixerData = (LPMIXER_DATA)CONTAINING_RECORD(Entry, MIXER_DATA, Entry);
|
||||||
|
if (wcsicmp(DeviceName, MixerData->DeviceName) == 0)
|
||||||
|
{
|
||||||
|
// found entry
|
||||||
|
return MixerData;
|
||||||
|
}
|
||||||
|
Entry = Entry->Flink;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
MIXER_STATUS
|
||||||
|
MMixerCreateMixerData(
|
||||||
|
IN PMIXER_CONTEXT MixerContext,
|
||||||
|
IN PMIXER_LIST MixerList,
|
||||||
|
IN ULONG DeviceId,
|
||||||
|
IN LPWSTR DeviceName,
|
||||||
|
IN HANDLE hDevice,
|
||||||
|
IN HANDLE hKey)
|
||||||
|
{
|
||||||
|
LPMIXER_DATA MixerData;
|
||||||
|
|
||||||
|
MixerData = (LPMIXER_DATA)MixerContext->Alloc(sizeof(MIXER_DATA));
|
||||||
|
if (!MixerData)
|
||||||
|
return MM_STATUS_NO_MEMORY;
|
||||||
|
|
||||||
|
MixerData->DeviceId = DeviceId;
|
||||||
|
MixerData->DeviceName = DeviceName;
|
||||||
|
MixerData->hDevice = hDevice;
|
||||||
|
MixerData->hDeviceInterfaceKey = hKey;
|
||||||
|
|
||||||
|
InsertTailList(&MixerList->MixerData, &MixerData->Entry);
|
||||||
|
MixerList->MixerDataCount++;
|
||||||
|
return MM_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
MIXER_STATUS
|
||||||
|
MMixerGetDeviceName(
|
||||||
|
IN PMIXER_CONTEXT MixerContext,
|
||||||
|
IN LPMIXER_INFO MixerInfo,
|
||||||
|
IN HANDLE hKey)
|
||||||
|
{
|
||||||
|
LPWSTR Name;
|
||||||
|
HANDLE hTemp;
|
||||||
|
ULONG Length;
|
||||||
|
ULONG Type;
|
||||||
|
MIXER_STATUS Status;
|
||||||
|
|
||||||
|
Status = MixerContext->QueryKeyValue(hKey, L"FriendlyName", (PVOID*)&Name, &Length, &Type);
|
||||||
|
if (Status == MM_STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
wcscpy(MixerInfo->MixCaps.szPname, Name);
|
||||||
|
MixerContext->Free(Name);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = MixerContext->OpenKey(hKey, L"Device Parameters", KEY_READ, &hTemp);
|
||||||
|
if (Status != MM_STATUS_SUCCESS)
|
||||||
|
return Status;
|
||||||
|
|
||||||
|
Status = MixerContext->QueryKeyValue(hKey, L"FriendlyName", (PVOID*)&Name, &Length, &Type);
|
||||||
|
if (Status == MM_STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
wcscpy(MixerInfo->MixCaps.szPname, Name);
|
||||||
|
MixerContext->Free(Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
MixerContext->CloseKey(hTemp);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue