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

Forbid other programs to use the virtual camera when already in use #67

Open
rnixik opened this issue Nov 19, 2022 · 3 comments
Open

Forbid other programs to use the virtual camera when already in use #67

rnixik opened this issue Nov 19, 2022 · 3 comments

Comments

@rnixik
Copy link

rnixik commented Nov 19, 2022

I set two formats: 720p and 480p for my virtual camera. I want to edit source code to forbid getting stream from the same camera when we are already streaming in other format like my real web come does.
I'm not sure if this is possible with DShow. If you think is it possible, could you please suggest class or method to add mutex/if?

@hipersayanX
Copy link
Member

hipersayanX commented Nov 20, 2022

I've read your question many times but I did not understand what you want to do.

  • Do you want to send different streams depending of the video format selected by the client?
  • All the virtual cameras are receiving the same stream independently of the selected vcam? (maybe a bug?)
  • Do you want to forbid other programs to use the virtual camera when already in use? (maybe another bug?)

I don't understand your use case at all, please explain.
Anyway all the frames sent to the vcam are received here, and then sent to the client here.

@rnixik
Copy link
Author

rnixik commented Nov 20, 2022

Do you want to send different streams depending of the video format selected by the client?

No

All the virtual cameras are receiving the same stream independently of the selected vcam? (maybe a bug?)

No

Do you want to forbid other programs to use the virtual camera when already in use?

Yes

I use a web camera in Chrome.
I'm getting stream with constraints video: { width: 1280, height: 720 }, but at the same time i'm trying to display a stream with constraints video: { width: 640, height: 480 } with the same camera. My real web cam cannot output streams in different formats, i get a error and this is ok.
When i do the same with virtual camera i see both streams. The same for different programs.

Is it possible to implement exclusive mode?

Thank you for your efforts :)

@hipersayanX
Copy link
Member

Ok, now I understand, it was not supposed to work like that.

Is it possible to implement exclusive mode?

Yes of course. The camera setup pipeline is basically: getting the camera filter, setup the format, and then call IMediaControl::Run().
If I remember well, IMediaControl::Run(), called IMediaFilter::Run() which is called here, the global state of the vcams are saved here, and you can communicate with the service using the IPC bridge.
You can probably check if the vcam has other listeners beside current instance and then return an error when calling IMediaFilter::Run(). This is the documentation for IMediaFilter::Run(). It probably need a bit more of thinking, but you have a starting point there.

@hipersayanX hipersayanX changed the title Is it possible to forbid two concurrent formats? Forbid other programs to use the virtual camera when already in use Nov 20, 2022
@hipersayanX hipersayanX transferred this issue from webcamoid/akvirtualcamera Oct 29, 2023
@hipersayanX hipersayanX transferred this issue from another repository Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants