18 #include <assert.h> |
18 #include <assert.h> |
19 #include <string.h> |
19 #include <string.h> |
20 #include <gst/gst.h> |
20 #include <gst/gst.h> |
21 #include <gst/gstbuffer.h> |
21 #include <gst/gstbuffer.h> |
22 #include "xaobjectitf.h" |
22 #include "xaobjectitf.h" |
23 #include "xacameradevice.h" |
|
24 #include "xaradiodevice.h" |
23 #include "xaradiodevice.h" |
25 #include "xaoutputmix.h" |
|
26 #include "xamediaplayeradaptctx.h" |
|
27 #include "xacameraadaptctx.h" |
|
28 #include <stdlib.h> |
24 #include <stdlib.h> |
29 |
25 #include "xaadaptationgst.h" |
30 #ifdef OMAX_CAMERABIN |
|
31 extern XAboolean cameraRealized; |
|
32 |
|
33 extern XACameraAdaptationCtx_* cameraCtx; |
|
34 #else |
|
35 XAboolean cameraRealized = XA_BOOLEAN_FALSE; |
|
36 XACameraAdaptationCtx_* cameraCtx = NULL; |
|
37 #endif |
|
38 /* |
26 /* |
39 * XAAdaptationGstCtx* XAAdaptationGst_Create() |
27 * XAAdaptationGstCtx* XAAdaptationGst_Create() |
40 * 1st phase initialization function for Adaptation Base context structure. |
28 * 1st phase initialization function for Adaptation Base context structure. |
41 * Reserves memory for base context and initializes GStreamer FW. |
29 * Reserves memory for base context and initializes GStreamer FW. |
42 */ |
30 */ |
53 free(pSelf); |
41 free(pSelf); |
54 pSelf = NULL; |
42 pSelf = NULL; |
55 } |
43 } |
56 else |
44 else |
57 { |
45 { |
|
46 GError* gerror = 0; |
58 /* Add default handler for Gst-bus messages */ |
47 /* Add default handler for Gst-bus messages */ |
59 pSelf->busCb = XAAdaptationGst_GstBusCb; |
48 pSelf->busCb = XAAdaptationGst_GstBusCb; |
60 |
49 |
61 // VASU MOD BEGINS |
50 // VASU MOD BEGINS |
62 pSelf->cond_mutx_inited = XA_BOOLEAN_FALSE; |
51 pSelf->cond_mutx_inited = XA_BOOLEAN_FALSE; |
63 // VASU MOD ENDS |
52 // VASU MOD ENDS |
64 |
53 |
65 sem_init(&(pSelf->semAsyncWait), 0, 0); |
54 sem_init(&(pSelf->semAsyncWait), 0, 0); |
|
55 //cross check |
|
56 if ( !gst_init_check( NULL, NULL, &gerror ) ) |
|
57 { |
|
58 DEBUG_ERR("Gst Initalization failure."); |
|
59 return XA_RESULT_INTERNAL_ERROR; |
|
60 } |
66 } |
61 } |
67 } |
62 } |
68 else |
63 else |
69 { |
64 { |
70 DEBUG_ERR("Invalid Gst Base Context.") |
65 DEBUG_ERR("Invalid Gst Base Context.") |
250 } |
246 } |
251 if (ret) |
247 if (ret) |
252 { |
248 { |
253 DEBUG_ERR_A1("could not create thread!! (%d)",ret) |
249 DEBUG_ERR_A1("could not create thread!! (%d)",ret) |
254 return XA_RESULT_INTERNAL_ERROR; |
250 return XA_RESULT_INTERNAL_ERROR; |
255 }DEBUG_API("<-XAAdaptationGst_InitGstListener"); |
251 } |
|
252 DEBUG_API("<-XAAdaptationGst_InitGstListener"); |
256 return XA_RESULT_SUCCESS; |
253 return XA_RESULT_SUCCESS; |
257 } |
254 } |
258 |
255 |
259 void * XAAdaptationGst_LaunchGstListener(void* args) |
256 void * XAAdaptationGst_LaunchGstListener(void* args) |
260 { |
257 { |
361 { |
359 { |
362 DEBUG_ERR_A3("ASYNC TIMED OUT : current %d, gsttarget %d, wanted %d", |
360 DEBUG_ERR_A3("ASYNC TIMED OUT : current %d, gsttarget %d, wanted %d", |
363 GST_STATE(bCtx->bin), GST_STATE_TARGET(bCtx->bin), bCtx->binWantedState); |
361 GST_STATE(bCtx->bin), GST_STATE_TARGET(bCtx->bin), bCtx->binWantedState); |
364 bCtx->waitingasyncop = XA_BOOLEAN_FALSE; |
362 bCtx->waitingasyncop = XA_BOOLEAN_FALSE; |
365 sem_post(&(bCtx->semAsyncWait)); |
363 sem_post(&(bCtx->semAsyncWait)); |
366 }DEBUG_API("<-XAAdaptationGst_CancelAsyncWait"); |
364 } |
|
365 DEBUG_API("<-XAAdaptationGst_CancelAsyncWait"); |
367 /* return false to remove timer */ |
366 /* return false to remove timer */ |
368 return FALSE; |
367 return FALSE; |
369 } |
368 } |
370 |
369 |
371 void XAAdaptationGst_CompleteAsyncWait(XAAdaptationGstCtx* ctx) |
370 void XAAdaptationGst_CompleteAsyncWait(XAAdaptationGstCtx* ctx) |
383 } |
382 } |
384 else if (i > 0) |
383 else if (i > 0) |
385 { /* should not be, reset semaphore */ |
384 { /* should not be, reset semaphore */ |
386 sem_init(&(ctx->semAsyncWait), 0, 0); |
385 sem_init(&(ctx->semAsyncWait), 0, 0); |
387 } |
386 } |
388 }DEBUG_API("<-XAAdaptationGst_CompleteAsyncWait"); |
387 } |
|
388 DEBUG_API("<-XAAdaptationGst_CompleteAsyncWait"); |
389 } |
389 } |
390 |
390 |
391 /** |
391 /** |
392 * GstElement* XAAdaptationGst_CreateGstSource( XADataSource* xaSrc, const XAchar *name ) |
392 * GstElement* XAAdaptationGst_CreateGstSource( XADataSource* xaSrc, const XAchar *name ) |
393 * @param XADataSource* xaSnk - XADataSource defining gst source to create |
393 * @param XADataSource* xaSnk - XADataSource defining gst source to create |
697 "async", FALSE, "qos", FALSE, "handle-events", TRUE, |
697 "async", FALSE, "qos", FALSE, "handle-events", TRUE, |
698 "handle-expose", TRUE, "max-lateness", (gint64) (-1), |
698 "handle-expose", TRUE, "max-lateness", (gint64) (-1), |
699 NULL); |
699 NULL); |
700 break; |
700 break; |
701 case XA_DATALOCATOR_OUTPUTMIX: |
701 case XA_DATALOCATOR_OUTPUTMIX: |
702 DEBUG_INFO("Sink locator type - XA_DATALOCATOR_OUTPUTMIX") |
702 DEBUG_INFO("Sink locator type - XA_DATALOCATOR_OUTPUTMIX"); |
703 ; |
|
704 { |
703 { |
705 /* Get OutputMix adaptation from data locator */ |
|
706 XADataLocator_OutputMix* omix = |
|
707 (XADataLocator_OutputMix*) (xaSnk->pLocator); |
|
708 if (omix->outputMix) |
|
709 { |
|
710 XAOMixImpl* omixDevice = |
|
711 (XAOMixImpl*) (*omix->outputMix); |
|
712 |
|
713 if (omixDevice) |
|
714 { |
|
715 /*TODO we had to remove this line below since adaptationCtx |
|
716 * was not a member of structure*/ |
|
717 |
|
718 /*gstSnk = XAOutputMixAdapt_GetSink(omixDevice->adaptationCtx);*/ |
|
719 if (!gstSnk) |
|
720 { |
|
721 DEBUG_ERR("Cannot create sink!"); |
|
722 return NULL; |
|
723 } |
|
724 *isobj = XA_BOOLEAN_TRUE; |
|
725 } |
|
726 else |
|
727 { |
|
728 DEBUG_ERR("Warning - NULL outputmix object - default audio output used"); |
|
729 gstSnk = gst_element_factory_make("alsasink", |
|
730 name); |
|
731 } |
|
732 } |
|
733 else |
|
734 { |
|
735 DEBUG_ERR("Warning - NULL outputmix object - default audio output used"); |
|
736 gstSnk = gst_element_factory_make("alsasink", name); |
|
737 } |
|
738 |
|
739 } |
704 } |
740 break; |
705 break; |
741 |
706 |
742 case XA_DATALOCATOR_ADDRESS: |
707 case XA_DATALOCATOR_ADDRESS: |
743 { |
708 { |
1164 inputSelector = gst_element_factory_make("input-selector", |
1133 inputSelector = gst_element_factory_make("input-selector", |
1165 "input-selector"); |
1134 "input-selector"); |
1166 if (inputSelector) |
1135 if (inputSelector) |
1167 { |
1136 { |
1168 g_object_set(G_OBJECT(inputSelector), "select-all", TRUE, NULL); |
1137 g_object_set(G_OBJECT(inputSelector), "select-all", TRUE, NULL); |
1169 }DEBUG_API("<-XAAdaptationGst_CreateInputSelector"); |
1138 } |
|
1139 DEBUG_API("<-XAAdaptationGst_CreateInputSelector"); |
1170 return inputSelector; |
1140 return inputSelector; |
1171 } |
1141 } |
1172 |
1142 |
1173 /** |
1143 /** |
1174 * GstElement* XAAdaptationGst_CreateAudioPP( ) |
1144 * GstElement* XAAdaptationGst_CreateAudioPP( ) |