- Add more error checks
- Fix a bug MMixerGetControlsFromPinByConnectionIndex which pre-early stopped the enumeration of mixer controls
- Only add guids which can be later be resolved to mixer control
- Check if no a topology connection has no links connected

svn path=/trunk/; revision=44559
This commit is contained in:
Johannes Anderwald 2009-12-13 11:32:44 +00:00
parent 5ed5d97905
commit a20e1844ce
2 changed files with 35 additions and 11 deletions

View file

@ -96,6 +96,12 @@ MMixerGetControlsFromPinByConnectionIndex(
else else
NodeIndex = CurConnection->ToNode; NodeIndex = CurConnection->ToNode;
if (NodeIndex > NodeTypes->Count)
{
// reached end of pin connection
return MM_STATUS_SUCCESS;
}
/* get target node type of current connection */ /* get target node type of current connection */
NodeType = MMixerGetNodeType(NodeTypes, NodeIndex); NodeType = MMixerGetNodeType(NodeTypes, NodeIndex);
@ -124,7 +130,7 @@ MMixerGetControlsFromPinByConnectionIndex(
Status = MMixerGetNodeIndexes(MixerContext, NodeConnections, NodeIndex, TRUE, TRUE, &NodeConnectionCount, &NodeConnection); Status = MMixerGetNodeIndexes(MixerContext, NodeConnections, NodeIndex, TRUE, TRUE, &NodeConnectionCount, &NodeConnection);
} }
if (Status != MM_STATUS_SUCCESS) if (Status == MM_STATUS_SUCCESS)
{ {
for(Index = 0; Index < NodeConnectionCount; Index++) for(Index = 0; Index < NodeConnectionCount; Index++)
{ {
@ -332,6 +338,7 @@ MMixerAddMixerSourceLine(
LPWSTR PinName; LPWSTR PinName;
GUID NodeType; GUID NodeType;
ULONG BytesReturned, ControlCount, Index; ULONG BytesReturned, ControlCount, Index;
LPGUID Node;
PULONG Nodes; PULONG Nodes;
if (!bTargetPin) if (!bTargetPin)
@ -414,10 +421,16 @@ MMixerAddMixerSourceLine(
{ {
if (Nodes[Index]) if (Nodes[Index])
{ {
// found a node // get node type
Node = MMixerGetNodeType(NodeTypes, Index);
if (MMixerGetControlTypeFromTopologyNode(Node))
{
// found a node which can be resolved to a type
ControlCount++; ControlCount++;
} }
} }
}
/* now allocate the line controls */ /* now allocate the line controls */
if (ControlCount) if (ControlCount)
@ -456,6 +469,11 @@ MMixerAddMixerSourceLine(
for(Index = 0; Index < NodeTypes->Count; Index++) for(Index = 0; Index < NodeTypes->Count; Index++)
{ {
if (Nodes[Index]) if (Nodes[Index])
{
// get node type
Node = MMixerGetNodeType(NodeTypes, Index);
if (MMixerGetControlTypeFromTopologyNode(Node))
{ {
/* store the node index for retrieving / setting details */ /* store the node index for retrieving / setting details */
SrcLine->NodeIds[ControlCount] = Index; SrcLine->NodeIds[ControlCount] = Index;
@ -468,6 +486,7 @@ MMixerAddMixerSourceLine(
} }
} }
} }
}
/* store control count */ /* store control count */
SrcLine->Line.cControls = ControlCount; SrcLine->Line.cControls = ControlCount;
} }
@ -902,8 +921,6 @@ MMixerInitializeFilter(
return Status; return Status;
} }
RtlZeroMemory(Pins, sizeof(ULONG) * PinCount); RtlZeroMemory(Pins, sizeof(ULONG) * PinCount);
// now get the target pins of the ADC / DAC node // now get the target pins of the ADC / DAC node
Status = MMixerGetTargetPins(MixerContext, NodeTypes, NodeConnections, NodeIndex, bInputMixer, Pins, PinCount); Status = MMixerGetTargetPins(MixerContext, NodeTypes, NodeConnections, NodeIndex, bInputMixer, Pins, PinCount);

View file

@ -251,6 +251,13 @@ MMixerGetNodeIndexes(
Connection++; Connection++;
} }
if (!Count)
{
*NodeReferenceCount = 0;
*NodeReference = NULL;
return MM_STATUS_SUCCESS;
}
ASSERT(Count != 0); ASSERT(Count != 0);
/* now allocate node index array */ /* now allocate node index array */