summaryrefslogtreecommitdiffstats
path: root/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
blob: 843b0c8d1250c76317de09fce7bafe8ce2bc7874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
/*--------------------------------------------------------------------------
Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above
      copyright notice, this list of conditions and the following
      disclaimer in the documentation and/or other materials provided
      with the distribution.
    * Neither the name of The Linux Foundation nor the names of its
      contributors may be used to endorse or promote products derived
      from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------*/
#ifndef __OMX_VENC_DEV__
#define __OMX_VENC_DEV__

#include "OMX_Types.h"
#include "OMX_Core.h"
#include "OMX_VideoExt.h"
#include "OMX_QCOMExtns.h"
#include "qc_omx_component.h"
#include "VQZip.h"
#include "omx_video_common.h"
#include "omx_video_base.h"
#include "omx_video_encoder.h"
#include <linux/videodev2.h>
#include <media/msm_vidc.h>
#include <poll.h>

#define TIMEOUT 5*60*1000
#define BIT(num) (1 << (num))
#define MAX_HYB_HIERP_LAYERS 6
#define MAX_V4L2_BUFS 64 //VB2_MAX_FRAME

enum hier_type {
    HIER_NONE = 0x0,
    HIER_P = 0x1,
    HIER_B = 0x2,
    HIER_P_HYBRID = 0x3,
};

struct msm_venc_switch {
    unsigned char    status;
};

struct msm_venc_allocatorproperty {
    unsigned long     mincount;
    unsigned long     actualcount;
    unsigned long     datasize;
    unsigned long     suffixsize;
    unsigned long     alignment;
    unsigned long     bufpoolid;
};

struct msm_venc_basecfg {
    unsigned long    input_width;
    unsigned long    input_height;
    unsigned long    dvs_width;
    unsigned long    dvs_height;
    unsigned long    codectype;
    unsigned long    fps_num;
    unsigned long    fps_den;
    unsigned long    targetbitrate;
    unsigned long    inputformat;
};

struct msm_venc_profile {
    unsigned long    profile;
};
struct msm_venc_profilelevel {
    unsigned long    level;
};

struct msm_venc_sessionqp {
    unsigned long    iframeqp;
    unsigned long    pframeqp;
    unsigned long    bframeqp;
};

struct msm_venc_initqp {
    unsigned long    iframeqp;
    unsigned long    pframeqp;
    unsigned long    bframeqp;
    unsigned long    enableinitqp;
};

struct msm_venc_qprange {
    unsigned long    maxqp;
    unsigned long    minqp;
};
struct msm_venc_intraperiod {
    unsigned long    num_pframes;
    unsigned long    num_bframes;
};
struct msm_venc_seqheader {
    unsigned char *hdrbufptr;
    unsigned long    bufsize;
    unsigned long    hdrlen;
};

struct msm_venc_capability {
    unsigned long    codec_types;
    unsigned long    maxframe_width;
    unsigned long    maxframe_height;
    unsigned long    maxtarget_bitrate;
    unsigned long    maxframe_rate;
    unsigned long    input_formats;
    unsigned char    dvs;
};

struct msm_venc_entropycfg {
    unsigned longentropysel;
    unsigned long    cabacmodel;
};

struct msm_venc_dbcfg {
    unsigned long    db_mode;
    unsigned long    slicealpha_offset;
    unsigned long    slicebeta_offset;
};

struct msm_venc_intrarefresh {
    unsigned long    irmode;
    unsigned long    mbcount;
};

struct msm_venc_multiclicecfg {
    unsigned long    mslice_mode;
    unsigned long    mslice_size;
};

struct msm_venc_bufferflush {
    unsigned long    flush_mode;
};

struct msm_venc_ratectrlcfg {
    unsigned long    rcmode;
};

struct    msm_venc_voptimingcfg {
    unsigned long    voptime_resolution;
};
struct msm_venc_framerate {
    unsigned long    fps_denominator;
    unsigned long    fps_numerator;
};

struct msm_venc_targetbitrate {
    unsigned long    target_bitrate;
};


struct msm_venc_rotation {
    unsigned long    rotation;
};

struct msm_venc_timeout {
    unsigned long    millisec;
};

struct msm_venc_headerextension {
    unsigned long    header_extension;
};

struct msm_venc_video_capability {
    unsigned int min_width;
    unsigned int max_width;
    unsigned int min_height;
    unsigned int max_height;
};

struct msm_venc_idrperiod {
    unsigned long idrperiod;
};

