• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     @file src/base/amr_component.h
20 
21     OpenMax base_component component. This component does not perform any multimedia
22     processing. It is used as a base_component for new components development.
23 
24 */
25 
26 #ifndef OMX_AMR_COMPONENT_H_INCLUDED
27 #define OMX_AMR_COMPONENT_H_INCLUDED
28 
29 #ifndef PV_OMXCOMPONENT_H_INCLUDED
30 #include "pv_omxcomponent.h"
31 #endif
32 
33 #ifndef AMR_DEC_H_INCLUDED
34 #include "amr_dec.h"
35 #endif
36 
37 #define INPUT_BUFFER_SIZE_AMR 2000
38 #define OUTPUT_BUFFER_SIZE_AMR 640
39 
40 #define NUMBER_INPUT_BUFFER_AMR  10
41 #define NUMBER_OUTPUT_BUFFER_AMR  9
42 
43 // we are assuming 16 bits per sample
44 #define AMR_NB_OUTPUT_FRAME_SIZE_IN_BYTES 320
45 #define AMR_WB_OUTPUT_FRAME_SIZE_IN_BYTES 640
46 
47 class OpenmaxAmrAO : public OmxComponentAudio
48 {
49     public:
50 
51         OpenmaxAmrAO();
52         ~OpenmaxAmrAO();
53 
54 
55         OMX_ERRORTYPE ConstructComponent(OMX_PTR pAppData, OMX_PTR pProxy);
56         OMX_ERRORTYPE DestroyComponent();
57 
58         OMX_ERRORTYPE ComponentInit();
59         OMX_ERRORTYPE ComponentDeInit();
60 
61         static void ComponentGetRolesOfComponent(OMX_STRING* aRoleString);
62         void ProcessData();
63 
64         void DecodeWithoutMarker();
65         void DecodeWithMarker();
66 
67         void ComponentBufferMgmtWithoutMarker();
68         void SyncWithInputTimestamp();
69         void ProcessInBufferFlag();
70 
71         void ResetComponent();
72 
73         OMX_ERRORTYPE GetConfig(
74             OMX_IN  OMX_HANDLETYPE hComponent,
75             OMX_IN  OMX_INDEXTYPE nIndex,
76             OMX_INOUT OMX_PTR pComponentConfigStructure);
77 
78     private:
79 
80         void CheckForSilenceInsertion();
81         void DoSilenceInsertion();
82 
83         OMX_TICKS               iCurrentTimestamp;
84         OMX_S32                 iPreviousFrameLength;
85         OMX_U32                 iZeroFramesNeeded;
86 
87         OmxAmrDecoder* ipAmrDec;
88 };
89 
90 #endif // OMX_AMR_COMPONENT_H_INCLUDED
91