Author: janderwald
Date: Sat Oct 23 18:42:59 2010
New Revision: 49242
URL:
http://svn.reactos.org/svn/reactos?rev=49242&view=rev
Log:
[PORTCLS]
- Remove silence buffer hack
- Stub DRM Property Handler
- Before stopping the audio pin, fill the dma buffer with silence samples
- create a subdevice descriptor for instantiated pins too
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.cpp
trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp
trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.cpp
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.cpp
trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.cpp [iso-8859-1] Sat Oct 23
18:42:59 2010
@@ -79,6 +79,7 @@
const GUID KSPROPSETID_Pin = {0x8C134960L, 0x51AD, 0x11CF, {0x87,
0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}};
const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5,
0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
const GUID KSPROPTYPESETID_General = {0x97E99BA0L, 0xBDEA, 0x11CF, {0xA5,
0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
+const GUID KSPROPSETID_DrmAudioStream = {0x2f2c8ddd, 0x4198, 0x4fac, {0xba,
0x29, 0x61, 0xbb, 0x05, 0xb7, 0xde, 0x06}};
const GUID KSEVENTSETID_LoopedStreaming = {0x4682B940L, 0xC6EF, 0x11D0, {0x96,
0xD8, 0x00, 0xAA, 0x00, 0x51, 0xE5, 0x1D}};
const GUID KSEVENTSETID_Connection = {0x7f4bcbe0L, 0x9ea5, 0x11cf, {0xa5,
0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00}};
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp [iso-8859-1] Sat Oct 23
18:42:59 2010
@@ -321,8 +321,7 @@
STDMETHOD_(NTSTATUS, Init)(THIS_
IN KSPIN_CONNECT *ConnectDetails,
IN ULONG FrameSize,
- IN ULONG Alignment,
- IN PVOID SilenceBuffer) PURE;
+ IN ULONG Alignment) PURE;
STDMETHOD_(NTSTATUS, AddMapping)(THIS_
IN PIRP Irp,
@@ -363,8 +362,7 @@
STDMETHODIMP_(NTSTATUS) Init(THIS_ \
IN KSPIN_CONNECT *ConnectDetails, \
IN ULONG FrameSize, \
- IN ULONG Alignment, \
- IN PVOID SilenceBuffer); \
+ IN ULONG Alignment); \
\
STDMETHODIMP_(NTSTATUS) AddMapping(THIS_ \
IN PIRP Irp, \
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp [iso-8859-1] Sat Oct 23
18:42:59 2010
@@ -43,7 +43,6 @@
LIST_ENTRY m_IrpList;
LIST_ENTRY m_FreeIrpList;
PIRP m_Irp;
- PVOID m_SilenceBuffer;
ULONG m_OutOfMapping;
ULONG m_MaxFrameSize;
@@ -84,12 +83,10 @@
CIrpQueue::Init(
IN KSPIN_CONNECT *ConnectDetails,
IN ULONG FrameSize,
- IN ULONG Alignment,
- IN PVOID SilenceBuffer)
+ IN ULONG Alignment)
{
m_ConnectDetails = ConnectDetails;
m_MaxFrameSize = FrameSize;
- m_SilenceBuffer = SilenceBuffer;
m_Alignment = Alignment;
InitializeListHead(&m_IrpList);
@@ -259,21 +256,12 @@
m_CurrentOffset = Offset = 0;
}
- if (!Irp && m_SilenceBuffer && m_MaxFrameSize)
- {
+ if (!Irp)
+ {
+ // no irp buffer available
DPRINT("NoIrp\n");
- // no irp available, use silence buffer
- *Buffer = (PUCHAR)m_SilenceBuffer;
- *BufferSize = m_MaxFrameSize;
- return STATUS_SUCCESS;
- }
-
- if (!Irp)
- {
- // no irp buffer available
return STATUS_UNSUCCESSFUL;
}
-
// get stream header
StreamHeader = (PKSSTREAM_HEADER)Irp->Tail.Overlay.DriverContext[2];
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.cpp [iso-8859-1] Sat Oct 23
18:42:59 2010
@@ -604,7 +604,7 @@
}
}
- Status = m_IrpQueue->Init(ConnectDetails, 0, 0, NULL);
+ Status = m_IrpQueue->Init(ConnectDetails, 0, 0);
if (!NT_SUCCESS(Status))
{
DPRINT("IrpQueue_Init failed with %x\n", Status);
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp [iso-8859-1] Sat
Oct 23 18:42:59 2010
@@ -73,7 +73,7 @@
ULONG m_StopCount;
KSAUDIO_POSITION m_Position;
KSALLOCATOR_FRAMING m_AllocatorFraming;
- SUBDEVICE_DESCRIPTOR m_Descriptor;
+ PSUBDEVICE_DESCRIPTOR m_Descriptor;
KSPIN_LOCK m_EventListLock;
LIST_ENTRY m_EventList;
@@ -105,10 +105,12 @@
NTSTATUS NTAPI PinWaveCyclicAllocatorFraming(IN PIRP Irp, IN PKSIDENTIFIER Request, IN
OUT PVOID Data);
NTSTATUS NTAPI PinWaveCyclicAddEndOfStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData,
IN PKSEVENT_ENTRY EventEntry);
NTSTATUS NTAPI PinWaveCyclicAddLoopedStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData,
IN PKSEVENT_ENTRY EventEntry);
+NTSTATUS NTAPI PinWaveCyclicDRMHandler(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT
PVOID Data);
DEFINE_KSPROPERTY_CONNECTIONSET(PinWaveCyclicConnectionSet, PinWaveCyclicState,
PinWaveCyclicDataFormat, PinWaveCyclicAllocatorFraming);
DEFINE_KSPROPERTY_AUDIOSET(PinWaveCyclicAudioSet, PinWaveCyclicAudioPosition);
+DEFINE_KSPROPERTY_DRMSET(PinWaveCyclicDRMSet, PinWaveCyclicDRMHandler);
KSEVENT_ITEM PinWaveCyclicConnectionEventSet =
{
@@ -146,6 +148,13 @@
(const KSPROPERTY_ITEM*)&PinWaveCyclicAudioSet,
0,
NULL
+ },
+ {
+ &KSPROPSETID_DrmAudioStream,
+ sizeof(PinWaveCyclicDRMSet) / sizeof(KSPROPERTY_ITEM),
+ (const KSPROPERTY_ITEM*)&PinWaveCyclicDRMSet,
+ 0,
+ NULL
}
};
@@ -191,6 +200,19 @@
return STATUS_UNSUCCESSFUL;
}
+
+NTSTATUS
+NTAPI
+PinWaveCyclicDRMHandler(
+ IN PIRP Irp,
+ IN PKSIDENTIFIER Request,
+ IN OUT PVOID Data)
+{
+ DPRINT1("PinWaveCyclicDRMHandler\n");
+ ASSERT(0);
+ return STATUS_INVALID_PARAMETER;
+}
+
NTSTATUS
NTAPI
@@ -448,12 +470,14 @@
{
// FIXME
// complete with successful state
+ Pin->m_Stream->Silence(Pin->m_CommonBuffer,
Pin->m_CommonBufferSize);
Pin->m_IrpQueue->CancelBuffers();
Pin->m_Position.PlayOffset = 0;
Pin->m_Position.WriteOffset = 0;
}
else if (Pin->m_State == KSSTATE_STOP)
{
+ Pin->m_Stream->Silence(Pin->m_CommonBuffer,
Pin->m_CommonBufferSize);
Pin->m_IrpQueue->CancelBuffers();
Pin->m_Position.PlayOffset = 0;
Pin->m_Position.WriteOffset = 0;
@@ -751,7 +775,6 @@
m_Position.PlayOffset = m_Position.PlayOffset % m_Position.WriteOffset;
}
}
-
}
if (Gap == Length)
@@ -773,22 +796,13 @@
{
ULONG Position;
NTSTATUS Status;
- PUCHAR Buffer;
- ULONG BufferSize;
ULONGLONG OldOffset, NewOffset;
PC_ASSERT_IRQL(DISPATCH_LEVEL);
if (m_State == KSSTATE_RUN)
{
- Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
- if (!NT_SUCCESS(Status))
- {
- return;
- }
-
Status = m_Stream->GetPosition(&Position);
- DPRINT("Position %u Buffer %p BufferSize %u ActiveIrpOffset %u Capture
%u\n", Position, Buffer, m_CommonBufferSize, BufferSize, m_Capture);
OldOffset = m_Position.PlayOffset;
@@ -841,7 +855,7 @@
if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY)
{
/* handle property with subdevice descriptor */
- Status = PcHandlePropertyWithTable(Irp, m_Descriptor.FilterPropertySetCount,
m_Descriptor.FilterPropertySet, &m_Descriptor);
+ Status = PcHandlePropertyWithTable(Irp, m_Descriptor->FilterPropertySetCount,
m_Descriptor->FilterPropertySet, m_Descriptor);
if (Status == STATUS_NOT_FOUND)
{
@@ -854,11 +868,11 @@
}
else if (IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_KS_ENABLE_EVENT)
{
- Status = PcHandleEnableEventWithTable(Irp, &m_Descriptor);
+ Status = PcHandleEnableEventWithTable(Irp, m_Descriptor);
}
else if (IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_KS_DISABLE_EVENT)
{
- Status = PcHandleDisableEventWithTable(Irp, &m_Descriptor);
+ Status = PcHandleDisableEventWithTable(Irp, m_Descriptor);
}
else if (IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_KS_RESET_STATE)
{
@@ -1120,7 +1134,6 @@
PKSDATAFORMAT DataFormat;
PDEVICE_OBJECT DeviceObject;
BOOLEAN Capture;
- PVOID SilenceBuffer;
PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor = NULL;
//IDrmAudioStream * DrmAudio = NULL;
@@ -1203,18 +1216,26 @@
InitializeListHead(&m_EventList);
KeInitializeSpinLock(&m_EventListLock);
- /* set up subdevice descriptor */
- RtlZeroMemory(&m_Descriptor, sizeof(SUBDEVICE_DESCRIPTOR));
- m_Descriptor.FilterPropertySet = PinWaveCyclicPropertySet;
- m_Descriptor.FilterPropertySetCount = sizeof(PinWaveCyclicPropertySet) /
sizeof(KSPROPERTY_SET);
- m_Descriptor.UnknownStream = (PUNKNOWN)m_Stream;
- m_Descriptor.DeviceDescriptor = SubDeviceDescriptor->DeviceDescriptor;
- m_Descriptor.UnknownMiniport = SubDeviceDescriptor->UnknownMiniport;
- m_Descriptor.PortPin = (PVOID)this;
- m_Descriptor.EventSetCount = sizeof(PinWaveCyclicEventSet) / sizeof(KSEVENT_SET);
- m_Descriptor.EventSet = PinWaveCyclicEventSet;
- m_Descriptor.EventList = &m_EventList;
- m_Descriptor.EventListLock = &m_EventListLock;
+ Status = PcCreateSubdeviceDescriptor(&m_Descriptor,
+ SubDeviceDescriptor->InterfaceCount,
+ SubDeviceDescriptor->Interfaces,
+ 0, /* FIXME KSINTERFACE_STANDARD with
KSINTERFACE_STANDARD_STREAMING / KSINTERFACE_STANDARD_LOOPED_STREAMING */
+ NULL,
+ sizeof(PinWaveCyclicPropertySet) /
sizeof(KSPROPERTY_SET),
+ PinWaveCyclicPropertySet,
+ 0,
+ 0,
+ 0,
+ NULL,
+ sizeof(PinWaveCyclicEventSet) /
sizeof(KSEVENT_SET),
+ PinWaveCyclicEventSet,
+ SubDeviceDescriptor->DeviceDescriptor);
+
+ m_Descriptor->UnknownStream = (PUNKNOWN)m_Stream;
+ m_Descriptor->UnknownMiniport = SubDeviceDescriptor->UnknownMiniport;
+ m_Descriptor->PortPin = (PVOID)this;
+ m_Descriptor->EventList = &m_EventList;
+ m_Descriptor->EventListLock = &m_EventListLock;
// initialize reset state
m_ResetState = KSRESET_END;
@@ -1247,9 +1268,6 @@
PC_ASSERT(NT_SUCCESS(Status));
PC_ASSERT(m_FrameSize);
- SilenceBuffer = AllocateItem(NonPagedPool, m_FrameSize, TAG_PORTCLASS);
- if (!SilenceBuffer)
- return STATUS_INSUFFICIENT_RESOURCES;
/* set up allocator framing */
@@ -1260,10 +1278,9 @@
m_AllocatorFraming.Reserved = 0;
m_AllocatorFraming.FrameSize = m_FrameSize;
- m_Stream->Silence(SilenceBuffer, m_FrameSize);
m_Stream->Silence(m_CommonBuffer, m_CommonBufferSize);
- Status = m_IrpQueue->Init(ConnectDetails, m_FrameSize, 0, SilenceBuffer);
+ Status = m_IrpQueue->Init(ConnectDetails, m_FrameSize, 0);
if (!NT_SUCCESS(Status))
{
m_IrpQueue->Release();
@@ -1282,9 +1299,6 @@
m_Port = Port;
m_Filter = Filter;
- //DPRINT("Setting state to acquire %x\n",
m_Stream->SetState(KSSTATE_ACQUIRE));
- //DPRINT("Setting state to pause %x\n",
m_Stream->SetState(KSSTATE_PAUSE));
-
return STATUS_SUCCESS;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp [iso-8859-1] Sat Oct
23 18:42:59 2010
@@ -919,7 +919,7 @@
}
// initialize irp queue
- Status = m_IrpQueue->Init(ConnectDetails, m_AllocatorFraming.FrameSize,
m_AllocatorFraming.FileAlignment, NULL);
+ Status = m_IrpQueue->Init(ConnectDetails, m_AllocatorFraming.FrameSize,
m_AllocatorFraming.FileAlignment);
if (!NT_SUCCESS(Status))
{
// this should never happen
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.cpp [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.cpp [iso-8859-1] Sat Oct 23
18:42:59 2010
@@ -587,7 +587,7 @@
goto cleanup;
}
- Status = m_IrpQueue->Init(ConnectDetails, 0, 0, NULL);
+ Status = m_IrpQueue->Init(ConnectDetails, 0, 0);
if (!NT_SUCCESS(Status))
{
goto cleanup;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp [iso-8859-1] Sat Oct 23
18:42:59 2010
@@ -354,6 +354,22 @@
PropPositionHandler)\
DEFINE_KSPROPERTY_TABLE(PinSet) {\
DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION(PropPositionHandler, PropPositionHandler)\
+}
+
+
+#define DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(SetHandler)\
+ DEFINE_KSPROPERTY_ITEM(\
+ KSPROPERTY_DRMAUDIOSTREAM_CONTENTID,\
+ NULL,\
+ sizeof(KSPROPERTY),\
+ sizeof(ULONG),\
+ (SetHandler),\
+ NULL, 0, NULL, NULL, 0)
+
+#define DEFINE_KSPROPERTY_DRMSET(PinSet,\
+ PropPositionHandler)\
+DEFINE_KSPROPERTY_TABLE(PinSet) {\
+ DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(PropPositionHandler)\
}
#define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PinSet,\