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