ReactOS 0.4.15-dev-8408-g466a198
CPortPinWaveRT Class Reference
Inheritance diagram for CPortPinWaveRT:
Collaboration diagram for CPortPinWaveRT:

Public Member Functions

STDMETHODIMP QueryInterface (REFIID InterfaceId, PVOID *Interface)
 
 CPortPinWaveRT (IUnknown *OuterUnknown)
 
virtual ~CPortPinWaveRT ()
 
- Public Member Functions inherited from CUnknownImpl< IPortPinWaveRT >
 STDMETHODIMP_ (ULONG) AddRef()
 
 STDMETHODIMP_ (ULONG) Release()
 

Public Attributes

 IMP_IPortPinWaveRT
 

Protected Member Functions

NTSTATUS NTAPI HandleKsProperty (IN PIRP Irp)
 
NTSTATUS NTAPI HandleKsStream (IN PIRP Irp)
 
VOID NTAPI SetStreamState (IN KSSTATE State)
 
- Protected Member Functions inherited from CUnknownImpl< IPortPinWaveRT >
 CUnknownImpl ()
 
virtual ~CUnknownImpl ()
 

Protected Attributes

IPortWaveRT * m_Port
 
IPortFilterWaveRT * m_Filter
 
KSPIN_DESCRIPTOR * m_KsPinDescriptor
 
PMINIPORTWAVERT m_Miniport
 
PMINIPORTWAVERTSTREAM m_Stream
 
PPORTWAVERTSTREAM m_PortStream
 
KSSTATE m_State
 
PKSDATAFORMAT m_Format
 
KSPIN_CONNECTm_ConnectDetails
 
PVOID m_CommonBuffer
 
ULONG m_CommonBufferSize
 
ULONG m_CommonBufferOffset
 
IIrpQueue * m_IrpQueue
 
BOOL m_Capture
 
ULONG m_TotalPackets
 
ULONG m_PreCompleted
 
ULONG m_PostCompleted
 
ULONGLONG m_Delay
 
MEMORY_CACHING_TYPE m_CacheType
 
PMDL m_Mdl
 

Friends

