Home | History | Annotate | Download | only in inc
      1 /*--------------------------------------------------------------------------
      2 Copyright (c) 2010-2014, The Linux Foundation. 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
      6 met:
      7     * Redistributions of source code must retain the above copyright
      8       notice, this list of conditions and the following disclaimer.
      9     * Redistributions in binary form must reproduce the above
     10       copyright notice, this list of conditions and the following
     11       disclaimer in the documentation and/or other materials provided
     12       with the distribution.
     13     * Neither the name of The Linux Foundation nor the names of its
     14       contributors may be used to endorse or promote products derived
     15       from this software without specific prior written permission.
     16 
     17 THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
     18 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
     20 ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
     21 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     24 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     25 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     26 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
     27 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28 --------------------------------------------------------------------------*/
     29 #ifndef __OMX_SWVENC__H
     30 #define __OMX_SWVENC__H
     31 
     32 #include <unistd.h>
     33 #include "omx_video_base.h"
     34 #include "SwVencTypes.h"
     35 #include "SwVencAPI.h"
     36 
     37 extern "C" {
     38     OMX_API void * get_omx_component_factory_fn(void);
     39 }
     40 
     41 class omx_swvenc: public omx_video
     42 {
     43 public:
     44     omx_swvenc(); //constructor
     45     ~omx_swvenc(); //des
     46 
     47     OMX_ERRORTYPE component_init(OMX_STRING role);
     48 
     49     OMX_ERRORTYPE set_parameter(OMX_HANDLETYPE hComp,
     50             OMX_INDEXTYPE  paramIndex,
     51             OMX_PTR        paramData);
     52     OMX_ERRORTYPE set_config(OMX_HANDLETYPE hComp,
     53             OMX_INDEXTYPE  configIndex,
     54             OMX_PTR        configData);
     55     OMX_ERRORTYPE component_deinit(OMX_HANDLETYPE hComp);
     56     bool is_secure_session();
     57 
     58     static SWVENC_STATUS swvenc_input_buffer_done_cb(SWVENC_HANDLE pSwEnc, SWVENC_IPBUFFER *pIpBuffer, void *pClientHandle);
     59     static SWVENC_STATUS swvenc_fill_buffer_done_cb(SWVENC_HANDLE pSwEnc, SWVENC_OPBUFFER *pOpBuffer, void *pClientHandle);
     60     static SWVENC_STATUS swvenc_handle_event_cb (SWVENC_HANDLE pSwEnc, SWVENC_EVENTHANDLER* pEventHandler, void *pClientHandle);
     61     void swvenc_input_buffer_done(SWVENC_IPBUFFER *pIpBuffer);
     62     void swvenc_fill_buffer_done(SWVENC_OPBUFFER *pOpBuffer);
     63     void swvenc_handle_event(SWVENC_EVENTHANDLER *pEvent);
     64     bool update_profile_level();
     65 
     66     //OMX strucutres
     67     OMX_U32 m_nVenc_format;
     68 
     69 private:
     70     virtual OMX_U32 dev_stop(void);
     71     virtual OMX_U32 dev_pause(void);
     72     virtual OMX_U32 dev_start(void);
     73     virtual OMX_U32 dev_flush(unsigned);
     74     virtual OMX_U32 dev_resume(void);
     75     virtual OMX_U32 dev_start_done(void);
     76     virtual OMX_U32 dev_set_message_thread_id(pthread_t);
     77     virtual bool dev_use_buf(void *,unsigned,unsigned);
     78     virtual bool dev_free_buf(void *,unsigned);
     79     virtual bool dev_empty_buf(void *, void *,unsigned,unsigned);
     80     virtual bool dev_fill_buf(void *buffer, void *,unsigned,unsigned);
     81     virtual bool dev_get_buf_req(OMX_U32 *,OMX_U32 *,OMX_U32 *,OMX_U32);
     82     bool dev_set_buf_req(OMX_U32 *,OMX_U32 *,OMX_U32 *,OMX_U32);
     83     virtual bool dev_get_seq_hdr(void *, unsigned, unsigned *);
     84     virtual bool dev_loaded_start(void);
     85     virtual bool dev_loaded_stop(void);
     86     virtual bool dev_loaded_start_done(void);
     87     virtual bool dev_loaded_stop_done(void);
     88 #ifdef _MSM8974_
     89     virtual int dev_handle_extradata(void*, int);
     90     virtual int dev_set_format(int);
     91 #endif
     92     virtual bool dev_is_video_session_supported(OMX_U32 width, OMX_U32 height);
     93     virtual bool dev_get_capability_ltrcount(OMX_U32 *, OMX_U32 *, OMX_U32 *);
     94     virtual bool dev_get_performance_level(OMX_U32 *);
     95     virtual bool dev_get_vui_timing_info(OMX_U32 *);
     96     virtual bool dev_get_peak_bitrate(OMX_U32 *);
     97     virtual bool dev_color_align(OMX_BUFFERHEADERTYPE *buffer, OMX_U32 width,
     98                         OMX_U32 height);
     99     virtual bool dev_get_output_log_flag();
    100     virtual int dev_output_log_buffers(const char *buffer_addr, int buffer_len);
    101     virtual int dev_extradata_log_buffers(char *buffer_addr);
    102 
    103     SWVENC_HANDLE    m_pSwVenc;
    104     SWVENC_CALLBACK  m_callBackInfo;
    105     SWVENC_IPBUFFER  m_pSwVencIpBuffer[32];
    106     SWVENC_OPBUFFER  m_pSwVencOpBuffer[32];
    107 };
    108 
    109 #endif //__OMX_SWVENC__H
    110