sysprog21 / vcam

Virtual camera device driver for Linux
MIT License
105 stars 45 forks source link

Consolidate tests in scale/crop mode #24

Closed kevinshieh0225 closed 2 years ago

kevinshieh0225 commented 2 years ago

This commit focus on the problem according to issue#23. There are three main changes:

  1. Modify TRY_FMT to only negotiate and fill in information to user, while S_FMT responsible for switching device format.
  2. Initialize the expected format in create_vcam_device rather than accomplish it in S_FMT, and open S_FMT scaling option for user to switch from three kinds of resolution defined in vcam_sizes[]
  3. Extract negotiate_resolution and set_crop_resolution function for reuse in TRY_FMT, S_FMT, create_vcam_device.

The version can pass compliance test from scaling mode and cropping mode. However the current version could not pass scaling+cropping mode in TRY_FMT and S_FMT, which I think in current implementation is not able to pass it. Because G_FMT return crop resolution, and in TRY_FMT will negotiate with crop resolution which will return a new resolution type. The test will fail when "TRY_FMT(G_FMT) != G_FMT".

The reason why we can use it normally on vlc player is that vlc will S_FMT base on input_format but not the format return by G_FMT. I don't know the detail how vlc player work, but it is the behavior I found.

kevinshieh0225 commented 2 years ago

@jserv I have change the topic to: Modify TRY/S_FMT to pass test in scale/crop mode.

jserv commented 2 years ago

Thank @kevinshieh0225 for contributing. I amended the commit messages for consistent expressions.