VOID NTAPI SetStreamWorkerRoutine (IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
 
VOID NTAPI CloseStreamRoutine (IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
 

Detailed Description

Definition at line 14 of file pin_wavert.cpp.

Constructor & Destructor Documentation

◆ CPortPinWaveRT()

CPortPinWaveRT::CPortPinWaveRT ( IUnknown OuterUnknown)
inline

Definition at line 20 of file pin_wavert.cpp.

20{}

◆ ~CPortPinWaveRT()

virtual CPortPinWaveRT::~CPortPinWaveRT ( )
inlinevirtual

Definition at line 21 of file pin_wavert.cpp.

21{}

Member Function Documentation

◆ HandleKsProperty()

NTSTATUS NTAPI CPortPinWaveRT::HandleKsProperty ( IN PIRP  Irp)
protected

Definition at line 106 of file pin_wavert.cpp.

108{
112 PIO_STACK_LOCATION IoStack;
113
115
116 DPRINT("IPortPinWave_HandleKsProperty entered\n");
117
118 if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KSPROPERTY))
119 {
120 Irp->IoStatus.Information = 0;
121 Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
124 }
125
126 Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
127
129 {
131 {
132 PKSSTATE State = (PKSSTATE)Irp->UserBuffer;
133
134 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KSSTATE))
135 {
136 Irp->IoStatus.Information = sizeof(KSSTATE);
137 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
140 }
141
142 if (Property->Flags & KSPROPERTY_TYPE_SET)
143 {
145 Irp->IoStatus.Information = 0;
146
147 if (m_Stream)
148 {
149 Status = m_Stream->SetState(*State);
150
151 DPRINT("Setting state %u %x\n", *State, Status);
152 if (NT_SUCCESS(Status))
153 {
154 m_State = *State;
155 }
156 }
157 Irp->IoStatus.Status = Status;
159 return Status;
160 }
161 else if (Property->Flags & KSPROPERTY_TYPE_GET)
162 {
163 *State = m_State;
164 Irp->IoStatus.Information = sizeof(KSSTATE);
165 Irp->IoStatus.Status = STATUS_SUCCESS;
167 return STATUS_SUCCESS;
168 }
169 }
171 {
174 {
175 PKSDATAFORMAT NewDataFormat;
177 {
178 Irp->IoStatus.Information = DataFormat->FormatSize;
179 Irp->IoStatus.Status = STATUS_SUCCESS;
181 return STATUS_SUCCESS;
182 }
183
184 NewDataFormat = (PKSDATAFORMAT)AllocateItem(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS);
185 if (!NewDataFormat)
186 {
187 Irp->IoStatus.Information = 0;
188 Irp->IoStatus.Status = STATUS_NO_MEMORY;
190 return STATUS_NO_MEMORY;
191 }
192 RtlMoveMemory(NewDataFormat, DataFormat, DataFormat->FormatSize);
193
194 if (m_Stream)
195 {
196#if 0
198 ASSERT(NewDataFormat->FormatSize == sizeof(KSDATAFORMAT_WAVEFORMATEX));
202
204#endif
205 DPRINT("NewDataFormat: Channels %u Bits %u Samples %u\n", ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nChannels,
206 ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.wBitsPerSample,
207 ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nSamplesPerSec);
208
209 Status = m_Stream->SetFormat(NewDataFormat);
210 if (NT_SUCCESS(Status))
211 {
212 if (m_Format)
214
215 m_Format = NewDataFormat;
216 Irp->IoStatus.Information = DataFormat->FormatSize;
217 Irp->IoStatus.Status = STATUS_SUCCESS;
219 return STATUS_SUCCESS;
220 }
221 }
222 DPRINT("Failed to set format\n");
223 Irp->IoStatus.Information = 0;
224 Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
226 return STATUS_UNSUCCESSFUL;
227 }
228 else if (Property->Flags & KSPROPERTY_TYPE_GET)
229 {
230 if (!m_Format)
231 {
232 DPRINT("No format\n");
233 Irp->IoStatus.Information = 0;
234 Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
236 return STATUS_UNSUCCESSFUL;
237 }
238 if (m_Format->FormatSize > IoStack->Parameters.DeviceIoControl.OutputBufferLength)
239 {
240 Irp->IoStatus.Information = m_Format->FormatSize;
241 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
244 }
245
247 Irp->IoStatus.Information = DataFormat->FormatSize;
248 Irp->IoStatus.Status = STATUS_SUCCESS;
250 return STATUS_SUCCESS;
251 }
252 }
253
254 }
256 DPRINT("Unhandled property Set |%S| Id %u Flags %x\n", GuidString.Buffer, Property->Id, Property->Flags);
258
259 Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
260 Irp->IoStatus.Information = 0;
263}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
LONG NTSTATUS
Definition: precomp.h:26
KSSTATE m_State
Definition: pin_wavert.cpp:31
PMINIPORTWAVERTSTREAM m_Stream
Definition: pin_wavert.cpp:29
PKSDATAFORMAT m_Format
Definition: pin_wavert.cpp:32
_In_ PIRP Irp
Definition: csq.h:116
KSDATAFORMAT * PKSDATAFORMAT
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
struct KSIDENTIFIER * PKSPROPERTY
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define NonPagedPool
Definition: env_spec_w32.h:307
Status
Definition: gdiplustypes.h:25
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
@ KSPROPERTY_CONNECTION_DATAFORMAT
Definition: ks.h:351
@ KSPROPERTY_CONNECTION_STATE
Definition: ks.h:349
enum KSSTATE * PKSSTATE
KSSTATE
Definition: ks.h:1214
@ KSSTATE_STOP
Definition: ks.h:1215
#define KSPROPSETID_Connection
Definition: ks.h:346
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
VOID FreeItem(IN PVOID Item)
Definition: misc.c:37
#define KSDATAFORMAT_SUBTYPE_PCM
Definition: ksmedia.h:1021
#define KSDATAFORMAT_TYPE_AUDIO
Definition: ksmedia.h:983
#define KSDATAFORMAT_SPECIFIER_WAVEFORMATEX
Definition: ksmedia.h:1031
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
static PWSTR GuidString
Definition: apphelp.c:93
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define TAG_PORTCLASS
Definition: private.hpp:24
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define DPRINT
Definition: sndvol32.h:73
union _IO_STACK_LOCATION::@1565 Parameters
struct _IO_STACK_LOCATION::@1565::@1566 DeviceIoControl
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ HandleKsStream()

