1 /* 2 Copyright (c) 2006-2008 dogbert <dogber1@gmail.com> 3 All rights reserved. 4 5 Redistribution and use in source and binary forms, with or without 6 modification, are permitted provided that the following conditions 7 are met: 8 1. Redistributions of source code must retain the above copyright 9 notice, this list of conditions and the following disclaimer. 10 2. Redistributions in binary form must reproduce the above copyright 11 notice, this list of conditions and the following disclaimer in the 12 documentation and/or other materials provided with the distribution. 13 3. The name of the author may not be used to endorse or promote products 14 derived from this software without specific prior written permission. 15 16 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 #ifndef _MINWAVETABLES_HPP_ 29 #define _MINWAVETABLES_HPP_ 30 31 #define STATIC_KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_DOLBY_AC3_SPDIF) 32 DEFINE_GUIDSTRUCT("00000092-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF); 33 #define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF) 34 35 #define WAVE_FORMAT_WMA_SPDIF 0x164 36 #define STATIC_KSDATAFORMAT_SUBTYPE_WMA_SPDIF DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_WMA_SPDIF) 37 DEFINE_GUIDSTRUCT("00000164-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_WMA_SPDIF); 38 #define KSDATAFORMAT_SUBTYPE_WMA_SPDIF DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_WMA_SPDIF) 39 40 static KSDATARANGE_AUDIO WavePinDataRangesPCMStream[] = 41 { 42 { 43 { 44 { 45 sizeof(KSDATARANGE_AUDIO), 46 0, 47 0, 48 0, 49 {STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)}, 50 {STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM)}, 51 {STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)} 52 } 53 }, 54 MAX_CHANNELS_PCM, 55 MIN_BITS_PER_SAMPLE_PCM, 56 MAX_BITS_PER_SAMPLE_PCM, 57 MIN_SAMPLE_RATE, 58 MAX_SAMPLE_RATE 59 } 60 }; 61 62 static KSDATARANGE_AUDIO WavePinDataRangesAC3Stream[] = 63 { 64 { 65 { 66 { 67 sizeof(KSDATARANGE_AUDIO), 68 0, 69 0, 70 0, 71 {STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)}, 72 {STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)}, 73 {STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)} 74 } 75 }, 76 MAX_CHANNELS_AC3, 77 MIN_BITS_PER_SAMPLE_AC3, 78 MAX_BITS_PER_SAMPLE_AC3, 79 MIN_SAMPLE_RATE_AC3, 80 MAX_SAMPLE_RATE_AC3 81 }, 82 { 83 { 84 { 85 sizeof(KSDATARANGE_AUDIO), 86 0, 87 0, 88 0, 89 {STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)}, 90 {STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)}, 91 {STATICGUIDOF(KSDATAFORMAT_SPECIFIER_DSOUND)} 92 } 93 }, 94 MAX_CHANNELS_AC3, 95 MIN_BITS_PER_SAMPLE_AC3, 96 MAX_BITS_PER_SAMPLE_AC3, 97 MIN_SAMPLE_RATE_AC3, 98 MAX_SAMPLE_RATE_AC3 99 }, 100 { 101 { 102 { 103 sizeof(KSDATARANGE_AUDIO), 104 0, 105 0, 106 0, 107 {STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)}, 108 {STATICGUIDOF(KSDATAFORMAT_SUBTYPE_WMA_SPDIF)}, 109 {STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)} 110 } 111 }, 112 MAX_CHANNELS_WMA, 113 MIN_BITS_PER_SAMPLE_WMA, 114 MAX_BITS_PER_SAMPLE_WMA, 115 MIN_SAMPLE_RATE_WMA, 116 MIN_SAMPLE_RATE_WMA 117 }, 118 { 119 { 120 { 121 sizeof(KSDATARANGE_AUDIO), 122 0, 123 0, 124 0, 125 {STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)}, 126 {STATICGUIDOF(KSDATAFORMAT_SUBTYPE_WMA_SPDIF)}, 127 {STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)} 128 } 129 }, 130 MAX_CHANNELS_WMA, 131 MIN_BITS_PER_SAMPLE_WMA, 132 MAX_BITS_PER_SAMPLE_WMA, 133 MAX_SAMPLE_RATE_WMA, 134 MAX_SAMPLE_RATE_WMA 135 } 136 }; 137 138 static PKSDATARANGE WavePinDataRangePointersPCMStream[] = 139 { 140 PKSDATARANGE(&WavePinDataRangesPCMStream[0]) 141 }; 142 143 static PKSDATARANGE WavePinDataRangePointersAC3Stream[] = 144 { 145 PKSDATARANGE(&WavePinDataRangesAC3Stream[0]), 146 PKSDATARANGE(&WavePinDataRangesAC3Stream[1]), 147 PKSDATARANGE(&WavePinDataRangesAC3Stream[2]), 148 PKSDATARANGE(&WavePinDataRangesAC3Stream[3]), 149 }; 150 151 152 153 static KSDATARANGE WavePinDataRangesPCMBridge[] = 154 { 155 { 156 { 157 sizeof(KSDATARANGE), 158 0, 159 0, 160 0, 161 {STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)}, 162 {STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG)}, 163 {STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)} 164 } 165 } 166 }; 167 168 static KSDATARANGE WavePinDataRangesAC3Bridge[] = 169 { 170 { 171 { 172 sizeof(KSDATARANGE), 173 0, 174 0, 175 0, 176 {STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)}, 177 {STATICGUIDOF(KSDATAFORMAT_SUBTYPE_AC3_AUDIO)}, 178 {STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)} 179 } 180 } 181 }; 182 183 static PKSDATARANGE WavePinDataRangePointersPCMBridge[] = 184 { 185 &WavePinDataRangesPCMBridge[0] 186 }; 187 188 static PKSDATARANGE WavePinDataRangePointersAC3Bridge[] = 189 { 190 &WavePinDataRangesAC3Bridge[0] 191 }; 192 193 static PCPIN_DESCRIPTOR WaveMiniportPins[] = 194 { 195 // PIN_WAVE_CAPTURE_SINK - 0 196 { 197 MAX_OUTPUT_STREAMS, 198 MAX_OUTPUT_STREAMS, 199 0, 200 NULL, 201 { 202 0, 203 NULL, 204 0, 205 NULL, 206 SIZEOF_ARRAY(WavePinDataRangePointersPCMStream), 207 WavePinDataRangePointersPCMStream, 208 KSPIN_DATAFLOW_OUT, 209 KSPIN_COMMUNICATION_SINK, 210 &KSCATEGORY_AUDIO, 211 &KSAUDFNAME_RECORDING_CONTROL, 212 {0} 213 } 214 }, 215 216 // PIN_WAVE_CAPTURE_SOURCE - 1 217 { 218 0, 219 0, 220 0, 221 NULL, 222 { 223 0, 224 NULL, 225 0, 226 NULL, 227 SIZEOF_ARRAY(WavePinDataRangePointersPCMBridge), 228 WavePinDataRangePointersPCMBridge, 229 KSPIN_DATAFLOW_IN, 230 KSPIN_COMMUNICATION_NONE, 231 &KSCATEGORY_AUDIO, 232 NULL, 233 {0} 234 } 235 }, 236 237 // PIN_WAVE_RENDER_SINK - 2 238 { 239 MAX_INPUT_STREAMS, 240 MAX_INPUT_STREAMS, 241 0, 242 NULL, 243 { 244 0, 245 NULL, 246 0, 247 NULL, 248 SIZEOF_ARRAY(WavePinDataRangePointersPCMStream), 249 WavePinDataRangePointersPCMStream, 250 KSPIN_DATAFLOW_IN, 251 KSPIN_COMMUNICATION_SINK, 252 &KSCATEGORY_AUDIO, 253 &KSAUDFNAME_VOLUME_CONTROL, 254 {0} 255 } 256 }, 257 258 // PIN_WAVE_RENDER_SOURCE - 3 259 { 260 0, 261 0, 262 0, 263 NULL, 264 { 265 0, 266 NULL, 267 0, 268 NULL, 269 SIZEOF_ARRAY(WavePinDataRangePointersPCMBridge), 270 WavePinDataRangePointersPCMBridge, 271 KSPIN_DATAFLOW_OUT, 272 KSPIN_COMMUNICATION_NONE, 273 &KSNODETYPE_SPEAKER, 274 NULL, 275 {0} 276 } 277 }, 278 279 // PIN_WAVE_AC3_RENDER_SINK - 4 280 { 281 MAX_AC3_INPUT_STREAMS, 282 MAX_AC3_INPUT_STREAMS, 283 0, 284 NULL, 285 { 286 0, 287 NULL, 288 0, 289 NULL, 290 SIZEOF_ARRAY(WavePinDataRangePointersAC3Stream), 291 WavePinDataRangePointersAC3Stream, 292 KSPIN_DATAFLOW_IN, 293 KSPIN_COMMUNICATION_SINK, 294 &KSCATEGORY_AUDIO, 295 NULL, 296 {0} 297 } 298 }, 299 300 301 // PIN_WAVE_AC3_RENDER_SOURCE - 5 302 { 303 0, 304 0, 305 0, 306 NULL, 307 { 308 0, 309 NULL, 310 0, 311 NULL, 312 SIZEOF_ARRAY(WavePinDataRangePointersAC3Bridge), 313 WavePinDataRangePointersAC3Bridge, 314 KSPIN_DATAFLOW_OUT, 315 KSPIN_COMMUNICATION_NONE, 316 &KSNODETYPE_SPDIF_INTERFACE, 317 NULL, 318 {0} 319 } 320 } 321 }; 322 323 NTSTATUS NTAPI PropertyHandler_ChannelConfig(PPCPROPERTY_REQUEST PropertyRequest); 324 325 static PCPROPERTY_ITEM PropertiesChannels[] = 326 { 327 { 328 &KSPROPSETID_Audio, 329 KSPROPERTY_AUDIO_CHANNEL_CONFIG, 330 KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_SET, 331 PropertyHandler_ChannelConfig 332 } 333 }; 334 DEFINE_PCAUTOMATION_TABLE_PROP(AutomationChans,PropertiesChannels); 335 336 static PCNODE_DESCRIPTOR WaveMiniportNodes[] = 337 {// Flags AutomationTable Type Name 338 // 0 - KSNODE_WAVE_ADC 339 { 0, NULL, &KSNODETYPE_ADC, NULL }, 340 // 1 - KSNODE_WAVE_VOLUME1 341 { 0, NULL, &KSNODETYPE_VOLUME, NULL }, 342 // 2 - KSNODE_WAVE_3D_EFFECTS 343 { 0, NULL, &KSNODETYPE_3D_EFFECTS, NULL }, 344 // 3 - KSNODE_WAVE_SUPERMIX 345 { 0, NULL, &KSNODETYPE_SUPERMIX, NULL }, 346 // 4 - KSNODE_WAVE_VOLUME2 347 { 0, NULL, &KSNODETYPE_VOLUME, NULL }, 348 // 5 - KSNODE_WAVE_SRC 349 { 0, NULL, &KSNODETYPE_SRC, NULL }, 350 // 6 - KSNODE_WAVE_SUM 351 { 0, NULL, &KSNODETYPE_SUM, NULL }, 352 // 7 - KSNODE_WAVE_DAC 353 { 0, &AutomationChans, &KSNODETYPE_DAC, NULL }, 354 // 8 - KSNODE_WAVE_SPDIF (XP crashes if the pins are directly connected) 355 { 0, NULL, &KSNODETYPE_SPDIF_INTERFACE, NULL }, 356 }; 357 358 static PCCONNECTION_DESCRIPTOR WaveMiniportConnections[] = 359 {// FromNode, FromPin, ToNode, ToPin 360 { PCFILTER_NODE, PIN_WAVE_CAPTURE_SOURCE, KSNODE_WAVE_ADC, 1 }, 361 { KSNODE_WAVE_ADC, 0, PCFILTER_NODE, PIN_WAVE_CAPTURE_SINK }, 362 363 { PCFILTER_NODE, PIN_WAVE_RENDER_SINK, KSNODE_WAVE_VOLUME1, 1 }, 364 { KSNODE_WAVE_VOLUME1, 0, KSNODE_WAVE_3D_EFFECTS, 1 }, 365 { KSNODE_WAVE_3D_EFFECTS, 0, KSNODE_WAVE_SUPERMIX, 1 }, 366 { KSNODE_WAVE_SUPERMIX, 0, KSNODE_WAVE_VOLUME2, 1 }, 367 { KSNODE_WAVE_VOLUME2, 0, KSNODE_WAVE_SRC, 1 }, 368 { KSNODE_WAVE_SRC, 0, KSNODE_WAVE_SUM, 1 }, 369 { KSNODE_WAVE_SUM, 0, KSNODE_WAVE_DAC, 1 }, 370 { KSNODE_WAVE_DAC, 0, PCFILTER_NODE, PIN_WAVE_RENDER_SOURCE }, 371 372 { PCFILTER_NODE, PIN_WAVE_AC3_RENDER_SINK,KSNODE_WAVE_SPDIF, 1 }, 373 { KSNODE_WAVE_SPDIF, 0, PCFILTER_NODE, PIN_WAVE_AC3_RENDER_SOURCE }, 374 }; 375 376 static PCFILTER_DESCRIPTOR WaveMiniportFilterDescriptor = 377 { 378 0, // Version 379 NULL, // AutomationTable 380 sizeof(PCPIN_DESCRIPTOR), // PinSize 381 SIZEOF_ARRAY(WaveMiniportPins), // PinCount 382 WaveMiniportPins, // Pins 383 sizeof(PCNODE_DESCRIPTOR), // NodeSize 384 SIZEOF_ARRAY(WaveMiniportNodes), // NodeCount 385 WaveMiniportNodes, // Nodes 386 SIZEOF_ARRAY(WaveMiniportConnections), // ConnectionCount 387 WaveMiniportConnections, // Connections 388 0, // CategoryCount 389 NULL // Categories - use the default categories (audio, render, capture) 390 }; 391 392 #endif //_MINWAVETABLES_HPP_ 393