Author: janderwald
Date: Wed Dec 9 10:51:39 2009
New Revision: 44479
URL:
http://svn.reactos.org/svn/reactos?rev=44479&view=rev
Log:
[MMIXER]
- Store initialized mixers in a struct MIXER_LIST
- Implement MMixerGetCapabilities
Modified:
trunk/reactos/lib/drivers/sound/mmixer/controls.c
trunk/reactos/lib/drivers/sound/mmixer/mixer.c
trunk/reactos/lib/drivers/sound/mmixer/mmixer.h
trunk/reactos/lib/drivers/sound/mmixer/priv.h
trunk/reactos/lib/drivers/sound/mmixer/sup.c
Modified: trunk/reactos/lib/drivers/sound/mmixer/controls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/c…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/controls.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/controls.c [iso-8859-1] Wed Dec 9 10:51:39
2009
@@ -781,6 +781,7 @@
MIXER_STATUS
MMixerInitializeFilter(
IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_LIST MixerList,
IN HANDLE hMixer,
IN LPWSTR DeviceName,
IN PKSMULTIPLE_ITEM NodeTypes,
@@ -866,9 +867,9 @@
}
MixerContext->Free(Pins);
- //FIXME
- // store MixerInfo in context
-
+ // store mixer info in list
+ InsertTailList(&MixerList->MixerList, &MixerInfo->Entry);
+ MixerList->MixerListCount++;
// done
return Status;
@@ -876,7 +877,8 @@
MIXER_STATUS
MMixerSetupFilter(
- IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_LIST MixerList,
IN HANDLE hMixer,
IN PULONG DeviceCount,
IN LPWSTR DeviceName)
@@ -913,7 +915,7 @@
if (NodeIndex != MAXULONG)
{
// it has
- Status = MMixerInitializeFilter(MixerContext, hMixer, DeviceName, NodeTypes,
NodeConnections, PinCount, NodeIndex, FALSE);
+ Status = MMixerInitializeFilter(MixerContext, MixerList, hMixer, DeviceName,
NodeTypes, NodeConnections, PinCount, NodeIndex, FALSE);
// check for success
if (Status == MM_STATUS_SUCCESS)
@@ -929,7 +931,7 @@
if (NodeIndex != MAXULONG)
{
// it has
- Status = MMixerInitializeFilter(MixerContext, hMixer, DeviceName, NodeTypes,
NodeConnections, PinCount, NodeIndex, TRUE);
+ Status = MMixerInitializeFilter(MixerContext, MixerList, hMixer, DeviceName,
NodeTypes, NodeConnections, PinCount, NodeIndex, TRUE);
// check for success
if (Status == MM_STATUS_SUCCESS)
Modified: trunk/reactos/lib/drivers/sound/mmixer/mixer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/m…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/mixer.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/mixer.c [iso-8859-1] Wed Dec 9 10:51:39 2009
@@ -10,6 +10,169 @@
#include "priv.h"
+ULONG
+MMixerGetCount(
+ IN PMIXER_CONTEXT MixerContext)
+{
+ PMIXER_LIST MixerList;
+ MIXER_STATUS Status;
+
+ // verify mixer context
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ // invalid context passed
+ return Status;
+ }
+
+ // grab mixer list
+ MixerList = (PMIXER_LIST)MixerContext->MixerContext;
+
+ // return number of mixers
+ return MixerList->MixerListCount;
+}
+
+MIXER_STATUS
+MMixerGetCapabilities(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG MixerIndex,
+ OUT LPMIXERCAPSW MixerCaps)
+{
+ MIXER_STATUS Status;
+ LPMIXER_INFO MixerInfo;
+
+ // verify mixer context
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ // invalid context passed
+ return Status;
+ }
+
+ // get mixer info
+ MixerInfo = MMixerGetMixerInfoByIndex(MixerContext, MixerIndex);
+
+ if (!MixerInfo)
+ {
+ // invalid device index
+ return MM_STATUS_INVALID_PARAMETER;
+ }
+
+ MixerCaps->wMid = MixerInfo->MixCaps.wMid;
+ MixerCaps->wPid = MixerInfo->MixCaps.wPid;
+ MixerCaps->vDriverVersion = MixerInfo->MixCaps.vDriverVersion;
+ MixerCaps->fdwSupport = MixerInfo->MixCaps.fdwSupport;
+ MixerCaps->cDestinations = MixerInfo->MixCaps.cDestinations;
+ wcscpy(MixerCaps->szPname, MixerInfo->MixCaps.szPname);
+
+ return MM_STATUS_SUCCESS;
+}
+
+MIXER_STATUS
+MMixerOpen(
+ IN PMIXER_CONTEXT MixerContext,
+ IN PVOID MixerEvent,
+ IN PMIXER_EVENT MixerEventRoutine,
+ OUT PHANDLE MixerHandle)
+{
+ MIXER_STATUS Status;
+
+ // verify mixer context
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ // invalid context passed
+ return Status;
+ }
+
+ return MM_STATUS_NOT_IMPLEMENTED;
+}
+
+MIXER_STATUS
+MMixerGetLineInfo(
+ IN PMIXER_CONTEXT MixerContext,
+ IN HANDLE MixerHandle,
+ IN ULONG Flags,
+ OUT LPMIXERLINEW MixerLine)
+{
+ MIXER_STATUS Status;
+
+ // verify mixer context
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ // invalid context passed
+ return Status;
+ }
+ return MM_STATUS_NOT_IMPLEMENTED;
+}
+
+MIXER_STATUS
+MMixerGetLineControls(
+ IN PMIXER_CONTEXT MixerContext,
+ IN HANDLE MixerHandle,
+ IN ULONG Flags,
+ OUT LPMIXERLINECONTROLS MixerLineControls)
+{
+ MIXER_STATUS Status;
+
+ // verify mixer context
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ // invalid context passed
+ return Status;
+ }
+
+ return MM_STATUS_NOT_IMPLEMENTED;
+}
+
+MIXER_STATUS
+MMixerSetControlDetails(
+ IN PMIXER_CONTEXT MixerContext,
+ IN HANDLE MixerHandle,
+ IN ULONG Flags,
+ OUT LPMIXERCONTROLDETAILS MixerControlDetails)
+{
+ MIXER_STATUS Status;
+
+ // verify mixer context
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ // invalid context passed
+ return Status;
+ }
+ return MM_STATUS_NOT_IMPLEMENTED;
+}
+
+MIXER_STATUS
+MMixerGetControlDetails(
+ IN PMIXER_CONTEXT MixerContext,
+ IN HANDLE MixerHandle,
+ IN ULONG Flags,
+ OUT LPMIXERCONTROLDETAILS MixerControlDetails)
+{
+ MIXER_STATUS Status;
+
+ // verify mixer context
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ // invalid context passed
+ return Status;
+ }
+
+ return MM_STATUS_NOT_IMPLEMENTED;
+}
+
MIXER_STATUS
MMixerInitialize(
IN PMIXER_CONTEXT MixerContext,
@@ -20,6 +183,7 @@
HANDLE hMixer;
ULONG DeviceIndex, Count;
LPWSTR DeviceName;
+ PMIXER_LIST MixerList;
if (!MixerContext || !EnumFunction || !EnumContext)
{
@@ -27,12 +191,23 @@
return MM_STATUS_INVALID_PARAMETER;
}
- if (!MixerContext->Alloc || !MixerContext->Control || !MixerContext->Free)
+ if (!MixerContext->Alloc || !MixerContext->Control || !MixerContext->Free ||
!MixerContext->Open || !MixerContext->Close)
{
// invalid parameter
return MM_STATUS_INVALID_PARAMETER;
}
+ // allocate a mixer list
+ MixerList = (PMIXER_LIST)MixerContext->Alloc(sizeof(MIXER_LIST));
+ if (!MixerList)
+ {
+ // no memory
+ return MM_STATUS_NO_MEMORY;
+ }
+
+ //initialize mixer list
+ MixerList->MixerListCount = 0;
+ InitializeListHead(&MixerList->MixerList);
// start enumerating all available devices
Count = 0;
@@ -59,7 +234,7 @@
// increment device index
DeviceIndex++;
- Status = MMixerSetupFilter(MixerContext, hMixer, &Count, DeviceName);
+ Status = MMixerSetupFilter(MixerContext, MixerList, hMixer, &Count,
DeviceName);
if (Status != MM_STATUS_SUCCESS)
break;
@@ -69,5 +244,3 @@
// done
return Status;
}
-
-
Modified: trunk/reactos/lib/drivers/sound/mmixer/mmixer.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/m…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/mmixer.h [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/mmixer.h [iso-8859-1] Wed Dec 9 10:51:39 2009
@@ -60,16 +60,11 @@
PMIXER_CLOSE Close;
}MIXER_CONTEXT, *PMIXER_CONTEXT;
-
-
-
-
MIXER_STATUS
MMixerInitialize(
- IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_CONTEXT MixerContext,
IN PMIXER_ENUM EnumFunction,
IN PVOID EnumContext);
-
ULONG
MMixerGetCount(
@@ -79,7 +74,7 @@
MMixerGetCapabilities(
IN PMIXER_CONTEXT MixerContext,
IN ULONG MixerIndex,
- OUT MIXERCAPSW MixerCaps);
+ OUT LPMIXERCAPSW MixerCaps);
MIXER_STATUS
MMixerOpen(
@@ -90,24 +85,28 @@
MIXER_STATUS
MMixerGetLineInfo(
+ IN PMIXER_CONTEXT MixerContext,
IN HANDLE MixerHandle,
IN ULONG Flags,
OUT LPMIXERLINEW MixerLine);
MIXER_STATUS
MMixerGetLineControls(
+ IN PMIXER_CONTEXT MixerContext,
IN HANDLE MixerHandle,
IN ULONG Flags,
OUT LPMIXERLINECONTROLS MixerLineControls);
MIXER_STATUS
MMixerSetControlDetails(
+ IN PMIXER_CONTEXT MixerContext,
IN HANDLE MixerHandle,
IN ULONG Flags,
OUT LPMIXERCONTROLDETAILS MixerControlDetails);
MIXER_STATUS
MMixerGetControlDetails(
+ IN PMIXER_CONTEXT MixerContext,
IN HANDLE MixerHandle,
IN ULONG Flags,
OUT LPMIXERCONTROLDETAILS MixerControlDetails);
Modified: trunk/reactos/lib/drivers/sound/mmixer/priv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/p…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/priv.h [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/priv.h [iso-8859-1] Wed Dec 9 10:51:39 2009
@@ -18,6 +18,7 @@
typedef struct
{
+ LIST_ENTRY Entry;
MIXERCAPSW MixCaps;
HANDLE hMixer;
LIST_ENTRY LineList;
@@ -52,6 +53,11 @@
PLONG Values;
}MIXERVOLUME_DATA, *LPMIXERVOLUME_DATA;
+typedef struct
+{
+ ULONG MixerListCount;
+ LIST_ENTRY MixerList;
+}MIXER_LIST, *PMIXER_LIST;
#define DESTINATION_LINE 0xFFFF0000
@@ -125,7 +131,8 @@
MIXER_STATUS
MMixerSetupFilter(
- IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_LIST MixerList,
IN HANDLE hMixer,
IN PULONG DeviceCount,
IN LPWSTR DeviceName);
@@ -148,4 +155,14 @@
IN ULONG bUpDirection,
OUT PULONG Nodes);
+MIXER_STATUS
+MMixerVerifyContext(
+ IN PMIXER_CONTEXT MixerContext);
+
+LPMIXER_INFO
+MMixerGetMixerInfoByIndex(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG MixerIndex);
+
+
#endif
Modified: trunk/reactos/lib/drivers/sound/mmixer/sup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/s…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/sup.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/sup.c [iso-8859-1] Wed Dec 9 10:51:39 2009
@@ -17,7 +17,7 @@
if (MixerContext->SizeOfStruct != sizeof(MIXER_CONTEXT))
return MM_STATUS_INVALID_PARAMETER;
- if (!MixerContext->Alloc || !MixerContext->Control || !MixerContext->Free)
+ if (!MixerContext->Alloc || !MixerContext->Control || !MixerContext->Free ||
!MixerContext->Open || !MixerContext->Close)
return MM_STATUS_INVALID_PARAMETER;
if (!MixerContext->MixerContext)
@@ -37,6 +37,40 @@
MixerContext->Free((PVOID)MixerInfo);
}
+
+LPMIXER_INFO
+MMixerGetMixerInfoByIndex(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG MixerIndex)
+{
+ LPMIXER_INFO MixerInfo;
+ PLIST_ENTRY Entry;
+ PMIXER_LIST MixerList;
+ ULONG Index = 0;
+
+ // get mixer list
+ MixerList = (PMIXER_LIST)MixerContext->MixerContext;
+
+ if (!MixerList->MixerListCount)
+ return NULL;
+
+ Entry = MixerList->MixerList.Flink;
+
+ while(Entry != &MixerList->MixerList)
+ {
+ MixerInfo = (LPMIXER_INFO)CONTAINING_RECORD(Entry, MIXER_INFO, Entry);
+
+ if (Index == MixerIndex)
+ return MixerInfo;
+
+ // move to next mixer entry
+ Index++;
+ Entry = Entry->Flink;
+ }
+
+ return NULL;
+}
+
LPMIXERLINE_EXT
MMixerGetSourceMixerLineByLineId(