@@ -43,6 +43,16 @@ struct camera_portal_source {
4343
4444 obs_pipewire_stream * obs_pw_stream ;
4545 char * device_id ;
46+
47+ struct {
48+ struct spa_rectangle rect ;
49+ bool set ;
50+ } resolution ;
51+
52+ struct {
53+ struct spa_fraction fraction ;
54+ bool set ;
55+ } framerate ;
4656};
4757
4858/* ------------------------------------------------- */
@@ -259,6 +269,8 @@ static bool update_device_id(struct camera_portal_source *camera_source,
259269static void stream_camera (struct camera_portal_source * camera_source )
260270{
261271 struct obs_pipwire_connect_stream_info connect_info ;
272+ const struct spa_rectangle * resolution = NULL ;
273+ const struct spa_fraction * framerate = NULL ;
262274 struct camera_device * device ;
263275
264276 g_clear_pointer (& camera_source -> obs_pw_stream ,
@@ -273,12 +285,20 @@ static void stream_camera(struct camera_portal_source *camera_source)
273285 blog (LOG_INFO , "[camera-portal] streaming camera '%s'" ,
274286 camera_source -> device_id );
275287
288+ if (camera_source -> resolution .set )
289+ resolution = & camera_source -> resolution .rect ;
290+ if (camera_source -> framerate .set )
291+ framerate = & camera_source -> framerate .fraction ;
292+
276293 connect_info = (struct obs_pipwire_connect_stream_info ){
277294 .stream_name = "OBS PipeWire Camera" ,
278295 .stream_properties = pw_properties_new (
279296 PW_KEY_MEDIA_TYPE , "Video" , PW_KEY_MEDIA_CATEGORY ,
280297 "Capture" , PW_KEY_MEDIA_ROLE , "Camera" , NULL ),
281- };
298+ .video = {
299+ .resolution = resolution ,
300+ .framerate = framerate ,
301+ }};
282302
283303 camera_source -> obs_pw_stream = obs_pipewire_connect_stream (
284304 connection -> obs_pw , camera_source -> source , device -> id ,
@@ -1239,11 +1259,18 @@ static const char *pipewire_camera_get_name(void *data)
12391259static void * pipewire_camera_create (obs_data_t * settings , obs_source_t * source )
12401260{
12411261 struct camera_portal_source * camera_source ;
1262+ bool set ;
12421263
12431264 camera_source = bzalloc (sizeof (struct camera_portal_source ));
12441265 camera_source -> source = source ;
12451266 camera_source -> device_id =
12461267 bstrdup (obs_data_get_string (settings , "device_id" ));
1268+ camera_source -> framerate .set =
1269+ parse_framerate (& camera_source -> framerate .fraction ,
1270+ obs_data_get_string (settings , "framerate" ));
1271+ camera_source -> resolution .set =
1272+ parse_resolution (& camera_source -> resolution .rect ,
1273+ obs_data_get_string (settings , "resolution" ));
12471274
12481275 access_camera (camera_source );
12491276
0 commit comments