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
6   are met:
7 
8     * Redistributions of source code must retain the above copyright
9   notice, this list of conditions and the following disclaimer.
10     * Redistributions in binary form must reproduce the above
11   copyright notice, this list of conditions and the following
12       disclaimer in the documentation and/or other materials provided
13       with the distribution.
14     * Neither the name of The Linux Foundation nor the names of its
15       contributors may be used to endorse or promote products derived
16       from this software without specific prior written permission.
17 
18 THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
19 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
21 ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
25 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
28 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 --------------------------------------------------------------------------*/
30 #ifndef __OMX_VDEC_H__
31 #define __OMX_VDEC_H__
32 /*============================================================================
33                             O p e n M A X   Component
34                                 Video Decoder
35 
36 *//** @file comx_vdec.h
37   This module contains the class definition for openMAX decoder component.
38 
39 *//*========================================================================*/
40 
41 //////////////////////////////////////////////////////////////////////////////
42 //                             Include Files
43 //////////////////////////////////////////////////////////////////////////////
44 
45 #include <stdlib.h>
46 #include <stdio.h>
47 #include <string.h>
48 #include <inttypes.h>
49 #include <cstddef>
50 #include <cutils/atomic.h>
51 
52 static ptrdiff_t x;
53 
54 #ifdef _ANDROID_
55 #ifdef MAX_RES_720P
56 #define LOG_TAG "OMX-VDEC-720P"
57 #elif MAX_RES_1080P
58 #define LOG_TAG "OMX-VDEC-1080P"
59 #else
60 #define LOG_TAG "OMX-VDEC"
61 #endif
62 
63 #ifdef USE_ION
64 #include <linux/msm_ion.h>
65 //#include <binder/MemoryHeapIon.h>
66 //#else
67 #endif
68 #include <binder/MemoryHeapBase.h>
69 #include <ui/ANativeObjectBase.h>
70 extern "C" {
71 #include <utils/Log.h>
72 }
73 #include <linux/videodev2.h>
74 #include <poll.h>
75 #include "hevc_utils.h"
76 #define TIMEOUT 5000
77 #endif // _ANDROID_
78 
79 #if defined (_ANDROID_HONEYCOMB_) || defined (_ANDROID_ICS_)
80 #include <media/hardware/HardwareAPI.h>
81 #endif
82 
83 #include <unistd.h>
84 
85 #if defined (_ANDROID_ICS_)
86 #include <gralloc_priv.h>
87 #endif
88 
89 #include <pthread.h>
90 #ifndef PC_DEBUG
91 #include <semaphore.h>
92 #endif
93 #include "OMX_Core.h"
94 #include "OMX_QCOMExtns.h"
95 #include "qc_omx_component.h"
96 #include <linux/msm_vidc_dec.h>
97 #include <media/msm_vidc.h>
98 #include "frameparser.h"
99 #ifdef MAX_RES_1080P
100 #include "mp4_utils.h"
101 #endif
102 #include "extra_data_handler.h"
103 #include "ts_parser.h"
104 #include "vidc_color_converter.h"
105 #include "vidc_debug.h"
106 #ifdef _ANDROID_
107 #include <cutils/properties.h>
108 #else
109 #define PROPERTY_VALUE_MAX 92
110 #endif
111 extern "C" {
112     OMX_API void * get_omx_component_factory_fn(void);
113 }
114 
115 #ifdef _ANDROID_
116 using namespace android;
117 #ifdef USE_ION
118 class VideoHeap : public MemoryHeapBase
119 {
120     public:
121         VideoHeap(int devicefd, size_t size, void* base,struct ion_handle *handle,int mapfd);
~VideoHeap()122         virtual ~VideoHeap() {}
123     private:
124         int m_ion_device_fd;
125         struct ion_handle *m_ion_handle;
126 };
127 #else
128 // local pmem heap object
129 class VideoHeap : public MemoryHeapBase
130 {
131     public:
132         VideoHeap(int fd, size_t size, void* base);
~VideoHeap()133         virtual ~VideoHeap() {}
134 };
135 #endif
136 #endif // _ANDROID_
137 //////////////////////////////////////////////////////////////////////////////
138 //                       Module specific globals
139 //////////////////////////////////////////////////////////////////////////////
140 #define OMX_SPEC_VERSION  0x00000101
141 
142 //PC:TODO------------ kernel update ----------
143 #define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4') /* H264 MVC */
144 //-----------
145 
146 //////////////////////////////////////////////////////////////////////////////
147 //               Macros
148 //////////////////////////////////////////////////////////////////////////////
149 #define PrintFrameHdr(bufHdr) DEBUG_PRINT("bufHdr %x buf %x size %d TS %d\n",\
150         (unsigned) bufHdr,\
151         (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,\
152         (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFilledLen,\
153         (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nTimeStamp)
154 
155 // BitMask Management logic
156 #define BITS_PER_BYTE        32
157 #define BITMASK_SIZE(mIndex) (((mIndex) + BITS_PER_BYTE - 1)/BITS_PER_BYTE)
158 #define BITMASK_OFFSET(mIndex) ((mIndex)/BITS_PER_BYTE)
159 #define BITMASK_FLAG(mIndex) (1 << ((mIndex) % BITS_PER_BYTE))
160 #define BITMASK_CLEAR(mArray,mIndex) (mArray)[BITMASK_OFFSET(mIndex)] \
161     &=  ~(BITMASK_FLAG(mIndex))
162 #define BITMASK_SET(mArray,mIndex)  (mArray)[BITMASK_OFFSET(mIndex)] \
163     |=  BITMASK_FLAG(mIndex)
164 #define BITMASK_PRESENT(mArray,mIndex) ((mArray)[BITMASK_OFFSET(mIndex)] \
165         & BITMASK_FLAG(mIndex))
166 #define BITMASK_ABSENT(mArray,mIndex) (((mArray)[BITMASK_OFFSET(mIndex)] \
167             & BITMASK_FLAG(mIndex)) == 0x0)
168 #define BITMASK_PRESENT(mArray,mIndex) ((mArray)[BITMASK_OFFSET(mIndex)] \
169         & BITMASK_FLAG(mIndex))
170 #define BITMASK_ABSENT(mArray,mIndex) (((mArray)[BITMASK_OFFSET(mIndex)] \
171             & BITMASK_FLAG(mIndex)) == 0x0)
172 
173 #define OMX_CORE_CONTROL_CMDQ_SIZE   100
174 #define OMX_CORE_QCIF_HEIGHT         144
175 #define OMX_CORE_QCIF_WIDTH          176
176 #define OMX_CORE_VGA_HEIGHT          480
177 #define OMX_CORE_VGA_WIDTH           640
178 #define OMX_CORE_WVGA_HEIGHT         480
179 #define OMX_CORE_WVGA_WIDTH          800
180 
181 #define DESC_BUFFER_SIZE (8192 * 16)
182 
183 #ifdef _ANDROID_
184 #define MAX_NUM_INPUT_OUTPUT_BUFFERS 32
185 #endif
186 
187 #ifdef _ION_HEAP_MASK_COMPATIBILITY_WA
188     #define ION_HEAP_MASK heap_mask
189 #else
190     #define ION_HEAP_MASK heap_id_mask
191 #endif
192 
193 #define OMX_FRAMEINFO_EXTRADATA 0x00010000
194 #define OMX_INTERLACE_EXTRADATA 0x00020000
195 #define OMX_TIMEINFO_EXTRADATA  0x00040000
196 #define OMX_PORTDEF_EXTRADATA   0x00080000
197 #define OMX_EXTNUSER_EXTRADATA  0x00100000
198 #define OMX_FRAMEDIMENSION_EXTRADATA  0x00200000
199 #define OMX_FRAMEPACK_EXTRADATA 0x00400000
200 #define OMX_QP_EXTRADATA        0x00800000
201 #define OMX_BITSINFO_EXTRADATA  0x01000000
202 #define DRIVER_EXTRADATA_MASK   0x0000FFFF
203 
204 #define OMX_INTERLACE_EXTRADATA_SIZE ((sizeof(OMX_OTHER_EXTRADATATYPE) +\
205             sizeof(OMX_STREAMINTERLACEFORMAT) + 3)&(~3))
206 #define OMX_FRAMEINFO_EXTRADATA_SIZE ((sizeof(OMX_OTHER_EXTRADATATYPE) +\
207             sizeof(OMX_QCOM_EXTRADATA_FRAMEINFO) + 3)&(~3))
208 #define OMX_PORTDEF_EXTRADATA_SIZE ((sizeof(OMX_OTHER_EXTRADATATYPE) +\
209             sizeof(OMX_PARAM_PORTDEFINITIONTYPE) + 3)&(~3))
210 #define OMX_FRAMEDIMENSION_EXTRADATA_SIZE (sizeof(OMX_OTHER_EXTRADATATYPE) +\
211             sizeof(OMX_QCOM_EXTRADATA_FRAMEDIMENSION) + 3)&(~3)
212 #define OMX_FRAMEPACK_EXTRADATA_SIZE ((sizeof(OMX_OTHER_EXTRADATATYPE) +\
213             sizeof(OMX_QCOM_FRAME_PACK_ARRANGEMENT) + 3)&(~3))
214 #define OMX_QP_EXTRADATA_SIZE ((sizeof(OMX_OTHER_EXTRADATATYPE) +\
215             sizeof(OMX_QCOM_EXTRADATA_QP) + 3)&(~3))
216 #define OMX_BITSINFO_EXTRADATA_SIZE ((sizeof(OMX_OTHER_EXTRADATATYPE) +\
217             sizeof(OMX_QCOM_EXTRADATA_BITS_INFO) + 3)&(~3))
218 #define OMX_USERDATA_EXTRADATA_SIZE ((sizeof(OMX_OTHER_EXTRADATATYPE) +\
219             ((8*1024) + 3))&(~3)) /* 8 KB is the size that driver/FW considers as worst case size for userdata */
220 
221 //  Define next macro with required values to enable default extradata,
222 //    VDEC_EXTRADATA_MB_ERROR_MAP
223 //    OMX_INTERLACE_EXTRADATA
224 //    OMX_FRAMEINFO_EXTRADATA
225 //    OMX_TIMEINFO_EXTRADATA
226 
227 //#define DEFAULT_EXTRADATA (OMX_FRAMEINFO_EXTRADATA|OMX_INTERLACE_EXTRADATA)
228 
229 enum port_indexes {
230     OMX_CORE_INPUT_PORT_INDEX        =0,
231     OMX_CORE_OUTPUT_PORT_INDEX       =1
232 };
233 #ifdef USE_ION
234 struct vdec_ion {
235     int ion_device_fd;
236     struct ion_fd_data fd_ion_data;
237     struct ion_allocation_data ion_alloc_data;
238 };
239 #endif
240 
241 #ifdef _MSM8974_
242 struct extradata_buffer_info {
243     unsigned long buffer_size;
244     char* uaddr;
245     int count;
246     int size;
247 #ifdef USE_ION
248     struct vdec_ion ion;
249 #endif
250 };
251 #endif
252 
253 struct video_driver_context {
254     int video_driver_fd;
255     enum vdec_codec decoder_format;
256     enum vdec_output_fromat output_format;
257     enum vdec_interlaced_format interlace;
258     enum vdec_output_order picture_order;
259     struct vdec_picsize video_resolution;
260     struct vdec_allocatorproperty ip_buf;
261     struct vdec_allocatorproperty op_buf;
262     struct vdec_bufferpayload *ptr_inputbuffer;
263     struct vdec_bufferpayload *ptr_outputbuffer;
264     struct vdec_output_frameinfo *ptr_respbuffer;
265 #ifdef USE_ION
266     struct vdec_ion *ip_buf_ion_info;
267     struct vdec_ion *op_buf_ion_info;
268     struct vdec_ion h264_mv;
269     struct vdec_ion meta_buffer;
270     struct vdec_ion meta_buffer_iommu;
271 #endif
272     struct vdec_framerate frame_rate;
273     unsigned extradata;
274     bool timestamp_adjust;
275     char kind[128];
276     bool idr_only_decoding;
277     unsigned disable_dmx;
278 #ifdef _MSM8974_
279     struct extradata_buffer_info extradata_info;
280     int num_planes;
281 #endif
282 };
283 
284 #ifdef _ANDROID_
285 class DivXDrmDecrypt;
286 #endif //_ANDROID_
287 
288 struct video_decoder_capability {
289     unsigned int min_width;
290     unsigned int max_width;
291     unsigned int min_height;
292     unsigned int max_height;
293 };
294 
295 struct debug_cap {
296     bool in_buffer_log;
297     bool out_buffer_log;
298     char infile_name[PROPERTY_VALUE_MAX + 36];
299     char outfile_name[PROPERTY_VALUE_MAX + 36];
300     char log_loc[PROPERTY_VALUE_MAX];
301     FILE *infile;
302     FILE *outfile;
303 };
304 
305 struct dynamic_buf_list {
306     OMX_U32 fd;
307     OMX_U32 dup_fd;
308     OMX_U32 offset;
309     OMX_U32 ref_count;
310 };
311 
312 // OMX video decoder class
313 class omx_vdec: public qc_omx_component
314 {
315 
316     public:
317         omx_vdec();  // constructor
318         virtual ~omx_vdec();  // destructor
319 
320         static int async_message_process (void *context, void* message);
321         static void process_event_cb(void *ctxt,unsigned char id);
322 
323         OMX_ERRORTYPE allocate_buffer(
324                 OMX_HANDLETYPE hComp,
325                 OMX_BUFFERHEADERTYPE **bufferHdr,
326                 OMX_U32 port,
327                 OMX_PTR appData,
328                 OMX_U32 bytes
329                 );
330 
331 
332         OMX_ERRORTYPE component_deinit(OMX_HANDLETYPE hComp);
333 
334         OMX_ERRORTYPE component_init(OMX_STRING role);
335 
336         OMX_ERRORTYPE component_role_enum(
337                 OMX_HANDLETYPE hComp,
338                 OMX_U8 *role,
339                 OMX_U32 index
340                 );
341 
342         OMX_ERRORTYPE component_tunnel_request(
343                 OMX_HANDLETYPE hComp,
344                 OMX_U32 port,
345                 OMX_HANDLETYPE  peerComponent,
346                 OMX_U32 peerPort,
347                 OMX_TUNNELSETUPTYPE *tunnelSetup
348                 );
349 
350         OMX_ERRORTYPE empty_this_buffer(
351                 OMX_HANDLETYPE hComp,
352                 OMX_BUFFERHEADERTYPE *buffer
353                 );
354 
355 
356 
357         OMX_ERRORTYPE fill_this_buffer(
358                 OMX_HANDLETYPE hComp,
359                 OMX_BUFFERHEADERTYPE *buffer
360                 );
361 
362 
363         OMX_ERRORTYPE free_buffer(
364                 OMX_HANDLETYPE hComp,
365                 OMX_U32 port,
366                 OMX_BUFFERHEADERTYPE *buffer
367                 );
368 
369         OMX_ERRORTYPE get_component_version(
370                 OMX_HANDLETYPE hComp,
371                 OMX_STRING componentName,
372                 OMX_VERSIONTYPE *componentVersion,
373                 OMX_VERSIONTYPE *specVersion,
374                 OMX_UUIDTYPE *componentUUID
375                 );
376 
377         OMX_ERRORTYPE get_config(
378                 OMX_HANDLETYPE hComp,
379                 OMX_INDEXTYPE configIndex,
380                 OMX_PTR configData
381                 );
382 
383         OMX_ERRORTYPE get_extension_index(
384                 OMX_HANDLETYPE hComp,
385                 OMX_STRING paramName,
386                 OMX_INDEXTYPE *indexType
387                 );
388 
389         OMX_ERRORTYPE get_parameter(OMX_HANDLETYPE hComp,
390                 OMX_INDEXTYPE  paramIndex,
391                 OMX_PTR        paramData);
392 
393         OMX_ERRORTYPE get_state(OMX_HANDLETYPE hComp,
394                 OMX_STATETYPE *state);
395 
396 
397 
398         OMX_ERRORTYPE send_command(OMX_HANDLETYPE  hComp,
399                 OMX_COMMANDTYPE cmd,
400                 OMX_U32         param1,
401                 OMX_PTR         cmdData);
402 
403 
404         OMX_ERRORTYPE set_callbacks(OMX_HANDLETYPE   hComp,
405                 OMX_CALLBACKTYPE *callbacks,
406                 OMX_PTR          appData);
407 
408         OMX_ERRORTYPE set_config(OMX_HANDLETYPE hComp,
409                 OMX_INDEXTYPE  configIndex,
410                 OMX_PTR        configData);
411 
412         OMX_ERRORTYPE set_parameter(OMX_HANDLETYPE hComp,
413                 OMX_INDEXTYPE  paramIndex,
414                 OMX_PTR        paramData);
415 
416         OMX_ERRORTYPE use_buffer(OMX_HANDLETYPE      hComp,
417                 OMX_BUFFERHEADERTYPE **bufferHdr,
418                 OMX_U32              port,
419                 OMX_PTR              appData,
420                 OMX_U32              bytes,
421                 OMX_U8               *buffer);
422 
423         OMX_ERRORTYPE  use_input_heap_buffers(
424                 OMX_HANDLETYPE            hComp,
425                 OMX_BUFFERHEADERTYPE** bufferHdr,
426                 OMX_U32                   port,
427                 OMX_PTR                   appData,
428                 OMX_U32                   bytes,
429                 OMX_U8*                   buffer);
430 
431         OMX_ERRORTYPE use_EGL_image(OMX_HANDLETYPE     hComp,
432                 OMX_BUFFERHEADERTYPE **bufferHdr,
433                 OMX_U32              port,
434                 OMX_PTR              appData,
435                 void *               eglImage);
436         void complete_pending_buffer_done_cbs();
437         struct video_driver_context drv_ctx;
438 #ifdef _MSM8974_
439         OMX_ERRORTYPE allocate_extradata();
440         void free_extradata();
441         int update_resolution(int width, int height, int stride, int scan_lines);
442         OMX_ERRORTYPE is_video_session_supported();
443 #endif
444         int  m_pipe_in;
445         int  m_pipe_out;
446         pthread_t msg_thread_id;
447         pthread_t async_thread_id;
448         bool is_component_secure();
449         void buf_ref_add(OMX_U32 fd, OMX_U32 offset);
450         void buf_ref_remove(OMX_U32 fd, OMX_U32 offset);
451 
452     private:
453         // Bit Positions
454         enum flags_bit_positions {
455             // Defer transition to IDLE
456             OMX_COMPONENT_IDLE_PENDING            =0x1,
457             // Defer transition to LOADING
458             OMX_COMPONENT_LOADING_PENDING         =0x2,
459             // First  Buffer Pending
460             OMX_COMPONENT_FIRST_BUFFER_PENDING    =0x3,
461             // Second Buffer Pending
462             OMX_COMPONENT_SECOND_BUFFER_PENDING   =0x4,
463             // Defer transition to Enable
464             OMX_COMPONENT_INPUT_ENABLE_PENDING    =0x5,
465             // Defer transition to Enable
466             OMX_COMPONENT_OUTPUT_ENABLE_PENDING   =0x6,
467             // Defer transition to Disable
468             OMX_COMPONENT_INPUT_DISABLE_PENDING   =0x7,
469             // Defer transition to Disable
470             OMX_COMPONENT_OUTPUT_DISABLE_PENDING  =0x8,
471             //defer flush notification
472             OMX_COMPONENT_OUTPUT_FLUSH_PENDING    =0x9,
473             OMX_COMPONENT_INPUT_FLUSH_PENDING    =0xA,
474             OMX_COMPONENT_PAUSE_PENDING          =0xB,
475             OMX_COMPONENT_EXECUTE_PENDING        =0xC,
476             OMX_COMPONENT_OUTPUT_FLUSH_IN_DISABLE_PENDING =0xD,
477             OMX_COMPONENT_DISABLE_OUTPUT_DEFERRED=0xE
478         };
479 
480         // Deferred callback identifiers
481         enum {
482             //Event Callbacks from the vdec component thread context
483             OMX_COMPONENT_GENERATE_EVENT       = 0x1,
484             //Buffer Done callbacks from the vdec component thread context
485             OMX_COMPONENT_GENERATE_BUFFER_DONE = 0x2,
486             //Frame Done callbacks from the vdec component thread context
487             OMX_COMPONENT_GENERATE_FRAME_DONE  = 0x3,
488             //Buffer Done callbacks from the vdec component thread context
489             OMX_COMPONENT_GENERATE_FTB         = 0x4,
490             //Frame Done callbacks from the vdec component thread context
491             OMX_COMPONENT_GENERATE_ETB         = 0x5,
492             //Command
493             OMX_COMPONENT_GENERATE_COMMAND     = 0x6,
494             //Push-Pending Buffers
495             OMX_COMPONENT_PUSH_PENDING_BUFS    = 0x7,
496             // Empty Buffer Done callbacks
497             OMX_COMPONENT_GENERATE_EBD         = 0x8,
498             //Flush Event Callbacks from the vdec component thread context
499             OMX_COMPONENT_GENERATE_EVENT_FLUSH       = 0x9,
500             OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH = 0x0A,
501             OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH = 0x0B,
502             OMX_COMPONENT_GENERATE_FBD = 0xc,
503             OMX_COMPONENT_GENERATE_START_DONE = 0xD,
504             OMX_COMPONENT_GENERATE_PAUSE_DONE = 0xE,
505             OMX_COMPONENT_GENERATE_RESUME_DONE = 0xF,
506             OMX_COMPONENT_GENERATE_STOP_DONE = 0x10,
507             OMX_COMPONENT_GENERATE_HARDWARE_ERROR = 0x11,
508             OMX_COMPONENT_GENERATE_ETB_ARBITRARY = 0x12,
509             OMX_COMPONENT_GENERATE_PORT_RECONFIG = 0x13,
510             OMX_COMPONENT_GENERATE_EOS_DONE = 0x14,
511             OMX_COMPONENT_GENERATE_INFO_PORT_RECONFIG = 0x15,
512             OMX_COMPONENT_GENERATE_INFO_FIELD_DROPPED = 0x16,
513             OMX_COMPONENT_GENERATE_UNSUPPORTED_SETTING = 0x17,
514         };
515 
516         enum vc1_profile_type {
517             VC1_SP_MP_RCV = 1,
518             VC1_AP = 2
519         };
520 
521 #ifdef _MSM8974_
522         enum v4l2_ports {
523             CAPTURE_PORT,
524             OUTPUT_PORT,
525             MAX_PORT
526         };
527 #endif
528 
529         struct omx_event {
530             unsigned long param1;
531             unsigned long param2;
532             unsigned long id;
533         };
534 
535         struct omx_cmd_queue {
536             omx_event m_q[OMX_CORE_CONTROL_CMDQ_SIZE];
537             unsigned long m_read;
538             unsigned long m_write;
539             unsigned long m_size;
540 
541             omx_cmd_queue();
542             ~omx_cmd_queue();
543             bool insert_entry(unsigned long p1, unsigned long p2, unsigned long id);
544             bool pop_entry(unsigned long *p1,unsigned long *p2, unsigned long *id);
545             // get msgtype of the first ele from the queue
546             unsigned get_q_msg_type();
547 
548         };
549 
550 #ifdef _ANDROID_
551         struct ts_entry {
552             OMX_TICKS timestamp;
553             bool valid;
554         };
555 
556         struct ts_arr_list {
557             ts_entry m_ts_arr_list[MAX_NUM_INPUT_OUTPUT_BUFFERS];
558 
559             ts_arr_list();
560             ~ts_arr_list();
561 
562             bool insert_ts(OMX_TICKS ts);
563             bool pop_min_ts(OMX_TICKS &ts);
564             bool reset_ts_list();
565         };
566 #endif
567 
568         struct desc_buffer_hdr {
569             OMX_U8 *buf_addr;
570             OMX_U32 desc_data_size;
571         };
572         bool allocate_done(void);
573         bool allocate_input_done(void);
574         bool allocate_output_done(void);
575 
576         OMX_ERRORTYPE free_input_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
577         OMX_ERRORTYPE free_input_buffer(unsigned int bufferindex,
578                 OMX_BUFFERHEADERTYPE *pmem_bufferHdr);
579         OMX_ERRORTYPE free_output_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
580         void free_output_buffer_header();
581         void free_input_buffer_header();
582 
583         OMX_ERRORTYPE allocate_input_heap_buffer(OMX_HANDLETYPE       hComp,
584                 OMX_BUFFERHEADERTYPE **bufferHdr,
585                 OMX_U32              port,
586                 OMX_PTR              appData,
587                 OMX_U32              bytes);
588 
589 
590         OMX_ERRORTYPE allocate_input_buffer(OMX_HANDLETYPE       hComp,
591                 OMX_BUFFERHEADERTYPE **bufferHdr,
592                 OMX_U32              port,
593                 OMX_PTR              appData,
594                 OMX_U32              bytes);
595 
596         OMX_ERRORTYPE allocate_output_buffer(OMX_HANDLETYPE       hComp,
597                 OMX_BUFFERHEADERTYPE **bufferHdr,
598                 OMX_U32 port,OMX_PTR appData,
599                 OMX_U32              bytes);
600         OMX_ERRORTYPE use_output_buffer(OMX_HANDLETYPE hComp,
601                 OMX_BUFFERHEADERTYPE   **bufferHdr,
602                 OMX_U32                port,
603                 OMX_PTR                appData,
604                 OMX_U32                bytes,
605                 OMX_U8                 *buffer);
606 #ifdef MAX_RES_720P
607         OMX_ERRORTYPE get_supported_profile_level_for_720p(OMX_VIDEO_PARAM_PROFILELEVELTYPE *profileLevelType);
608 #endif
609 #ifdef MAX_RES_1080P
610         OMX_ERRORTYPE get_supported_profile_level_for_1080p(OMX_VIDEO_PARAM_PROFILELEVELTYPE *profileLevelType);
611 #endif
612 
613         OMX_ERRORTYPE allocate_desc_buffer(OMX_U32 index);
614         OMX_ERRORTYPE allocate_output_headers();
615         bool execute_omx_flush(OMX_U32);
616         bool execute_output_flush();
617         bool execute_input_flush();
618         OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE hComp,
619                 OMX_BUFFERHEADERTYPE * buffer);
620 
621         OMX_ERRORTYPE fill_buffer_done(OMX_HANDLETYPE hComp,
622                 OMX_BUFFERHEADERTYPE * buffer);
623         OMX_ERRORTYPE empty_this_buffer_proxy(OMX_HANDLETYPE       hComp,
624                 OMX_BUFFERHEADERTYPE *buffer);
625 
626         OMX_ERRORTYPE empty_this_buffer_proxy_arbitrary(OMX_HANDLETYPE hComp,
627                 OMX_BUFFERHEADERTYPE *buffer
628                 );
629 
630         OMX_ERRORTYPE push_input_buffer (OMX_HANDLETYPE hComp);
631         OMX_ERRORTYPE push_input_sc_codec (OMX_HANDLETYPE hComp);
632         OMX_ERRORTYPE push_input_h264 (OMX_HANDLETYPE hComp);
633         OMX_ERRORTYPE push_input_hevc (OMX_HANDLETYPE hComp);
634         OMX_ERRORTYPE push_input_vc1 (OMX_HANDLETYPE hComp);
635 
636         OMX_ERRORTYPE fill_this_buffer_proxy(OMX_HANDLETYPE       hComp,
637                 OMX_BUFFERHEADERTYPE *buffer);
638         bool release_done();
639 
640         bool release_output_done();
641         bool release_input_done();
642         OMX_ERRORTYPE get_buffer_req(vdec_allocatorproperty *buffer_prop);
643         OMX_ERRORTYPE set_buffer_req(vdec_allocatorproperty *buffer_prop);
644         OMX_ERRORTYPE start_port_reconfig();
645         OMX_ERRORTYPE update_picture_resolution();
646         int stream_off(OMX_U32 port);
647         void adjust_timestamp(OMX_S64 &act_timestamp);
648         void set_frame_rate(OMX_S64 act_timestamp);
649         void handle_extradata_secure(OMX_BUFFERHEADERTYPE *p_buf_hdr);
650         void handle_extradata(OMX_BUFFERHEADERTYPE *p_buf_hdr);
651         void print_debug_extradata(OMX_OTHER_EXTRADATATYPE *extra);
652 #ifdef _MSM8974_
653         void append_interlace_extradata(OMX_OTHER_EXTRADATATYPE *extra,
654                 OMX_U32 interlaced_format_type, bool is_mbaff);
655         OMX_ERRORTYPE enable_extradata(OMX_U32 requested_extradata, bool is_internal,
656                 bool enable = true);
657         void append_frame_info_extradata(OMX_OTHER_EXTRADATATYPE *extra,
658                 OMX_U32 num_conceal_mb,
659                 OMX_U32 picture_type,
660                 OMX_U32 frame_rate,
661                 OMX_TICKS time_stamp,
662                 struct msm_vidc_panscan_window_payload *panscan_payload,
663                 struct vdec_aspectratioinfo *aspect_ratio_info);
664 #else
665         void append_interlace_extradata(OMX_OTHER_EXTRADATATYPE *extra,
666                 OMX_U32 interlaced_format_type, OMX_U32 buf_index);
667         OMX_ERRORTYPE enable_extradata(OMX_U32 requested_extradata, bool enable = true);
668 #endif
669         void append_frame_info_extradata(OMX_OTHER_EXTRADATATYPE *extra,
670                 OMX_U32 num_conceal_mb,
671                 OMX_U32 picture_type,
672                 OMX_S64 timestamp,
673                 OMX_U32 frame_rate,
674                 struct vdec_aspectratioinfo *aspect_ratio_info);
675         void fill_aspect_ratio_info(struct vdec_aspectratioinfo *aspect_ratio_info,
676                 OMX_QCOM_EXTRADATA_FRAMEINFO *frame_info);
677         void append_terminator_extradata(OMX_OTHER_EXTRADATATYPE *extra);
678         OMX_ERRORTYPE update_portdef(OMX_PARAM_PORTDEFINITIONTYPE *portDefn);
679         void append_portdef_extradata(OMX_OTHER_EXTRADATATYPE *extra);
680         void append_frame_dimension_extradata(OMX_OTHER_EXTRADATATYPE *extra);
681         void append_extn_extradata(OMX_OTHER_EXTRADATATYPE *extra, OMX_OTHER_EXTRADATATYPE *p_extn);
682         void append_user_extradata(OMX_OTHER_EXTRADATATYPE *extra, OMX_OTHER_EXTRADATATYPE *p_user);
683         void append_concealmb_extradata(OMX_OTHER_EXTRADATATYPE *extra,
684                 OMX_OTHER_EXTRADATATYPE *p_concealmb, OMX_U8 *conceal_mb_data);
685         void append_framepack_extradata(OMX_OTHER_EXTRADATATYPE *extra,
686                 struct msm_vidc_s3d_frame_packing_payload *s3d_frame_packing_payload);
687         void append_qp_extradata(OMX_OTHER_EXTRADATATYPE *extra,
688                 struct msm_vidc_frame_qp_payload *qp_payload);
689         void append_bitsinfo_extradata(OMX_OTHER_EXTRADATATYPE *extra,
690                 struct msm_vidc_frame_bits_info_payload *bits_payload);
691         void insert_demux_addr_offset(OMX_U32 address_offset);
692         void extract_demux_addr_offsets(OMX_BUFFERHEADERTYPE *buf_hdr);
693         OMX_ERRORTYPE handle_demux_data(OMX_BUFFERHEADERTYPE *buf_hdr);
694         OMX_U32 count_MB_in_extradata(OMX_OTHER_EXTRADATATYPE *extra);
695 
696         bool align_pmem_buffers(int pmem_fd, OMX_U32 buffer_size,
697                 OMX_U32 alignment);
698 #ifdef USE_ION
699         int alloc_map_ion_memory(OMX_U32 buffer_size,
700                 OMX_U32 alignment, struct ion_allocation_data *alloc_data,
701                 struct ion_fd_data *fd_data,int flag);
702         void free_ion_memory(struct vdec_ion *buf_ion_info);
703 #endif
704 
705 
706         OMX_ERRORTYPE send_command_proxy(OMX_HANDLETYPE  hComp,
707                 OMX_COMMANDTYPE cmd,
708                 OMX_U32         param1,
709                 OMX_PTR         cmdData);
710         bool post_event( unsigned long p1,
711                 unsigned long p2,
712                 unsigned long id
713                    );
clip2(int x)714         inline int clip2(int x) {
715             x = x -1;
716             x = x | x >> 1;
717             x = x | x >> 2;
718             x = x | x >> 4;
719             x = x | x >> 16;
720             x = x + 1;
721             return x;
722         }
723 
724 #ifdef MAX_RES_1080P
725         OMX_ERRORTYPE vdec_alloc_h264_mv();
726         void vdec_dealloc_h264_mv();
727         OMX_ERRORTYPE vdec_alloc_meta_buffers();
728         void vdec_dealloc_meta_buffers();
729 #endif
730 
omx_report_error()731         inline void omx_report_error () {
732             if (m_cb.EventHandler && !m_error_propogated) {
733                 ALOGE("\nERROR: Sending OMX_EventError to Client");
734                 m_error_propogated = true;
735                 m_cb.EventHandler(&m_cmp,m_app_data,
736                         OMX_EventError,OMX_ErrorHardware,0,NULL);
737             }
738         }
739 
omx_report_unsupported_setting()740         inline void omx_report_unsupported_setting () {
741             if (m_cb.EventHandler && !m_error_propogated) {
742                 DEBUG_PRINT_ERROR(
743                         "\nERROR: Sending OMX_ErrorUnsupportedSetting to Client");
744                 m_error_propogated = true;
745                 m_cb.EventHandler(&m_cmp,m_app_data,
746                         OMX_EventError,OMX_ErrorUnsupportedSetting,0,NULL);
747             }
748         }
749 #ifdef _ANDROID_
750         OMX_ERRORTYPE createDivxDrmContext();
751 #endif //_ANDROID_
752 #if defined (_ANDROID_HONEYCOMB_) || defined (_ANDROID_ICS_)
753         OMX_ERRORTYPE use_android_native_buffer(OMX_IN OMX_HANDLETYPE hComp, OMX_PTR data);
754 #endif
755 #if defined (_ANDROID_ICS_)
756         struct nativebuffer {
757             native_handle_t *nativehandle;
758             private_handle_t *privatehandle;
759             int inuse;
760         };
761         nativebuffer native_buffer[MAX_NUM_INPUT_OUTPUT_BUFFERS];
762 #endif
763 
764 
765         //*************************************************************
766         //*******************MEMBER VARIABLES *************************
767         //*************************************************************
768         pthread_mutex_t       m_lock;
769         pthread_mutex_t       c_lock;
770         //sem to handle the minimum procesing of commands
771         sem_t                 m_cmd_lock;
772         sem_t                 m_safe_flush;
773         bool              m_error_propogated;
774         // compression format
775         OMX_VIDEO_CODINGTYPE eCompressionFormat;
776         // OMX State
777         OMX_STATETYPE m_state;
778         // Application data
779         OMX_PTR m_app_data;
780         // Application callbacks
781         OMX_CALLBACKTYPE m_cb;
782         OMX_PRIORITYMGMTTYPE m_priority_mgm ;
783         OMX_PARAM_BUFFERSUPPLIERTYPE m_buffer_supplier;
784         // fill this buffer queue
785         omx_cmd_queue         m_ftb_q;
786         // Command Q for rest of the events
787         omx_cmd_queue         m_cmd_q;
788         omx_cmd_queue         m_etb_q;
789         // Input memory pointer
790         OMX_BUFFERHEADERTYPE  *m_inp_mem_ptr;
791         // Output memory pointer
792         OMX_BUFFERHEADERTYPE  *m_out_mem_ptr;
793         // number of input bitstream error frame count
794         unsigned int m_inp_err_count;
795 #ifdef _ANDROID_
796         // Timestamp list
797         ts_arr_list           m_timestamp_list;
798 #endif
799 
800         bool input_flush_progress;
801         bool output_flush_progress;
802         bool input_use_buffer;
803         bool output_use_buffer;
804         bool ouput_egl_buffers;
805         OMX_BOOL m_use_output_pmem;
806         OMX_BOOL m_out_mem_region_smi;
807         OMX_BOOL m_out_pvt_entry_pmem;
808 
809         int pending_input_buffers;
810         int pending_output_buffers;
811         // bitmask array size for output side
812         unsigned int m_out_bm_count;
813         // bitmask array size for input side
814         unsigned int m_inp_bm_count;
815         //Input port Populated
816         OMX_BOOL m_inp_bPopulated;
817         //Output port Populated
818         OMX_BOOL m_out_bPopulated;
819         // encapsulate the waiting states.
820         unsigned int m_flags;
821 
822 #ifdef _ANDROID_
823         // Heap pointer to frame buffers
824         struct vidc_heap {
825             sp<MemoryHeapBase>    video_heap_ptr;
826         };
827         struct vidc_heap *m_heap_ptr;
828         unsigned int m_heap_count;
829 #endif //_ANDROID_
830         // store I/P PORT state
831         OMX_BOOL m_inp_bEnabled;
832         // store O/P PORT state
833         OMX_BOOL m_out_bEnabled;
834         OMX_U32 m_in_alloc_cnt;
835         OMX_U8                m_cRole[OMX_MAX_STRINGNAME_SIZE];
836         // Platform specific details
837         OMX_QCOM_PLATFORM_PRIVATE_LIST      *m_platform_list;
838         OMX_QCOM_PLATFORM_PRIVATE_ENTRY     *m_platform_entry;
839         OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *m_pmem_info;
840         // SPS+PPS sent as part of set_config
841         OMX_VENDOR_EXTRADATATYPE            m_vendor_config;
842 
843         /*Variables for arbitrary Byte parsing support*/
844         frame_parse m_frame_parser;
845         h264_stream_parser *h264_parser;
846         MP4_Utils mp4_headerparser;
847         HEVC_Utils m_hevc_utils;
848 
849         omx_cmd_queue m_input_pending_q;
850         omx_cmd_queue m_input_free_q;
851         bool arbitrary_bytes;
852         OMX_BUFFERHEADERTYPE  h264_scratch;
853         OMX_BUFFERHEADERTYPE  *psource_frame;
854         OMX_BUFFERHEADERTYPE  *pdest_frame;
855         OMX_BUFFERHEADERTYPE  *m_inp_heap_ptr;
856         OMX_BUFFERHEADERTYPE  **m_phdr_pmem_ptr;
857         unsigned int m_heap_inp_bm_count;
858         codec_type codec_type_parse;
859         bool first_frame_meta;
860         unsigned frame_count;
861         unsigned nal_count;
862         unsigned nal_length;
863         bool look_ahead_nal;
864         int first_frame;
865         unsigned char *first_buffer;
866         int first_frame_size;
867         unsigned char m_hwdevice_name[80];
868         FILE *m_device_file_ptr;
869         enum vc1_profile_type m_vc1_profile;
870         OMX_S64 h264_last_au_ts;
871         OMX_U32 h264_last_au_flags;
872         OMX_U32 m_demux_offsets[8192];
873         OMX_U32 m_demux_entries;
874         OMX_U32 m_disp_hor_size;
875         OMX_U32 m_disp_vert_size;
876 
877         OMX_S64 prev_ts;
878         bool rst_prev_ts;
879         OMX_U32 frm_int;
880 
881         struct vdec_allocatorproperty op_buf_rcnfg;
882         bool in_reconfig;
883         OMX_NATIVE_WINDOWTYPE m_display_id;
884         OMX_U32 client_extradata;
885 #ifdef _ANDROID_
886         bool m_debug_timestamp;
887         bool perf_flag;
888         OMX_U32 proc_frms, latency;
889         perf_metrics fps_metrics;
890         perf_metrics dec_time;
891         bool m_reject_avc_1080p_mp;
892         bool m_enable_android_native_buffers;
893         bool m_use_android_native_buffers;
894         bool m_debug_extradata;
895         bool m_debug_concealedmb;
896         bool m_disable_dynamic_buf_mode;
897         OMX_U32 m_conceal_color;
898 #endif
899 
900         struct h264_mv_buffer {
901             unsigned char* buffer;
902             int size;
903             int count;
904             int pmem_fd;
905             int offset;
906         };
907         h264_mv_buffer h264_mv_buff;
908 
909         struct meta_buffer {
910             unsigned char* buffer;
911             int size;
912             int count;
913             int pmem_fd;
914             int pmem_fd_iommu;
915             int offset;
916         };
917         meta_buffer meta_buff;
918         extra_data_handler extra_data_handle;
919 #ifdef _ANDROID_
920         DivXDrmDecrypt* iDivXDrmDecrypt;
921 #endif //_ANDROID_
922         OMX_PARAM_PORTDEFINITIONTYPE m_port_def;
923         OMX_QCOM_FRAME_PACK_ARRANGEMENT m_frame_pack_arrangement;
924         omx_time_stamp_reorder time_stamp_dts;
925         desc_buffer_hdr *m_desc_buffer_ptr;
926         bool secure_mode;
927         bool external_meta_buffer;
928         bool external_meta_buffer_iommu;
929         OMX_QCOM_EXTRADATA_FRAMEINFO *m_extradata;
930         OMX_OTHER_EXTRADATATYPE *m_other_extradata;
931         bool codec_config_flag;
932 #ifdef _MSM8974_
933         int capture_capability;
934         int output_capability;
935         bool streaming[MAX_PORT];
936         OMX_CONFIG_RECTTYPE rectangle;
937         int prev_n_filled_len;
938         bool is_down_scalar_enabled;
939 #endif
940         bool m_power_hinted;
941         bool is_q6_platform;
942         OMX_ERRORTYPE power_module_register();
943         OMX_ERRORTYPE power_module_deregister();
944         bool msg_thread_created;
945         bool async_thread_created;
946 
947         OMX_VIDEO_PARAM_PROFILELEVELTYPE m_profile_lvl;
948         OMX_U32 m_profile;
949 
950         //variables to handle dynamic buffer mode
951         bool dynamic_buf_mode;
952         struct dynamic_buf_list *out_dynamic_list;
953         bool m_smoothstreaming_mode;
954         OMX_U32 m_smoothstreaming_width;
955         OMX_U32 m_smoothstreaming_height;
956         OMX_ERRORTYPE enable_smoothstreaming();
957 
958         unsigned int m_fill_output_msg;
959         bool client_set_fps;
960         class allocate_color_convert_buf
961         {
962             public:
963                 allocate_color_convert_buf();
964                 ~allocate_color_convert_buf();
965                 void set_vdec_client(void *);
966                 void update_client();
967                 bool set_color_format(OMX_COLOR_FORMATTYPE dest_color_format);
968                 bool get_color_format(OMX_COLOR_FORMATTYPE &dest_color_format);
969                 bool update_buffer_req();
970                 bool get_buffer_req(unsigned int &buffer_size);
971                 OMX_BUFFERHEADERTYPE* get_il_buf_hdr();
972                 OMX_BUFFERHEADERTYPE* get_il_buf_hdr(OMX_BUFFERHEADERTYPE *input_hdr);
973                 OMX_BUFFERHEADERTYPE* get_dr_buf_hdr(OMX_BUFFERHEADERTYPE *input_hdr);
974                 OMX_BUFFERHEADERTYPE* convert(OMX_BUFFERHEADERTYPE *header);
975                 OMX_BUFFERHEADERTYPE* queue_buffer(OMX_BUFFERHEADERTYPE *header);
976                 OMX_ERRORTYPE allocate_buffers_color_convert(OMX_HANDLETYPE hComp,
977                         OMX_BUFFERHEADERTYPE **bufferHdr,OMX_U32 port,OMX_PTR appData,
978                         OMX_U32 bytes);
979                 OMX_ERRORTYPE free_output_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
980             private:
981 #define MAX_COUNT 32
982                 omx_vdec *omx;
983                 bool enabled;
984                 OMX_COLOR_FORMATTYPE ColorFormat;
985                 void init_members();
986                 bool color_convert_mode;
987                 ColorConvertFormat dest_format;
988                 class omx_c2d_conv c2d;
989                 unsigned int allocated_count;
990                 unsigned int buffer_size_req;
991                 unsigned int buffer_alignment_req;
992                 OMX_QCOM_PLATFORM_PRIVATE_LIST      m_platform_list_client[MAX_COUNT];
993                 OMX_QCOM_PLATFORM_PRIVATE_ENTRY     m_platform_entry_client[MAX_COUNT];
994                 OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO m_pmem_info_client[MAX_COUNT];
995                 OMX_BUFFERHEADERTYPE  m_out_mem_ptr_client[MAX_COUNT];
996 #ifdef USE_ION
997                 struct vdec_ion op_buf_ion_info[MAX_COUNT];
998 #endif
999                 unsigned char *pmem_baseaddress[MAX_COUNT];
1000                 unsigned long pmem_fd[MAX_COUNT];
1001                 struct vidc_heap {
1002                     sp<MemoryHeapBase>    video_heap_ptr;
1003                 };
1004                 struct vidc_heap m_heap_ptr[MAX_COUNT];
1005         };
1006 #if  defined (_MSM8960_) || defined (_MSM8974_)
1007         allocate_color_convert_buf client_buffers;
1008 #endif
1009         struct video_decoder_capability m_decoder_capability;
1010         struct debug_cap m_debug;
1011         int log_input_buffers(const char *, int);
1012         int log_output_buffers(OMX_BUFFERHEADERTYPE *);
1013 #ifdef _MSM8974_
1014         void send_codec_config();
1015 #endif
1016         OMX_TICKS m_last_rendered_TS;
1017 
1018         class perf_control {
1019             // 2 cores will be requested if framerate is beyond 45 fps
1020             static const int MIN_FRAME_DURATION_FOR_PERF_REQUEST_US = (1e6 / 45);
1021             typedef int (*perf_lock_acquire_t)(int, int, int*, int);
1022             typedef int (*perf_lock_release_t)(int);
1023 
1024             public:
1025                 perf_control();
1026                 ~perf_control();
1027                 void request_cores(int frame_duration_us);
1028             private:
1029                 void *m_perf_lib;
1030                 int m_perf_handle;
1031                 perf_lock_acquire_t m_perf_lock_acquire;
1032                 perf_lock_release_t m_perf_lock_release;
1033                 //void (*perf_cpu_boost)(int ntasks);
1034                 void load_lib();
1035         };
1036         perf_control m_perf_control;
1037 
1038         volatile int32_t m_queued_codec_config_count;
getColorFormatAt(OMX_U32 index)1039         static OMX_COLOR_FORMATTYPE getColorFormatAt(OMX_U32 index) {
1040             OMX_COLOR_FORMATTYPE formats[] = {
1041                 [0] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
1042                 [1] = OMX_COLOR_FormatYUV420SemiPlanar,
1043                 [2] = OMX_COLOR_FormatYUV420Planar,
1044                 [3] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView,
1045             };
1046             return (index < sizeof(formats) / sizeof(OMX_COLOR_FORMATTYPE)) ?
1047                 formats[index] : OMX_COLOR_FormatMax;
1048         }
1049 
1050         static OMX_ERRORTYPE describeColorFormat(DescribeColorFormatParams *params);
1051 };
1052 
1053 #ifdef _MSM8974_
1054 enum instance_state {
1055     MSM_VIDC_CORE_UNINIT_DONE = 0x0001,
1056     MSM_VIDC_CORE_INIT,
1057     MSM_VIDC_CORE_INIT_DONE,
1058     MSM_VIDC_OPEN,
1059     MSM_VIDC_OPEN_DONE,
1060     MSM_VIDC_LOAD_RESOURCES,
1061     MSM_VIDC_LOAD_RESOURCES_DONE,
1062     MSM_VIDC_START,
1063     MSM_VIDC_START_DONE,
1064     MSM_VIDC_STOP,
1065     MSM_VIDC_STOP_DONE,
1066     MSM_VIDC_RELEASE_RESOURCES,
1067     MSM_VIDC_RELEASE_RESOURCES_DONE,
1068     MSM_VIDC_CLOSE,
1069     MSM_VIDC_CLOSE_DONE,
1070     MSM_VIDC_CORE_UNINIT,
1071 };
1072 
1073 enum vidc_resposes_id {
1074     MSM_VIDC_DECODER_FLUSH_DONE = 0x11,
1075     MSM_VIDC_DECODER_EVENT_CHANGE,
1076 };
1077 
1078 #endif // _MSM8974_
1079 
1080 #endif // __OMX_VDEC_H__
1081