• 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 omx_mpeg4enc_component.h
20     OpenMax encoder_component component.
21 
22 */
23 
24 #ifndef OMX_MPEG4ENC_COMPONENT_H_INCLUDED
25 #define OMX_MPEG4ENC_COMPONENT_H_INCLUDED
26 
27 #ifndef PV_OMXCOMPONENT_H_INCLUDED
28 #include "pv_omxcomponent.h"
29 #endif
30 
31 #ifndef MPEG4_ENC_H_INCLUDED
32 #include "mpeg4_enc.h"
33 #endif
34 
35 
36 #define INPUT_BUFFER_SIZE_MP4ENC 38016          //(176 * 144 * 1.5) for YUV 420 format.
37 #define OUTPUT_BUFFER_SIZE_MP4ENC 8192
38 
39 
40 #define NUMBER_INPUT_BUFFER_MP4ENC  5
41 #define NUMBER_OUTPUT_BUFFER_MP4ENC  2
42 
43 
44 
45 class OmxComponentMpeg4EncAO : public OmxComponentVideo
46 {
47     public:
48 
49         OmxComponentMpeg4EncAO();
50         ~OmxComponentMpeg4EncAO();
51 
52         OMX_ERRORTYPE ConstructComponent(OMX_PTR pAppData, OMX_PTR pProxy);
53         OMX_ERRORTYPE DestroyComponent();
54 
55         OMX_ERRORTYPE ComponentInit();
56         OMX_ERRORTYPE ComponentDeInit();
57 
58         static void ComponentGetRolesOfComponent(OMX_STRING* aRoleString);
59 
60         void SetEncoderMode(OMX_S32 aMode);
61         void ProcessInBufferFlag();
62 
63         void ProcessData();
64 
65         OMX_ERRORTYPE SetConfig(
66             OMX_IN  OMX_HANDLETYPE hComponent,
67             OMX_IN  OMX_INDEXTYPE nIndex,
68             OMX_IN  OMX_PTR pComponentConfigStructure);
69 
70     private:
71 
72         OMX_BOOL CopyDataToOutputBuffer();
73 
74         Mpeg4Encoder_OMX* ipMpegEncoderObject;
75         OMX_S32           iEncMode;
76 
77         OMX_BOOL          iBufferOverRun;
78         OMX_U8*           ipInternalOutBuffer;
79         OMX_U32           iInternalOutBufFilledLen;
80         OMX_TICKS         iOutputTimeStamp;
81         OMX_BOOL          iSyncFlag;
82 };
83 
84 #endif // OMX_MPEG4ENC_COMPONENT_H_INCLUDED
85