summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-01-15 11:26:54 +0100
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-01-28 15:38:43 +0100
commit5f5c1a6460b3bf342d1c3a01ae296ecb14560fb5 (patch)
tree8c91df06973df3e94f89cbb80eaca73f0ce14a53 /4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
parente3f74a9f59c05df601aa26554612fc68901c1646 (diff)
Improve stream creation/deletion functions
Add functions to add/remove stream verb while adding/deleting stream data. Use them to create streams when mixer response is received. Change-Id: I158b04cef7f6ce4f58a9c7481b6ebad00de989e3 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
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.c55
1 files changed, 12 insertions, 43 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 72f62dd..da05498 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
@@ -26,6 +26,8 @@
#include "4a-hal-utilities-appfw-responses-handler.h"
#include "4a-hal-utilities-data.h"
+
+#include "4a-hal-utilities-hal-streams-handler.h"
#include "4a-hal-utilities-verbs-loader.h"
#include "../4a-hal-manager/4a-hal-manager.h"
@@ -91,47 +93,14 @@ int HalCtlsHandleMixerData(AFB_ApiT apiHandle, struct CtlHalMixerData **firstMix
if(verbStart == size)
verbStart = 0;
- if(! (currentMixerData = HalUtlAddMixerDataToMixerDataList(firstMixerData))) {
- AFB_ApiError(apiHandle, "Error while adding a stream to stream list");
- err += (int) MIXER_ERROR_STREAM_NOT_ADDED_TO_STREAM_LIST;
- break;
- }
-
- currentMixerData->verb = strdup(&currentDataVerbName[verbStart]);
- currentMixerData->verbToCall = strdup(currentDataVerbName);
- currentMixerData->streamCardId = strdup(currentStreamCardId);
-
- if((! currentMixerData->verb) ||
- (! currentMixerData->verbToCall) ||
- (! currentMixerData->streamCardId)) {
- HalUtlRemoveSelectedMixerData(firstMixerData, currentMixerData);
- err += (int) MIXER_ERROR_STREAM_ALLOCATION_FAILED;
- break;
- }
-
- if(AFB_ApiAddVerb(apiHandle,
- currentMixerData->verb,
- "Stream action transferred to mixer",
- HalCtlsActionOnStream,
- (void *) currentMixerData,
- NULL,
- 0,
- 0)) {
+ if(! HalUtlAddStreamDataAndCreateStreamVerb(apiHandle,
+ &currentDataVerbName[verbStart],
+ currentDataVerbName,
+ currentStreamCardId)) {
AFB_ApiError(apiHandle,
- "Error while creating verbs for stream : '%s'",
- currentMixerData->verb);
- HalUtlRemoveSelectedMixerData(firstMixerData, currentMixerData);
- err += (int) MIXER_ERROR_STREAM_VERB_NOT_CREATED;
- break;
- }
-
- currentMixerData->event = AFB_EventMake(apiHandle, currentMixerData->verb);
- if(! AFB_EventIsValid(currentMixerData->event)) {
- AFB_ApiError(apiHandle,
- "Error while creating event for stream %s",
- currentMixerData->verb);
- HalUtlRemoveSelectedMixerData(firstMixerData, currentMixerData);
- err += (int) MIXER_ERROR_STREAM_EVENT_NOT_CREATED;
+ "Error while adding stream '%s'",
+ currentDataVerbName);
+ err += (int) MIXER_ERROR_STREAM_NOT_ADDED;
}
break;
@@ -160,7 +129,7 @@ int HalCtlsHandleMixerData(AFB_ApiT apiHandle, struct CtlHalMixerData **firstMix
if(AFB_ApiAddVerb(apiHandle,
HAL_PLAYBACK_ID,
"Playback action transferred to mixer",
- HalCtlsActionOnPlayback,
+ HalUtlActionOnPlayback,
(void *) *firstMixerData,
NULL,
0,
@@ -174,7 +143,7 @@ int HalCtlsHandleMixerData(AFB_ApiT apiHandle, struct CtlHalMixerData **firstMix
if(AFB_ApiAddVerb(apiHandle,
HAL_CAPTURE_ID,
"Capture action transferred to mixer",
- HalCtlsActionOnCapture,
+ HalUtlActionOnCapture,
(void *) *firstMixerData,
NULL,
0,
@@ -218,7 +187,7 @@ int HalCtlsHandleMixerAttachResponse(AFB_ApiT apiHandle, struct CtlHalSpecificDa
else if(AFB_ApiAddVerb(apiHandle,
HAL_ALL_STREAMS_VERB,
"Send a stream action on all streams",
- HalCtlsActionOnAllStream,
+ HalUtlActionOnAllStream,
(void *) currentHalSpecificData->ctlHalStreamsData,
NULL,
0,