struct msm_venc_slice_delivery {
    unsigned long enable;
};

struct msm_venc_hierlayers {
    unsigned int numlayers;
    enum hier_type hier_mode;
};

struct msm_venc_ltrinfo {
    unsigned int enabled;
    unsigned int count;
};

struct msm_venc_perf_level {
    unsigned int perflevel;
};

struct msm_venc_vui_timing_info {
    unsigned int enabled;
};

struct msm_venc_vqzip_sei_info {
    unsigned int enabled;
};

struct msm_venc_peak_bitrate {
    unsigned int peakbitrate;
};

struct msm_venc_vpx_error_resilience {
    unsigned int enable;
};

struct msm_venc_priority {
    OMX_U32 priority;
};

struct msm_venc_hybrid_hp {
   unsigned int nSize;
   unsigned int nKeyFrameInterval;
   unsigned int nTemporalLayerBitrateRatio[OMX_VIDEO_MAX_HP_LAYERS];
   unsigned int nMinQuantizer;
   unsigned int nMaxQuantizer;
   unsigned int nHpLayers;
};

enum v4l2_ports {
    CAPTURE_PORT,
    OUTPUT_PORT,
    MAX_PORT
};

class encExtradata {
private:
    enum {
        FREE,
        BUSY,
        FOR_CONFIG,
    };
    struct info {
        int status;
        void *cookie;
    };
    pthread_mutex_t lock;
    unsigned int mCount;
    ssize_t mSize;
    char *mUaddr;
    struct venc_ion mIon;
    struct info mIndex[MAX_V4L2_BUFS];
    class omx_venc *mVencHandle;
    int __get(char **userptr, int *fd, unsigned *offset, ssize_t *size, int type);
    OMX_ERRORTYPE __allocate();
    void __free();
    void __debug();
public:
    unsigned int mDbgEtbCount;
    encExtradata(class omx_venc *venc_handle);
    ~encExtradata();
    void update(unsigned int count, ssize_t size);
    /* Get extradata whose status is FREE. */
    OMX_ERRORTYPE get(char **userptr, int *fd, unsigned *offset, ssize_t *size);
    /* Get extradata which is tagged with cookie via setCookieForConfigExtradata. If no extradata is tagged with this cookie then get extradata whose status is FREE. */
    OMX_ERRORTYPE get(void *cookie, char **userptr, int *fd, unsigned *offset, ssize_t *size);
    /* return the extradata back to the pool of FREE extradata. */
    OMX_ERRORTYPE put(char *userptr);
    /* If there is already an extradata with status FOR_CONFIG, return that else return FREE extradata. */
    OMX_ERRORTYPE getForConfig(char **userptr, int *fd, unsigned *offset, ssize_t *size);
    /* Return the extradata pointer corresponding to the index. Does not change status of extradata. */
    OMX_ERRORTYPE peek(unsigned index, char **userptr, int *fd, unsigned* offset, ssize_t *size);
    /* Attach a cookie to extradata. Extradata with this cookie can be retrieved via getExtradata call.*/
    void setCookieForConfig(void *cookie);
    ssize_t getBufferSize();
    unsigned int getBufferCount();
};

struct statistics {
    struct timeval prev_tv;
    int prev_fbd;
    int bytes_generated;
};

enum rc_modes {
    RC_VBR_VFR = BIT(0),
    RC_VBR_CFR = BIT(1),
    RC_CBR_VFR = BIT(2),
    RC_CBR_CFR = BIT(3),
    RC_ALL = (RC_VBR_VFR | RC_VBR_CFR
        | RC_CBR_VFR | RC_CBR_CFR)
};

class venc_dev
{
    public:
        venc_dev(class omx_venc *venc_class); //constructor
        ~venc_dev(); //des

        static void* async_venc_message_thread (void *);
        bool venc_open(OMX_U32);
        void venc_close();
        unsigned venc_stop(void);
        unsigned venc_pause(void);
        unsigned venc_start(void);
        unsigned venc_flush(unsigned);
#ifdef _ANDROID_ICS_
        bool venc_set_meta_mode(bool);
#endif
        unsigned venc_resume(void);
        unsigned venc_start_done(void);
        unsigned venc_stop_done(void);
        unsigned venc_set_message_thread_id(pthread_t);
        bool venc_use_buf(void*, unsigned,unsigned);
        bool venc_free_buf(void*, unsigned);
        bool venc_empty_buf(void *, void *,unsigned,unsigned);
        bool venc_fill_buf(void *, void *,unsigned,unsigned);

