@@ -38,7 +38,7 @@ QAction *auto_start_action;
3838QAction *tools_menu_action;
3939#endif
4040
41- const char *PluginVer = " 012 " ;
41+ const char *PluginVer = " 020 " ;
4242const char *PluginName = " DroidCam Virtual Output" ;
4343obs_output_t *droidcam_virtual_output = NULL ;
4444config_t *obs_config = NULL ;
@@ -176,11 +176,16 @@ static void video_conversion(droidcam_output_plugin *plugin) {
176176
177177 float src_ar = (float ) src_w / (float ) src_h;
178178 float dst_ar = (float ) dst_w / (float ) dst_h;
179+
180+ float h_ar = (float )dst_h / (float )src_h;
181+ float w_ar = (float )dst_w / (float )src_w;
182+
179183 if (abs (src_ar - dst_ar) < 0 .01f ) {
180184 // same aspect ratio
181185 shift_x = 0 ;
182186 shift_y = 0 ;
183- } else if ((src_h - dst_h) > (src_w - dst_w)) {
187+
188+ } else if (h_ar < w_ar) {
184189 const int dst_w0 = dst_w;
185190 dst_w = dst_h * src_w / src_h;
186191 shift_x = (dst_w0 - dst_w) / 2 ;
@@ -199,7 +204,7 @@ static void video_conversion(droidcam_output_plugin *plugin) {
199204 dst_w &= ~1 ;
200205 dst_h &= ~1 ;
201206
202- ilog (" video scaling: %dx%d -> %dx%d -> %dx%d at %d,%d" ,
207+ ilog (" video scaling: %dx%d -> %dx%d inside %dx%d at %d,%d" ,
203208 src_w, src_h, dst_w, dst_h,
204209 plugin->webcam_w , plugin->webcam_h ,
205210 shift_x, shift_y);
0 commit comments