video outputs initialisation...

Gildas Bazin gbazin at netcourrier.com
Mon May 7 12:08:34 CEST 2001


Hi all,

I've been running into problems with the way system dependent video outputs
are initialized.

The problem is that on Windows, the events are managed on a thread by
thread basis. So, if you create
your video window in one thread, but do the event managing in another
thread, you simply won't see
any of the events that are sent to your video window.

Unfortunately, video_outup.c will always create the system dependent video
output method before
creating the video_output thread. Is there any reason why it's been done
like this ? (or is it
because you never designed the VLC to run on such a crap OS ;-)

I've included a little patch which just does the system video output
initialisation in InitThread
instead of CreateThread. But now, vout_Create and vout_Init are a little
bit redundant...

Regards,

Gildas

-- Attached file included as plaintext by Listar --

Index: src/video_output/video_output.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/video_output/video_output.c,v
retrieving revision 1.126
diff -u -r1.126 video_output.c
--- src/video_output/video_output.c	2001/05/07 04:42:42	1.126
+++ src/video_output/video_output.c	2001/05/07 09:31:31
@@ -118,7 +118,8 @@
  *****************************************************************************
  * This function creates a new video output thread, and returns a pointer
  * to its description. On error, it returns NULL.
- * If pi_status is NULL, then the function will block until the thread is ready.
+ * If pi_status is NULL, then the function will block until the thread is
+ * ready.
  * If not, it will be updated using one of the THREAD_* constants.
  *****************************************************************************/
 vout_thread_t * vout_CreateThread   ( int *pi_status )
@@ -226,50 +227,6 @@
 
     p_vout->i_pictures = 0;
 
-    /* Create and initialize system-dependant method - this function issues its
-     * own error messages */
-    if( p_vout->pf_create( p_vout ) )
-    {
-        module_Unneed( p_vout->p_module );
-        free( p_vout );
-        return( NULL );
-    }
-
-    intf_WarnMsg( 3, "actual configuration: %dx%d, %d/%d bpp (%d Bpl), "
-                  "masks: 0x%x/0x%x/0x%x",
-                  p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
-                  p_vout->i_bytes_per_pixel * 8, p_vout->i_bytes_per_line,
-                  p_vout->i_red_mask, p_vout->i_green_mask,
-                  p_vout->i_blue_mask );
-
-    /* Calculate shifts from system-updated masks */
-    MaskToShift( &p_vout->i_red_lshift, &p_vout->i_red_rshift,
-                 p_vout->i_red_mask );
-    MaskToShift( &p_vout->i_green_lshift, &p_vout->i_green_rshift,
-                 p_vout->i_green_mask );
-    MaskToShift( &p_vout->i_blue_lshift, &p_vout->i_blue_rshift,
-                 p_vout->i_blue_mask );
-
-    /* Set some useful colors */
-    p_vout->i_white_pixel = RGB2PIXEL( p_vout, 255, 255, 255 );
-    p_vout->i_black_pixel = RGB2PIXEL( p_vout, 0, 0, 0 );
-    p_vout->i_gray_pixel  = RGB2PIXEL( p_vout, 128, 128, 128 );
-    p_vout->i_blue_pixel  = RGB2PIXEL( p_vout, 0, 0, 50 );
-
-    /* Load fonts - fonts must be initialized after the system method since
-     * they may be dependant on screen depth and other thread properties */
-    p_vout->p_default_font = vout_LoadFont( VOUT_DEFAULT_FONT );
-    if( p_vout->p_default_font == NULL )
-    {
-        intf_ErrMsg( "vout error: could not load default font" );
-    }
-
-    p_vout->p_large_font = vout_LoadFont( VOUT_LARGE_FONT );
-    if( p_vout->p_large_font == NULL )
-    {
-        intf_ErrMsg( "vout error: could not load large font" );
-    }
-
     /* Create thread and set locks */
     vlc_mutex_init( &p_vout->picture_lock );
     vlc_mutex_init( &p_vout->subpicture_lock );
@@ -279,8 +236,6 @@
                            (void *) RunThread, (void *) p_vout) )
     {
         intf_ErrMsg("vout error: %s", strerror(ENOMEM));
-        vout_UnloadFont( p_vout->p_default_font );
-        vout_UnloadFont( p_vout->p_large_font );
         p_vout->pf_destroy( p_vout );
         free( p_vout );
         return( NULL );
@@ -948,6 +903,50 @@
 #ifdef STATS
     p_vout->c_loops = 0;
 #endif
+
+    /* Create and initialize system-dependant method - this function issues its
+     * own error messages */
+    if( p_vout->pf_create( p_vout ) )
+    {
+        module_Unneed( p_vout->p_module );
+        free( p_vout );
+        return( 1 );
+    }
+
+    intf_WarnMsg( 3, "actual configuration: %dx%d, %d/%d bpp (%d Bpl), "
+                  "masks: 0x%x/0x%x/0x%x",
+                  p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
+                  p_vout->i_bytes_per_pixel * 8, p_vout->i_bytes_per_line,
+                  p_vout->i_red_mask, p_vout->i_green_mask,
+                  p_vout->i_blue_mask );
+
+    /* Calculate shifts from system-updated masks */
+    MaskToShift( &p_vout->i_red_lshift, &p_vout->i_red_rshift,
+                 p_vout->i_red_mask );
+    MaskToShift( &p_vout->i_green_lshift, &p_vout->i_green_rshift,
+                 p_vout->i_green_mask );
+    MaskToShift( &p_vout->i_blue_lshift, &p_vout->i_blue_rshift,
+                 p_vout->i_blue_mask );
+
+    /* Set some useful colors */
+    p_vout->i_white_pixel = RGB2PIXEL( p_vout, 255, 255, 255 );
+    p_vout->i_black_pixel = RGB2PIXEL( p_vout, 0, 0, 0 );
+    p_vout->i_gray_pixel  = RGB2PIXEL( p_vout, 128, 128, 128 );
+    p_vout->i_blue_pixel  = RGB2PIXEL( p_vout, 0, 0, 50 );
+
+    /* Load fonts - fonts must be initialized after the system method since
+     * they may be dependant on screen depth and other thread properties */
+    p_vout->p_default_font = vout_LoadFont( VOUT_DEFAULT_FONT );
+    if( p_vout->p_default_font == NULL )
+    {
+        intf_ErrMsg( "vout error: could not load default font" );
+    }
+
+    p_vout->p_large_font = vout_LoadFont( VOUT_LARGE_FONT );
+    if( p_vout->p_large_font == NULL )
+    {
+        intf_ErrMsg( "vout error: could not load large font" );
+    }
 
    /* Initialize output method - this function issues its own error messages */
     if( p_vout->pf_init( p_vout ) )





More information about the vlc-devel mailing list