equal
deleted
inserted
replaced
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <stdio.h> |
18 #include <stdio.h> |
19 #include <stdlib.h> |
19 #include <stdlib.h> |
20 #include <assert.h> |
|
21 #include <string.h> |
20 #include <string.h> |
22 |
21 |
23 #include "xaglobals.h" |
22 #include "xaglobals.h" |
24 #include "xaaudioiodevicecapabilitiesitf.h" |
23 #include "xaaudioiodevicecapabilitiesitf.h" |
25 #include "xacapabilitiesmgr.h" |
24 #include "xacapabilitiesmgr.h" |
26 |
25 #include "xaadptbasectx.h" |
27 |
26 |
28 /* XAAudIODevCapaItfImpl* GetImpl |
27 /* XAAudIODevCapaItfImpl* GetImpl |
29 * Description: Validate interface pointer and cast it to implementation pointer. |
28 * Description: Validate interface pointer and cast it to implementation pointer. |
30 */ |
29 */ |
31 static XAAudIODevCapaItfImpl* GetImpl(XAAudioIODeviceCapabilitiesItf self) |
30 static XAAudIODevCapaItfImpl* GetImpl(XAAudioIODeviceCapabilitiesItf self) |
79 { |
78 { |
80 /* query device id from adaptation using index value */ |
79 /* query device id from adaptation using index value */ |
81 res = XACapabilitiesMgr_GetCapsByIdx(impl->capslist, (XACapsType)(XACAP_DEVSRC|XACAP_AUDIO), i, &temp); |
80 res = XACapabilitiesMgr_GetCapsByIdx(impl->capslist, (XACapsType)(XACAP_DEVSRC|XACAP_AUDIO), i, &temp); |
82 pInputDeviceIDs[i] = temp.xaid; |
81 pInputDeviceIDs[i] = temp.xaid; |
83 } |
82 } |
84 |
83 } |
85 pInputDeviceIDs[0] = 0xAD7E5001; |
84 } |
86 } |
85 else |
87 } |
86 { |
88 *pNumInputs = impl->numInputDevices; |
87 *pNumInputs = impl->numInputDevices; |
|
88 } |
89 } |
89 } |
90 DEBUG_API("<-XAAudIODevCapaItfImpl_GetAvailableAudioInputs"); |
90 DEBUG_API("<-XAAudIODevCapaItfImpl_GetAvailableAudioInputs"); |
91 return res; |
91 return res; |
92 } |
92 } |
93 |
93 |
214 { |
214 { |
215 /* query device id from adaptation using index value */ |
215 /* query device id from adaptation using index value */ |
216 res = XACapabilitiesMgr_GetCapsByIdx(impl->capslist, (XACapsType)(XACAP_DEVSNK|XACAP_AUDIO), i, &temp); |
216 res = XACapabilitiesMgr_GetCapsByIdx(impl->capslist, (XACapsType)(XACAP_DEVSNK|XACAP_AUDIO), i, &temp); |
217 pOutputDeviceIDs[i] = temp.xaid; |
217 pOutputDeviceIDs[i] = temp.xaid; |
218 } |
218 } |
219 |
219 } |
220 pOutputDeviceIDs[0] = 0xAD7E5002; |
220 } |
221 } |
221 else |
222 } |
222 { |
223 *pNumOutputs = impl->numOutputDevices; |
223 *pNumOutputs = impl->numOutputDevices; |
|
224 } |
224 } |
225 } |
225 DEBUG_API("<-XAAudIODevCapaItfImpl_GetAvailableAudioOutputs"); |
226 DEBUG_API("<-XAAudIODevCapaItfImpl_GetAvailableAudioOutputs"); |
226 return res; |
227 return res; |
227 } |
228 } |
228 |
229 |
395 } |
396 } |
396 } |
397 } |
397 } |
398 } |
398 |
399 |
399 *pNumAudioInputs = associatedCount; |
400 *pNumAudioInputs = associatedCount; |
400 |
|
401 |
|
402 if(!pAudioInputDeviceIDs) |
|
403 { |
|
404 switch(deviceId) |
|
405 { |
|
406 case 0xAD7E5001: |
|
407 *pNumAudioInputs = 0; |
|
408 break; |
|
409 case 0xAD7E5002: |
|
410 *pNumAudioInputs = 1; |
|
411 break; |
|
412 default: |
|
413 res = XA_RESULT_PARAMETER_INVALID; |
|
414 break; |
|
415 } |
|
416 } |
|
417 else |
|
418 { |
|
419 switch(deviceId) |
|
420 { |
|
421 case 0xAD7E5001: |
|
422 res = XA_RESULT_PARAMETER_INVALID; |
|
423 break; |
|
424 case 0xAD7E5002: |
|
425 pAudioInputDeviceIDs[*pNumAudioInputs - 1] = 0xAD7E5001; |
|
426 break; |
|
427 default: |
|
428 res = XA_RESULT_PARAMETER_INVALID; |
|
429 break; |
|
430 } |
|
431 } |
|
432 |
|
433 } |
401 } |
434 |
402 |
435 DEBUG_API("<-XAAudIODevCapaItfImpl_GetAssociatedAudioInputs"); |
403 DEBUG_API("<-XAAudIODevCapaItfImpl_GetAssociatedAudioInputs"); |
436 return res; |
404 return res; |
437 } |
405 } |
491 } |
459 } |
492 } |
460 } |
493 } |
461 } |
494 |
462 |
495 *pNumAudioOutputs = associatedCount; |
463 *pNumAudioOutputs = associatedCount; |
496 |
|
497 |
|
498 if(!pAudioOutputDeviceIDs) |
|
499 { |
|
500 switch(deviceId) |
|
501 { |
|
502 case 0xAD7E5002: |
|
503 *pNumAudioOutputs = 0; |
|
504 break; |
|
505 case 0xAD7E5001: |
|
506 *pNumAudioOutputs = 1; |
|
507 break; |
|
508 default: |
|
509 res = XA_RESULT_PARAMETER_INVALID; |
|
510 break; |
|
511 } |
|
512 } |
|
513 else |
|
514 { |
|
515 switch(deviceId) |
|
516 { |
|
517 case 0xAD7E5002: |
|
518 res = XA_RESULT_PARAMETER_INVALID; |
|
519 break; |
|
520 case 0xAD7E5001: |
|
521 pAudioOutputDeviceIDs[*pNumAudioOutputs - 1] = 0xAD7E5001; |
|
522 break; |
|
523 default: |
|
524 res = XA_RESULT_PARAMETER_INVALID; |
|
525 break; |
|
526 } |
|
527 } |
|
528 } |
464 } |
529 |
465 |
530 DEBUG_API("<-XAAudIODevCapaItfImpl_GetAssociatedAudioOutputs"); |
466 DEBUG_API("<-XAAudIODevCapaItfImpl_GetAssociatedAudioOutputs"); |
531 return res; |
467 return res; |
532 } |
468 } |
568 else |
504 else |
569 { |
505 { |
570 switch(defaultDeviceID) |
506 switch(defaultDeviceID) |
571 { |
507 { |
572 case XA_DEFAULTDEVICEID_AUDIOOUTPUT: |
508 case XA_DEFAULTDEVICEID_AUDIOOUTPUT: |
573 pAudioDeviceIDs[*pNumAudioDevices - 1] = 0xAD7E5002; |
509 pAudioDeviceIDs[*pNumAudioDevices - 1] = XA_ADAPT_DEFAULTAUDIOOUTPUT; |
574 break; |
510 break; |
575 case XA_DEFAULTDEVICEID_AUDIOINPUT: |
511 case XA_DEFAULTDEVICEID_AUDIOINPUT: |
576 pAudioDeviceIDs[*pNumAudioDevices - 1] = 0xAD7E5001; |
512 pAudioDeviceIDs[*pNumAudioDevices - 1] = XA_ADAPT_DEFAULTAUDIOINPUT; |
577 break; |
513 break; |
578 default: |
514 default: |
579 res = XA_RESULT_PARAMETER_INVALID; |
515 res = XA_RESULT_PARAMETER_INVALID; |
580 break; |
516 break; |
581 } |
517 } |
716 XACapabilitiesMgr_QueryColorFormats(caps, NULL, NULL); |
652 XACapabilitiesMgr_QueryColorFormats(caps, NULL, NULL); |
717 |
653 |
718 self->inputCbPtrToSelf = NULL; |
654 self->inputCbPtrToSelf = NULL; |
719 self->outputCbPtrToSelf = NULL; |
655 self->outputCbPtrToSelf = NULL; |
720 self->deviceMapCbPtrToSelf = NULL; |
656 self->deviceMapCbPtrToSelf = NULL; |
721 self->numInputDevices = 1; |
|
722 self->numOutputDevices = 1; |
|
723 self->self = self; |
657 self->self = self; |
724 } |
658 } |
725 DEBUG_API("<-XAAudIODevCapaItfImpl_Create"); |
659 DEBUG_API("<-XAAudIODevCapaItfImpl_Create"); |
726 return self; |
660 return self; |
727 } |
661 } |
730 * Description: Free all resources reserved at XAAudIODevCapaItfImpl_Create |
664 * Description: Free all resources reserved at XAAudIODevCapaItfImpl_Create |
731 */ |
665 */ |
732 void XAAudIODevCapaItfImpl_Free(XAAudIODevCapaItfImpl* self) |
666 void XAAudIODevCapaItfImpl_Free(XAAudIODevCapaItfImpl* self) |
733 { |
667 { |
734 DEBUG_API("->XAAudIODevCapaItfImpl_Free"); |
668 DEBUG_API("->XAAudIODevCapaItfImpl_Free"); |
735 assert(self==self->self); |
|
736 free(self); |
669 free(self); |
737 DEBUG_API("<-XAAudIODevCapaItfImpl_Free"); |
670 DEBUG_API("<-XAAudIODevCapaItfImpl_Free"); |
738 } |
671 } |