19
|
1 |
/*
|
25
|
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: Dynamic Src Itf MMF Adapt Implementation
|
|
15 |
*
|
|
16 |
*/
|
19
|
17 |
|
|
18 |
#include "xamediaplayeradaptctxmmf.h"
|
|
19 |
#include "xametadataadaptctxmmf.h"
|
|
20 |
#include "xadynamicsourceitfadaptationmmf.h"
|
|
21 |
#include "xaplayitfadaptationmmf.h"
|
|
22 |
#include "cmmfbackendengine.h"
|
|
23 |
#include "cmetadatautilityitf.h"
|
|
24 |
|
|
25 |
/*
|
|
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
|
|
28 |
* @param XADataSource *pDataSource - new data source
|
|
29 |
* @return XAresult ret - Success value
|
|
30 |
*/
|
25
|
31 |
XAresult XADynamicSourceItfAdaptMMF_SetSource(XAAdaptationMMFCtx *bCtx,
|
|
32 |
XADataSource *pDataSource)
|
|
33 |
{
|
19
|
34 |
XAresult ret = XA_RESULT_SUCCESS;
|
|
35 |
XAuint32 origstate;
|
|
36 |
DEBUG_API("->XADynamicSourceItfAdaptMMF_SetSource");
|
25
|
37 |
if (!bCtx || !pDataSource || !pDataSource->pLocator)
|
|
38 |
{
|
19
|
39 |
DEBUG_ERR("Invalid NULL parameter");
|
|
40 |
ret = XA_RESULT_PARAMETER_INVALID;
|
25
|
41 |
}
|
|
42 |
else if (bCtx->baseObj.ctxId == XAMediaPlayerAdaptation)
|
|
43 |
{
|
|
44 |
XADataLocator_URI* tempUri =
|
|
45 |
(XADataLocator_URI*) (pDataSource->pLocator);
|
|
46 |
XADataFormat_MIME* tempFormat =
|
|
47 |
(XADataFormat_MIME*) (pDataSource->pFormat);
|
|
48 |
XAMediaPlayerAdaptationMMFCtx* mCtx =
|
|
49 |
(XAMediaPlayerAdaptationMMFCtx*) bCtx;
|
19
|
50 |
|
|
51 |
ret = XAPlayItfAdaptMMF_GetPlayState(&bCtx->baseObj, &origstate);
|
25
|
52 |
|
|
53 |
ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj,
|
|
54 |
XA_PLAYSTATE_STOPPED);
|
|
55 |
|
19
|
56 |
mmf_close(mCtx->mmfContext);
|
|
57 |
mCtx->xaSource = pDataSource;
|
25
|
58 |
if (mCtx->xaVideoSink)
|
20
|
59 |
{
|
25
|
60 |
ret = mmf_setup_native_display(mCtx->mmfContext,
|
|
61 |
mCtx->xaVideoSink);
|
20
|
62 |
}
|
|
63 |
if (ret == XA_RESULT_SUCCESS)
|
|
64 |
{
|
25
|
65 |
ret = mmf_set_player_uri(mCtx->mmfContext,
|
|
66 |
(char *) (tempUri->URI), tempFormat->containerType);
|
20
|
67 |
}
|
25
|
68 |
if (ret == XA_RESULT_SUCCESS)
|
19
|
69 |
{
|
20
|
70 |
ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, origstate);
|
|
71 |
}
|
|
72 |
else
|
|
73 |
{
|
|
74 |
DEBUG_ERR("Set Play state failed");
|
|
75 |
ret = XA_RESULT_INTERNAL_ERROR;
|
|
76 |
}
|
25
|
77 |
if ((ret == XA_RESULT_SUCCESS) && (mCtx->mmfMetadataContext))
|
20
|
78 |
{
|
25
|
79 |
mmf_metadata_utility_parse_source(mCtx->mmfMetadataContext,
|
|
80 |
(char *) (tempUri->URI));
|
20
|
81 |
}
|
25
|
82 |
}
|
|
83 |
else if (bCtx->baseObj.ctxId == XAMDAdaptation)
|
|
84 |
{
|
|
85 |
|
19
|
86 |
XAMetadataAdaptationMMFCtx* mCtx = (XAMetadataAdaptationMMFCtx*) bCtx;
|
25
|
87 |
if (mCtx->mmfContext)
|
|
88 |
{
|
|
89 |
mCtx->xaSource = pDataSource;
|
|
90 |
mmf_metadata_utility_parse_source(
|
|
91 |
mCtx->mmfContext,
|
|
92 |
(char *) (((XADataLocator_URI*) (pDataSource->pLocator))->URI));
|
|
93 |
}
|
|
94 |
}
|
19
|
95 |
DEBUG_API("<-XADynamicSourceItfAdaptMMF_SetSource");
|
|
96 |
return ret;
|
25
|
97 |
}
|
19
|
98 |
|