1 /* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 * express or implied.
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
17 */
18
19 #include "oscl_stdstring.h"
20
21 // Use default DLL entry point
22 #ifndef OSCL_DLL_H_INCLUDED
23 #include "oscl_dll.h"
24 #endif
25
26 #include "pv_omx_config_parser.h"
27 #include "pv_omxcore.h"
28
29 #if (USE_DYNAMIC_LOAD_OMX_COMPONENTS == 0)
30 // in case of static build - just redirect master omx core call to local pv core call
OMX_MasterConfigParser(OMX_PTR aInputParameters,OMX_PTR aOutputParameters)31 OSCL_EXPORT_REF OMX_BOOL OMX_MasterConfigParser(
32 OMX_PTR aInputParameters,
33 OMX_PTR aOutputParameters)
34
35 {
36 return OMXConfigParser(aInputParameters, aOutputParameters);
37 }
38 #endif
39
OMXConfigParser(OMX_PTR aInputParameters,OMX_PTR aOutputParameters)40 OSCL_EXPORT_REF OMX_BOOL OMXConfigParser(
41 OMX_PTR aInputParameters,
42 OMX_PTR aOutputParameters)
43
44 {
45 OMXConfigParserInputs* pInputs;
46
47 pInputs = (OMXConfigParserInputs*) aInputParameters;
48
49
50 if (NULL != pInputs->cComponentRole)
51 {
52 if (0 == oscl_strncmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder", oscl_strlen("audio_decoder")))
53 {
54 OMX_S32 Status;
55 pvAudioConfigParserInputs aInputs;
56
57 aInputs.inPtr = pInputs->inPtr;
58 aInputs.inBytes = pInputs->inBytes;
59
60 if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.wma"))
61 {
62 aInputs.iMimeType = PVMF_MIME_WMA;
63
64 }
65 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.aac"))
66 {
67 aInputs.iMimeType = PVMF_MIME_AAC_SIZEHDR;
68
69 }
70 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.amr"))
71 {
72 aInputs.iMimeType = PVMF_MIME_AMR;
73
74 }
75 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.amrnb"))
76 {
77 aInputs.iMimeType = PVMF_MIME_AMR;
78
79 }
80 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.amrwb"))
81 {
82 aInputs.iMimeType = PVMF_MIME_AMRWB;
83
84 }
85 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.mp3"))
86 {
87 aInputs.iMimeType = PVMF_MIME_MP3;
88
89 }
90 else
91 {
92 return OMX_FALSE;
93 }
94
95
96 Status = pv_audio_config_parser(&aInputs, (pvAudioConfigParserOutputs *)aOutputParameters);
97 if (0 == Status)
98 {
99 return OMX_FALSE;
100 }
101 }
102 else if (0 == oscl_strncmp(pInputs->cComponentRole, (OMX_STRING)"video_decoder", oscl_strlen("video_decoder")))
103 {
104
105 OMX_S32 Status;
106 pvVideoConfigParserInputs aInputs;
107
108 aInputs.inPtr = pInputs->inPtr;
109 aInputs.inBytes = pInputs->inBytes;
110
111 if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"video_decoder.wmv"))
112 {
113 aInputs.iMimeType = PVMF_MIME_WMV;
114
115 }
116 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"video_decoder.avc"))
117 {
118 aInputs.iMimeType = PVMF_MIME_H264_VIDEO;
119
120 }
121 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"video_decoder.mpeg4"))
122 {
123 aInputs.iMimeType = PVMF_MIME_M4V;
124
125 }
126 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"video_decoder.h263"))
127 {
128 aInputs.iMimeType = PVMF_MIME_H2632000;
129
130 }
131 else
132 {
133 return OMX_FALSE;
134 }
135
136 Status = pv_video_config_parser(&aInputs, (pvVideoConfigParserOutputs *)aOutputParameters);
137 if (0 != Status)
138 {
139 return OMX_FALSE;
140 }
141 }
142 else
143 {
144 return OMX_FALSE;
145 }
146
147 }
148 else
149 {
150 return OMX_FALSE;
151 }
152
153 return OMX_TRUE;
154 }
155
156