ReactOS 0.4.15-dev-5664-g3bf4ef6
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 17 of file pin_wavert.cpp.

Constructor & Destructor Documentation

◆ CPortPinWaveRT()

CPortPinWaveRT::CPortPinWaveRT ( IUnknown OuterUnknown)
inline

Definition at line 23 of file pin_wavert.cpp.

23{}

◆ ~CPortPinWaveRT()

virtual CPortPinWaveRT::~CPortPinWaveRT ( )
inlinevirtual

Definition at line 24 of file pin_wavert.cpp.

24{}

Member Function Documentation

◆ HandleKsProperty()

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

Definition at line 110 of file pin_wavert.cpp.

112{
116 PIO_STACK_LOCATION IoStack;
117
119
120 DPRINT("IPortPinWave_HandleKsProperty entered\n");
121
122 if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KSPROPERTY))
123 {
124 Irp->IoStatus.Information = 0;
125 Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
128 }
129
130 Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
131
133 {
135 {
136 PKSSTATE State = (PKSSTATE)Irp->UserBuffer;
137
138 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KSSTATE))
139 {
140 Irp->IoStatus.Information = sizeof(KSSTATE);
141 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
144 }
145
146 if (Property->Flags & KSPROPERTY_TYPE_SET)
147 {
149 Irp->IoStatus.Information = 0;
150
151 if (m_Stream)
152 {
153 Status = m_Stream->SetState(*State);
154
155 DPRINT("Setting state %u %x\n", *State, Status);
156 if (NT_SUCCESS(Status))
157 {
158 m_State = *State;
159 }
160 }
161 Irp->IoStatus.Status = Status;
163 return Status;
164 }
165 else if (Property->Flags & KSPROPERTY_TYPE_GET)
166 {
167 *State = m_State;
168 Irp->IoStatus.Information = sizeof(KSSTATE);
169 Irp->IoStatus.Status = STATUS_SUCCESS;
171 return STATUS_SUCCESS;
172 }
173 }
175 {
178 {
179 PKSDATAFORMAT NewDataFormat;
181 {
182 Irp->IoStatus.Information = DataFormat->FormatSize;
183 Irp->IoStatus.Status = STATUS_SUCCESS;
185 return STATUS_SUCCESS;
186 }
187
188 NewDataFormat = (PKSDATAFORMAT)AllocateItem(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS);
189 if (!NewDataFormat)
190 {
191 Irp->IoStatus.Information = 0;
192 Irp->IoStatus.Status = STATUS_NO_MEMORY;
194 return STATUS_NO_MEMORY;
195 }
196 RtlMoveMemory(NewDataFormat, DataFormat, DataFormat->FormatSize);
197
198 if (m_Stream)
199 {
200#if 0
202 ASSERT(NewDataFormat->FormatSize == sizeof(KSDATAFORMAT_WAVEFORMATEX));
206
208#endif
209 DPRINT("NewDataFormat: Channels %u Bits %u Samples %u\n", ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nChannels,
210 ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.wBitsPerSample,
211 ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nSamplesPerSec);
212
213 Status = m_Stream->SetFormat(NewDataFormat);
214 if (NT_SUCCESS(Status))
215 {
216 if (m_Format)
218
219 m_Format = NewDataFormat;
220 Irp->IoStatus.Information = DataFormat->FormatSize;
221 Irp->IoStatus.Status = STATUS_SUCCESS;
223 return STATUS_SUCCESS;
224 }
225 }
226 DPRINT("Failed to set format\n");
227 Irp->IoStatus.Information = 0;
228 Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
230 return STATUS_UNSUCCESSFUL;
231 }
232 else if (Property->Flags & KSPROPERTY_TYPE_GET)
233 {
234 if (!m_Format)
235 {
236 DPRINT("No format\n");
237 Irp->IoStatus.Information = 0;
238 Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
240 return STATUS_UNSUCCESSFUL;
241 }
242 if (m_Format->FormatSize > IoStack->Parameters.DeviceIoControl.OutputBufferLength)
243 {
244 Irp->IoStatus.Information = m_Format->FormatSize;
245 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
248 }
249
251 Irp->IoStatus.Information = DataFormat->FormatSize;
252 Irp->IoStatus.Status = STATUS_SUCCESS;
254 return STATUS_SUCCESS;
255 }
256 }
257
258 }
260 DPRINT("Unhandled property Set |%S| Id %u Flags %x\n", GuidString.Buffer, Property->Id, Property->Flags);
262
263 Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
264 Irp->IoStatus.Information = 0;
267}
LONG NTSTATUS
Definition: precomp.h:26
KSSTATE m_State
Definition: pin_wavert.cpp:34
PMINIPORTWAVERTSTREAM m_Stream
Definition: pin_wavert.cpp:32
PKSDATAFORMAT m_Format
Definition: pin_wavert.cpp:35
_In_ PIRP Irp
Definition: csq.h:116
KSDATAFORMAT * PKSDATAFORMAT
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#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:30
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
#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:71
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
#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
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ HandleKsStream()

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

Definition at line 271 of file pin_wavert.cpp.

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

◆ QueryInterface()

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

Definition at line 75 of file pin_wavert.cpp.

