Home | History | Annotate | Download | only in inc
      1 /*--------------------------------------------------------------------------
      2 Copyright (c) 2010, Code Aurora Forum. All rights reserved.
      3 
      4 Redistribution and use in source and binary forms, with or without
      5 modification, are permitted provided that the following conditions are met:
      6     * Redistributions of source code must retain the above copyright
      7       notice, this list of conditions and the following disclaimer.
      8     * Redistributions in binary form must reproduce the above copyright
      9       notice, this list of conditions and the following disclaimer in the
     10       documentation and/or other materials provided with the distribution.
     11     * Neither the name of Code Aurora nor
     12       the names of its contributors may be used to endorse or promote
     13       products derived from this software without specific prior written
     14       permission.
     15 
     16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     17 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     18 IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     19 NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     20 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     21 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     22 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     23 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     24 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     25 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     26 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 --------------------------------------------------------------------------*/
     28 #ifndef __OMX_VENC_DEV__
     29 #define __OMX_VENC_DEV__
     30 
     31 #include "OMX_Types.h"
     32 #include "OMX_Core.h"
     33 #include "OMX_QCOMExtns.h"
     34 #include "qc_omx_component.h"
     35 #include "omx_video_common.h"
     36 #include <linux/msm_vidc_enc.h>
     37 
     38 
     39 void* async_venc_message_thread (void *);
     40 
     41 class venc_dev
     42 {
     43 public:
     44   venc_dev(); //constructor
     45   ~venc_dev(); //des
     46 
     47   bool venc_open(OMX_U32);
     48   void venc_close();
     49   unsigned venc_stop(void);
     50   unsigned venc_pause(void);
     51   unsigned venc_start(void);
     52   unsigned venc_flush(unsigned);
     53 
     54   unsigned venc_resume(void);
     55   bool venc_use_buf(void*, unsigned);
     56   bool venc_free_buf(void*, unsigned);
     57   bool venc_empty_buf(void *, void *);
     58   bool venc_fill_buf(void *, void *);
     59 
     60   bool venc_get_buf_req(unsigned long *,unsigned long *,
     61                         unsigned long *,unsigned long);
     62   bool venc_set_buf_req(unsigned long *,unsigned long *,
     63                         unsigned long *,unsigned long);
     64   bool venc_set_param(void *,OMX_INDEXTYPE);
     65   bool venc_set_config(void *configData, OMX_INDEXTYPE index);
     66   bool venc_get_profile_level(OMX_U32 *eProfile,OMX_U32 *eLevel);
     67   OMX_U32 m_nDriver_fd;
     68   bool m_profile_set;
     69   bool m_level_set;
     70 
     71 private:
     72   struct venc_basecfg             m_sVenc_cfg;
     73   struct venc_ratectrlcfg         rate_ctrl;
     74   struct venc_targetbitrate       bit_rate;
     75   struct venc_intraperiod         intra_period;
     76   struct venc_profile             codec_profile;
     77   struct ven_profilelevel         profile_level;
     78   struct venc_switch              set_param;
     79   struct venc_voptimingcfg        time_inc;
     80   struct venc_allocatorproperty   m_sInput_buff_property;
     81   struct venc_allocatorproperty   m_sOutput_buff_property;
     82   struct venc_sessionqp           session_qp;
     83   struct venc_multiclicecfg       multislice_cfg;
     84 
     85   bool venc_set_profile_level(OMX_U32 eProfile,OMX_U32 eLevel);
     86   bool venc_set_intra_period(OMX_U32 nPFrames);
     87   bool venc_set_target_bitrate(OMX_U32 nTargetBitrate);
     88   bool venc_set_ratectrl_cfg(OMX_VIDEO_CONTROLRATETYPE eControlRate);
     89   bool venc_set_session_qp(OMX_U32 i_frame_qp, OMX_U32 p_frame_qp);
     90   bool venc_set_encode_framerate(OMX_U32 encode_framerate);
     91   bool venc_set_intra_vop_refresh(OMX_BOOL intra_vop_refresh);
     92   bool venc_set_color_format(OMX_COLOR_FORMATTYPE color_format);
     93   bool venc_validate_profile_level(OMX_U32 *eProfile, OMX_U32 *eLevel);
     94   bool venc_set_multislice_cfg(OMX_VIDEO_AVCSLICEMODETYPE eSliceMode);
     95 };
     96 
     97 #endif
     98