        bool venc_get_buf_req(OMX_U32 *,OMX_U32 *,
                OMX_U32 *,OMX_U32);
        bool venc_set_buf_req(OMX_U32 *,OMX_U32 *,
                OMX_U32 *,OMX_U32);
        bool venc_set_param(void *,OMX_INDEXTYPE);
        bool venc_set_config(void *configData, OMX_INDEXTYPE index);
        bool venc_get_profile_level(OMX_U32 *eProfile,OMX_U32 *eLevel);
        bool venc_get_seq_hdr(void *, unsigned, unsigned *);
        bool venc_loaded_start(void);
        bool venc_loaded_stop(void);
        bool venc_loaded_start_done(void);
        bool venc_loaded_stop_done(void);
        bool venc_is_video_session_supported(unsigned long width, unsigned long height);
        bool venc_color_align(OMX_BUFFERHEADERTYPE *buffer, OMX_U32 width,
                        OMX_U32 height);
        bool venc_get_performance_level(OMX_U32 *perflevel);
        bool venc_get_vui_timing_info(OMX_U32 *enabled);
        bool venc_get_vqzip_sei_info(OMX_U32 *enabled);
        bool venc_get_peak_bitrate(OMX_U32 *peakbitrate);
        bool venc_get_batch_size(OMX_U32 *size);
        bool venc_get_output_log_flag();
        bool venc_check_valid_config();
        int venc_output_log_buffers(const char *buffer_addr, int buffer_len);
        int venc_input_log_buffers(OMX_BUFFERHEADERTYPE *buffer, int fd, int plane_offset,
                        unsigned long inputformat);
        int venc_extradata_log_buffers(char *buffer_addr);
        bool venc_set_bitrate_type(OMX_U32 type);
        int venc_roiqp_log_buffers(OMX_QTI_VIDEO_CONFIG_ROIINFO *roiInfo);

        class venc_dev_vqzip
        {
            public:
                venc_dev_vqzip();
                ~venc_dev_vqzip();
                bool init();
                void deinit();
                struct VQZipConfig pConfig;
                int tempSEI[300];
                int fill_stats_data(void* pBuf, void *pStats);
                typedef void (*vqzip_deinit_t)(void*);
                typedef void* (*vqzip_init_t)(void);
                typedef VQZipStatus (*vqzip_compute_stats_t)(void* const , const void * const , const VQZipConfig* ,VQZipStats*);
            private:
                pthread_mutex_t lock;
                void *mLibHandle;
                void *mVQZIPHandle;
                vqzip_init_t mVQZIPInit;
                vqzip_deinit_t mVQZIPDeInit;
                vqzip_compute_stats_t mVQZIPComputeStats;
        };
        venc_dev_vqzip vqzip;
        struct venc_debug_cap m_debug;
        OMX_U32 m_nDriver_fd;
        int m_poll_efd;
        bool m_profile_set;
        bool m_level_set;
        int num_input_planes, num_output_planes;
        int etb, ebd, ftb, fbd;
        struct recon_buffer {
            unsigned char* virtual_address;
            int pmem_fd;
            int size;
            int alignment;
            int offset;
#ifdef USE_ION
            int ion_device_fd;
            struct ion_allocation_data alloc_data;
            struct ion_fd_data ion_alloc_fd;
#endif
        };

        int stopped;
        int resume_in_stopped;
        bool m_max_allowed_bitrate_check;
        pthread_t m_tid;
        bool async_thread_created;
        class omx_venc *venc_handle;
        int append_mbi_extradata(void *, struct msm_vidc_extradata_header*);
        bool handle_output_extradata(void *);
        bool handle_input_extradata(void *, int);
        int venc_set_format(int);
        bool deinterlace_enabled;
        bool hw_overload;
        bool is_gralloc_source_ubwc;
        bool is_camera_source_ubwc;
        OMX_U32 fd_list[64];
        encExtradata mInputExtradata;
        encExtradata mOutputExtradata;

