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 //#define LOG_NDEBUG 0 20 #define LOG_TAG "intel_omx_config_parser" 21 #include <utils/Log.h> 22 23 24 #include "oscl_stdstring.h" 25 26 // Use default DLL entry point 27 #ifndef OSCL_DLL_H_INCLUDED 28 #include "oscl_dll.h" 29 #endif 30 31 #include "pv_omx_config_parser.h" 32 #include "pv_omxcore.h" 33 #include "intel_omx_config_parser.h" 34 #include "intel_video_config_parser.h" 35 36 37 OSCL_EXPORT_REF OMX_BOOL Intel_OMXConfigParser( 38 OMX_PTR aInputParameters, 39 OMX_PTR aOutputParameters) 40 41 { 42 OMXConfigParserInputs* pInputs; 43 44 LOGV("--- Intel_OMXConfigParser() ----\n"); 45 46 pInputs = (OMXConfigParserInputs*) aInputParameters; 47 48 49 if (NULL != pInputs->cComponentRole) 50 { 51 if (0 == oscl_strncmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder", oscl_strlen("audio_decoder"))) 52 { 53 OMX_S32 Status; 54 pvAudioConfigParserInputs aInputs; 55 56 aInputs.inPtr = pInputs->inPtr; 57 aInputs.inBytes = pInputs->inBytes; 58 59 if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.wma")) 60 { 61 aInputs.iMimeType = PVMF_MIME_WMA; 62 63 } 64 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.aac")) 65 { 66 aInputs.iMimeType = PVMF_MIME_AAC_SIZEHDR; 67 68 } 69 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.amr")) 70 { 71 aInputs.iMimeType = PVMF_MIME_AMR; 72 73 } 74 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.amrnb")) 75 { 76 aInputs.iMimeType = PVMF_MIME_AMR; 77 78 } 79 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.amrwb")) 80 { 81 aInputs.iMimeType = PVMF_MIME_AMRWB; 82 83 } 84 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"audio_decoder.mp3")) 85 { 86 aInputs.iMimeType = PVMF_MIME_MP3; 87 88 } 89 else 90 { 91 return OMX_FALSE; 92 } 93 94 95 Status = pv_audio_config_parser(&aInputs, (pvAudioConfigParserOutputs *)aOutputParameters); 96 if (0 == Status) 97 { 98 return OMX_FALSE; 99 } 100 } 101 else if (0 == oscl_strncmp(pInputs->cComponentRole, (OMX_STRING)"video_decoder", oscl_strlen("video_decoder"))) 102 { 103 104 OMX_S32 Status; 105 pvVideoConfigParserInputs aInputs; 106 107 aInputs.inPtr = pInputs->inPtr; 108 aInputs.inBytes = pInputs->inBytes; 109 110 if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"video_decoder.wmv")) 111 { 112 aInputs.iMimeType = PVMF_MIME_WMV; 113 114 } 115 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"video_decoder.avc")) 116 { 117 aInputs.iMimeType = PVMF_MIME_H264_VIDEO; 118 119 } 120 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"video_decoder.mpeg4")) 121 { 122 aInputs.iMimeType = PVMF_MIME_M4V; 123 124 } 125 else if (0 == oscl_strcmp(pInputs->cComponentRole, (OMX_STRING)"video_decoder.h263")) 126 { 127 aInputs.iMimeType = PVMF_MIME_H2632000; 128 129 } 130 else 131 { 132 return OMX_FALSE; 133 } 134 135 if(aInputs.iMimeType == PVMF_MIME_H264_VIDEO || 136 aInputs.iMimeType == PVMF_MIME_H2632000 || 137 aInputs.iMimeType == PVMF_MIME_H2631998) 138 { 139 LOGV("--- intel_video_config_parser() ---\n"); 140 Status = intel_video_config_parser(&aInputs, (pvVideoConfigParserOutputs *)aOutputParameters); 141 } 142 else 143 { 144 Status = pv_video_config_parser(&aInputs, (pvVideoConfigParserOutputs *)aOutputParameters); 145 } 146 if (0 != Status) 147 { 148 return OMX_FALSE; 149 } 150 } 151 else 152 { 153 return OMX_FALSE; 154 } 155 156 } 157 else 158 { 159 return OMX_FALSE; 160 } 161 162 return OMX_TRUE; 163 } 164 165