NTSTATUS NTAPI CPortPinWaveRT::HandleKsStream ( IN PIRP  Irp)
protected

Definition at line 267 of file pin_wavert.cpp.

269{
270 DPRINT("IPortPinWaveRT_HandleKsStream entered State %u Stream %p is UNIMPLEMENTED\n", m_State, m_Stream);
271
272 return STATUS_PENDING;
273}
#define STATUS_PENDING
Definition: ntstatus.h:82

◆ QueryInterface()

NTSTATUS NTAPI CPortPinWaveRT::QueryInterface ( REFIID  InterfaceId,
PVOID Interface 
)

Definition at line 71 of file pin_wavert.cpp.

74{
75 DPRINT("IServiceSink_fnQueryInterface entered\n");
76
77 if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) ||
79 {
80 *Output = PVOID(PUNKNOWN((IIrpTarget*)this));
81 PUNKNOWN(*Output)->AddRef();
82 return STATUS_SUCCESS;
83 }
85}
const GUID IID_IUnknown
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
ULONG AddRef()
@ Output
Definition: arc.h:85
void * PVOID
Definition: typedefs.h:50

◆ SetStreamState()

VOID NTAPI CPortPinWaveRT::SetStreamState ( IN KSSTATE  State)
protected

Friends And Related Function Documentation

◆ CloseStreamRoutine

VOID NTAPI CloseStreamRoutine ( IN PDEVICE_OBJECT  DeviceObject,
IN PVOID  Context 
)
friend

Definition at line 359 of file pin_wavert.cpp.

362{
365 ISubdevice *ISubDevice;
369
370 This = (CPortPinWaveRT*)Ctx->Pin;
371
372 if (This->m_Stream)
373 {
374 if (This->m_State != KSSTATE_STOP)
375 {
376 This->m_Stream->SetState(KSSTATE_STOP);
378 }
379 }
380
381 Status = This->m_Port->QueryInterface(IID_ISubdevice, (PVOID*)&ISubDevice);
382 if (NT_SUCCESS(Status))
383 {
384 Status = ISubDevice->GetDescriptor(&Descriptor);
385 if (NT_SUCCESS(Status))
386 {
387 Descriptor->Factory.Instances[This->m_ConnectDetails->PinId].CurrentPinInstanceCount--;
388 }
389 ISubDevice->Release();
390 }
391
392 if (This->m_Format)
393 {
394 FreeItem(This->m_Format, TAG_PORTCLASS);
395 This->m_Format = NULL;
396 }
397
398 if (This->m_IrpQueue)
399 {
400 This->m_IrpQueue->Release();
401 }
402
403 // complete the irp
404 Ctx->Irp->IoStatus.Information = 0;
407
408 // free the work item
410
411 // free work item ctx
413
414 if (This->m_Stream)
415 {
416 Stream = This->m_Stream;
417 This->m_Stream = NULL;
418 DPRINT("Closing stream at Irql %u\n", KeGetCurrentIrql());
419 Stream->Release();
420 }
421}
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:81
#define NULL
Definition: types.h:112
ULONG Release()
nsrefcnt Release()
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
Definition: iowork.c:64
static IStream Stream
Definition: htmldoc.c:1115
IMiniportWaveRTStream * PMINIPORTWAVERTSTREAM
Definition: portcls.h:1865
struct CLOSESTREAM_CONTEXT * PCLOSESTREAM_CONTEXT
PIO_WORKITEM WorkItem
Definition: private.hpp:424
IO_STATUS_BLOCK IoStatus
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342

