v4l2loopback: Add support for non-Linux environments
Ifdef code specific to Linux to allow the v4l2loopback support to detect the v4l2 loopback device under FreeBSD/webcamd.
Signed-off-by: Hans Petter Selasky [email protected]
Description
Make the virtual webcam support work under FreeBSD/webcamd.
Motivation and Context
Fixes detection of the service.
How Has This Been Tested?
-
Run: webcamd -c v4l2loopback -U webcamd -G webcamd -B
-
Run: obs &
-
Click start virtual webcam in UI.
Types of changes
- Bug fix (non-breaking change which fixes an issue)
Checklist:
- [x] My code has been run through clang-format.
- [x] I have read the contributing document.
- [x] My code is not on the master branch.
- [x] The code has been tested.
- [x] All commit messages are properly formatted and commits squashed where appropriate.
- [x] I have included updates to all appropriate documentation.
This diff looks less like a bugfix and more of a hack. I don't believe it's a good idea to assume loopback_module_available() is true on unsupported platforms. I am, however, OK with putting flatpak-related code behind a linux ifdef.
OK, while reviewing the code I found a file descriptor leak (see separate commit).
Updated the patch. Please review again.
Build fails:
/usr/ports/multimedia/obs-studio/work/obs-studio-27.2.3/plugins/linux-v4l2/v4l2-output.c:112:19: error: use of undeclared identifier 'MAX_DEVICES'
for (i = 0; i != MAX_DEVICES; i++) {
^
1 error generated.
this code has changed a bit since the PR was created it seems it needs to be rebased.
Just pushed an update. Yes, the code has changed, but still need some ifdefs for FreeBSD.
This PR is now backported to the FreeBSD port.
Please make sure to mark conversations as resolved if they have been resolved because apparently github now blocks PRs if conversations are not marked as resolved. @kkartaltepe
Not sure if you meant to leave it unresolved, but from here on out, you'll have to make sure to mark that.
Please do not use periods at the end of commit message subjects (the first line of a commit message).
Please wrap commit message bodies at 72 characters.
See our Commit Guidelines for more details.
Done.
Thanks this looks good but the commit prefix should be linux-v4l2.
Thanks this looks good but the commit prefix should be
linux-v4l2.
Fixed!
This PR has merge conflicts and unaddressed feedback. Please address those.
@kkartaltepe Is this PR worth picking up/finishing up ourselves? Our last call to action was in February, so I'd close this otherwise.
Unfortunately Hans-Petter passed away earlier this year in a traffic accident. https://freebsdfoundation.org/wp-content/uploads/2023/08/In_Memoriam.pdf
I am still interested in seeing this change make it into OBS.
Unfortunately Hans-Petter passed away earlier this year in a traffic accident. https://freebsdfoundation.org/wp-content/uploads/2023/08/In_Memoriam.pdf
I am still interested in seeing this change make it into OBS.
Sorry to hear that, thanks for sharing. If you are interested in this can you rebase and test that it still works? If so I can take a look at resolving the last couple comments.
If you are interested in this can you rebase and test that it still works? If so I can take a look at resolving the last couple comments.
Will do - I have been away from using OBS on FreeBSD for a bit but took another look recently and fixed two minor issues (#10889, #10894). I'll rebase and test this change.
The updated, mergeable PR is here: https://github.com/obsproject/obs-studio/pull/12073
Closed by #12073.