• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*--------------------------------------------------------------------------
2 Copyright (c) 2012-2020, 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_VENC_DEV__
30 #define __OMX_VENC_DEV__
31 
32 #include "OMX_Types.h"
33 #include "OMX_Core.h"
34 #include "OMX_VideoExt.h"
35 #include "QComOMXMetadata.h"
36 #include "OMX_QCOMExtns.h"
37 #include "qc_omx_component.h"
38 
39 #include "omx_video_common.h"
40 #include "omx_video_base.h"
41 #include "omx_video_encoder.h"
42 #include "vidc_common.h"
43 #include <linux/videodev2.h>
44 #include "media/msm_vidc_utils.h"
45 #include <poll.h>
46 #include <list>
47 #include <qdMetaData.h>
48 #include "color_metadata.h"
49 
50 #define TIMEOUT 5*60*1000
51 #define BIT(num) (1 << (num))
52 #define MAX_HYB_HIERP_LAYERS 6
53 #define MAX_AVC_HP_LAYERS (4)
54 #define MAX_V4L2_BUFS 64 //VB2_MAX_FRAME
55 #define ENABLE_I_QP 0x1
56 #define ENABLE_P_QP 0x2
57 #define ENABLE_B_QP 0x4
58 
59 #define OMX_VIDEO_LEVEL_UNKNOWN 0
60 
61 #define VENC_BFRAME_MAX_COUNT       1
62 #define VENC_BFRAME_MAX_FPS         60
63 #define VENC_BFRAME_MAX_WIDTH       1920
64 #define VENC_BFRAME_MAX_HEIGHT      1088
65 #define VENC_INFINITE_GOP 0xFFFFFFF
66 
67 /* TODO: Use sanctioned vendor bits for HEIF
68  * once end to end 64-bit support is available.
69  */
70 #define GRALLOC_USAGE_PRIVATE_HEIF_VIDEO (UINT32_C(1) << 27)
71 #define GRALLOC_USAGE_PRIVATE_10BIT_VIDEO (UINT32_C(1) << 30)
72 
73 #define REQUEST_LINEAR_COLOR_8_BIT   0x1
74 #define REQUEST_LINEAR_COLOR_10_BIT  0x2
75 #define REQUEST_LINEAR_COLOR_ALL     (REQUEST_LINEAR_COLOR_8_BIT | REQUEST_LINEAR_COLOR_10_BIT)
76 
77 #define VENC_QUALITY_BOOST_BITRATE_THRESHOLD 2000000
78 
79 enum hier_type {
80     HIER_NONE = 0x0,
81     HIER_P = 0x1,
82     HIER_B = 0x2,
83 };
84 
85 struct msm_venc_switch {
86     unsigned char    status;
87 };
88 
89 struct msm_venc_allocatorproperty {
90     unsigned long     mincount;
91     unsigned long     actualcount;
92     unsigned long     datasize;
93     unsigned long     suffixsize;
94     unsigned long     alignment;
95     unsigned long     bufpoolid;
96 };
97 
98 struct msm_venc_basecfg {
99     unsigned long    input_width;
100     unsigned long    input_height;
101     unsigned long    dvs_width;
102     unsigned long    dvs_height;
103     unsigned long    codectype;
104     unsigned long    fps_num;
105     unsigned long    fps_den;
106     unsigned long    targetbitrate;
107     unsigned long    inputformat;
108 };
109 
110 struct msm_venc_profile {
111     unsigned long    profile;
112 };
113 struct msm_venc_profilelevel {
114     unsigned long    level;
115     unsigned long    tier;
116 };
117 
118 struct msm_venc_sessionqp {
119     unsigned long    iframeqp;
120     unsigned long    pframeqp;
121     unsigned long    bframeqp;
122     unsigned long    enableqp;
123 };
124 
125 struct msm_venc_ipb_qprange {
126     unsigned long    max_qp_packed;
127     unsigned long    min_qp_packed;
128 };
129 
130 struct msm_venc_intraperiod {
131     unsigned long    num_pframes;
132     unsigned long    num_bframes;
133 };
134 struct msm_venc_seqheader {
135     unsigned char *hdrbufptr;
136     unsigned long    bufsize;
137     unsigned long    hdrlen;
138 };
139 
140 struct msm_venc_capability {
141     unsigned long    codec_types;
142     unsigned long    maxframe_width;
143     unsigned long    maxframe_height;
144     unsigned long    maxtarget_bitrate;
145     unsigned long    maxframe_rate;
146     unsigned long    input_formats;
147     unsigned char    dvs;
148 };
149 
150 struct msm_venc_entropycfg {
151     unsigned longentropysel;
152     unsigned long    cabacmodel;
153 };
154 
155 struct msm_venc_dbcfg {
156     unsigned long    db_mode;
157     unsigned long    slicealpha_offset;
158     unsigned long    slicebeta_offset;
159 };
160 
161 struct msm_venc_intrarefresh {
162     unsigned long    irmode;
163     unsigned long    mbcount;
164     unsigned long    framecount;
165 };
166 
167 struct msm_venc_multiclicecfg {
168     unsigned long    mslice_mode;
169     unsigned long    mslice_size;
170 };
171 
172 struct msm_venc_bufferflush {
173     unsigned long    flush_mode;
174 };
175 
176 struct msm_venc_ratectrlcfg {
177     unsigned long    rcmode;
178 };
179 
180 struct    msm_venc_voptimingcfg {
181     unsigned long    voptime_resolution;
182 };
183 struct msm_venc_framerate {
184     unsigned long    fps_denominator;
185     unsigned long    fps_numerator;
186 };
187 
188 struct msm_venc_targetbitrate {
189     unsigned long    target_bitrate;
190 };
191 
192 
193 struct msm_venc_rotation {
194     unsigned long    rotation;
195 };
196 
197 struct msm_venc_timeout {
198     unsigned long    millisec;
199 };
200 
201 struct msm_venc_headerextension {
202     unsigned long    header_extension;
203 };
204 
205 struct msm_venc_video_capability {
206     unsigned int min_width;
207     unsigned int max_width;
208     unsigned int min_height;
209     unsigned int max_height;
210 };
211 
212 struct msm_venc_idrperiod {
213     unsigned long idrperiod;
214 };
215 
216 struct msm_venc_vui_timing_info {
217     unsigned int enabled;
218 };
219 
220 struct msm_venc_peak_bitrate {
221     unsigned int peakbitrate;
222 };
223 
224 struct msm_venc_vpx_error_resilience {
225     unsigned int enable;
226 };
227 
228 struct msm_venc_priority {
229     OMX_U32 priority;
230 };
231 
232 struct msm_venc_color_space {
233     OMX_U32 primaries;
234     OMX_U32 range;
235     OMX_U32 matrix_coeffs;
236     OMX_U32 transfer_chars;
237 };
238 
239 struct msm_venc_temporal_layers {
240     enum hier_type hier_mode;
241     OMX_U32 nMaxLayers;
242     OMX_U32 nMaxBLayers;
243     OMX_U32 nPLayers;
244     OMX_U32 nBLayers;
245     OMX_BOOL bIsBitrateRatioValid;
246     // cumulative ratio: eg [25, 50, 75, 100] means [L0=25%, L1=25%, L2=25%, L3=25%]
247     OMX_U32 nTemporalLayerBitrateRatio[OMX_VIDEO_ANDROID_MAXTEMPORALLAYERS];
248     OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE ePattern;
249 };
250 
251 enum v4l2_ports {
252     CAPTURE_PORT,
253     OUTPUT_PORT,
254     MAX_PORT
255 };
256 
257 struct extradata_buffer_info {
258     unsigned long buffer_size;
259     int count;
260     OMX_BOOL allocated;
261     enum v4l2_ports port_index;
262 #ifdef USE_ION
263     struct venc_ion ion[VIDEO_MAX_FRAME];
264 #endif
265 };
266 
267 struct statistics {
268     struct timespec prev_tv;
269     OMX_U32 prev_fbd;
270     OMX_U32 bytes_generated;
271 };
272 
273 enum rc_modes {
274     RC_VBR_VFR = BIT(0),
275     RC_VBR_CFR = BIT(1),
276     RC_CBR_VFR = BIT(2),
277     RC_CBR_CFR = BIT(3),
278     RC_MBR_CFR = BIT(4),
279     RC_MBR_VFR = BIT(5),
280     RC_CQ      = BIT(6),
281     RC_ALL = (RC_VBR_VFR | RC_VBR_CFR
282         | RC_CBR_VFR | RC_CBR_CFR | RC_MBR_CFR | RC_MBR_VFR | RC_CQ)
283 };
284 
285 enum roi_type {
286     ROI_NONE = V4L2_CID_MPEG_VIDC_VIDEO_ROI_TYPE_NONE,
287     ROI_2BIT = V4L2_CID_MPEG_VIDC_VIDEO_ROI_TYPE_2BIT,
288     ROI_2BYTE = V4L2_CID_MPEG_VIDC_VIDEO_ROI_TYPE_2BYTE,
289 };
290 
291 class venc_dev
292 {
293     public:
294         venc_dev(class omx_venc *venc_class); //constructor
295         ~venc_dev(); //des
296 
297         static void* async_venc_message_thread (void *);
298         bool venc_open(OMX_U32);
299         void venc_close();
300         unsigned venc_stop(void);
301         unsigned venc_pause(void);
302         bool is_streamon_done(OMX_U32 port);
303         unsigned venc_start(void);
304         unsigned venc_flush(unsigned);
305 #ifdef _ANDROID_ICS_
306         bool venc_set_meta_mode(bool);
307 #endif
308         unsigned venc_resume(void);
309         unsigned venc_start_done(void);
310         unsigned venc_stop_done(void);
311         unsigned venc_set_message_thread_id(pthread_t);
312         bool allocate_extradata(unsigned);
313         bool venc_free_buf(void*, unsigned);
314         bool venc_empty_buf(void *, void *,unsigned,unsigned);
315         bool venc_fill_buf(void *, void *,unsigned,unsigned);
316         bool venc_get_buf_req(OMX_U32 *,OMX_U32 *,
317                 OMX_U32 *,OMX_U32);
318         bool venc_set_buf_req(OMX_U32 *,OMX_U32 *,
319                 OMX_U32 *,OMX_U32);
320         bool venc_set_param(void *,OMX_INDEXTYPE);
321         bool venc_set_config(void *configData, OMX_INDEXTYPE index);
322         bool venc_h264_transform_8x8(OMX_BOOL enable);
323         bool venc_get_profile_level(OMX_U32 *eProfile,OMX_U32 *eLevel);
324         bool venc_get_seq_hdr(void *, unsigned, unsigned *);
325         bool venc_get_dimensions(OMX_U32 portIndex, OMX_U32 *w, OMX_U32 *h);
326         bool venc_loaded_start(void);
327         bool venc_loaded_stop(void);
328         bool venc_handle_empty_eos_buffer(void);
329         bool venc_loaded_start_done(void);
330         bool venc_loaded_stop_done(void);
331         bool venc_is_video_session_supported(unsigned long width, unsigned long height);
332         bool venc_color_align(OMX_BUFFERHEADERTYPE *buffer, OMX_U32 width,
333                         OMX_U32 height);
334         bool venc_get_vui_timing_info(OMX_U32 *enabled);
335         bool venc_get_peak_bitrate(OMX_U32 *peakbitrate);
336         bool venc_get_batch_size(OMX_U32 *size);
337         bool venc_get_temporal_layer_caps(OMX_U32 * /*nMaxLayers*/,
338                 OMX_U32 * /*nMaxBLayers*/, OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE */*SupportedPattern*/);
339         OMX_ERRORTYPE venc_get_supported_profile_level(OMX_VIDEO_PARAM_PROFILELEVELTYPE *profileLevelType);
340         bool venc_get_supported_color_format(unsigned index, OMX_U32 *colorFormat);
341         bool venc_check_for_hybrid_hp(OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE ePattern);
342         OMX_ERRORTYPE venc_set_max_hierp_layer();
343         OMX_ERRORTYPE venc_set_hierp_layer();
344         OMX_ERRORTYPE venc_set_bitrate_ratios();
345         bool venc_validate_temporal_extn(OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE &temporalSettings);
346         bool venc_get_output_log_flag();
347         int venc_output_log_buffers(const char *buffer_addr, int buffer_len, uint64_t timestamp);
348         int venc_input_log_buffers(OMX_BUFFERHEADERTYPE *buffer, int fd, int plane_offset,
349                         unsigned long inputformat, bool interlaced);
350         int venc_extradata_log_buffers(char *buffer_addr, int index, bool input);
351         bool venc_get_hevc_profile(OMX_U32* profile);
352         void venc_get_consumer_usage(OMX_U32* usage);
353         bool venc_set_vbv_delay(OMX_U32 nVbvDelay);
354 
355         struct venc_debug_cap m_debug;
356         OMX_U32 m_nDriver_fd;
357         int m_poll_efd;
358         int num_input_planes, num_output_planes;
359         OMX_U32 etb, ebd, ftb, fbd;
360 
361         int nPframes_cache;
362         int stopped;
363         int resume_in_stopped;
364         pthread_t m_tid;
365         bool async_thread_created;
366         bool async_thread_force_stop;
367         class omx_venc *venc_handle;
368         OMX_ERRORTYPE allocate_extradata(struct extradata_buffer_info *extradata_info, int flags);
369         void free_extradata_all();
370         void free_extradata(struct extradata_buffer_info *extradata_info);
371         bool handle_output_extradata(void *, int);
372         bool handle_input_extradata(struct v4l2_buffer);
373         bool venc_handle_client_input_extradata(void *);
374         int venc_set_format(int);
375         bool hw_overload;
376         bool is_gralloc_source_ubwc;
377         bool is_camera_source_ubwc;
378         bool is_csc_custom_matrix_enabled;
379         bool is_auto_blur_disabled;
380         bool csc_enable;
381         bool m_bDimensionsNeedFlip;
382         int32_t m_disable_hdr;
383         unsigned long get_media_colorformat(unsigned long);
384 
385     private:
386         OMX_U32                             m_codec;
387         struct msm_venc_basecfg             m_sVenc_cfg;
388         struct msm_venc_rotation            m_rotation;
389         struct msm_venc_ratectrlcfg         rate_ctrl;
390         struct msm_venc_targetbitrate       bitrate;
391         struct msm_venc_intraperiod         intra_period;
392         struct msm_venc_profile             codec_profile;
393         struct msm_venc_profilelevel        profile_level;
394         struct msm_venc_switch              set_param;
395         struct msm_venc_voptimingcfg        time_inc;
396         struct msm_venc_allocatorproperty   m_sInput_buff_property;
397         struct msm_venc_allocatorproperty   m_sOutput_buff_property;
398         struct msm_venc_sessionqp           session_qp;
399         struct msm_venc_ipb_qprange         session_ipb_qp_values;
400         struct msm_venc_multiclicecfg       multislice;
401         struct msm_venc_entropycfg          entropy;
402         struct msm_venc_dbcfg               dbkfilter;
403         struct msm_venc_intrarefresh        intra_refresh;
404         struct msm_venc_headerextension     hec;
405         struct msm_venc_voptimingcfg        voptimecfg;
406         struct msm_venc_video_capability    capability;
407         struct msm_venc_idrperiod           idrperiod;
408         struct msm_venc_vui_timing_info     vui_timing_info;
409         struct msm_venc_peak_bitrate        peak_bitrate;
410         struct msm_venc_vpx_error_resilience vpx_err_resilience;
411         struct msm_venc_priority            sess_priority;
412         OMX_U32                             operating_rate;
413         struct msm_venc_color_space         color_space;
414         msm_venc_temporal_layers            temporal_layers_config;
415         OMX_BOOL                            downscalar_enabled;
416         bool bframe_implicitly_enabled;
417         bool client_req_disable_temporal_layers;
418 
419         bool venc_query_cap(struct v4l2_queryctrl &cap);
420         bool venc_validate_range(OMX_S32 id, OMX_S32 val);
421         bool venc_set_profile(OMX_U32 eProfile);
422         bool venc_set_level(OMX_U32 eLevel);
423         bool set_nB_frames(unsigned long nBframes);
424         bool set_native_recoder(bool enable);
425         bool set_nP_frames(unsigned long nPframes);
426         bool venc_set_target_bitrate(OMX_U32 nTargetBitrate);
427         bool venc_set_ratectrl_cfg(OMX_VIDEO_CONTROLRATETYPE eControlRate);
428         bool venc_set_bitrate_savings_mode(OMX_U32 bitrateSavingEnable);
429         bool venc_set_session_qp_range(OMX_QCOM_VIDEO_PARAM_IPB_QPRANGETYPE *qp_range);
430         bool venc_set_encode_framerate(OMX_U32 encode_framerate);
431         bool venc_set_intra_vop_refresh(OMX_BOOL intra_vop_refresh);
432         bool venc_set_color_format(OMX_COLOR_FORMATTYPE color_format);
433         bool venc_validate_profile_level(OMX_U32 *eProfile, OMX_U32 *eLevel);
434         bool venc_set_multislice_cfg(OMX_U32 slicemode, OMX_U32 slicesize);
435         bool venc_set_entropy_config(OMX_BOOL enable, OMX_U32 i_cabac_level);
436         bool venc_set_inloop_filter(OMX_VIDEO_AVCLOOPFILTERTYPE loop_filter);
437         bool venc_set_intra_refresh ();
438         bool venc_set_error_resilience(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE* error_resilience);
439         void venc_config_print();
440         bool venc_set_extradata(OMX_U32 extra_data, OMX_BOOL enable);
441         bool venc_reconfig_reqbufs();
442         bool venc_set_vpe_rotation(OMX_S32 rotation_angle);
443         bool venc_prepare_c2d_rotation(OMX_S32 rotation_angle);
444         bool venc_set_mirror(OMX_MIRRORTYPE mirror);
445         bool venc_set_ltrcount(OMX_U32 count);
446         bool venc_set_useltr(OMX_U32 frameIdx);
447         bool venc_set_markltr(OMX_U32 frameIdx);
448         bool venc_set_inband_video_header(OMX_BOOL enable);
449         bool venc_set_hier_layers(QOMX_VIDEO_HIERARCHICALCODINGTYPE type, OMX_U32 num_layers);
450         bool venc_set_vui_timing_info(OMX_BOOL enable);
451         bool venc_set_peak_bitrate(OMX_U32 nPeakBitrate);
452         bool venc_set_vpx_error_resilience(OMX_BOOL enable);
453         bool venc_set_batch_size(OMX_U32 size);
454         bool venc_set_hierp_layers(OMX_U32 hierp_layers);
455         bool venc_set_baselayerid(OMX_U32 baseid);
456         bool venc_set_qp(OMX_U32 i_frame_qp, OMX_U32 p_frame_qp,OMX_U32 b_frame_qp, OMX_U32 enable);
457         bool venc_set_aspectratio(void *nSar);
458         bool venc_set_priority(OMX_U32 priority);
459         bool venc_set_session_priority(OMX_U32 priority);
460         bool venc_set_operatingrate(OMX_U32 rate);
461         bool venc_set_lowlatency_mode(OMX_BOOL enable);
462         bool venc_set_roi_qp_info(OMX_QTI_VIDEO_CONFIG_ROIINFO *roiInfo);
463         bool venc_set_blur_resolution(OMX_QTI_VIDEO_CONFIG_BLURINFO *blurInfo);
464         bool venc_set_colorspace(OMX_U32 primaries, OMX_U32 range, OMX_U32 transfer_chars, OMX_U32 matrix_coeffs);
465         bool venc_set_iframesize_type(QOMX_VIDEO_IFRAMESIZE_TYPE type);
466         unsigned long venc_get_color_format(OMX_COLOR_FORMATTYPE eColorFormat);
467         unsigned long venc_get_codectype(OMX_VIDEO_CODINGTYPE eCompressionFormat);
468         bool venc_set_nal_size (OMX_VIDEO_CONFIG_NALSIZE *nalSizeInfo);
469         bool venc_set_grid_enable();
470         bool venc_set_extradata_hdr10metadata(OMX_U32 omx_profile);
471         bool venc_store_dynamic_config(OMX_INDEXTYPE type, OMX_PTR config);
472         bool venc_cvp_enable(private_handle_t *handle);
473         bool venc_get_cvp_metadata(private_handle_t *handle, struct v4l2_buffer *buf);
474         bool venc_set_cvp_skipratio_controls();
475         bool venc_superframe_enable(private_handle_t *handle);
476         void venc_set_quality_boost(OMX_BOOL c2d_enable);
477         bool reconfigure_avc_param(OMX_VIDEO_PARAM_AVCTYPE *param);
478 
479         OMX_U32 pmem_free();
480         OMX_U32 pmem_allocate(OMX_U32 size, OMX_U32 alignment, OMX_U32 count);
481         OMX_U32 venc_allocate_recon_buffers();
482 
483         int metadatamode;
484         bool streaming[MAX_PORT];
485         struct extradata_buffer_info input_extradata_info;
486         struct extradata_buffer_info output_extradata_info;
487         bool m_hdr10meta_enabled;
488         ColorMetaData colorData= {};
489 
490         bool m_cvp_first_metadata;
491         bool m_cvp_meta_enabled;
492         CVPMetadata cvpMetadata;
493         pthread_mutex_t pause_resume_mlock;
494         pthread_cond_t pause_resume_cond;
495         bool paused;
496         int color_format;
497         bool camera_mode_enabled;
498         bool low_latency_mode;
499         struct roidata {
500             bool dirty;
501             OMX_QTI_VIDEO_CONFIG_ROIINFO info;
502         };
503         bool m_roi_enabled;
504         roi_type m_roi_type;
505         pthread_mutex_t m_roilock;
506         std::list<roidata> m_roilist;
507         void get_roi_for_timestamp(struct roidata &roi, OMX_TICKS timestamp);
508         bool venc_empty_batch (OMX_BUFFERHEADERTYPE *buf, unsigned index);
509         static const int kMaxBuffersInBatch = 16;
510         unsigned int mBatchSize;
511         struct BatchInfo {
512             BatchInfo();
513             /* register a buffer and obtain its unique id (v4l2-buf-id)
514              */
515             int registerBuffer(int bufferId);
516             /* retrieve the buffer given its v4l2-buf-id
517              */
518             int retrieveBufferAt(int v4l2Id);
519             bool isPending(int bufferId);
520 
521           private:
522             static const int kMaxBufs = 64;
523             static const int kBufIDFree = -1;
524             pthread_mutex_t mLock;
525             int mBufMap[64];  // Map with slots for each buffer
526             size_t mNumPending;
527 
528         };
529         BatchInfo mBatchInfo;
530         bool mUseAVTimerTimestamps;
531         bool venc_set_hdr_info(const MasteringDisplay&, const ContentLightLevel&);
532         bool mIsGridset;
533         OMX_U32 mUseLinearColorFormat;
534         OMX_U32 mBitrateSavingsEnable;
535         bool mQualityBoostRequested;
536         bool mQualityBoostEligible;
537 
538         union dynamicConfigData {
539             OMX_VIDEO_CONFIG_BITRATETYPE bitrate;
540             OMX_CONFIG_FRAMERATETYPE framerate;
541             QOMX_VIDEO_INTRAPERIODTYPE intraperiod;
542             OMX_CONFIG_INTRAREFRESHVOPTYPE intravoprefresh;
543             OMX_CONFIG_ROTATIONTYPE rotation;
544             OMX_CONFIG_MIRRORTYPE mirror;
545             OMX_VIDEO_VP8REFERENCEFRAMETYPE vp8refframe;
546             OMX_QCOM_VIDEO_CONFIG_LTRMARK_TYPE markltr;
547             OMX_QCOM_VIDEO_CONFIG_LTRUSE_TYPE useltr;
548             OMX_SKYPE_VIDEO_CONFIG_QP configqp;
549             OMX_VIDEO_CONFIG_ANDROID_TEMPORALLAYERINGTYPE temporallayer;
550             OMX_SKYPE_VIDEO_CONFIG_BASELAYERPID configbaselayerid;
551         };
552         struct dynamicConfig {
553             OMX_TICKS timestamp;
554             unsigned int type;
555             union dynamicConfigData config_data;
556         };
557         pthread_mutex_t m_configlock;
558         std::list<dynamicConfig> m_configlist;
559         bool handle_dynamic_config(OMX_BUFFERHEADERTYPE *bufferHdr);
560         bool venc_config_bitrate(OMX_VIDEO_CONFIG_BITRATETYPE *bit_rate);
561         bool venc_config_framerate(OMX_CONFIG_FRAMERATETYPE *frame_rate);
562         bool venc_config_intravoprefresh(OMX_CONFIG_INTRAREFRESHVOPTYPE *intra_vop_refresh);
563         bool venc_config_vp8refframe(OMX_VIDEO_VP8REFERENCEFRAMETYPE *vp8refframe);
564         bool venc_config_markLTR(OMX_QCOM_VIDEO_CONFIG_LTRMARK_TYPE *markltr);
565         bool venc_config_useLTR(OMX_QCOM_VIDEO_CONFIG_LTRUSE_TYPE *useltr);
566         bool venc_config_qp(OMX_SKYPE_VIDEO_CONFIG_QP *configqp);
567 
568         // the list to contain the region roi info
569         std::list<OMX_QTI_VIDEO_CONFIG_ROI_RECT_REGION_INFO> mRoiRegionList;
570         bool venc_set_roi_region_qp_info(OMX_QTI_VIDEO_CONFIG_ROI_RECT_REGION_INFO *roiRegionInfo);
571         OMX_U32 append_extradata_roi_region_qp_info(OMX_OTHER_EXTRADATATYPE *data,
572                 OMX_TICKS timestamp, OMX_U32 freeSize);
573 };
574 
575 enum instance_state {
576     MSM_VIDC_CORE_UNINIT_DONE = 0x0001,
577     MSM_VIDC_CORE_INIT,
578     MSM_VIDC_CORE_INIT_DONE,
579     MSM_VIDC_OPEN,
580     MSM_VIDC_OPEN_DONE,
581     MSM_VIDC_LOAD_RESOURCES,
582     MSM_VIDC_LOAD_RESOURCES_DONE,
583     MSM_VIDC_START,
584     MSM_VIDC_START_DONE,
585     MSM_VIDC_STOP,
586     MSM_VIDC_STOP_DONE,
587     MSM_VIDC_RELEASE_RESOURCES,
588     MSM_VIDC_RELEASE_RESOURCES_DONE,
589     MSM_VIDC_CLOSE,
590     MSM_VIDC_CLOSE_DONE,
591     MSM_VIDC_CORE_UNINIT,
592 };
593 #endif
594 
595