|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <assert.h> |
|
19 #include <stdlib.h> |
|
20 #include "xamediaplayeradaptctxmmf.h" |
|
21 #include "xaadaptationmmf.h" |
|
22 #include "xaobjectitf.h" |
|
23 #include "cmmfbackendengine.h" |
|
24 |
|
25 |
|
26 /* |
|
27 * XAMediaPlayerAdaptationMMFCtx* XAMediaPlayerAdapt_Create() |
|
28 * Allocates memory for Media Player Adaptation Context and makes 1st phase initialization |
|
29 * @param XADataSource *pDataSrc - pointer to OMX-AL data source |
|
30 * @param XADataSource *pBankSrc - pointer to instrument bank structure in Mobile DLS, if NULL default will be used. |
|
31 * @param XADataSink *pAudioSnk - pointer to OMX-AL audio sink definition |
|
32 * @param XADataSink *pImageVideoSnk - pointer to OMX-AL image and video sink definition |
|
33 * @returns XAMediaPlayerAdaptationMMFCtx* - Pointer to created context, NULL if error occurs. |
|
34 */ |
|
35 XAAdaptationBaseMMFCtx* XAMediaPlayerAdaptMMF_Create(XADataSource *pDataSrc, XADataSource *pBankSrc, |
|
36 XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, |
|
37 XADataSink *pVibra, XADataSink *pLEDArray) |
|
38 { |
|
39 XAMediaPlayerAdaptationMMFCtx *pSelf = NULL; |
|
40 XAuint32 locType = 0; |
|
41 XAresult res; |
|
42 DEBUG_API("->XAMediaPlayerAdaptMMF_Create"); |
|
43 |
|
44 pSelf = calloc(1, sizeof(XAMediaPlayerAdaptationMMFCtx)); |
|
45 if ( pSelf) |
|
46 { |
|
47 #ifdef _GSTREAMER_BACKEND_ |
|
48 if( XAAdaptationBaseMMF_Init(&(pSelf->baseObj),0) |
|
49 != XA_RESULT_SUCCESS ) |
|
50 { |
|
51 DEBUG_ERR("Failed to init base context!!!"); |
|
52 free(pSelf); |
|
53 pSelf = NULL; |
|
54 } |
|
55 else |
|
56 #endif |
|
57 { |
|
58 pSelf->xaSource = pDataSrc; |
|
59 pSelf->xaBankSrc = pBankSrc; |
|
60 pSelf->xaAudioSink = pAudioSnk; |
|
61 pSelf->xaVideoSink = pImageVideoSnk; |
|
62 pSelf->xaLEDArray = pLEDArray; |
|
63 pSelf->xaVibra = pVibra; |
|
64 pSelf->curMirror = XA_VIDEOMIRROR_NONE; |
|
65 pSelf->curRotation = 0; |
|
66 pSelf->isobjsrc = XA_BOOLEAN_FALSE; |
|
67 pSelf->cameraSinkSynced = XA_BOOLEAN_FALSE; |
|
68 /*pSelf->waitData = XA_BOOLEAN_FALSE;*/ |
|
69 } |
|
70 |
|
71 |
|
72 if ( pDataSrc ) |
|
73 { |
|
74 locType = *((XAuint32*)(pDataSrc->pLocator)); |
|
75 if ( locType == XA_DATALOCATOR_IODEVICE ) |
|
76 { |
|
77 //XADataLocator_IODevice *ioDevice = (XADataLocator_IODevice*)(pDataSrc->pLocator); |
|
78 } |
|
79 } |
|
80 } |
|
81 |
|
82 if(pSelf) |
|
83 { |
|
84 res = mmf_backend_engine_init(&(pSelf->mmfContext)); |
|
85 if(pSelf->mmfContext && res == XA_RESULT_SUCCESS) |
|
86 { |
|
87 XADataLocator_URI* tempUri; |
|
88 XADataFormat_MIME* tempFormat; |
|
89 tempUri = (XADataLocator_URI*)(pSelf->xaSource->pLocator); |
|
90 tempFormat = (XADataFormat_MIME*)(pSelf->xaSource->pFormat); |
|
91 mmf_set_player_uri(pSelf->mmfContext, (char *)(tempUri->URI), tempFormat->containerType); |
|
92 if(pImageVideoSnk) |
|
93 { |
|
94 mmf_setup_native_display(pSelf->mmfContext, pImageVideoSnk); |
|
95 } |
|
96 } |
|
97 else |
|
98 { |
|
99 DEBUG_ERR("Failed to init mmf context!!!"); |
|
100 free(pSelf); |
|
101 pSelf = NULL; |
|
102 } |
|
103 } |
|
104 |
|
105 DEBUG_API("<-XAMediaPlayerAdaptMMF_Create"); |
|
106 return (XAAdaptationBaseMMFCtx*)pSelf; |
|
107 } |
|
108 |
|
109 |
|
110 |
|
111 /* |
|
112 * XAresult XAMediaPlayerAdaptMMF_PostInit() |
|
113 * 2nd phase initialization of Media Player Adaptation Context |
|
114 * @param XAMediaPlayerAdaptationMMFCtx* ctx - pointer to Media Player adaptation context |
|
115 * @return XAresult - Success value |
|
116 */ |
|
117 XAresult XAMediaPlayerAdaptMMF_PostInit( XAAdaptationBaseMMFCtx* bCtx ) |
|
118 { |
|
119 XAresult ret = XA_RESULT_SUCCESS; |
|
120 DEBUG_API("<-XAMediaPlayerAdaptMMF_PostInit"); |
|
121 return ret; |
|
122 } |
|
123 |
|
124 /* |
|
125 * void XAMediaPlayerAdaptMMF_Destroy( XAMediaPlayerAdaptationMMFCtx* ctx ) |
|
126 * Destroys Media Player Adaptation Context |
|
127 * @param ctx - Media Player Adaptation context to be destroyed |
|
128 */ |
|
129 void XAMediaPlayerAdaptMMF_Destroy( XAAdaptationBaseMMFCtx* bCtx ) |
|
130 { |
|
131 XAMediaPlayerAdaptationMMFCtx* ctx = NULL; |
|
132 |
|
133 |
|
134 DEBUG_API("->XAMediaPlayerAdaptMMF_Destroy"); |
|
135 if(bCtx == NULL) |
|
136 { |
|
137 DEBUG_ERR("Invalid parameter!!"); |
|
138 DEBUG_API("<-XAMediaPlayerAdaptMMF_Destroy"); |
|
139 return; |
|
140 } |
|
141 ctx = (XAMediaPlayerAdaptationMMFCtx*)bCtx; |
|
142 |
|
143 #ifdef _GSTREAMER_BACKEND_ |
|
144 XAAdaptationBase_Free( bCtx ); |
|
145 #endif |
|
146 free(ctx); |
|
147 ctx = NULL; |
|
148 |
|
149 DEBUG_API("<-XAMediaPlayerAdaptMMF_Destroy"); |
|
150 } |
|
151 |
|
152 |