1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: Dynamic Src Itf MMF Adapt Implementation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "xamediaplayeradaptctxmmf.h" |
18 #include "xamediaplayeradaptctxmmf.h" |
19 #include "xametadataadaptctxmmf.h" |
19 #include "xametadataadaptctxmmf.h" |
20 #include "xadynamicsourceitfadaptationmmf.h" |
20 #include "xadynamicsourceitfadaptationmmf.h" |
21 #include "xaplayitfadaptationmmf.h" |
21 #include "xaplayitfadaptationmmf.h" |
26 * XAresult XADynamicSourceItfAdaptMMF_SetSource(XAAdaptationGstCtx *bCtx, XADataSource *pDataSource) |
26 * XAresult XADynamicSourceItfAdaptMMF_SetSource(XAAdaptationGstCtx *bCtx, XADataSource *pDataSource) |
27 * @param XAAdaptationGstCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value |
27 * @param XAAdaptationGstCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value |
28 * @param XADataSource *pDataSource - new data source |
28 * @param XADataSource *pDataSource - new data source |
29 * @return XAresult ret - Success value |
29 * @return XAresult ret - Success value |
30 */ |
30 */ |
31 XAresult XADynamicSourceItfAdaptMMF_SetSource(XAAdaptationMMFCtx *bCtx, XADataSource *pDataSource) |
31 XAresult XADynamicSourceItfAdaptMMF_SetSource(XAAdaptationMMFCtx *bCtx, |
32 { |
32 XADataSource *pDataSource) |
|
33 { |
33 XAresult ret = XA_RESULT_SUCCESS; |
34 XAresult ret = XA_RESULT_SUCCESS; |
34 XAuint32 origstate; |
35 XAuint32 origstate; |
35 DEBUG_API("->XADynamicSourceItfAdaptMMF_SetSource"); |
36 DEBUG_API("->XADynamicSourceItfAdaptMMF_SetSource"); |
36 if( !bCtx || !pDataSource || !pDataSource->pLocator ) |
37 if (!bCtx || !pDataSource || !pDataSource->pLocator) |
37 { |
38 { |
38 DEBUG_ERR("Invalid NULL parameter"); |
39 DEBUG_ERR("Invalid NULL parameter"); |
39 ret = XA_RESULT_PARAMETER_INVALID; |
40 ret = XA_RESULT_PARAMETER_INVALID; |
40 } |
41 } |
41 else if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation) |
42 else if (bCtx->baseObj.ctxId == XAMediaPlayerAdaptation) |
42 { |
43 { |
43 XADataLocator_URI* tempUri = (XADataLocator_URI*)(pDataSource->pLocator); |
44 XADataLocator_URI* tempUri = |
44 XADataFormat_MIME* tempFormat = (XADataFormat_MIME*)(pDataSource->pFormat); |
45 (XADataLocator_URI*) (pDataSource->pLocator); |
45 XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
46 XADataFormat_MIME* tempFormat = |
|
47 (XADataFormat_MIME*) (pDataSource->pFormat); |
|
48 XAMediaPlayerAdaptationMMFCtx* mCtx = |
|
49 (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
46 |
50 |
47 ret = XAPlayItfAdaptMMF_GetPlayState(&bCtx->baseObj, &origstate); |
51 ret = XAPlayItfAdaptMMF_GetPlayState(&bCtx->baseObj, &origstate); |
48 |
52 |
49 ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, XA_PLAYSTATE_STOPPED); |
53 ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, |
50 |
54 XA_PLAYSTATE_STOPPED); |
|
55 |
51 mmf_close(mCtx->mmfContext); |
56 mmf_close(mCtx->mmfContext); |
52 mCtx->xaSource = pDataSource; |
57 mCtx->xaSource = pDataSource; |
53 if(mCtx->xaVideoSink) |
58 if (mCtx->xaVideoSink) |
54 { |
59 { |
55 ret = mmf_setup_native_display(mCtx->mmfContext, mCtx->xaVideoSink); |
60 ret = mmf_setup_native_display(mCtx->mmfContext, |
|
61 mCtx->xaVideoSink); |
56 } |
62 } |
57 if (ret == XA_RESULT_SUCCESS) |
63 if (ret == XA_RESULT_SUCCESS) |
58 { |
64 { |
59 ret = mmf_set_player_uri(mCtx->mmfContext, (char *)(tempUri->URI), tempFormat->containerType); |
65 ret = mmf_set_player_uri(mCtx->mmfContext, |
|
66 (char *) (tempUri->URI), tempFormat->containerType); |
60 } |
67 } |
61 if(ret == XA_RESULT_SUCCESS) |
68 if (ret == XA_RESULT_SUCCESS) |
62 { |
69 { |
63 ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, origstate); |
70 ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, origstate); |
64 } |
71 } |
65 else |
72 else |
66 { |
73 { |
67 DEBUG_ERR("Set Play state failed"); |
74 DEBUG_ERR("Set Play state failed"); |
68 ret = XA_RESULT_INTERNAL_ERROR; |
75 ret = XA_RESULT_INTERNAL_ERROR; |
69 } |
76 } |
70 if((ret == XA_RESULT_SUCCESS) && (mCtx->mmfMetadataContext)) |
77 if ((ret == XA_RESULT_SUCCESS) && (mCtx->mmfMetadataContext)) |
71 { |
78 { |
72 mmf_metadata_utility_parse_source(mCtx->mmfMetadataContext, (char *)(tempUri->URI)); |
79 mmf_metadata_utility_parse_source(mCtx->mmfMetadataContext, |
|
80 (char *) (tempUri->URI)); |
73 } |
81 } |
74 } |
82 } |
75 else if(bCtx->baseObj.ctxId == XAMDAdaptation) |
83 else if (bCtx->baseObj.ctxId == XAMDAdaptation) |
76 { |
84 { |
77 |
85 |
78 XAMetadataAdaptationMMFCtx* mCtx = (XAMetadataAdaptationMMFCtx*) bCtx; |
86 XAMetadataAdaptationMMFCtx* mCtx = (XAMetadataAdaptationMMFCtx*) bCtx; |
79 if(mCtx->mmfContext) |
87 if (mCtx->mmfContext) |
80 { |
88 { |
81 mCtx->xaSource = pDataSource; |
89 mCtx->xaSource = pDataSource; |
82 mmf_metadata_utility_parse_source(mCtx->mmfContext, (char *)(( (XADataLocator_URI*)(pDataSource->pLocator))->URI)); |
90 mmf_metadata_utility_parse_source( |
83 } |
91 mCtx->mmfContext, |
84 } |
92 (char *) (((XADataLocator_URI*) (pDataSource->pLocator))->URI)); |
|
93 } |
|
94 } |
85 DEBUG_API("<-XADynamicSourceItfAdaptMMF_SetSource"); |
95 DEBUG_API("<-XADynamicSourceItfAdaptMMF_SetSource"); |
86 return ret; |
96 return ret; |
87 } |
97 } |
88 |
98 |