    private:
        OMX_U32                             m_codec;
        struct msm_venc_basecfg             m_sVenc_cfg;
        struct msm_venc_ratectrlcfg         rate_ctrl;
        struct msm_venc_targetbitrate       bitrate;
        struct msm_venc_intraperiod         intra_period;
        struct msm_venc_profile             codec_profile;
        struct msm_venc_profilelevel        profile_level;
        struct msm_venc_switch              set_param;
        struct msm_venc_voptimingcfg        time_inc;
        struct msm_venc_allocatorproperty   m_sInput_buff_property;
        struct msm_venc_allocatorproperty   m_sOutput_buff_property;
        struct msm_venc_sessionqp           session_qp;
        struct msm_venc_initqp              init_qp;
        struct msm_venc_qprange             session_qp_range;
        struct msm_venc_qprange             session_qp_values;
        struct msm_venc_multiclicecfg       multislice;
        struct msm_venc_entropycfg          entropy;
        struct msm_venc_dbcfg               dbkfilter;
        struct msm_venc_intrarefresh        intra_refresh;
        struct msm_venc_headerextension     hec;
        struct msm_venc_voptimingcfg        voptimecfg;
        struct msm_venc_video_capability    capability;
        struct msm_venc_idrperiod           idrperiod;
        struct msm_venc_slice_delivery      slice_mode;
        struct msm_venc_hierlayers          hier_layers;
        struct msm_venc_perf_level          performance_level;
        struct msm_venc_vui_timing_info     vui_timing_info;
        struct msm_venc_vqzip_sei_info      vqzip_sei_info;
        struct msm_venc_peak_bitrate        peak_bitrate;
        struct msm_venc_ltrinfo             ltrinfo;
        struct msm_venc_vpx_error_resilience vpx_err_resilience;
        struct msm_venc_priority            sess_priority;
        OMX_U32                             operating_rate;
        int rc_off_level;
        struct msm_venc_hybrid_hp           hybrid_hp;

        bool venc_set_profile_level(OMX_U32 eProfile,OMX_U32 eLevel);
        bool venc_set_intra_period(OMX_U32 nPFrames, OMX_U32 nBFrames);
        bool venc_set_target_bitrate(OMX_U32 nTargetBitrate, OMX_U32 config);
        bool venc_set_ratectrl_cfg(OMX_VIDEO_CONTROLRATETYPE eControlRate);
        bool venc_set_session_qp(OMX_U32 i_frame_qp, OMX_U32 p_frame_qp,OMX_U32 b_frame_qp);
        bool venc_set_session_qp_range(OMX_U32 min_qp, OMX_U32 max_qp);
        bool venc_set_encode_framerate(OMX_U32 encode_framerate, OMX_U32 config);
        bool venc_set_intra_vop_refresh(OMX_BOOL intra_vop_refresh);
        bool venc_set_color_format(OMX_COLOR_FORMATTYPE color_format);
        bool venc_validate_profile_level(OMX_U32 *eProfile, OMX_U32 *eLevel);
        bool venc_set_multislice_cfg(OMX_INDEXTYPE codec, OMX_U32 slicesize);
        bool venc_set_entropy_config(OMX_BOOL enable, OMX_U32 i_cabac_level);
        bool venc_set_inloop_filter(OMX_VIDEO_AVCLOOPFILTERTYPE loop_filter);
        bool venc_set_intra_refresh (OMX_VIDEO_INTRAREFRESHTYPE intrarefresh, OMX_U32 nMBs);
        bool venc_set_error_resilience(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE* error_resilience);
        bool venc_set_voptiming_cfg(OMX_U32 nTimeIncRes);
        void venc_config_print();
        bool venc_set_slice_delivery_mode(OMX_U32 enable);
        bool venc_set_extradata(OMX_U32 extra_data, OMX_BOOL enable);
        bool venc_set_idr_period(OMX_U32 nPFrames, OMX_U32 nIDRPeriod);
        bool venc_reconfig_reqbufs();
        bool venc_set_vpe_rotation(OMX_S32 rotation_angle);
        bool venc_set_deinterlace(OMX_U32 enable);
        bool venc_set_ltrmode(OMX_U32 enable, OMX_U32 count);
        bool venc_enable_initial_qp(QOMX_EXTNINDEX_VIDEO_INITIALQP* initqp);
        bool venc_set_useltr(OMX_U32 frameIdx);
        bool venc_set_markltr(OMX_U32 frameIdx);
        bool venc_set_inband_video_header(OMX_BOOL enable);
        bool venc_set_au_delimiter(OMX_BOOL enable);
        bool venc_set_hier_layers(QOMX_VIDEO_HIERARCHICALCODINGTYPE type, OMX_U32 num_layers);
        bool venc_set_perf_level(QOMX_VIDEO_PERF_LEVEL ePerfLevel);
        bool venc_set_vui_timing_info(OMX_BOOL enable);
        bool venc_set_peak_bitrate(OMX_U32 nPeakBitrate);
        bool venc_set_searchrange();
        bool venc_set_vpx_error_resilience(OMX_BOOL enable);
        bool venc_set_perf_mode(OMX_U32 mode);
        bool venc_set_mbi_statistics_mode(OMX_U32 mode);
        bool venc_set_vqzip_sei_type(OMX_BOOL enable);
        bool venc_set_hybrid_hierp(QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE* hhp);
        bool venc_set_batch_size(OMX_U32 size);
        bool venc_calibrate_gop();
        void venc_set_vqzip_defaults();
        bool venc_validate_hybridhp_params(OMX_U32 layers, OMX_U32 bFrames, OMX_U32 count, int mode);
        bool venc_set_max_hierp(OMX_U32 hierp_layers);
        bool venc_set_baselayerid(OMX_U32 baseid);
        bool venc_set_qp(OMX_U32 nQp);
        bool venc_set_aspectratio(void *nSar);
        bool venc_set_priority(OMX_U32 priority);
        bool venc_set_session_priority(OMX_U32 priority);
        bool venc_set_operatingrate(OMX_U32 rate);
        bool venc_set_layer_bitrates(QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE* hpmode);
        bool venc_set_roi_qp_info(OMX_QTI_VIDEO_CONFIG_ROIINFO *roiInfo);
        bool venc_set_lowlatency_mode(OMX_BOOL enable);
#ifdef MAX_RES_1080P
        OMX_U32 pmem_free();
        OMX_U32 pmem_allocate(OMX_U32 size, OMX_U32 alignment, OMX_U32 count);
        OMX_U32 venc_allocate_recon_buffers();
        inline int clip2(int x) {
            x = x -1;
            x = x | x >> 1;
            x = x | x >> 2;
            x = x | x >> 4;
            x = x | x >> 16;
            x = x + 1;
            return x;
        }
#endif
        int metadatamode;
        bool streaming[MAX_PORT];
        bool extradata;

