[USBAUDIO]
[reactos.git] / reactos / drivers / usb / usbaudio / filter.c
1 /*
2 * PROJECT: ReactOS Universal Audio Class Driver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/usb/usbaudio/filter.c
5 * PURPOSE: USB Audio device driver.
6 * PROGRAMMERS:
7 * Johannes Anderwald (johannes.anderwald@reactos.org)
8 */
9
10 #include "usbaudio.h"
11
12 NTSTATUS
13 BuildUSBAudioFilterTopology(
14 PKSDEVICE Device)
15 {
16 UNIMPLEMENTED
17 return STATUS_NOT_IMPLEMENTED;
18 }
19
20 NTSTATUS
21 USBAudioPinBuildDescriptors(
22 PKSDEVICE Device,
23 PKSPIN_DESCRIPTOR_EX *PinDescriptors,
24 PULONG PinDescriptorsCount,
25 PULONG PinDescriptorSize)
26 {
27 UNIMPLEMENTED
28 return STATUS_NOT_IMPLEMENTED;
29 }
30
31 NTSTATUS
32 USBAudioInitComponentId(
33 PKSDEVICE Device,
34 IN PKSCOMPONENTID ComponentId)
35 {
36 PDEVICE_EXTENSION DeviceExtension;
37
38 /* get device extension */
39 DeviceExtension = Device->Context;
40
41 INIT_USBAUDIO_MID(&ComponentId->Manufacturer, DeviceExtension->DeviceDescriptor->idVendor);
42 INIT_USBAUDIO_PID(&ComponentId->Product, DeviceExtension->DeviceDescriptor->idProduct);
43
44 return STATUS_NOT_IMPLEMENTED;
45 }
46
47
48 NTSTATUS
49 NTAPI
50 USBAudioCreateFilterContext(
51 PKSDEVICE Device)
52 {
53 KSFILTER_DESCRIPTOR FilterDescriptor;
54 PKSCOMPONENTID ComponentId;
55 NTSTATUS Status;
56
57 /* clear filter descriptor */
58 RtlZeroMemory(&FilterDescriptor, sizeof(KSFILTER_DESCRIPTOR));
59
60 /* init filter descriptor*/
61 FilterDescriptor.Version = KSFILTER_DESCRIPTOR_VERSION;
62 FilterDescriptor.ReferenceGuid = &KSNAME_Filter;
63
64 /* init component id*/
65 ComponentId = AllocFunction(sizeof(KSCOMPONENTID));
66 if (!ComponentId)
67 {
68 /* no memory */
69 return USBD_STATUS_INSUFFICIENT_RESOURCES;
70 }
71 Status = USBAudioInitComponentId(Device, ComponentId);
72 if (!NT_SUCCESS(Status))
73 {
74 /* failed*/
75 FreeFunction(ComponentId);
76 return Status;
77 }
78 FilterDescriptor.ComponentId = ComponentId;
79
80 /* build pin descriptors */
81 Status = USBAudioPinBuildDescriptors(Device, (PKSPIN_DESCRIPTOR_EX *)&FilterDescriptor.PinDescriptors, &FilterDescriptor.PinDescriptorsCount, &FilterDescriptor.PinDescriptorSize);
82 if (!NT_SUCCESS(Status))
83 {
84 /* failed*/
85 FreeFunction(ComponentId);
86 return Status;
87 }
88
89 /* build topology */
90 Status = BuildUSBAudioFilterTopology(Device);
91 if (!NT_SUCCESS(Status))
92 {
93 /* failed*/
94 FreeFunction(ComponentId);
95 return Status;
96 }
97
98 return Status;
99 }
100
101