1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Kernel Streaming
4 * FILE: drivers/wdm/audio/filters/splitter/splitter.c
5 * PURPOSE: Splitter entry point
6 * PROGRAMMER: Johannes Anderwald
7 */
8
9 #include "precomp.h"
10
11 const GUID PIN_VIDEO_CAPTURE = {0xfb6c4281, 0x0353, 0x11d1, {0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba}};
12 const GUID KSPROPSETID_Audio = {0x45FFAAA0, 0x6E1B, 0x11D0, {0xBC, 0xF2, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};
13 const GUID KSCATEGORY_AUDIO_SPLITTER = {0x9EA331FA, 0xB91B, 0x45F8, {0x92, 0x85, 0xBD, 0x2B, 0xC7, 0x7A, 0xFC, 0xDE}};
14 const GUID KSNAME_Filter = {0x9b365890, 0x165f, 0x11d0, {0xa1, 0x95, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4}};
15 const GUID GUID_NULL = {0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
16
17
18 KSPROPERTY_ITEM
19 PinPropertyTable[] =
20 {
21 {
22 KSPROPERTY_AUDIO_POSITION,
23 {AudioPositionPropertyHandler},
24 sizeof(KSPROPERTY),
25 sizeof(KSAUDIO_POSITION),
26 {AudioPositionPropertyHandler},
27 NULL,
28 0,
29 NULL,
30 NULL,
31 0
32 }
33 };
34
35 const
36 KSPROPERTY_SET
37 PinPropertySet[] =
38 {
39 {
40 &KSPROPSETID_Audio,
41 1,
42 PinPropertyTable,
43 0,
44 NULL
45 }
46 };
47
48
49 const
50 KSAUTOMATION_TABLE
51 PinAutomation =
52 {
53 1,
54 sizeof(PinPropertySet) / sizeof(KSPROPERTY_SET),
55 (const KSPROPERTY_SET*)&PinPropertySet,
56 0,
57 sizeof(KSMETHOD_SET),
58 NULL,
59 0,
60 sizeof(KSEVENT_SET),
61 NULL
62 };
63
64 const
65 KSPIN_DISPATCH
66 PinDispatch =
67 {
68 PinCreate,
69 PinClose,
70 NULL, /* filter centric processing */
71 PinReset,
72 NULL,
73 PinState,
74 NULL,
75 NULL,
76 NULL,
77 NULL
78 };
79
80
81 const
82 KSFILTER_DISPATCH
83 FilterDispatch =
84 {
85 NULL,
86 NULL,
87 FilterProcess,
88 NULL
89 };
90
91 KSDATARANGE
92 PinDataFormatRange =
93 {
94 {
95 sizeof(KSDATARANGE),
96 0,
97 0,
98 0,
99 {STATIC_KSDATAFORMAT_TYPE_AUDIO},
100 {STATIC_GUID_NULL},
101 {STATIC_GUID_NULL}
102 }
103 };
104
105 const
106 PKSDATARANGE
107 PinDataFormatRanges[] =
108 {
109 &PinDataFormatRange
110 };
111
112 #if 0
113 const
114 KSALLOCATOR_FRAMING_EX
115 AllocatorFraming =
116 {
117 1,
118 0,
119 {
120 1,
121 1,
122 0
123 },
124 0,
125 {
126 {STATIC_KSMEMORY_TYPE_KERNEL_PAGED},
127 {STATIC_GUID_NULL},
128 KSALLOCATOR_REQUIREMENTF_MUST_ALLOCATE,
129 0,
130 0, //KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY | KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO | KSALLOCATOR_OPTIONF_VALID
131 8,
132 FILE_64_BYTE_ALIGNMENT,
133 0,
134 {
135 0,
136 MAXULONG,
137 1
138 },
139 {
140 {
141 1536, // (48000khz * 2 channels * 16bit / 1000 ) * 8 frames
142 1536,
143 1
144 },
145 0,
146 0
147 }
148 }
149 };
150 #endif
151
152 const
153 KSPIN_DESCRIPTOR_EX
154 PinDescriptors[] =
155 {
156 {
157 &PinDispatch,
158 &PinAutomation,
159 {
160 0, //no interfaces
161 NULL,
162 0, // no mediums
163 NULL,
164 sizeof(PinDataFormatRange) / sizeof(PKSDATARANGE),
165 (const PKSDATARANGE*)&PinDataFormatRange,
166 KSPIN_DATAFLOW_OUT,
167 KSPIN_COMMUNICATION_BOTH,
168 NULL,
169 (const GUID*)&PIN_VIDEO_CAPTURE,
170 {
171 0,
172 }
173 },
174 KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING | KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL |
175 KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING | KSPIN_FLAG_PROCESS_IF_ANY_IN_RUN_STATE,
176 MAXULONG,
177 1,
178 NULL, //&AllocatorFraming,
179 PinIntersectHandler
180 },
181 {
182 &PinDispatch,
183 &PinAutomation,
184 {
185 0, //no interfaces
186 NULL,
187 0, // no mediums
188 NULL,
189 1,
190 (const PKSDATARANGE*)&PinDataFormatRange,
191 KSPIN_DATAFLOW_IN,
192 KSPIN_COMMUNICATION_BOTH,
193 NULL,
194 NULL,
195 {
196 0
197 }
198 },
199 KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING | KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL | KSPIN_FLAG_PROCESS_IF_ANY_IN_RUN_STATE,
200 1,
201 1,
202 NULL, //&AllocatorFraming,
203 PinIntersectHandler
204 }
205 };
206 const
207 GUID
208 Categories[] =
209 {
210 {STATIC_KSCATEGORY_AUDIO},
211 {STATIC_KSCATEGORY_AUDIO_SPLITTER}
212 };
213
214
215 const
216 KSNODE_DESCRIPTOR
217 NodeDescriptor[] =
218 {
219 {
220 NULL, //automation table
221 &KSCATEGORY_AUDIO_SPLITTER, //type
222 NULL // name
223 }
224 };
225
226
227 const
228 KSFILTER_DESCRIPTOR
229 FilterDescriptor =
230 {
231 &FilterDispatch,
232 NULL,
233 KSFILTER_DESCRIPTOR_VERSION,
234 KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING,
235 &KSNAME_Filter,
236 2,
237 sizeof(KSPIN_DESCRIPTOR_EX),
238 (const KSPIN_DESCRIPTOR_EX*)&PinDescriptors,
239 sizeof(Categories) / sizeof(GUID),
240 (const GUID* )&Categories,
241 sizeof(NodeDescriptor) / sizeof(KSNODE_DESCRIPTOR),
242 sizeof(KSNODE_DESCRIPTOR),
243 (const KSNODE_DESCRIPTOR*)&NodeDescriptor,
244 DEFINE_KSFILTER_DEFAULT_CONNECTIONS,
245 NULL
246 };
247
248 const
249 KSFILTER_DESCRIPTOR *
250 FilterDescriptors =
251 {
252 (const KSFILTER_DESCRIPTOR *)&FilterDescriptor
253 };
254
255 const
256 KSDEVICE_DESCRIPTOR
257 DeviceDescriptor =
258 {
259 NULL, //no pnp notifications needed
260 1, // filter descriptor count
261 (const KSFILTER_DESCRIPTOR * const *)&FilterDescriptors,
262 0, // pre KSDEVICE_DESCRIPTOR_VERSION
263 0
264 };
265
266
267 NTSTATUS
268 NTAPI
DriverEntry(PDRIVER_OBJECT DriverObject,PUNICODE_STRING RegistryPathName)269 DriverEntry(
270 PDRIVER_OBJECT DriverObject,
271 PUNICODE_STRING RegistryPathName)
272 {
273 return KsInitializeDriver(DriverObject, RegistryPathName, &DeviceDescriptor);
274 }
275