obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

v4l2loopback: Add support for non-Linux environments

Open hselasky opened this issue 4 years ago • 15 comments

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?

  1. Run: webcamd -c v4l2loopback -U webcamd -G webcamd -B

  2. Run: obs &

  3. 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.

hselasky avatar Aug 04 '21 15:08 hselasky

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.

WizardCM avatar Aug 05 '21 00:08 WizardCM

OK, while reviewing the code I found a file descriptor leak (see separate commit).

Updated the patch. Please review again.

hselasky avatar Aug 06 '21 10:08 hselasky

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.

yurivict avatar Mar 06 '22 16:03 yurivict

this code has changed a bit since the PR was created it seems it needs to be rebased.

kkartaltepe avatar Mar 06 '22 17:03 kkartaltepe

Just pushed an update. Yes, the code has changed, but still need some ifdefs for FreeBSD.

hselasky avatar Mar 06 '22 20:03 hselasky

This PR is now backported to the FreeBSD port.

yurivict avatar Mar 06 '22 21:03 yurivict

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.

jp9000 avatar Mar 08 '22 20:03 jp9000

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.

hselasky avatar Mar 09 '22 09:03 hselasky

Thanks this looks good but the commit prefix should be linux-v4l2.

kkartaltepe avatar Mar 15 '22 04:03 kkartaltepe

Thanks this looks good but the commit prefix should be linux-v4l2.

Fixed!

hselasky avatar Mar 15 '22 08:03 hselasky

This PR has merge conflicts and unaddressed feedback. Please address those.

RytoEX avatar Feb 17 '23 20:02 RytoEX

@kkartaltepe Is this PR worth picking up/finishing up ourselves? Our last call to action was in February, so I'd close this otherwise.

PatTheMav avatar Dec 05 '23 19:12 PatTheMav

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.

emaste avatar Dec 05 '23 19:12 emaste

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.

kkartaltepe avatar Dec 06 '23 00:12 kkartaltepe

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.

emaste avatar Jun 19 '24 20:06 emaste

The updated, mergeable PR is here: https://github.com/obsproject/obs-studio/pull/12073

yurivict avatar Apr 23 '25 03:04 yurivict

Closed by #12073.

RytoEX avatar Apr 28 '25 20:04 RytoEX