◆ SetStreamWorkerRoutine

VOID NTAPI SetStreamWorkerRoutine ( IN PDEVICE_OBJECT  DeviceObject,
IN PVOID  Context 
)
friend

Member Data Documentation

◆ IMP_IPortPinWaveRT

CPortPinWaveRT::IMP_IPortPinWaveRT

Definition at line 19 of file pin_wavert.cpp.

◆ m_CacheType

MEMORY_CACHING_TYPE CPortPinWaveRT::m_CacheType
protected

Definition at line 49 of file pin_wavert.cpp.

◆ m_Capture

BOOL CPortPinWaveRT::m_Capture
protected

Definition at line 41 of file pin_wavert.cpp.

◆ m_CommonBuffer

PVOID CPortPinWaveRT::m_CommonBuffer
protected

Definition at line 35 of file pin_wavert.cpp.

◆ m_CommonBufferOffset

ULONG CPortPinWaveRT::m_CommonBufferOffset
protected

Definition at line 37 of file pin_wavert.cpp.

◆ m_CommonBufferSize

ULONG CPortPinWaveRT::m_CommonBufferSize
protected

Definition at line 36 of file pin_wavert.cpp.

◆ m_ConnectDetails

KSPIN_CONNECT* CPortPinWaveRT::m_ConnectDetails
protected

Definition at line 33 of file pin_wavert.cpp.

◆ m_Delay

ULONGLONG CPortPinWaveRT::m_Delay
protected

Definition at line 47 of file pin_wavert.cpp.

◆ m_Filter

IPortFilterWaveRT* CPortPinWaveRT::m_Filter
protected

Definition at line 26 of file pin_wavert.cpp.

◆ m_Format

PKSDATAFORMAT CPortPinWaveRT::m_Format
protected

Definition at line 32 of file pin_wavert.cpp.

Referenced by HandleKsProperty().

◆ m_IrpQueue

IIrpQueue* CPortPinWaveRT::m_IrpQueue
protected

Definition at line 39 of file pin_wavert.cpp.

◆ m_KsPinDescriptor

KSPIN_DESCRIPTOR* CPortPinWaveRT::m_KsPinDescriptor
protected

Definition at line 27 of file pin_wavert.cpp.

◆ m_Mdl

PMDL CPortPinWaveRT::m_Mdl
protected

Definition at line 50 of file pin_wavert.cpp.

◆ m_Miniport

PMINIPORTWAVERT CPortPinWaveRT::m_Miniport
protected

Definition at line 28 of file pin_wavert.cpp.

◆ m_Port

IPortWaveRT* CPortPinWaveRT::m_Port
protected

Definition at line 25 of file pin_wavert.cpp.

◆ m_PortStream

PPORTWAVERTSTREAM CPortPinWaveRT::m_PortStream
protected

Definition at line 30 of file pin_wavert.cpp.

◆ m_PostCompleted

ULONG CPortPinWaveRT::m_PostCompleted
protected

Definition at line 45 of file pin_wavert.cpp.

◆ m_PreCompleted

ULONG CPortPinWaveRT::m_PreCompleted
protected

Definition at line 44 of file pin_wavert.cpp.

◆ m_State

KSSTATE CPortPinWaveRT::m_State
protected

Definition at line 31 of file pin_wavert.cpp.

Referenced by HandleKsProperty(), and HandleKsStream().

◆ m_Stream

PMINIPORTWAVERTSTREAM CPortPinWaveRT::m_Stream
protected

Definition at line 29 of file pin_wavert.cpp.

Referenced by HandleKsProperty(), and HandleKsStream().

◆ m_TotalPackets

ULONG CPortPinWaveRT::m_TotalPackets
protected

Definition at line 43 of file pin_wavert.cpp.


The documentation for this class was generated from the following file: