[vlc-devel] commit: Don't compute system-dependent stuff in the plugin descriptor ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Jan 28 22:39:22 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Jan 28 23:33:16 2009 +0200| [ae6c447ae09c0adf2c722c7387c528cf2dd71219] | committer: Rémi Denis-Courmont 

Don't compute system-dependent stuff in the plugin descriptor

This is cached data. Nothing forbids upgrading your OS or sharing the
cache with multiple versions.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ae6c447ae09c0adf2c722c7387c528cf2dd71219
---

 modules/video_output/msw/direct3d.c |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c
index 716b931..5797927 100644
--- a/modules/video_output/msw/direct3d.c
+++ b/modules/video_output/msw/direct3d.c
@@ -84,9 +84,7 @@ static void Direct3DVoutRenderScene     ( vout_thread_t *, picture_t * );
  * Module descriptor
  *****************************************************************************/
 
-static bool _got_vista_or_above;
-
-static int get_capability_for_osversion(void)
+static bool IsVistaOrAbove(void)
 {
     OSVERSIONINFO winVer;
     winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -96,13 +94,21 @@ static int get_capability_for_osversion(void)
         if( winVer.dwMajorVersion > 5 )
         {
             /* Windows Vista or above, make this module the default */
-        _got_vista_or_above = true;
-            return 150;
+            return true;
         }
     }
     /* Windows XP or lower, make sure this module isn't the default */
-    _got_vista_or_above = false;
-    return 50;
+    return false;
+}
+
+static int OpenVideoXP( vlc_object_t *obj )
+{
+    return IsVistaOrAbove() ? VLC_EGENERIC : OpenVideo( obj );
+}
+
+static int OpenVideoVista( vlc_object_t *obj )
+{
+    return IsVistaOrAbove() ? OpenVideo( obj ) : VLC_EGENERIC;
 }
 
 vlc_module_begin ()
@@ -110,12 +116,16 @@ vlc_module_begin ()
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VOUT )
     set_description( N_("DirectX 3D video output") )
-    set_capability( "video output", get_capability_for_osversion() )
+    set_capability( "video output", 50 )
     add_shortcut( "direct3d" )
-    set_callbacks( OpenVideo, CloseVideo )
+    set_callbacks( OpenVideoXP, CloseVideo )
 
     /* FIXME: Hack to avoid unregistering our window class */
     linked_with_a_crap_library_which_uses_atexit ()
+
+    add_submodule()
+        set_capability( "video output", 150 )
+        set_callbacks( OpenVideoVista, CloseVideo )
 vlc_module_end ()
 
 #if 0 /* FIXME */




More information about the vlc-devel mailing list