]> git.sesse.net Git - vlc/blobdiff - src/video_output/vout_intf.c
* changed the order of offered aspect/crop values so that the most commonly
[vlc] / src / video_output / vout_intf.c
index 4301e4733118200652a56dd316249ad018eb0935..dba906723a4f4be6c410918708fa93e6f0a3aa76 100644 (file)
@@ -239,12 +239,14 @@ void vout_IntfInit( vout_thread_t *p_vout )
     var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
     val.psz_string = "004:3"; text.psz_string = "4:3";
     var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
-    val.psz_string = "16:10"; text.psz_string = "16:10";
+    val.psz_string = "16:09"; text.psz_string = "16:9";
     var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
-    val.psz_string = "16:9"; text.psz_string = "16:9";
+    val.psz_string = "16:10"; text.psz_string = "16:10";
     var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
     val.psz_string = "221:100"; text.psz_string = "221:100";
     var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
+    val.psz_string = "5:4"; text.psz_string = "5:4";
+    var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
 
     var_AddCallback( p_vout, "crop", CropCallback, NULL );
     var_Get( p_vout, "crop", &old_val );
@@ -300,12 +302,14 @@ void vout_IntfInit( vout_thread_t *p_vout )
     var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text );
     val.psz_string = "004:3"; text.psz_string = "4:3";
     var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text );
-    val.psz_string = "16:10"; text.psz_string = "16:10";
+    val.psz_string = "16:09"; text.psz_string = "16:9";
     var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text );
-    val.psz_string = "16:9"; text.psz_string = "16:9";
+    val.psz_string = "16:10"; text.psz_string = "16:10";
     var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text );
     val.psz_string = "221:100"; text.psz_string = "221:100";
     var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text );
+    val.psz_string = "5:4"; text.psz_string = "5:4";
+    var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text );
 
     var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
     var_Get( p_vout, "aspect-ratio", &old_val );
@@ -376,96 +380,12 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
         val.psz_string = 0;
     }
 
-#if defined(__APPLE__) || defined(SYS_BEOS)
-    if( !val.psz_string && p_vout->p_vlc->psz_homedir )
-    {
-        asprintf( &val.psz_string, "%s/Desktop",
-                  p_vout->p_vlc->psz_homedir );
-    }
-
-#elif defined(WIN32) && !defined(UNDER_CE)
-    if( !val.psz_string && p_vout->p_vlc->psz_homedir )
-    {
-        /* Get the My Pictures folder path */
-
-        char *p_mypicturesdir = NULL;
-        typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD,
-                                                   LPSTR );
-        #ifndef CSIDL_FLAG_CREATE
-        #   define CSIDL_FLAG_CREATE 0x8000
-        #endif
-        #ifndef CSIDL_MYPICTURES
-        #   define CSIDL_MYPICTURES 0x27
-        #endif
-        #ifndef SHGFP_TYPE_CURRENT
-        #   define SHGFP_TYPE_CURRENT 0
-        #endif
-
-        HINSTANCE shfolder_dll;
-        SHGETFOLDERPATH SHGetFolderPath ;
-
-        /* load the shfolder dll to retrieve SHGetFolderPath */
-        if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL )
-        {
-            SHGetFolderPath = (void *)GetProcAddress( shfolder_dll,
-                                                      _T("SHGetFolderPathA") );
-            if( SHGetFolderPath != NULL )
-            {
-                p_mypicturesdir = (char *)malloc( MAX_PATH );
-                if( p_mypicturesdir ) 
-                {
-
-                    if( S_OK != SHGetFolderPath( NULL,
-                                        CSIDL_MYPICTURES | CSIDL_FLAG_CREATE,
-                                        NULL, SHGFP_TYPE_CURRENT,
-                                        p_mypicturesdir ) )
-                    {
-                        free( p_mypicturesdir );
-                        p_mypicturesdir = NULL;
-                    }
-                }
-            }
-            FreeLibrary( shfolder_dll );
-        }
-
-        if( p_mypicturesdir == NULL )
-        {
-            asprintf( &val.psz_string, "%s/" CONFIG_DIR,
-                      p_vout->p_vlc->psz_homedir );
-        }
-        else
-        {
-            asprintf( &val.psz_string, p_mypicturesdir );
-            free( p_mypicturesdir );
-        }
-    }
-
-#else
-    if( !val.psz_string && p_vout->p_vlc->psz_homedir )
-    {
-        asprintf( &val.psz_string, "%s/" CONFIG_DIR,
-                  p_vout->p_vlc->psz_homedir );
-    }
-#endif
-
-    if( !val.psz_string )
-    {
-        msg_Err( p_vout, "no directory specified for snapshots" );
-        return VLC_EGENERIC;
-    }
-    var_Get( p_vout, "snapshot-format", &format );
-    if( !format.psz_string || !*format.psz_string )
-    {
-        if( format.psz_string ) free( format.psz_string );
-        format.psz_string = strdup( "png" );
-    }
-
     /* Embedded snapshot : if snapshot-path == object:object-id, then
        create a snapshot_t* and store it in
        object(object-id)->p_private, then unlock and signal the
        waiting object.
      */
