source: svn/trunk/newcon3bcm2_21bu/magnum/syslib/synclib/7552/bsynclib_channel_config.c

Last change on this file was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 18.5 KB
Line 
1/***************************************************************************
2*     Copyright (c) 2004-2010, Broadcom Corporation
3*     All Rights Reserved
4*     Confidential Property of Broadcom Corporation
5*
6*  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7*  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8*  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9*
10* $brcm_Workfile: bsynclib_channel_config.c $
11* $brcm_Revision: Hydra_Software_Devel/9 $
12* $brcm_Date: 5/28/10 6:31p $
13*
14* Revision History:
15*
16* $brcm_Log: /magnum/syslib/synclib/noarch/bsynclib_channel_config.c $
17*
18* Hydra_Software_Devel/9   5/28/10 6:31p bandrews
19* SW7405-4436: printing channel index in dbg messages
20*
21* Hydra_Software_Devel/8   3/22/10 5:44p bandrews
22* sw7408-83: add unconditional video unmute
23*
24* Hydra_Software_Devel/7   3/18/10 9:34p bandrews
25* SW7405-4042: rework delay estimation so that imprecise lipsync works
26* correctly
27*
28* Hydra_Software_Devel/6   2/1/10 8:01p bandrews
29* SW7405-3774: only mute/unmute synchronized sources
30*
31* Hydra_Software_Devel/5   2/1/10 3:28p bandrews
32* SW7405-3774: default mute control to off
33*
34* Hydra_Software_Devel/4   1/26/10 9:00p bandrews
35* SW7405-3774: added mute control support
36*
37* Hydra_Software_Devel/3   7/24/09 4:15p bandrews
38* PR48566: support preferred units
39*
40* Hydra_Software_Devel/2   11/26/08 5:09p bandrews
41* PR49294: Added precision lipsync flag
42*
43* Hydra_Software_Devel/1   3/24/08 3:09p bandrews
44* PR40865: Fixed
45*
46* Hydra_Software_Devel/8   2/28/08 8:36p bandrews
47* PR37951: Added call to self clear config bits that are supposed to be
48* self-clearing
49*
50* Hydra_Software_Devel/7   2/26/08 10:21p bandrews
51* PR37951: Fixed units.  Implemented static rate mismatch detection.
52*
53* Hydra_Software_Devel/6   2/25/08 9:33p bandrews
54* PR37951: Fixed various bugs
55*
56* Hydra_Software_Devel/5   2/22/08 9:20p bandrews
57* PR37951: Added RMD support
58*
59* Hydra_Software_Devel/4   2/22/08 8:28p bandrews
60* PR37951: Fixed bug in units conversion
61*
62* Hydra_Software_Devel/3   2/20/08 10:03p bandrews
63* PR37951: Updated based on feedback from usage
64*
65* Hydra_Software_Devel/2   1/3/08 5:17p bandrews
66* PR37951: Updated based on initial feedback
67*
68* Hydra_Software_Devel/1   12/12/07 2:53p bandrews
69* PR37951: Initial check-in
70***************************************************************************/
71
72#include "bstd.h"
73#include "bsyslib.h"
74#include "bsynclib.h"
75#include "bsynclib_priv.h"
76#include "bsynclib_channel_priv.h"
77#include "bsynclib_algo.h"
78#include "bkni.h"
79
80BDBG_MODULE(synclib);
81
82/*
83Summary:
84Returns the default configuration of a sync channel
85*/
86void BSYNClib_Channel_P_GetDefaultConfig(BSYNClib_Channel_Config * psConfig) 
87{
88        BDBG_ENTER(BSYNClib_Channel_P_GetDefaultConfig);
89       
90        BDBG_ASSERT(psConfig);
91
92        BKNI_Memset(psConfig, 0, sizeof(BSYNClib_Channel_Config));
93
94        psConfig->bEnabled = true;
95
96        psConfig->sMuteControl.bEnabled = true;
97        psConfig->sMuteControl.bSimultaneousUnmute = false;
98
99        psConfig->uiVideoSourceCount = 0;
100        psConfig->uiVideoSinkCount = 0;
101        psConfig->uiAudioSourceCount = 0;
102        psConfig->uiAudioSinkCount = 0;
103
104        BDBG_LEAVE(BSYNClib_Channel_P_GetDefaultConfig);
105}
106
107/*
108Summary:
109Returns the current configuration of an SYNC lib channel
110Description:
111*/
112void BSYNClib_Channel_GetConfig(
113        BSYNClib_Channel_Handle hChn, 
114        BSYNClib_Channel_Config * psConfig
115)
116{
117        BDBG_ENTER(BSYNClib_Channel_GetConfig);
118       
119        BDBG_ASSERT(hChn);
120
121        if (BSYNClib_P_Enabled(hChn->hParent))
122        {
123                BDBG_ASSERT(psConfig);
124                *psConfig = hChn->sConfig;
125        }
126
127        BDBG_LEAVE(BSYNClib_Channel_GetConfig);
128}
129
130BERR_Code BSYNClib_Channel_SetConfig(
131        BSYNClib_Channel_Handle hChn,
132        const BSYNClib_Channel_Config * psConfig
133)
134{
135        BERR_Code rc = BERR_SUCCESS;
136
137        BDBG_ENTER(BSYNClib_Channel_SetConfig);
138       
139        BDBG_ASSERT(hChn);
140
141        if (BSYNClib_P_Enabled(hChn->hParent))
142        {
143                /* copy config */
144                BDBG_ASSERT(psConfig);
145                hChn->sConfig = *psConfig;
146
147                rc = BSYNClib_Channel_P_ProcessConfig(hChn);
148        }
149
150        BDBG_LEAVE(BSYNClib_Channel_SetConfig);
151        return rc;
152}
153
154BERR_Code BSYNClib_Channel_P_ProcessConfig(
155        BSYNClib_Channel_Handle hChn
156)
157{
158        BERR_Code rc = BERR_SUCCESS;
159        BSYNClib_Channel_Config * psConfig;
160        BSYNClib_RateMismatchDetector_Config sRmdConfig;
161        BSYSlib_List_IteratorHandle hIterator;
162        unsigned int i = 0;
163        bool bGenerateInitialCallbacks = false;
164
165        BDBG_ENTER(BSYNClib_Channel_P_ProcessConfig);
166       
167        BDBG_ASSERT(hChn);
168
169        psConfig = &hChn->sConfig;
170
171        /* copy enable flag first */
172        hChn->bEnabled = psConfig->bEnabled;
173
174        if ((psConfig->uiVideoSourceCount && psConfig->uiVideoSourceCount != hChn->sVideo.uiSourceCount)
175                || (psConfig->uiVideoSinkCount && psConfig->uiVideoSinkCount != hChn->sVideo.uiSinkCount) 
176                || (psConfig->uiAudioSourceCount && psConfig->uiAudioSourceCount != hChn->sAudio.uiSourceCount)
177                || (psConfig->uiAudioSinkCount && psConfig->uiAudioSinkCount != hChn->sAudio.uiSinkCount))
178        {
179                bGenerateInitialCallbacks = true;
180        }
181       
182        /* video sources */
183        if (psConfig->uiVideoSourceCount != hChn->sVideo.uiSourceCount)
184        {
185                /* take down previous data */
186                hIterator = BSYSlib_List_AcquireIterator(hChn->sVideo.hSources);
187               
188                while (BSYSlib_List_HasNext(hIterator))
189                {
190                        BSYNClib_VideoSource * psSource;
191
192                        psSource = (BSYNClib_VideoSource *)BSYSlib_List_Next(hIterator);
193                        BSYSlib_List_RemoveElement(hChn->sVideo.hSources, psSource);
194
195                        if (psSource->psTsmLockTimer)
196                        {
197                                BDBG_MSG(("[%d] Releasing video source %d tsm lock timer", hChn->iIndex, psSource->sElement.uiIndex));
198                                BSYNClib_ResourcePool_Release(hChn->psTimers, psSource->psTsmLockTimer);
199                                psSource->psTsmLockTimer = NULL;
200                        }
201                        if (psSource->psUnmuteTimer)
202                        {
203                                BDBG_MSG(("[%d] Releasing video source %d unmute timer", hChn->iIndex, psSource->sElement.uiIndex));
204                                BSYNClib_ResourcePool_Release(hChn->psTimers, psSource->psUnmuteTimer);
205                                psSource->psUnmuteTimer = NULL;
206                        }
207
208#if BSYNCLIB_UNCONDITIONAL_VIDEO_UNMUTE_SUPPORT
209                        if (psSource->psUnconditionalUnmuteTimer)
210                        {
211                                BDBG_MSG(("[%d] Releasing video source %d unconditional unmute timer", hChn->iIndex, psSource->sElement.uiIndex));
212                                BSYNClib_ResourcePool_Release(hChn->psTimers, psSource->psUnconditionalUnmuteTimer);
213                                psSource->psUnconditionalUnmuteTimer = NULL;
214                        }
215#endif
216
217                        BSYNClib_VideoSource_Destroy(psSource);
218                }
219
220                BSYSlib_List_ReleaseIterator(hIterator);
221
222                /* bring up new data */
223                for (i = 0; i < psConfig->uiVideoSourceCount; i++)
224                {
225                        BSYNClib_VideoSource * psSource;
226                        psSource = BSYNClib_VideoSource_Create();
227                        if (!psSource) goto error;
228                        psSource->sElement.hParent = hChn;
229                        BSYSlib_List_AddElement(hChn->sVideo.hSources, psSource);
230                        psSource->sElement.uiIndex = i;
231
232                        BDBG_MSG(("[%d] Acquiring video source %d tsm lock timer", hChn->iIndex, i));
233                        psSource->psTsmLockTimer = BSYNClib_ResourcePool_Acquire(hChn->psTimers);
234
235                        BDBG_MSG(("[%d] Acquiring video source %d unmute timer", hChn->iIndex, i));
236                        psSource->psUnmuteTimer = BSYNClib_ResourcePool_Acquire(hChn->psTimers);
237
238#if BSYNCLIB_UNCONDITIONAL_VIDEO_UNMUTE_SUPPORT
239                        BDBG_MSG(("[%d] Acquiring video source %d unconditional unmute timer", hChn->iIndex, i));
240                        psSource->psUnconditionalUnmuteTimer = BSYNClib_ResourcePool_Acquire(hChn->psTimers);
241#endif
242
243                        psSource->sElement.sDelay.sData.ePreferredUnits = hChn->sSettings.sVideo.sSource.cbDelay.preferredDelayUnits;
244                        psSource->sElement.sNotification.sData.ePreferredUnits = hChn->sSettings.sVideo.sSource.cbDelay.preferredDelayUnits;
245
246                        psSource->sElement.sDelay.sResults.bGenerateCallback = true;
247                        psSource->sElement.sNotification.sResults.bGenerateCallback = true;
248                }
249
250                hChn->sVideo.uiSourceCount = psConfig->uiVideoSourceCount;
251        }
252
253        /* PR49294 20081125 bandrews - add precision lipsync flag */
254        if (psConfig->bPrecisionLipsyncEnabled != hChn->bPrecisionLipsyncEnabled)
255        {
256                /* copy flag */
257                hChn->bPrecisionLipsyncEnabled = psConfig->bPrecisionLipsyncEnabled;
258
259                /* generate callbacks at end of process config */
260                bGenerateInitialCallbacks = true;
261
262                hIterator = BSYSlib_List_AcquireIterator(hChn->sVideo.hSources);
263
264                /* enable notification callback on all video sources */
265                while (BSYSlib_List_HasNext(hIterator))
266                {
267                        BSYNClib_VideoSource * psSource;
268
269                        psSource = (BSYNClib_VideoSource *)BSYSlib_List_Next(hIterator);
270                        psSource->sElement.sNotification.sResults.bGenerateCallback = true;
271                        BKNI_EnterCriticalSection();
272                        BSYNClib_VideoSource_EstimateDelay_isr(psSource);
273                        BKNI_LeaveCriticalSection();
274                }
275
276                BSYSlib_List_ReleaseIterator(hIterator);
277        }
278
279        /* video sinks */
280        if (psConfig->uiVideoSinkCount != hChn->sVideo.uiSinkCount)
281        {
282                /* take down previous */
283                hIterator = BSYSlib_List_AcquireIterator(hChn->sVideo.hSinks);
284               
285                while (BSYSlib_List_HasNext(hIterator))
286                {
287                        BSYNClib_VideoSink * psSink;
288
289                        psSink = (BSYNClib_VideoSink *)BSYSlib_List_Next(hIterator);
290                        BSYSlib_List_RemoveElement(hChn->sVideo.hSinks, psSink);
291
292                        BSYNClib_VideoSink_Destroy(psSink);
293                }
294
295                BSYSlib_List_ReleaseIterator(hIterator);
296               
297                /* bring up new */
298                for (i = 0; i < psConfig->uiVideoSinkCount; i++)
299                {
300                        BSYNClib_VideoSink * psSink;
301                        psSink = BSYNClib_VideoSink_Create();
302                        if (!psSink) goto error;
303                        psSink->sElement.hParent = hChn;
304                        BSYSlib_List_AddElement(hChn->sVideo.hSinks, psSink);
305                        psSink->sElement.uiIndex = i;
306
307                        psSink->sElement.sDelay.sData.ePreferredUnits = hChn->sSettings.sVideo.sSink.cbDelay.preferredDelayUnits;
308                        psSink->sElement.sNotification.sData.ePreferredUnits = hChn->sSettings.sVideo.sSink.cbDelay.preferredDelayUnits;
309
310                        psSink->sElement.sDelay.sResults.bGenerateCallback = true;
311                        psSink->sElement.sNotification.sResults.bGenerateCallback = true;
312                }
313
314                hChn->sVideo.uiSinkCount = psConfig->uiVideoSinkCount;
315        }
316
317        /* RMD */
318        BSYNClib_RateMismatchDetector_GetConfig(hChn->hDetector, &sRmdConfig);
319        sRmdConfig.uiVideoSourceCount = psConfig->uiVideoSourceCount;
320        sRmdConfig.uiVideoSinkCount = psConfig->uiVideoSinkCount;
321        BSYNClib_RateMismatchDetector_SetConfig(hChn->hDetector, &sRmdConfig);
322       
323        /* audio sources */
324        if (psConfig->uiAudioSourceCount != hChn->sAudio.uiSourceCount)
325        {
326                /* take down previous */
327                hIterator = BSYSlib_List_AcquireIterator(hChn->sAudio.hSources);
328               
329                while (BSYSlib_List_HasNext(hIterator))
330                {
331                        BSYNClib_AudioSource * psSource;
332
333                        psSource = (BSYNClib_AudioSource *)BSYSlib_List_Next(hIterator);
334                        BSYSlib_List_RemoveElement(hChn->sAudio.hSources, psSource);
335
336                        if (psSource->psUnmuteTimer)
337                        {
338                                BDBG_MSG(("[%d] Releasing audio source %d unmute timer", hChn->iIndex, psSource->sElement.uiIndex));
339                                BSYNClib_ResourcePool_Release(hChn->psTimers, psSource->psUnmuteTimer);
340                                psSource->psUnmuteTimer = NULL;
341                        }
342
343#if BSYNCLIB_UNCONDITIONAL_AUDIO_UNMUTE_SUPPORT
344                        if (psSource->psUnconditionalUnmuteTimer)
345                        {
346                                BDBG_MSG(("[%d] Releasing audio source %d unconditional unmute timer", hChn->iIndex, psSource->sElement.uiIndex));
347                                BSYNClib_ResourcePool_Release(hChn->psTimers, psSource->psUnconditionalUnmuteTimer);
348                                psSource->psUnconditionalUnmuteTimer = NULL;
349                        }
350#endif
351
352                        BSYNClib_AudioSource_Destroy(psSource);
353                }
354
355                BSYSlib_List_ReleaseIterator(hIterator);
356
357                /* bring up new */
358                for (i = 0; i < psConfig->uiAudioSourceCount; i++)
359                {
360                        BSYNClib_AudioSource * psSource;
361                        psSource = BSYNClib_AudioSource_Create();
362                        if (!psSource) goto error;
363                        psSource->sElement.hParent = hChn;
364                        BSYSlib_List_AddElement(hChn->sAudio.hSources, psSource);
365                        psSource->sElement.uiIndex = i;
366
367                        BDBG_MSG(("[%d] Acquiring audio source %d unmute timer", hChn->iIndex, i));
368                        psSource->psUnmuteTimer = BSYNClib_ResourcePool_Acquire(hChn->psTimers);
369
370#if BSYNCLIB_UNCONDITIONAL_AUDIO_UNMUTE_SUPPORT
371                        BDBG_MSG(("[%d] Acquiring audio source %d unconditional unmute timer", hChn->iIndex, i));
372                        psSource->psUnconditionalUnmuteTimer = BSYNClib_ResourcePool_Acquire(hChn->psTimers);
373#endif
374
375                        psSource->sElement.sDelay.sData.ePreferredUnits = hChn->sSettings.sAudio.sSource.cbDelay.preferredDelayUnits;
376                        psSource->sElement.sNotification.sData.ePreferredUnits = hChn->sSettings.sAudio.sSource.cbDelay.preferredDelayUnits;
377
378                        psSource->sElement.sDelay.sResults.bGenerateCallback = true;
379                        psSource->sElement.sNotification.sResults.bGenerateCallback = true;
380                }
381
382                hChn->sAudio.uiSourceCount = psConfig->uiAudioSourceCount;
383        }
384
385        /* audio sinks */
386        if (psConfig->uiAudioSinkCount != hChn->sAudio.uiSinkCount)
387        {
388                /* take down previous */
389                hIterator = BSYSlib_List_AcquireIterator(hChn->sAudio.hSinks);
390               
391                while (BSYSlib_List_HasNext(hIterator))
392                {
393                        BSYNClib_AudioSink * psSink;
394
395                        psSink = (BSYNClib_AudioSink *)BSYSlib_List_Next(hIterator);
396                        BSYSlib_List_RemoveElement(hChn->sAudio.hSinks, psSink);
397                       
398                        BSYNClib_AudioSink_Destroy(psSink);
399                }
400
401                BSYSlib_List_ReleaseIterator(hIterator);
402
403                /* bring up new */
404                for (i = 0; i < psConfig->uiAudioSinkCount; i++)
405                {
406                        BSYNClib_AudioSink * psSink;
407                        psSink = BSYNClib_AudioSink_Create();
408                        if (!psSink) goto error;
409                        psSink->sElement.hParent = hChn;
410                        BSYSlib_List_AddElement(hChn->sAudio.hSinks, psSink);
411                        psSink->sElement.uiIndex = i;
412
413                        psSink->sElement.sDelay.sData.ePreferredUnits = hChn->sSettings.sAudio.sSink.cbDelay.preferredDelayUnits;
414                        psSink->sElement.sNotification.sData.ePreferredUnits = hChn->sSettings.sAudio.sSink.cbDelay.preferredDelayUnits;
415
416                        psSink->sElement.sDelay.sResults.bGenerateCallback = true;
417                        psSink->sElement.sNotification.sResults.bGenerateCallback = true;
418                }
419
420                hChn->sAudio.uiSinkCount = psConfig->uiAudioSinkCount;
421        }
422
423        if (bGenerateInitialCallbacks)
424        {
425                BDBG_MSG(("[%d] Generating initial state callbacks", hChn->iIndex));
426                BSYNClib_Channel_P_GenerateCallbacks(hChn);
427        }
428
429        goto end;
430       
431error:
432
433end:
434
435        BDBG_LEAVE(BSYNClib_Channel_P_ProcessConfig);
436        return rc;
437}
438
439
440void BSYNClib_Channel_GetVideoSourceConfig_isr
441(
442        const BSYNClib_Channel_Handle hChn,
443        unsigned int uiSource,
444        BSYNClib_VideoSource_Config * psConfig /* [out] */
445)
446{
447        BDBG_ENTER(BSYNClib_Channel_GetVideoSourceConfig_isr);
448       
449        BDBG_ASSERT(hChn);
450
451        if (BSYNClib_P_Enabled(hChn->hParent))
452        {
453                BSYNClib_VideoSource * psSource;
454
455                psSource = (BSYNClib_VideoSource *)BSYSlib_List_GetByIndex_isr(hChn->sVideo.hSources, uiSource);
456
457                if (psSource)
458                {
459                        /* copy config */
460                        BDBG_ASSERT(psConfig);
461                        *psConfig = psSource->sConfig;
462                }
463        }
464
465        BDBG_LEAVE(BSYNClib_Channel_GetVideoSourceConfig_isr);
466}
467
468BERR_Code BSYNClib_Channel_SetVideoSourceConfig_isr
469(
470        BSYNClib_Channel_Handle hChn,
471        unsigned int uiSource,
472        const BSYNClib_VideoSource_Config * psConfig
473)
474{
475        BERR_Code rc = BERR_SUCCESS;
476
477        BDBG_ENTER(BSYNClib_Channel_SetVideoSourceConfig_isr);
478       
479        BDBG_ASSERT(hChn);
480
481        if (BSYNClib_P_Enabled(hChn->hParent))
482        {
483                BSYNClib_VideoSource * psSource;
484               
485                psSource = (BSYNClib_VideoSource *)BSYSlib_List_GetByIndex_isr(hChn->sVideo.hSources, uiSource);
486
487                if (psSource)
488                {
489                        /* copy config */
490                        BDBG_ASSERT(psConfig);
491                        psSource->sConfig = *psConfig;
492                        rc = BSYNClib_VideoSource_P_ProcessConfig_isr(psSource);
493                        BSYNClib_VideoSource_P_SelfClearConfig_isr(psSource);
494                }
495        }
496
497        BDBG_LEAVE(BSYNClib_Channel_SetVideoSourceConfig_isr);
498        return rc;
499}
500
501void BSYNClib_Channel_GetVideoSinkConfig_isr
502(
503        const BSYNClib_Channel_Handle hChn,
504        unsigned int uiSink,
505        BSYNClib_VideoSink_Config * psConfig /* [out] */
506)
507{
508        BDBG_ENTER(BSYNClib_Channel_GetVideoSinkConfig_isr);
509       
510        BDBG_ASSERT(hChn);
511
512        if (BSYNClib_P_Enabled(hChn->hParent))
513        {
514                BSYNClib_VideoSink * psSink;
515
516                psSink = (BSYNClib_VideoSink *)BSYSlib_List_GetByIndex_isr(hChn->sVideo.hSinks, uiSink);
517
518                if (psSink)
519                {
520                        /* copy config */
521                        BDBG_ASSERT(psConfig);
522                        *psConfig = psSink->sConfig;
523                }
524        }
525
526        BDBG_LEAVE(BSYNClib_Channel_GetVideoSinkConfig_isr);
527}
528
529BERR_Code BSYNClib_Channel_SetVideoSinkConfig_isr
530(
531        BSYNClib_Channel_Handle hChn,
532        unsigned int uiSink,
533        const BSYNClib_VideoSink_Config * psConfig
534)
535{
536        BERR_Code rc = BERR_SUCCESS;
537
538        BDBG_ENTER(BSYNClib_Channel_SetVideoSinkConfig_isr);
539       
540        BDBG_ASSERT(hChn);
541
542        if (BSYNClib_P_Enabled(hChn->hParent))
543        {
544                BSYNClib_VideoSink * psSink;
545
546                psSink = (BSYNClib_VideoSink *)BSYSlib_List_GetByIndex_isr(hChn->sVideo.hSinks, uiSink);
547
548                if (psSink)
549                {
550                        /* copy config */
551                        BDBG_ASSERT(psConfig);
552                        psSink->sConfig = *psConfig;
553                        rc = BSYNClib_VideoSink_P_ProcessConfig_isr(psSink);
554                        BSYNClib_VideoSink_P_SelfClearConfig_isr(psSink);
555                }
556        }
557
558        BDBG_LEAVE(BSYNClib_Channel_SetVideoSinkConfig_isr);
559        return rc;
560}
561
562
563void BSYNClib_Channel_GetAudioSourceConfig_isr
564(
565        const BSYNClib_Channel_Handle hChn,
566        unsigned int uiSource,
567        BSYNClib_AudioSource_Config * psConfig /* [out] */
568)
569{
570        BDBG_ENTER(BSYNClib_Channel_GetAudioSourceConfig_isr);
571       
572        BDBG_ASSERT(hChn);
573
574        if (BSYNClib_P_Enabled(hChn->hParent))
575        {
576                BSYNClib_AudioSource * psSource;
577
578                psSource = (BSYNClib_AudioSource *)BSYSlib_List_GetByIndex_isr(hChn->sAudio.hSources, uiSource);
579
580                if (psSource)
581                {
582                        /* copy config */
583                        BDBG_ASSERT(psConfig);
584                        *psConfig = psSource->sConfig;
585                }
586        }
587
588        BDBG_LEAVE(BSYNClib_Channel_GetAudioSourceConfig_isr);
589}
590
591BERR_Code BSYNClib_Channel_SetAudioSourceConfig_isr
592(
593        BSYNClib_Channel_Handle hChn,
594        unsigned int uiSource,
595        const BSYNClib_AudioSource_Config * psConfig
596)
597{
598        BERR_Code rc = BERR_SUCCESS;
599
600        BDBG_ENTER(BSYNClib_Channel_SetAudioSourceConfig_isr);
601       
602        BDBG_ASSERT(hChn);
603
604        if (BSYNClib_P_Enabled(hChn->hParent))
605        {
606                BSYNClib_AudioSource * psSource;
607               
608                psSource = (BSYNClib_AudioSource *)BSYSlib_List_GetByIndex_isr(hChn->sAudio.hSources, uiSource);
609               
610                if (psSource)
611                {
612                        /* copy config */
613                        BDBG_ASSERT(psConfig);
614                        psSource->sConfig = *psConfig;
615                        rc = BSYNClib_AudioSource_P_ProcessConfig_isr(psSource);
616                        BSYNClib_AudioSource_P_SelfClearConfig_isr(psSource);
617                }
618        }
619
620        BDBG_LEAVE(BSYNClib_Channel_SetAudioSourceConfig_isr);
621        return rc;
622}
623
624void BSYNClib_Channel_GetAudioSinkConfig_isr
625(
626        const BSYNClib_Channel_Handle hChn,
627        unsigned int uiSink,
628        BSYNClib_AudioSink_Config * psConfig /* [out] */
629)
630{
631        BDBG_ENTER(BSYNClib_Channel_GetAudioSinkConfig_isr);
632       
633        BDBG_ASSERT(hChn);
634
635        if (BSYNClib_P_Enabled(hChn->hParent))
636        {
637                BSYNClib_AudioSink * psSink;
638
639                psSink = (BSYNClib_AudioSink *)BSYSlib_List_GetByIndex_isr(hChn->sAudio.hSinks, uiSink);
640
641                if (psSink)
642                {
643                        /* copy config */
644                        BDBG_ASSERT(psConfig);
645                        *psConfig = psSink->sConfig;
646                }
647        }
648
649        BDBG_LEAVE(BSYNClib_Channel_GetAudioSinkConfig_isr);
650}
651
652BERR_Code BSYNClib_Channel_SetAudioSinkConfig_isr
653(
654        BSYNClib_Channel_Handle hChn,
655        unsigned int uiSink,
656        const BSYNClib_AudioSink_Config * psConfig
657)
658{
659        BERR_Code rc = BERR_SUCCESS;
660
661        BDBG_ENTER(BSYNClib_Channel_SetAudioSinkConfig_isr);
662       
663        BDBG_ASSERT(hChn);
664
665        if (BSYNClib_P_Enabled(hChn->hParent))
666        {
667                BSYNClib_AudioSink * psSink;
668
669                psSink = (BSYNClib_AudioSink *)BSYSlib_List_GetByIndex_isr(hChn->sAudio.hSinks, uiSink);
670
671                if (psSink)
672                {
673                        /* copy config */
674                        BDBG_ASSERT(psConfig);
675                        psSink->sConfig = *psConfig;
676                        rc = BSYNClib_AudioSink_P_ProcessConfig_isr(psSink);
677                        BSYNClib_AudioSink_P_SelfClearConfig_isr(psSink);
678                }
679        }
680
681        BDBG_LEAVE(BSYNClib_Channel_SetAudioSinkConfig_isr);
682        return rc;
683}
684
Note: See TracBrowser for help on using the repository browser.