author | junliang.zhou <junliang.zhou@amlogic.com> | 2013-11-04 08:28:26 (GMT) |
---|---|---|
committer | tao.dong <tao.dong@amlogic.com> | 2013-12-30 09:56:26 (GMT) |
commit | d9689c9321d0ecaf7a0732991f3d8b8239b6a7df (patch) | |
tree | 1b2eae75cb155fdd7534885f04fd51817e29edca | |
parent | cce3fd95c74412028cab5bb1164b5346a2f2d673 (diff) | |
download | screen_source-d9689c9321d0ecaf7a0732991f3d8b8239b6a7df.zip screen_source-d9689c9321d0ecaf7a0732991f3d8b8239b6a7df.tar.gz screen_source-d9689c9321d0ecaf7a0732991f3d8b8239b6a7df.tar.bz2 |
PD #82099:miracast rotation
-rwxr-xr-x | v4l2_vdin.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/v4l2_vdin.cpp b/v4l2_vdin.cpp index 1d748a8..f15da75 100755 --- a/v4l2_vdin.cpp +++ b/v4l2_vdin.cpp @@ -42,6 +42,8 @@ namespace android { +#define V4L2_ROTATE_ID 0x980922 + vdin_screen_source::vdin_screen_source() : mCameraHandle(-1), mVideoInfo(NULL) @@ -183,8 +185,29 @@ int vdin_screen_source::set_format(int width, int height, int color_format) int vdin_screen_source::set_rotation(int degree) { ALOGV("[%s %d]", __FUNCTION__, __LINE__); + int ret = 0; - return ret; + struct v4l2_control ctl; + + if(mCameraHandle<0) + return -1; + + if((degree!=0)&&(degree!=90)&&(degree!=180)&&(degree!=270)){ + ALOGE("Set rotate value invalid: %d.", degree); + return -1; + } + + memset( &ctl, 0, sizeof(ctl)); + ctl.value=degree; + ctl.id = V4L2_ROTATE_ID; + ret = ioctl(mCameraHandle, VIDIOC_S_CTRL, &ctl); + + if(ret<0){ + ALOGE("Set rotate value fail: %s. ret=%d", strerror(errno),ret); + } + + return ret ; + } |