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