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 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 The Linux Foundation 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 
     29 #ifndef __EXTRA_DATA_HANDLER_H__
     30 #define __EXTRA_DATA_HANDLER_H__
     31 
     32 #include <stdio.h>
     33 #include <stdint.h>
     34 #include <string.h>
     35 #include <stdlib.h>
     36 #include "OMX_QCOMExtns.h"
     37 #include<linux/msm_vidc_dec.h>
     38 #include<linux/msm_vidc_enc.h>
     39 
     40 
     41 #ifdef _ANDROID_
     42 extern "C"{
     43 #include<utils/Log.h>
     44 }
     45 #endif // _ANDROID_
     46 
     47 #include "vidc_debug.h"
     48 #define SEI_PAYLOAD_FRAME_PACKING_ARRANGEMENT 0x2D
     49 #define H264_START_CODE 0x01
     50 #define NAL_TYPE_SEI 0x06
     51 #define VDEC_OMX_SEI 0x7F000007
     52 #define FRAME_PACK_SIZE 18
     53 #define H264_EMULATION_BYTE 0x03
     54 class extra_data_handler
     55 {
     56     public:
     57         extra_data_handler();
     58         ~extra_data_handler();
     59         OMX_U32 parse_extra_data(OMX_BUFFERHEADERTYPE *buf_hdr);
     60         OMX_U32 create_extra_data(OMX_BUFFERHEADERTYPE *buf_hdr);
     61         OMX_U32 get_frame_pack_data(OMX_QCOM_FRAME_PACK_ARRANGEMENT *frame_pack);
     62         OMX_U32 set_frame_pack_data(OMX_QCOM_FRAME_PACK_ARRANGEMENT *frame_pack);
     63     private:
     64         OMX_QCOM_FRAME_PACK_ARRANGEMENT frame_packing_arrangement;
     65         OMX_U8 *rbsp_buf;
     66         OMX_U32 bit_ptr;
     67         OMX_U32 byte_ptr;
     68         OMX_U32 pack_sei;
     69         OMX_U32 sei_payload_type;
     70         OMX_U32 d_u(OMX_U32 num_bits);
     71         OMX_U32 d_ue();
     72         OMX_U32 parse_frame_pack(void);
     73         OMX_S32 parse_rbsp(OMX_U8 *buf, OMX_U32 len);
     74         OMX_S32 parse_sei(OMX_U8 *buffer, OMX_U32 buffer_length);
     75         OMX_U32 e_u(OMX_U32 symbol, OMX_U32 num_bits);
     76         OMX_U32 e_ue(OMX_U32 symbol);
     77         OMX_U32 create_frame_pack();
     78         OMX_S32 create_rbsp(OMX_U8 *buf, OMX_U32 nalu_type);
     79         OMX_U32 create_sei(OMX_U8 *buffer);
     80         OMX_S32 parse_sliceinfo(OMX_BUFFERHEADERTYPE *pBufHdr,
     81                 OMX_OTHER_EXTRADATATYPE *pExtra);
     82         OMX_S32 parse_ltrinfo(OMX_OTHER_EXTRADATATYPE *pExtra);
     83 };
     84 
     85 #endif
     86