Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usege of v4lconvert_try_format is wrong #36

Open
nomaddo opened this issue Jun 11, 2021 · 1 comment
Open

usege of v4lconvert_try_format is wrong #36

nomaddo opened this issue Jun 11, 2021 · 1 comment

Comments

@nomaddo
Copy link
Contributor

nomaddo commented Jun 11, 2021

def try_convert(self, conf, expected_width, expected_height, expected_format):
fmt = format()
fmt.type = V4L2_BUF_TYPE.VIDEO_CAPTURE
fmt.fmt.pix.width = conf.width
fmt.fmt.pix.height = conf.height
fmt.fmt.pix.pixelformat = conf.pixel_format
fmt.fmt.pix.field = V4L2_FIELD.INTERLACED
expected_fmt = format()
expected_fmt.type = V4L2_BUF_TYPE.VIDEO_CAPTURE
expected_fmt.fmt.pix.width = expected_width
expected_fmt.fmt.pix.height = expected_height
expected_fmt.fmt.pix.pixelformat = expected_format
expected_fmt.fmt.pix.field = V4L2_FIELD.INTERLACED
result = _v4lconvert.try_format(self.converter, byref(expected_fmt), byref(fmt))
if -1 == result:
raise RuntimeError("incompatible format")
before = (expected_width, expected_height, expected_format)
after = (expected_fmt.fmt.pix.width, expected_fmt.fmt.pix.height, expected_fmt.fmt.pix.pixelformat)
if before == after:
return (fmt, expected_fmt)
else:
return None

The header file says:

https://github.com/philips/libv4l/blob/master/include/libv4lconvert.h#L63-L75

The function v4lconvert_try_format is not for check whether we can convert pictures from src_fmt to dest_fmt:
The function is to get src_fmt which we finally get dest_fmt.

@nomaddo
Copy link
Contributor Author

nomaddo commented Jun 11, 2021

And, v4lconvert_try_format may change dest_fmt.
The checking is lack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant