]> git.sesse.net Git - vlc/commitdiff
vout_Snapshot(): hability to specify width & height when the snapshot isn't taken...
authorRafaël Carré <funman@videolan.org>
Tue, 4 Dec 2007 15:49:28 +0000 (15:49 +0000)
committerRafaël Carré <funman@videolan.org>
Tue, 4 Dec 2007 15:49:28 +0000 (15:49 +0000)
Value of 0 for width OR height means that we want to keep the original aspect ratio.

src/video_output/vout_intf.c

index bf9481d3c109e49e5da78ec3569e613c57ac6993..d8b20839686ddf3150ced8fcc3783261453109f1 100644 (file)
@@ -705,6 +705,20 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
     free( val.psz_string );
     free( format.psz_string );
 
+    fmt_out.i_width = var_GetInteger( p_vout, "snapshot-width" );
+    fmt_out.i_height = var_GetInteger( p_vout, "snapshot-height" );
+
+    if( fmt_out.i_width == 0 && fmt_out.i_height > 0 )
+    {
+        float f = (float)p_vout->fmt_in.i_height / fmt_out.i_height;
+        fmt_out.i_width = p_vout->fmt_in.i_width / f;
+    }
+    else if( fmt_out.i_height == 0 && fmt_out.i_width > 0 )
+    {
+        float f = (float)p_vout->fmt_in.i_width / fmt_out.i_width;
+        fmt_out.i_height = p_vout->fmt_in.i_height / f;
+    }
+
     /* Save the snapshot */
     fmt_in = p_vout->fmt_in;
     fmt_out.i_sar_num = fmt_out.i_sar_den = 1;