Get Camera Resolution from API

danielscg

New Member
I'm relatively new to C++ and OBS plugin development and I've recently inherited a project from someone who has moved on. Currently, I'm working on a plugin that automatically sets up scenes in OBS for multiple connected cameras. The goal is to have a button in the plugin that configures scenes for all cameras connected to the laptop.

I've made progress in detecting connected cameras and setting them up as sources in scenes. However, I'm facing an issue with scaling the resolution of these camera sources to match the canvas resolution. Different cameras seem to default to different resolutions, with some at their maximum resolution and others at lower resolutions.

For instance, my webcam defaults to 720p, while another camera I'm testing defaults to 480p even though its maximum resolution is 4K.

Ideally, I'd like to manually change the output resolution of the cameras to match the canvas resolution. For example, scaling down the 4K camera source to fit the 1080p canvas. However, my main priority is to ensure that the source resolution matches the canvas resolution automatically during the scene generation process.

Attached is the SceneGenerator.cpp file in zipped form.
 

Attachments

  • SceneGenerator.zip
    2.7 KB · Views: 8
Top