ReactOS  0.4.15-dev-3287-gfec35dc
filter.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Kernel Streaming
4  * FILE: drivers/wdm/audio/filters/splitter/filter.c
5  * PURPOSE: Filter File Context Handling
6  * PROGRAMMER: Johannes Anderwald
7  */
8 
9 #include "precomp.h"
10 
12 NTAPI
14  IN PKSFILTER Filter,
15  IN PKSPROCESSPIN_INDEXENTRY ProcessPinsIndex)
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 }
61 
#define IN
Definition: typedefs.h:39
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1801
unsigned char BOOLEAN
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:424
_In_ WDFCOLLECTION _In_ ULONG Index
struct _KSPROCESSPIN_INDEXENTRY * PKSPROCESSPIN_INDEXENTRY
Definition: ks.h:3028
NTSTATUS NTAPI FilterProcess(IN PKSFILTER Filter, IN PKSPROCESSPIN_INDEXENTRY ProcessPinsIndex)
Definition: filter.c:13
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65