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