25
|
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: Metadata Adaptation MMF
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
19
|
18 |
#include <stdlib.h>
|
|
19 |
#include "xametadataadaptctxmmf.h"
|
|
20 |
#include "xaobjectitf.h"
|
|
21 |
#include "cmetadatautilityitf.h"
|
|
22 |
|
|
23 |
XAAdaptationBaseCtx* XAMetadataAdaptCtxMMF_Create(XADataSource * pDataSrc)
|
25
|
24 |
{
|
19
|
25 |
|
|
26 |
XAMetadataAdaptationMMFCtx *pSelf = NULL;
|
|
27 |
DEBUG_API("->XAMetadataAdaptCtxMMF_Create");
|
25
|
28 |
|
19
|
29 |
pSelf = calloc(1, sizeof(XAMetadataAdaptationMMFCtx));
|
43
|
30 |
if(!pSelf)
|
19
|
31 |
{
|
43
|
32 |
/* memory allocation failed */
|
|
33 |
DEBUG_ERR("Failed to allocate memory");
|
|
34 |
DEBUG_API("<-XAMetadataAdaptCtxMMF_Create");
|
|
35 |
return NULL;
|
|
36 |
}
|
19
|
37 |
|
43
|
38 |
if (XAAdaptationBaseMMF_Init(&(pSelf->baseObj), XAMDAdaptation)
|
|
39 |
!= XA_RESULT_SUCCESS)
|
25
|
40 |
{
|
43
|
41 |
free(pSelf);
|
|
42 |
DEBUG_ERR("Failed to init base context!!!");
|
|
43 |
DEBUG_API("<-XAMetadataAdaptCtxMMF_Create");
|
25
|
44 |
return NULL;
|
|
45 |
}
|
43
|
46 |
|
|
47 |
pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF;
|
|
48 |
pSelf->xaSource = pDataSrc;
|
|
49 |
|
|
50 |
if (pDataSrc)
|
|
51 |
{
|
|
52 |
pSelf->mmfContext
|
|
53 |
= mmf_metadata_utility_init(
|
|
54 |
(char *) (((XADataLocator_URI*) (pDataSrc->pLocator))->URI));
|
|
55 |
if (!pSelf->mmfContext)
|
|
56 |
{
|
|
57 |
free(pSelf);
|
|
58 |
DEBUG_ERR("Failed to init mmf context!!!");
|
|
59 |
DEBUG_API("<-XAMetadataAdaptCtxMMF_Create");
|
|
60 |
return NULL;
|
|
61 |
}
|
|
62 |
}
|
19
|
63 |
|
|
64 |
DEBUG_API("<- XAMetadataAdaptCtxMMF_Create");
|
25
|
65 |
return (XAAdaptationBaseCtx*) (&pSelf->baseObj.baseObj);
|
|
66 |
}
|
19
|
67 |
|
|
68 |
/*
|
|
69 |
* XAresult XAMediaPlayerAdaptMMF_PostInit()
|
|
70 |
* 2nd phase initialization of Media Player Adaptation Context
|
|
71 |
* @param XAMediaPlayerAdaptationMMFCtx* ctx - pointer to Media Player adaptation context
|
|
72 |
* @return XAresult - Success value
|
|
73 |
*/
|
25
|
74 |
XAresult XAMetadataAdaptCtxMMF_PostInit(XAAdaptationMMFCtx* bCtx)
|
|
75 |
{
|
|
76 |
XAresult ret = XA_RESULT_SUCCESS;
|
|
77 |
|
|
78 |
DEBUG_API("<-XAMetadataAdaptCtxMMF_PostInit");
|
|
79 |
return ret;
|
|
80 |
}
|
19
|
81 |
|
|
82 |
/*
|
|
83 |
* void XAMediaPlayerAdaptMMF_Destroy( XAMediaPlayerAdaptationMMFCtx* ctx )
|
|
84 |
* Destroys Media Player Adaptation Context
|
|
85 |
* @param ctx - Media Player Adaptation context to be destroyed
|
|
86 |
*/
|
25
|
87 |
void XAMetadataAdaptCtxMMF_Destroy(XAAdaptationMMFCtx* bCtx)
|
|
88 |
{
|
19
|
89 |
DEBUG_API("->XAMetadataAdaptCtxMMF_Destroy");
|
25
|
90 |
if (bCtx == NULL)
|
|
91 |
{
|
33
|
92 |
DEBUG_ERR("Invalid parameter!!");
|
|
93 |
DEBUG_API("<-XAMetadataAdaptCtxMMF_Destroy");
|
19
|
94 |
return;
|
25
|
95 |
}
|
19
|
96 |
|
25
|
97 |
if (((XAMetadataAdaptationMMFCtx*) bCtx)->mmfContext)
|
|
98 |
{
|
|
99 |
mmf_metadata_utility_destroy(
|
|
100 |
((XAMetadataAdaptationMMFCtx*) bCtx)->mmfContext);
|
|
101 |
}
|
|
102 |
|
|
103 |
XAAdaptationBase_Free(&bCtx->baseObj);
|
19
|
104 |
free(bCtx);
|
|
105 |
bCtx = NULL;
|
|
106 |
|
|
107 |
DEBUG_API("<-XAMetadataExtractorAdaptMMF_Destroy");
|
25
|
108 |
}
|
19
|
109 |
|