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