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

Add FreeBSD support #102

Merged
merged 1 commit into from
Aug 8, 2024
Merged

Add FreeBSD support #102

merged 1 commit into from
Aug 8, 2024

Conversation

vladmovchan
Copy link
Contributor

I've used the proposed changes on a recent FreeBSD CURRENT with amd64 (i.e. x86_64) architecture with Logitech C922 Pro webcam.

What works:

  • video stream capturing via MmapStream
  • querying and changing capturing formats
  • querying and altering camera controls

What doesn't work:

  • video stream capturing via UserptrStream

@raymanfx
Copy link
Owner

raymanfx commented Aug 8, 2024

Thank you!

@raymanfx raymanfx merged commit 33817d4 into raymanfx:master Aug 8, 2024
Comment on lines +7 to +9
let pkg_conf = pkg_config::Config::new()
.probe("libv4l2")
.expect("pkg-config has failed to find `libv4l2`");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't v4l2-sys to build purely against the kernel bindings? v4l-sys links against libv4l2. Can you clarify why this is needed here (i.e. does FreeBSD provide fallbacks here?).

Copy link
Contributor Author

@vladmovchan vladmovchan Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Location of linux/videodev2.h (included in wrapper.h) is generally speaking indeterminate.
It might reside outside of default include location, i.e. not in /usr/include.

pkg-config crate provides means to query include directories necessary to locate libv4l2 header files in pkgconf database:

$ pkgconf --cflags-only-I libv4l2
-I/usr/local/include
$

I don't think changes from this PR affected/changed linking in any way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't affect linking, but the question remains why the kernel-only package now relies on pkg-config and lib4l2 being available, just to locate standard Linux headers. That should at the very least require a comment otherwise, to explain that this build.rs is not interested in generating bindings to libv4l2.

There should be a different/better way that doesn't involve these implicit dependencies. @raymanfx what do you think?

Copy link
Contributor Author

@vladmovchan vladmovchan Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't realize the presence of linux/videodev2.h header file doesn't depend on the existence of libv4l2 in pkgconf database on Linux.

I prepared a PR to limit use of pkg-config to FreeBSD only avoid libv4l2 dependency added via pkg-config: #106

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, understood, yeah it should be a Linux UAPI header (https://github.com/torvalds/linux/blob/master/include/uapi/linux/videodev2.h), but maybe FreeBSD provides it as part of the v4l2 package for compatibility? I'm not certain how FreeBSD works, but I think I found it here: https://www.freshports.org/multimedia/v4l_compat

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

Successfully merging this pull request may close these issues.

None yet

3 participants