78{
79 DPRINT("IServiceSink_fnQueryInterface entered\n");
80
81 if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) ||
83 {
84 *Output = PVOID(PUNKNOWN((IIrpTarget*)this));
85 PUNKNOWN(*Output)->AddRef();
86 return STATUS_SUCCESS;
87 }
89}
const GUID IID_IUnknown
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
ULONG AddRef()
void * PVOID
Definition: retypes.h:9
@ Output
Definition: arc.h:85

◆ 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 364 of file pin_wavert.cpp.

367{
370 ISubdevice *ISubDevice;
374
375 This = (CPortPinWaveRT*)Ctx->Pin;
376
377 if (This->m_Stream)
378 {
379 if (This->m_State != KSSTATE_STOP)
380 {
381 This->m_Stream->SetState(KSSTATE_STOP);
383 }
384 }
385
386 Status = This->m_Port->QueryInterface(IID_ISubdevice, (PVOID*)&ISubDevice);
387 if (NT_SUCCESS(Status))
388 {
389 Status = ISubDevice->GetDescriptor(&Descriptor);
390 if (NT_SUCCESS(Status))
391 {
392 Descriptor->Factory.Instances[This->m_ConnectDetails->PinId].CurrentPinInstanceCount--;
393 }
394 ISubDevice->Release();
395 }
396
397 if (This->m_Format)
398 {
399 FreeItem(This->m_Format, TAG_PORTCLASS);
400 This->m_Format = NULL;
401 }
402
403 if (This->m_IrpQueue)
404 {
405 This->m_IrpQueue->Release();
406 }
407
408 // complete the irp
409 Ctx->Irp->IoStatus.Information = 0;
412
413 // free the work item
415
416 // free work item ctx
418
419 if (This->m_Stream)
420 {
421 Stream = This->m_Stream;
422 This->m_Stream = NULL;
423 DPRINT("Closing stream at Irql %u\n", KeGetCurrentIrql());
424 Stream->Release();
425 }
426}
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 22 of file pin_wavert.cpp.

◆ m_CacheType

MEMORY_CACHING_TYPE CPortPinWaveRT::m_CacheType
protected

Definition at line 52 of file pin_wavert.cpp.

◆ m_Capture

BOOL CPortPinWaveRT::m_Capture
protected

Definition at line 44 of file pin_wavert.cpp.

◆ m_CommonBuffer

PVOID CPortPinWaveRT::m_CommonBuffer
protected

Definition at line 38 of file pin_wavert.cpp.

◆ m_CommonBufferOffset

ULONG CPortPinWaveRT::m_CommonBufferOffset
protected

Definition at line 40 of file pin_wavert.cpp.

◆ m_CommonBufferSize

ULONG CPortPinWaveRT::m_CommonBufferSize
protected

Definition at line 39 of file pin_wavert.cpp.

◆ m_ConnectDetails

KSPIN_CONNECT* CPortPinWaveRT::m_ConnectDetails
protected

Definition at line 36 of file pin_wavert.cpp.

◆ m_Delay

ULONGLONG CPortPinWaveRT::m_Delay
protected

Definition at line 50 of file pin_wavert.cpp.

◆ m_Filter

IPortFilterWaveRT* CPortPinWaveRT::m_Filter
protected

Definition at line 29 of file pin_wavert.cpp.

◆ m_Format

PKSDATAFORMAT CPortPinWaveRT::m_Format
protected

Definition at line 35 of file pin_wavert.cpp.

Referenced by HandleKsProperty().

◆ m_IrpQueue

IIrpQueue* CPortPinWaveRT::m_IrpQueue
protected

Definition at line 42 of file pin_wavert.cpp.

◆ m_KsPinDescriptor

KSPIN_DESCRIPTOR* CPortPinWaveRT::m_KsPinDescriptor
protected

Definition at line 30 of file pin_wavert.cpp.

◆ m_Mdl

PMDL CPortPinWaveRT::m_Mdl
protected

Definition at line 53 of file pin_wavert.cpp.

◆ m_Miniport

PMINIPORTWAVERT CPortPinWaveRT::m_Miniport
protected

Definition at line 31 of file pin_wavert.cpp.

◆ m_Port

IPortWaveRT* CPortPinWaveRT::m_Port
protected

Definition at line 28 of file pin_wavert.cpp.

◆ m_PortStream

PPORTWAVERTSTREAM CPortPinWaveRT::m_PortStream
protected

Definition at line 33 of file pin_wavert.cpp.

◆ m_PostCompleted

ULONG CPortPinWaveRT::m_PostCompleted
protected

Definition at line 48 of file pin_wavert.cpp.

◆ m_PreCompleted

ULONG CPortPinWaveRT::m_PreCompleted
protected

Definition at line 47 of file pin_wavert.cpp.

◆ m_State

KSSTATE CPortPinWaveRT::m_State
protected

Definition at line 34 of file pin_wavert.cpp.

Referenced by HandleKsProperty(), and HandleKsStream().

◆ m_Stream

PMINIPORTWAVERTSTREAM CPortPinWaveRT::m_Stream
protected

Definition at line 32 of file pin_wavert.cpp.

Referenced by HandleKsProperty(), and HandleKsStream().

◆ m_TotalPackets

ULONG CPortPinWaveRT::m_TotalPackets
protected

Definition at line 46 of file pin_wavert.cpp.


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