19
|
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 "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 |
*/
|
|
31 |
XAresult XADynamicSourceItfAdaptMMF_SetSource(XAAdaptationMMFCtx *bCtx, XADataSource *pDataSource)
|
|
32 |
{
|
|
33 |
XAresult ret = XA_RESULT_SUCCESS;
|
|
34 |
XAuint32 origstate;
|
|
35 |
DEBUG_API("->XADynamicSourceItfAdaptMMF_SetSource");
|
|
36 |
if( !bCtx || !pDataSource || !pDataSource->pLocator )
|
|
37 |
{
|
|
38 |
DEBUG_ERR("Invalid NULL parameter");
|
|
39 |
ret = XA_RESULT_PARAMETER_INVALID;
|
|
40 |
}
|
|
41 |
else if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation)
|
|
42 |
{
|
|
43 |
XADataLocator_URI* tempUri = (XADataLocator_URI*)(pDataSource->pLocator);
|
|
44 |
XADataFormat_MIME* tempFormat = (XADataFormat_MIME*)(pDataSource->pFormat);
|
|
45 |
XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx;
|
|
46 |
|
|
47 |
ret = XAPlayItfAdaptMMF_GetPlayState(&bCtx->baseObj, &origstate);
|
|
48 |
|
|
49 |
ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, XA_PLAYSTATE_STOPPED);
|
|
50 |
|
|
51 |
mmf_close(mCtx->mmfContext);
|
|
52 |
mCtx->xaSource = pDataSource;
|
|
53 |
ret = mmf_set_player_uri(mCtx->mmfContext, (char *)(tempUri->URI), tempFormat->containerType);
|
|
54 |
if(mCtx->xaVideoSink)
|
|
55 |
{
|
|
56 |
ret = mmf_setup_native_display(mCtx->mmfContext, mCtx->xaVideoSink);
|
|
57 |
}
|
|
58 |
if(ret == XA_RESULT_SUCCESS)
|
|
59 |
{
|
|
60 |
ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, origstate);
|
|
61 |
}
|
|
62 |
else
|
|
63 |
{
|
|
64 |
DEBUG_ERR("Set Play state failed");
|
|
65 |
ret = XA_RESULT_INTERNAL_ERROR;
|
|
66 |
}
|
|
67 |
if(ret == XA_RESULT_SUCCESS)
|
|
68 |
{
|
|
69 |
if(mCtx->mmfMetadataContext)
|
|
70 |
{
|
|
71 |
ret = mmf_metadata_utility_parse_source(mCtx->mmfMetadataContext, (char *)(tempUri->URI));
|
|
72 |
}
|
|
73 |
}
|
|
74 |
}
|
|
75 |
else if(bCtx->baseObj.ctxId == XAMDAdaptation)
|
|
76 |
{
|
|
77 |
|
|
78 |
XAMetadataAdaptationMMFCtx* mCtx = (XAMetadataAdaptationMMFCtx*) bCtx;
|
|
79 |
if(mCtx->mmfContext)
|
|
80 |
{
|
|
81 |
mCtx->xaSource = pDataSource;
|
|
82 |
ret = mmf_metadata_utility_parse_source(mCtx->mmfContext, (char *)(( (XADataLocator_URI*)(pDataSource->pLocator))->URI));
|
|
83 |
}
|
|
84 |
}
|
|
85 |
DEBUG_API("<-XADynamicSourceItfAdaptMMF_SetSource");
|
|
86 |
return ret;
|
|
87 |
}
|
|
88 |
|