v4l2sink: Keep aspect ratio when device scale
Submitted by Aurélien Zanelli
Link to original bug (#727483)
Description
Created attachment 273456
v4l2sink: Keep aspect ratio when device scale
It seems to be the responsibility of the application to ensure that aspect ratio is preserved. The device aspect ratio is constant within a standard. I attached a preliminary work which preserve display aspect ratio of the video. It has been written on 1.2 branch but it should apply on master with a little conflict in v4l2_calls.c
Here is the main idea of the solution:
First we determine if device can scale using VIDIOC_CROPCAP ioctl by checking if cropcap.bounds and cropcaps.defrect differs. If so we doesn't want to force PAR in caps.
Then, when we know video information and if scaling is supported, we determine the target rectangle and we set it with CROP ioctl.
This work is not complete since is conflicting with cropping property (crop_*) of v4l2sink element and it scale into output device bounds instead of user-defined display windows.
However before working further on this topic, I think it's better to have comments and remarks.
Regards
Patch 273456, "v4l2sink: Keep aspect ratio when device scale":
0001-v4l2sink-Keep-aspect-ratio-when-device-scale.patch