-    if( !strncmp( val.psz_string, "object:", 7 ) )
+    if( val.psz_string && !strncmp( val.psz_string, "object:", 7 ) )
     {
         int i_id;
         vlc_object_t* p_dest;
@@ -489,6 +409,8 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
         /* Save the snapshot to a memory zone */
         fmt_in = p_vout->fmt_in;
         fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
+       /* FIXME: should not be hardcoded. We should be able to
+          specify the snapshot size (snapshot-width and snapshot-height). */
         fmt_out.i_width = 320;
         fmt_out.i_height = 200;
         fmt_out.i_chroma = VLC_FOURCC( 'p','n','g',' ' );
@@ -548,6 +470,91 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
        return VLC_SUCCESS;
     }
 
+
+#if defined(__APPLE__) || defined(SYS_BEOS)
+    if( !val.psz_string && p_vout->p_vlc->psz_homedir )
+    {
+        asprintf( &val.psz_string, "%s/Desktop",
+                  p_vout->p_vlc->psz_homedir );
+    }
+
+#elif defined(WIN32) && !defined(UNDER_CE)
+    if( !val.psz_string && p_vout->p_vlc->psz_homedir )
+    {
+        /* Get the My Pictures folder path */
+
+        char *p_mypicturesdir = NULL;
+        typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD,
+                                                   LPSTR );
+        #ifndef CSIDL_FLAG_CREATE
+        #   define CSIDL_FLAG_CREATE 0x8000
+        #endif
+        #ifndef CSIDL_MYPICTURES
+        #   define CSIDL_MYPICTURES 0x27
+        #endif
+        #ifndef SHGFP_TYPE_CURRENT
+        #   define SHGFP_TYPE_CURRENT 0
+        #endif
+
+        HINSTANCE shfolder_dll;
+        SHGETFOLDERPATH SHGetFolderPath ;
+
+        /* load the shfolder dll to retrieve SHGetFolderPath */
+        if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL )
+        {
+            SHGetFolderPath = (void *)GetProcAddress( shfolder_dll,
+                                                      _T("SHGetFolderPathA") );
+            if( SHGetFolderPath != NULL )
+            {
+                p_mypicturesdir = (char *)malloc( MAX_PATH );
+                if( p_mypicturesdir ) 
+                {
+
+                    if( S_OK != SHGetFolderPath( NULL,
+                                        CSIDL_MYPICTURES | CSIDL_FLAG_CREATE,
+                                        NULL, SHGFP_TYPE_CURRENT,
+                                        p_mypicturesdir ) )
+                    {
+                        free( p_mypicturesdir );
+                        p_mypicturesdir = NULL;
+                    }
+                }
+            }
+            FreeLibrary( shfolder_dll );
+        }
+
+        if( p_mypicturesdir == NULL )
+        {
+            asprintf( &val.psz_string, "%s/" CONFIG_DIR,
+                      p_vout->p_vlc->psz_homedir );
+        }
+        else
+        {
+            asprintf( &val.psz_string, p_mypicturesdir );
+            free( p_mypicturesdir );
+        }
+    }
+
+#else
+    if( !val.psz_string && p_vout->p_vlc->psz_homedir )
+    {
+        asprintf( &val.psz_string, "%s/" CONFIG_DIR,
+                  p_vout->p_vlc->psz_homedir );
+    }
+#endif
+
+    if( !val.psz_string )
+    {
+        msg_Err( p_vout, "no directory specified for snapshots" );
+        return VLC_EGENERIC;
+    }
+    var_Get( p_vout, "snapshot-format", &format );
+    if( !format.psz_string || !*format.psz_string )
+    {
+        if( format.psz_string ) free( format.psz_string );
+        format.psz_string = strdup( "png" );
+    }
+
     asprintf( &psz_filename, "%s/vlcsnap-%u.%s", val.psz_string,
               (unsigned int)(p_pic->date / 100000) & 0xFFFFFF,
               format.psz_string );
@@ -712,7 +719,8 @@ static int ZoomCallback( vlc_object_t *p_this, char const *psz_cmd,
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
     InitWindowSize( p_vout, &p_vout->i_window_width,
                     &p_vout->i_window_height );
-    vout_Control( p_vout, VOUT_SET_SIZE, 0, 0 );
+    vout_Control( p_vout, VOUT_SET_SIZE, p_vout->i_window_width, 
+                  p_vout->i_window_height );
     return VLC_SUCCESS;
 }