nowrep / obs-vkcapture

OBS Linux Vulkan/OpenGL game capture
GNU General Public License v2.0
508 stars 25 forks source link

Is there someway to know if obs-vkcapture is running? #140

Closed sifiro closed 1 year ago

sifiro commented 1 year ago

Hi!, I usually use OBS Replay Buffer always-on and Advanced Scene Switch to switch scenes automatically using as reference: cursor position, process existence, file existence, window focus and other ways.

I would like to know or request If obs-vkcapture makes or someway is making noticeable when It's recording some game or Vulkan application. (for example, making a file in /run or /tmp )

nowrep commented 1 year ago

There will be dmabufs you can list with ls -l /proc/$(pidof obs)/fd.

sifiro commented 1 year ago

You are right but... It only shows when Game Capture is activated (So It's rendering), which is not relevant in my case because I need it when I'm not using it (to switch to a scene where Game Capture is on)

Clarifying, I'm referring to when a game which env var is settled to OBS_VKCapture=1 or obs-gamecapture is used (So, It's already listening or getting ready) but the Game Capture is not rendering (yet).

That said If It doesn't exist and you don't have any plans to include it, Could You name some key functions for implementing it myself as a local patch/fork? (I mean It's a silly feature which only benefits me)

EDIT: I made some workaround but It's dirty (Copy&Paste GameCapture in every scene and when the size changes to another scene), So I am still interested in a official way detect this.

nowrep commented 1 year ago

So you just want to know when there are clients (games) connected to OBS waiting for capture to start?

Client connect:

https://github.com/nowrep/obs-vkcapture/blob/eadcf2666608743ca497e2ef10761bcc6bb64959/src/vkcapture.c#L741-L750

Client disconnect:

https://github.com/nowrep/obs-vkcapture/blob/eadcf2666608743ca497e2ef10761bcc6bb64959/src/vkcapture.c#L674-L680

You can add your code there (check server.clients.num to see if there is any client connected).