diff options
Diffstat (limited to '4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c')
-rw-r--r-- | 4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c index 254c57b..aa169c7 100644 --- a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c +++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c @@ -83,21 +83,21 @@ int HalCtlsHandleMixerData(AFB_ApiT apiHandle, struct CtlHalMixerDataT *currentM size = (int) strlen(currentDataVerbName); for(verbStart = 0; verbStart < size; verbStart++) { - if(currentDataVerbName[verbStart] == '#') + if(currentDataVerbName[verbStart] == '#') { + verbStart++; break; + } } if(verbStart == size) verbStart = 0; - else - verbStart++; currentMixerDataT->data[idx].verb = strdup(¤tDataVerbName[verbStart]); if(afb_dynapi_add_verb(apiHandle, currentMixerDataT->data[idx].verb, "Stream action transferred to mixer", - HalCtlsActionOnCall, + HalCtlsActionOnStream, (void *) ¤tMixerDataT->data[idx], NULL, 0)) { @@ -108,36 +108,36 @@ int HalCtlsHandleMixerData(AFB_ApiT apiHandle, struct CtlHalMixerDataT *currentM } } else if(dataType == MIXER_DATA_PLAYBACKS) { - currentMixerDataT->data[idx].verb = strdup(HAL_PLAYBACK_VERB); + currentMixerDataT->data[idx].verb = strdup(HAL_PLAYBACK_ID); } else if(dataType == MIXER_DATA_CAPTURES) { - currentMixerDataT->data[idx].verb = strdup(HAL_CAPTURE_VERB); + currentMixerDataT->data[idx].verb = strdup(HAL_CAPTURE_ID); } } } if(dataType == MIXER_DATA_PLAYBACKS) { if(afb_dynapi_add_verb(apiHandle, - HAL_PLAYBACK_VERB, + HAL_PLAYBACK_ID, "Playback action transferred to mixer", - HalCtlsActionOnCall, - (void *) currentMixerDataT->data, + HalCtlsActionOnPlayback, + (void *) currentMixerDataT, NULL, 0)) { - AFB_ApiError(apiHandle, "Error while creating verb for playbacks : '%s'", HAL_PLAYBACK_VERB); + AFB_ApiError(apiHandle, "Error while creating verb for playbacks : '%s'", HAL_PLAYBACK_ID); err += (int) MIXER_ERROR_PLAYBACK_VERB_NOT_CREATED; } } if(dataType == MIXER_DATA_CAPTURES) { if(afb_dynapi_add_verb(apiHandle, - HAL_CAPTURE_VERB, + HAL_CAPTURE_ID, "Capture action transferred to mixer", - HalCtlsActionOnCall, - (void *) currentMixerDataT->data, + HalCtlsActionOnCapture, + (void *) currentMixerDataT, NULL, 0)) { - AFB_ApiError(apiHandle, "Error while creating verb for captures : '%s'", HAL_CAPTURE_VERB); + AFB_ApiError(apiHandle, "Error while creating verb for captures : '%s'", HAL_CAPTURE_ID); err += (int) MIXER_ERROR_CAPTURE_VERB_NOT_CREATED; } } @@ -170,6 +170,20 @@ int HalCtlsHandleMixerAttachResponse(AFB_ApiT apiHandle, struct CtlHalSpecificDa if(mixerCapturesJ && (err += HalCtlsHandleMixerData(apiHandle, ¤tHalSpecificData->ctlHalCapturesData, mixerCapturesJ, MIXER_DATA_CAPTURES))) AFB_ApiError(apiHandle, "Error during handling response mixer captures data '%s'", json_object_get_string(mixerCapturesJ)); + if(! currentHalSpecificData->ctlHalStreamsData.count) { + AFB_ApiWarning(apiHandle, "No stream detected in mixer response, %s verb won't be created", HAL_ALL_STREAMS_VERB); + } + else if(afb_dynapi_add_verb(apiHandle, + HAL_ALL_STREAMS_VERB, + "Send a stream action on all streams", + HalCtlsActionOnAllStream, + (void *) ¤tHalSpecificData->ctlHalStreamsData, + NULL, + 0)) { + AFB_ApiError(apiHandle, "Error while creating verb for all streams : '%s'", HAL_ALL_STREAMS_VERB); + return (int) MIXER_ERROR_ALL_STREAMS_VERB_NOT_CREATED; + } + return err; } |