        pthread_mutex_t pause_resume_mlock;
        pthread_cond_t pause_resume_cond;
        bool paused;
        int color_format;
        bool is_searchrange_set;
        bool enable_mv_narrow_searchrange;
        int supported_rc_modes;
        bool is_thulium_v1;
        bool camera_mode_enabled;

        bool venc_empty_batch (OMX_BUFFERHEADERTYPE *buf, unsigned index);
        static const int kMaxBuffersInBatch = 16;
        unsigned int mBatchSize;
        struct BatchInfo {
            BatchInfo();
            /* register a buffer and obtain its unique id (v4l2-buf-id)
             */
            int registerBuffer(int bufferId);
            /* retrieve the buffer given its v4l2-buf-id
             */
            int retrieveBufferAt(int v4l2Id);
            bool isPending(int bufferId);

          private:
            static const int kMaxBufs = 64;
            static const int kBufIDFree = -1;
            pthread_mutex_t mLock;
            int mBufMap[64];  // Map with slots for each buffer
            size_t mNumPending;

          public:
            // utility methods to parse entities in batch
            // payload format for batch of 3
            //| fd0 | fd1 | fd2 | off0 | off1 | off2 | len0 | len1 | len2 | csc0 | csc1 | csc2 | dTS0 | dTS1 | dTS2|
            static inline int getFdAt(native_handle_t *, int index);
            static inline int getOffsetAt(native_handle_t *, int index);
            static inline int getSizeAt(native_handle_t *, int index);
            static inline int getUsageAt(native_handle_t *, int index);
            static inline int getColorFormatAt(native_handle_t *, int index);
            static inline int getTimeStampAt(native_handle_t *, int index);
        };
        BatchInfo mBatchInfo;
};

enum instance_state {
    MSM_VIDC_CORE_UNINIT_DONE = 0x0001,
    MSM_VIDC_CORE_INIT,
    MSM_VIDC_CORE_INIT_DONE,
    MSM_VIDC_OPEN,
    MSM_VIDC_OPEN_DONE,
    MSM_VIDC_LOAD_RESOURCES,
    MSM_VIDC_LOAD_RESOURCES_DONE,
    MSM_VIDC_START,
    MSM_VIDC_START_DONE,
    MSM_VIDC_STOP,
    MSM_VIDC_STOP_DONE,
    MSM_VIDC_RELEASE_RESOURCES,
    MSM_VIDC_RELEASE_RESOURCES_DONE,
    MSM_VIDC_CLOSE,
    MSM_VIDC_CLOSE_DONE,
    MSM_VIDC_CORE_UNINIT,
};
#endif