Merge "mm-video-v4l2: venc: Update output resolution correctly for rotation"

This commit is contained in:
Linux Build Service Account 2017-04-04 01:10:19 -07:00 committed by Gerrit - the friendly Code Review server
commit bb24b8c395
3 changed files with 35 additions and 0 deletions

View file

@ -345,6 +345,7 @@ class venc_dev
bool venc_h264_transform_8x8(OMX_BOOL enable);
bool venc_get_profile_level(OMX_U32 *eProfile,OMX_U32 *eLevel);
bool venc_get_seq_hdr(void *, unsigned, unsigned *);
bool venc_get_dimensions(OMX_U32 portIndex, OMX_U32 *w, OMX_U32 *h);
bool venc_loaded_start(void);
bool venc_loaded_stop(void);
bool venc_loaded_start_done(void);

View file

@ -2056,6 +2056,15 @@ OMX_ERRORTYPE omx_venc::set_config(OMX_IN OMX_HANDLETYPE hComp,
return OMX_ErrorUnsupportedSetting;
}
m_sConfigFrameRotation.nRotation = pParam->nRotation;
// Update output-port resolution (since it might have been flipped by rotation)
if (handle->venc_get_dimensions(PORT_INDEX_OUT,
&m_sOutPortDef.format.video.nFrameWidth,
&m_sOutPortDef.format.video.nFrameHeight)) {
DEBUG_PRINT_HIGH("set Rotation: updated dimensions = %u x %u",
m_sOutPortDef.format.video.nFrameWidth,
m_sOutPortDef.format.video.nFrameHeight);
}
break;
}
case OMX_QcomIndexConfigVideoFramePackingArrangement:

View file

@ -1654,6 +1654,22 @@ bool venc_dev::venc_get_seq_hdr(void *buffer,
return true;
}
bool venc_dev::venc_get_dimensions(OMX_U32 portIndex, OMX_U32 *w, OMX_U32 *h) {
struct v4l2_format fmt;
memset(&fmt, 0, sizeof(fmt));
fmt.type = portIndex == PORT_INDEX_OUT ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE :
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
if (ioctl(m_nDriver_fd, VIDIOC_G_FMT, &fmt)) {
DEBUG_PRINT_ERROR("Failed to get format on %s port",
portIndex == PORT_INDEX_OUT ? "capture" : "output");
return false;
}
*w = fmt.fmt.pix_mp.width;
*h = fmt.fmt.pix_mp.height;
return true;
}
bool venc_dev::venc_get_buf_req(OMX_U32 *min_buff_count,
OMX_U32 *actual_buff_count,
OMX_U32 *buff_size,
@ -6389,6 +6405,15 @@ bool venc_dev::venc_set_vpe_rotation(OMX_S32 rotation_angle)
memset(&fmt, 0, sizeof(fmt));
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
if (rotation_angle == 90 || rotation_angle == 270) {
OMX_U32 nWidth = m_sVenc_cfg.dvs_height;
OMX_U32 nHeight = m_sVenc_cfg.dvs_width;
m_sVenc_cfg.dvs_height = nHeight;
m_sVenc_cfg.dvs_width = nWidth;
DEBUG_PRINT_LOW("Rotation (%u) Flipping wxh to %lux%lu",
rotation_angle, m_sVenc_cfg.dvs_width, m_sVenc_cfg.dvs_height);
}
fmt.fmt.pix_mp.height = m_sVenc_cfg.dvs_height;
fmt.fmt.pix_mp.width = m_sVenc_cfg.dvs_width;
fmt.fmt.pix_mp.pixelformat = m_sVenc_cfg.codectype;