uint32_t ExynosHWCService::getHdmiAudioChannel() { int channels; if (exynos_v4l2_g_ctrl(mHWCCtx->hdmi_layers[0].fd, V4L2_CID_TV_GET_AUDIO_INFORM, &channels) < 0) // V4L2_CID_TV_MAX_AUDIO_CHANNELS, &channels) < 0) ALOGE("%s: failed to get audio channels", __func__); return channels; }
static bool m_exynos_rotator_set_format( int fd, struct rotator_info *info, bool force) { struct v4l2_requestbuffers req_buf; int plane_count; plane_count = m_rotator_get_plane_count(info->v4l2_colorformat); if (plane_count < 0) { ALOGE("%s::not supported v4l2_colorformat", __func__); return false; } if (force == false) { // format info->format.type = info->buf_type; if (exynos_v4l2_g_fmt(fd, &info->format) < 0) { ALOGE("%s::exynos_v4l2_g_fmt() fail type=%d", __func__, info->buf_type); return false; } if (info->width != info->format.fmt.pix_mp.width || info->height != info->format.fmt.pix_mp.height || info->v4l2_colorformat != info->format.fmt.pix_mp.pixelformat) { ALOGV("%s::info is different..)", __func__); goto set_hw; } // crop if (info->buf_type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { info->crop.type = info->buf_type; if (exynos_v4l2_g_crop(fd, &info->crop) < 0) { ALOGE("%s::exynos_v4l2_g_crop() fail", __func__); return false; } if (info->crop_left != info->crop.c.left || info->crop_top != info->crop.c.top || info->crop_width != info->crop.c.width || info->crop_height != info->crop.c.height) { ALOGV("%s::crop is different..", __func__); goto set_hw; } } // rotation value; int value = 0; if (exynos_v4l2_g_ctrl(fd, V4L2_CID_ROTATE, &value) < 0) { ALOGE("%s::exynos_v4l2_g_ctrl(V4L2_CID_ROTATE) fail"); return false; } if (info->rotation != value) { ALOGV("%s::rotation is different..", __func__); goto set_hw; } // skip s_fmt ALOGV("%s::fmt, crop is same with old-one, so skip s_fmt crop..", __func__); return true; } set_hw: if (info->stream_on == true) { if (exynos_v4l2_streamoff(fd, info->buf_type) < 0) { ALOGE("%s::exynos_v4l2_streamoff() fail", __func__); return false; } info->stream_on = false; } if (exynos_v4l2_s_ctrl(fd, V4L2_CID_ROTATE, info->rotation) < 0) { ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_ROTATE) fail", __func__); return false; } info->format.fmt.pix_mp.width = info->width; info->format.fmt.pix_mp.height = info->height; info->format.fmt.pix_mp.pixelformat = info->v4l2_colorformat; info->format.fmt.pix_mp.field = V4L2_FIELD_ANY; info->format.fmt.pix_mp.num_planes = plane_count; if (exynos_v4l2_s_fmt(fd, &info->format) < 0) { ALOGE("%s::exynos_v4l2_s_fmt() fail", __func__); return false; } if (info->buf_type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { info->crop.type = info->buf_type; info->crop.c.left = info->crop_left; info->crop.c.top = info->crop_top; info->crop.c.width = info->crop_width; info->crop.c.height = info->crop_height; if (exynos_v4l2_s_crop(fd, &info->crop) < 0) { ALOGE("%s::exynos_v4l2_s_crop() fail", __func__); return false; } } if (exynos_v4l2_s_ctrl(fd, V4L2_CID_CACHEABLE, info->cacheable) < 0) { ALOGE("%s::exynos_v4l2_s_ctrl() fail", __func__); return false; } req_buf.count = 1; req_buf.type = info->buf_type; req_buf.memory = V4L2_MEMORY_USERPTR; if (exynos_v4l2_reqbufs(fd, &req_buf) < 0) { ALOGE("%s::exynos_v4l2_reqbufs() fail", __func__); return false; } return true; }