ReactOS  0.4.13-dev-455-g28ed234
precomp.h File Reference
#include <ntddk.h>
#include <portcls.h>
#include <ks.h>
#include <ksmedia.h>
#include <debug.h>
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PIN_CONTEXT
 

Typedefs

typedef struct PIN_CONTEXTPPIN_CONTEXT
 

Functions

NTSTATUS NTAPI FilterProcess (IN PKSFILTER Filter, IN PKSPROCESSPIN_INDEXENTRY ProcessPinsIndex)
 
NTSTATUS NTAPI PinCreate (IN PKSPIN Pin, IN PIRP Irp)
 
NTSTATUS NTAPI PinClose (IN PKSPIN Pin, IN PIRP Irp)
 
VOID NTAPI PinReset (IN PKSPIN Pin)
 
NTSTATUS NTAPI PinState (IN PKSPIN Pin, IN KSSTATE ToState, IN KSSTATE FromState)
 
NTSTATUS NTAPI AudioPositionPropertyHandler (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI PinIntersectHandler (IN PVOID Context, IN PIRP Irp, IN PKSP_PIN Pin, IN PKSDATARANGE DataRange, IN PKSDATARANGE MatchingDataRange, IN ULONG DataBufferSize, OUT PVOID Data OPTIONAL, OUT PULONG DataSize)
 

Typedef Documentation

◆ PPIN_CONTEXT

Function Documentation

◆ AudioPositionPropertyHandler()

NTSTATUS NTAPI AudioPositionPropertyHandler ( IN PIRP  Irp,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data 
)

Definition at line 127 of file pin.c.

131 {
132  PKSFILTER Filter;
133  PKSPIN Pin, FirstPin;
137 
138  /* first get the pin */
140 
141  /* sanity check */
142  ASSERT(Pin);
143 
144  /* get parent filter */
146 
147  /* acquire filter control mutex */
148  KsFilterAcquireControl(Filter);
149 
150  /* get first pin */
151  FirstPin = KsFilterGetFirstChildPin(Filter, Pin->Id);
152 
153  /* get connected pin of first pin */
155 
156  if (!FileObject)
157  {
158  /* no pin connected */
160  }
161  else
162  {
163  /* perform request */
165 
166  /* store result size */
167  Irp->IoStatus.Information = sizeof(KSAUDIO_POSITION);
168  }
169 
170  /* release control */
171  KsFilterReleaseControl(Filter);
172 
173  /* done */
174  return Status;
175 }
PKSFILTER NTAPI KsPinGetParentFilter(IN PKSPIN Pin)
Definition: pin.c:1097
#define IOCTL_KS_PROPERTY
Definition: ks.h:150
KSDDKAPI PKSPIN NTAPI KsFilterGetFirstChildPin(IN PKSFILTER Filter, IN ULONG PinId)
Definition: filter.c:2067
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
_In_ NDIS_HANDLE _In_ PNDIS_REQUEST Request
Definition: ndis.h:5173
KSDDKAPI NTSTATUS NTAPI KsSynchronousIoControlDevice(IN PFILE_OBJECT FileObject, IN KPROCESSOR_MODE RequestorMode, IN ULONG IoControl, IN PVOID InBuffer, IN ULONG InSize, OUT PVOID OutBuffer, IN ULONG OutSize, OUT PULONG BytesReturned)
Definition: api.c:1099
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
* PFILE_OBJECT
Definition: iotypes.h:1954
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
_In_ FILTER_INFORMATION_CLASS _In_ ULONG _Out_ PULONG BytesReturned
Definition: fltkernel.h:1716
KSDDKAPI PKSPIN NTAPI KsGetPinFromIrp(IN PIRP Irp)
Definition: pin.c:1211
PFILE_OBJECT NTAPI KsPinGetConnectedPinFileObject(IN PKSPIN Pin)
Definition: pin.c:1047
unsigned int ULONG
Definition: retypes.h:1

◆ FilterProcess()

NTSTATUS NTAPI FilterProcess ( IN PKSFILTER  Filter,
IN PKSPROCESSPIN_INDEXENTRY  ProcessPinsIndex 
)

Definition at line 13 of file filter.c.

16 {
17  ULONG Index;
18  PKSPROCESSPIN CurPin, Pin;
19  BOOLEAN PendingFrames = FALSE;
20 
21  if (ProcessPinsIndex->Count)
22  {
23  /* check if there are outstanding frames */
24  for(Index = 1; Index < ProcessPinsIndex->Count; Index++)
25  {
26  /* get current pin */
27  CurPin = ProcessPinsIndex->Pins[Index];
28 
29  if (CurPin->BytesAvailable && CurPin->Pin->DeviceState == KSSTATE_RUN)
30  {
31  /* pin has pending frames
32  * to keep all pins synchronized, every pin has to wait untill each chained pin has send its frames downwards
33  */
34  PendingFrames = TRUE;
35  }
36  }
37  }
38 
39  if (!PendingFrames && ProcessPinsIndex->Count)
40  {
41  /* get first pin */
42  Pin = ProcessPinsIndex->Pins[0];
43 
44  /* check if there is new data available */
45  if (Pin->BytesAvailable)
46  {
47  for(Index = 1; Index < ProcessPinsIndex->Count; Index++)
48  {
49  /* get current pin */
50  CurPin = ProcessPinsIndex->Pins[Index];
51 
52  /* copy the frame to pin */
53  RtlMoveMemory(CurPin->Data, Pin->Data, Pin->BytesAvailable);
54  CurPin->BytesUsed = Pin->BytesAvailable;
55  }
56  }
57  }
58  /* done */
59  return STATUS_SUCCESS;
60 }
#define TRUE
Definition: types.h:120
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
unsigned char BOOLEAN
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2777

◆ PinClose()

NTSTATUS NTAPI PinClose ( IN PKSPIN  Pin,
IN PIRP  Irp 
)

Definition at line 60 of file pin.c.

63 {
64  /* is there a context */
65  if (Pin->Context)
66  {
67  /* free pin context */
68  ExFreePool(Pin->Context);
69  }
70 
71  return STATUS_SUCCESS;
72 }
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
return STATUS_SUCCESS
Definition: btrfs.c:2777
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

◆ PinCreate()

NTSTATUS NTAPI PinCreate ( IN PKSPIN  Pin,
IN PIRP  Irp 
)

Definition at line 13 of file pin.c.

16 {
17  PKSFILTER Filter;
18  PKSPIN FirstPin;
19  PPIN_CONTEXT PinContext;
20 
21  /* first get the parent filter */
23 
24  /* now get first child pin */
25  FirstPin = KsFilterGetFirstChildPin(Filter, Pin->Id);
26 
27  /* sanity check */
28  ASSERT(FirstPin);
29 
30  if (FirstPin != Pin)
31  {
32  /* a previous pin already exists */
33  if (RtlCompareMemory(FirstPin->ConnectionFormat, Pin->ConnectionFormat, Pin->ConnectionFormat->FormatSize) != Pin->ConnectionFormat->FormatSize)
34  {
35  /* each instantiated pin must have the same connection format */
37  }
38  }
39 
40  /* allocate pin context */
41  PinContext = ExAllocatePool(NonPagedPool, sizeof(PIN_CONTEXT));
42  if (!PinContext)
44 
45  /* store pin context */
46  Pin->Context = PinContext;
47 
48  /* clear pin context */
49  RtlZeroMemory(PinContext, sizeof(PIN_CONTEXT));
50 
51  /* FIXME
52  * check allocator framing and apply to all pins
53  */
54 
55  return STATUS_SUCCESS;
56 }
PKSFILTER NTAPI KsPinGetParentFilter(IN PKSPIN Pin)
Definition: pin.c:1097
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
KSDDKAPI PKSPIN NTAPI KsFilterGetFirstChildPin(IN PKSFILTER Filter, IN ULONG PinId)
Definition: filter.c:2067
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
return STATUS_SUCCESS
Definition: btrfs.c:2777
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465

◆ PinIntersectHandler()

NTSTATUS NTAPI PinIntersectHandler ( IN PVOID  Context,
IN PIRP  Irp,
IN PKSP_PIN  Pin,
IN PKSDATARANGE  DataRange,
IN PKSDATARANGE  MatchingDataRange,
IN ULONG  DataBufferSize,
OUT PVOID Data  OPTIONAL,
OUT PULONG  DataSize 
)

Definition at line 179 of file pin.c.

188 {
189  PKSPIN FirstPin;
191 
192  /* get first pin */
193  FirstPin = KsFilterGetFirstChildPin((PKSFILTER)Context, Pin->PinId);
194 
195  /* sanity check */
196  ASSERT(FirstPin);
197 
198  /* check for matching dataformat */
199  if (!IsEqualGUIDAligned(&FirstPin->ConnectionFormat->SubFormat, &DataRange->SubFormat) ||
200  !IsEqualGUIDAligned(&FirstPin->ConnectionFormat->Specifier, &DataRange->Specifier) ||
201  !IsEqualGUIDAligned(&GUID_NULL, &DataRange->SubFormat) ||
202  !IsEqualGUIDAligned(&GUID_NULL, &DataRange->Specifier))
203  {
204  /* no match */
205  return STATUS_NO_MATCH;
206  }
207 
208 
209  if (DataBufferSize)
210  {
211  /* there is output buffer */
212  if (DataBufferSize >= FirstPin->ConnectionFormat->FormatSize)
213  {
214  /* copy dataformat */
215  RtlMoveMemory(Data, FirstPin->ConnectionFormat, FirstPin->ConnectionFormat->FormatSize);
216 
217  /* store output length */
218  *DataSize = FirstPin->ConnectionFormat->FormatSize;
219 
221  }
222  else
223  {
224  /* buffer too small */
226  }
227  }
228  else
229  {
230  /* store output length */
231  *DataSize = FirstPin->ConnectionFormat->FormatSize;
232 
234  }
235 
236  /* done */
237  return Status;
238 }
KSDDKAPI PKSPIN NTAPI KsFilterGetFirstChildPin(IN PKSFILTER Filter, IN ULONG PinId)
Definition: filter.c:2067
LONG NTSTATUS
Definition: precomp.h:26
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define GUID_NULL
Definition: ks.h:106
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STATUS_NO_MATCH
Definition: ntstatus.h:737
return STATUS_SUCCESS
Definition: btrfs.c:2777
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751

◆ PinReset()

VOID NTAPI PinReset ( IN PKSPIN  Pin)

Definition at line 76 of file pin.c.

78 {
79  PKSFILTER Filter;
80 
81  /* sanity check */
82  ASSERT(Pin->Context);
83 
84  /* clear pin context */
85  RtlZeroMemory(Pin->Context, sizeof(PIN_CONTEXT));
86 
87  /* get parent filter */
89 
90  /* sanity check */
91  ASSERT(Filter);
92 
93  /* attempt processing */
95 }
PKSFILTER NTAPI KsPinGetParentFilter(IN PKSPIN Pin)
Definition: pin.c:1097
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
KSDDKAPI VOID NTAPI KsFilterAttemptProcessing(IN PKSFILTER Filter, IN BOOLEAN Asynchronous)
Definition: filter.c:1915
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261

◆ PinState()

NTSTATUS NTAPI PinState ( IN PKSPIN  Pin,
IN KSSTATE  ToState,
IN KSSTATE  FromState 
)

Definition at line 99 of file pin.c.

103 {
104  PKSFILTER Filter;
105 
106  /* should the pin stop */
107  if (ToState == KSSTATE_STOP)
108  {
109  /* clear pin context */
110  RtlZeroMemory(Pin->Context, sizeof(PIN_CONTEXT));
111  }
112 
113  /* get parent filter */
115 
116  /* sanity check */
117  ASSERT(Filter);
118 
119  /* attempt processing */
121 
122  return STATUS_SUCCESS;
123 }
PKSFILTER NTAPI KsPinGetParentFilter(IN PKSPIN Pin)
Definition: pin.c:1097
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
KSDDKAPI VOID NTAPI KsFilterAttemptProcessing(IN PKSFILTER Filter, IN BOOLEAN Asynchronous)
Definition: filter.c:1915
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
return STATUS_SUCCESS
Definition: btrfs.c:2777