Hi , has any one tried changing the resolution dynamically while capture resolution is same, in chain mode. as we know in chain mode at a time only one user resolution we can handle with one resizer. so i want to change the resolution at runtime, i.e capture resolution will be same but output resolution will be resized to some different resolution. for example suppose capture resolution is 1920x1080. if i want the resized output resolution as 1280x1024 setting the fmt.fmt.pix.width = 1280; fmt.fmt.pix.height = 1024; before ioctl(hCapture->fd, VIDIOC_S_FMT, &fmt) call in Capture_create() will give the resized output which is set at capture initialization time. But if i need to get different resized resolution ( only one resolution at a time ) at run time how can i do it i.e
for dynamically changing the fmt.fmt.pix.width what i need to do. if i set fmt.fmt.pix.width and fmt.fmt.pix.height dynamically and call ioctl(hCapture->fd, VIDIOC_S_FMT, &fmt) i am getting error.
fmt.fmt.pix.height
i checked in VIDIOC_S_FMT driver code where i observed it is expecting
ioctl(hCapture->fd, VIDIOC_STREAMON, &type) should not start before VIDIOC_S_FMT ioctl call.
so i tried to block VIDIOC_STREAMON in Capture_create() and called before Capture_get() as below.
------------------------------------------------------------------------------------------------------------
{
enum v4l2_buf_type type;
struct v4l2_format fmt;
// assert(m_capture);
int width = 1280;
int height = 1024;
fmt.fmt.pix.width = width;
fmt.fmt.pix.height = height;
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_NV12;
fmt.fmt.pix.bytesperline = 0;
fmt.fmt.pix.sizeimage = 0;
fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
if
(ioctl(hCapture->fd, VIDIOC_S_FMT, &fmt) == -1) {
printf("Failed VIDIOC_S_FMT (%s)\n", strerror(errno));
//cleanup(hCapture);
//return NULL;
}
/* Start the video streaming */
type =
V4L2_BUF_TYPE_VIDEO_CAPTURE;
//if(attrs->resizer_is_chainmode == TRUE) {
// type = type |
0x0100;
// }
type = type | 0x0100;
if (ioctl(hCapture->fd,
VIDIOC_STREAMON, &type) == -1) {
printf("VIDIOC_STREAMON failed
\n");
//cleanup(m_capture);
//return NULL;
}
hCapture->started = TRUE;
----------------------------------------------------------------------------------------