summaryrefslogtreecommitdiff
path: root/audio/sysvad/PhoneAudioSample/Cellulartopo.h
blob: b898741c709d8d454ec546fd6ab8b088d2487cd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184

/*++

Copyright (c) Microsoft Corporation All Rights Reserved

Module Name:

    cellulartopo.h

Abstract:

    Declaration of topology miniport for the cellular endpoint.

--*/

#ifndef _SYSVAD_CELLULARTOPO_H_
#define _SYSVAD_CELLULARTOPO_H_

#include "basetopo.h"

// make sure all of these names matches with KSNAME_* in the inf's [Strings] section
#define SPEAKER_TOPONAME L"TopologySpeaker"
#define SPEAKER_HEADSET_TOPONAME L"TopologySpeakerHeadset"
#define MIC_HEADSET_TOPONAME L"TopologyMicHeadset"
#define MIC_ARRAY1_TOPONAME L"TopologyMicArray1"
#define HANDSET_SPEAKER_TOPONAME L"TopologyHandsetSpeaker"
#define HANDSET_MIC_TOPONAME L"TopologyHandsetMic"

// from bthhfpminipairs.h, static name of bluetooth speaker and mic topologies
#define HFP_SPEAKER_TOPONAME L"TopologyBthHfpSpeaker"
#define HFP_MIC_TOPONAME L"TopologyBthHfpMic"

// Special routing endpoints
#define HOSTRENDER_TOPONAME L"HostRender"
#define HOSTRENDER_PIN 0
#define HOSTCAPTURE_TOPONAME L"HostCapture"
#define HOSTCAPTURE_PIN 0

// Telephony Volume Stepping information
#define TELEPHONY_VOLUME_MAXIMUM 0                  //   0 dB
#define TELEPHONY_VOLUME_MINIMUM (-30 * 0x10000)    // -30 dB
#define TELEPHONY_VOLUME_STEPPING (3 * 0x10000)     //  10 steps


typedef struct _ENDPOINT_PAIR_ENTRY
{
    LIST_ENTRY                ListEntry;
    KSTOPOLOGY_ENDPOINTIDPAIR data;
} ENDPOINT_PAIR_ENTRY;

//=============================================================================
// Defines
//=============================================================================
// {3829F9C3-F341-4B82-976F-A635EB3CEA0D}
DEFINE_GUID(IID_ICellularTopology, 
0x3829f9c3, 0xf341, 0x4b82, 0x97, 0x6f, 0xa6, 0x35, 0xeb, 0x3c, 0xea, 0xd);


//=============================================================================
// Interfaces
//=============================================================================

///////////////////////////////////////////////////////////////////////////////
// ICellularTopology
//
DECLARE_INTERFACE_(ICellularTopology, IMiniportTopology)
{
    STDMETHOD_(NTSTATUS, UpdateTopologyJackState)
    (
        THIS_
        _In_ ULONG TelephonyId,
        _In_ BOOL NewState
    ) PURE;
};

typedef ICellularTopology *PCELLULARTOPOLOGY;

//=============================================================================
// Classes
//=============================================================================

///////////////////////////////////////////////////////////////////////////////
// CCellularMiniportTopology 
//   

class CCellularMiniportTopology : 
    public CMiniportTopologySYSVAD,
    public ICellularTopology,
    public IMiniportChange,
    public CUnknown
{
  private:
    KSTOPOLOGY_ENDPOINTID m_CellularRenderEndpoint;
    KSTOPOLOGY_ENDPOINTID m_CellularCaptureEndpoint;
    ULONG m_CellularVolume;

    FAST_MUTEX m_EndpointFastMutex;
    LIST_ENTRY m_EndpointPairs;

  public:
    DECLARE_STD_UNKNOWN();
    CCellularMiniportTopology
    (
        _In_opt_    PUNKNOWN                UnknownOuter,
        _In_        PCFILTER_DESCRIPTOR    *FilterDesc,
        _In_        USHORT                  DeviceMaxChannels
    );

    ~CCellularMiniportTopology();

    IMP_IMiniportTopology;

    NTSTATUS PropertyHandlerJackSinkInfo
    (
        _In_ PPCPROPERTY_REQUEST  PropertyRequest
    );
    
    NTSTATUS PropertyHandlerJackDescription
    (
        _In_ PPCPROPERTY_REQUEST  PropertyRequest
    );

    NTSTATUS PropertyHandlerJackDescription2
    (
        _In_ PPCPROPERTY_REQUEST  PropertyRequest
    );

    NTSTATUS PropertyHandlerTelephonyEndpointIdPair
    (
        _In_ PPCPROPERTY_REQUEST  PropertyRequest
    );

    NTSTATUS PropertyHandlerTelephonyVolume
    (
        _In_ PPCPROPERTY_REQUEST  PropertyRequest
    );

    NTSTATUS EventHandler_JackState
    (
        _In_ PPCEVENT_REQUEST _pEventRequest
    );

    STDMETHODIMP_(NTSTATUS) UpdateTopologyJackState
    (
        _In_ ULONG TelephonyId,
        _In_ BOOL NewState
    );

    NTSTATUS EventHandler_Telephony
    (
        _In_ PPCEVENT_REQUEST _pEventRequest
    );

    STDMETHODIMP_(NTSTATUS) NotifyEndpointPair
    ( 
        _In_ WCHAR              *RenderEndpointTopoName,
        _In_ ULONG              RenderEndpointNameLen,
        _In_ ULONG              RenderPinId,
        _In_ WCHAR              *CaptureEndpointTopoName,
        _In_ ULONG              CaptureEndpointNameLen,
        _In_ ULONG              CapturePinId
    );
};
    
typedef CCellularMiniportTopology *PCCellularMiniportTopology;

NTSTATUS
CreateCellularMiniportTopology( 
    _Out_           PUNKNOWN                              * Unknown,
    _In_            REFCLSID,
    _In_opt_        PUNKNOWN                                UnknownOuter,
    _When_((PoolType & NonPagedPoolMustSucceed) != 0,
       __drv_reportError("Must succeed pool allocations are forbidden. "
			 "Allocation failures cause a system crash"))
    _In_            POOL_TYPE                               PoolType,
    _In_            PUNKNOWN                                UnknownAdapter,
    _In_opt_        PVOID                                   DeviceContext,
    _In_            PENDPOINT_MINIPAIR                      MiniportPair
    );

NTSTATUS PropertyHandler_CellularTopoFilter(_In_ PPCPROPERTY_REQUEST PropertyRequest);

#endif // _SYSVAD_CELLULARTOPO_H_