]> git.sesse.net Git - vlc/blobdiff - src/video_output/video_output.c
. nouveaux plugins - ne fonctionnent pas encore tous
[vlc] / src / video_output / video_output.c
index a4f2a769e8a0d71d911f66503afc18fa929ddd45..2514f4d7f465e304909e81573d9587c12792d27d 100644 (file)
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -88,7 +87,8 @@ static void     SetPalette        ( p_vout_thread_t p_vout, u16 *red,
  * If not, it will be updated using one of the THREAD_* constants.
  *****************************************************************************/
 vout_thread_t * vout_CreateThread   ( char *psz_display, int i_root_window,
-                          int i_width, int i_height, int *pi_status, int i_method )
+                          int i_width, int i_height, int *pi_status,
+                          int i_method, void *p_data )
 {
     vout_thread_t * p_vout;                             /* thread descriptor */
     int             i_status;                               /* thread status */
@@ -107,20 +107,26 @@ vout_thread_t * vout_CreateThread   ( char *psz_display, int i_root_window,
     /* Request an interface plugin */
     psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD );
 
-    if( RequestPlugin( &p_vout->vout_plugin, "vout", psz_method ) < 0 )
+    if( RequestPlugin( &p_vout->vout_plugin, psz_method ) < 0 )
     {
-        intf_ErrMsg( "error: could not open video plugin vout_%s.so\n", psz_method );
+        intf_ErrMsg( "error: could not open video plugin %s.so\n", psz_method );
         free( p_vout );
         return( NULL );
     }
 
     /* Get plugins */
-    p_vout->p_sys_create =  GetPluginFunction( p_vout->vout_plugin, "vout_SysCreate" );
-    p_vout->p_sys_init =    GetPluginFunction( p_vout->vout_plugin, "vout_SysInit" );
-    p_vout->p_sys_end =     GetPluginFunction( p_vout->vout_plugin, "vout_SysEnd" );
-    p_vout->p_sys_destroy = GetPluginFunction( p_vout->vout_plugin, "vout_SysDestroy" );
-    p_vout->p_sys_manage =  GetPluginFunction( p_vout->vout_plugin, "vout_SysManage" );
-    p_vout->p_sys_display = GetPluginFunction( p_vout->vout_plugin, "vout_SysDisplay" );
+    p_vout->p_sys_create = 
+        GetPluginFunction( p_vout->vout_plugin, "vout_SysCreate" );
+    p_vout->p_sys_init =
+        GetPluginFunction( p_vout->vout_plugin, "vout_SysInit" );
+    p_vout->p_sys_end =
+        GetPluginFunction( p_vout->vout_plugin, "vout_SysEnd" );
+    p_vout->p_sys_destroy =
+        GetPluginFunction( p_vout->vout_plugin, "vout_SysDestroy" );
+    p_vout->p_sys_manage =
+        GetPluginFunction( p_vout->vout_plugin, "vout_SysManage" );
+    p_vout->p_sys_display =
+        GetPluginFunction( p_vout->vout_plugin, "vout_SysDisplay" );
 
     /* Initialize thread properties - thread id and locks will be initialized
      * later */
@@ -140,16 +146,17 @@ vout_thread_t * vout_CreateThread   ( char *psz_display, int i_root_window,
     p_vout->i_bytes_per_pixel   = 2;
     p_vout->f_gamma             = VOUT_GAMMA;
 
-    p_vout->b_grayscale         = main_GetIntVariable( VOUT_GRAYSCALE_VAR, VOUT_GRAYSCALE_DEFAULT );
+    p_vout->b_grayscale         = main_GetIntVariable( VOUT_GRAYSCALE_VAR,
+                                                       VOUT_GRAYSCALE_DEFAULT );
     p_vout->b_info              = 0;
     p_vout->b_interface         = 0;
     p_vout->b_scale             = 0;
 
     p_vout->p_set_palette       = SetPalette;
 
-    intf_DbgMsg("wished configuration: %dx%d, %d/%d bpp (%d Bpl)\n",
-                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 );
+    intf_DbgMsg( "wished configuration: %dx%d, %d/%d bpp (%d Bpl)\n",
+                 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 );
 
     /* Initialize idle screen */
     p_vout->last_display_date   = mdate();
@@ -184,7 +191,7 @@ vout_thread_t * vout_CreateThread   ( char *psz_display, int i_root_window,
 
     /* Create and initialize system-dependant method - this function issues its
      * own error messages */
-    if( p_vout->p_sys_create( p_vout, psz_display, i_root_window ) )
+    if( p_vout->p_sys_create( p_vout, psz_display, i_root_window, p_data ) )
     {
         TrashPlugin( p_vout->vout_plugin );
         free( p_vout );
@@ -1062,6 +1069,10 @@ last_display_date = display_date;
                     RenderPictureInfo( p_vout, p_pic );
                     RenderInfo( p_vout );
                 }
+                if( p_subpic )
+                {
+                    RenderSubPicture( p_vout, p_subpic );
+                }
             }
 
             /* Remove picture from heap */
@@ -1082,49 +1093,8 @@ last_display_date = display_date;
             {
                 RenderInterface( p_vout );
             }
-            if( p_subpic )
-            {
-                if( b_display )
-                {
-                    RenderSubPicture( p_vout, p_subpic );
-                }
-
-                /* Remove subpicture from heap */
-                /*vlc_mutex_lock( &p_vout->subpicture_lock );
-                p_subpic->i_status = DESTROYED_SUBPICTURE;
-                vlc_mutex_unlock( &p_vout->subpicture_lock );*/
-            }
 
         }
-#if 0
-        else if( p_subpic )                              /* subpicture alone */
-        {
-            b_display = p_vout->b_active;
-            p_vout->last_display_date = display_date;
-
-            if( b_display )
-            {
-                /* Clear buffer */
-                SetBufferPicture( p_vout, NULL );
-
-                /* Render informations, interface and subpicture */
-                if( p_vout->b_info )
-                {
-                    RenderInfo( p_vout );
-                }
-                if( p_vout->b_interface )
-                {
-                    RenderInterface( p_vout );
-                }
-                RenderSubPicture( p_vout, p_subpic );
-            }
-
-            /* Remove subpicture from heap */
-            /*vlc_mutex_lock( &p_vout->subpicture_lock );
-            p_subpic->i_status = DESTROYED_SUBPICTURE;
-            vlc_mutex_unlock( &p_vout->subpicture_lock );*/
-        }
-#endif
         else if( p_vout->b_active )        /* idle or interface screen alone */
         {
             if( p_vout->b_interface && 0 /* && XXX?? intf_change */ )
@@ -1184,7 +1154,9 @@ last_display_date = display_date;
         if( b_display && !(p_vout->i_changes & VOUT_NODISPLAY_CHANGE) )
         {
             p_vout->p_sys_display( p_vout );
+#ifndef SYS_BEOS
             p_vout->i_buffer_index = ++p_vout->i_buffer_index & 1;
+#endif
         }
 
         /*
@@ -1557,7 +1529,7 @@ static void SetBufferPicture( vout_thread_t *p_vout, picture_t *p_pic )
     }
 
     /*
-     * Set new picture size - if is is smaller than the previous one, clear
+     * Set new picture size - if it is smaller than the previous one, clear
      * around it. Since picture are centered, only their size is tested.
      */
     if( (p_buffer->i_pic_width > i_pic_width) || (p_buffer->i_pic_height > i_pic_height) )
@@ -1640,8 +1612,8 @@ static void RenderPicture( vout_thread_t *p_vout, picture_t *p_pic )
     /* Get and set rendering informations */
     p_buffer =          &p_vout->p_buffer[ p_vout->i_buffer_index ];
     p_pic_data =        p_buffer->p_data +
-        p_buffer->i_pic_x * p_vout->i_bytes_per_pixel +
-        p_buffer->i_pic_y * p_vout->i_bytes_per_line;
+                        p_buffer->i_pic_x * p_vout->i_bytes_per_pixel +
+                        p_buffer->i_pic_y * p_vout->i_bytes_per_line;
 #ifdef DEBUG_VIDEO
     render_time = mdate();
 #endif
@@ -1842,19 +1814,17 @@ static void RenderSubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
             /* test if the picture really has to be displayed */
             if( mdate() < p_subpic->begin_date )
             {
+                /* not yet, see you later */
                 break;
             }
             if( mdate() > p_subpic->end_date )
             {
                 /* too late, destroying the subpic */
                 vout_DestroySubPicture( p_vout, p_subpic );
-                printf( "destroying subpicture\n" );
                 break;
             }
-            vout_RenderSPU( p_subpic->p_data, p_subpic->type.spu.i_offset,
-                            p_subpic->type.spu.i_x1, p_subpic->type.spu.i_y1,
-                            p_vout->p_buffer[ p_vout->i_buffer_index ].p_data,
-                            p_vout->i_bytes_per_pixel,
+            vout_RenderSPU( &p_vout->p_buffer[ p_vout->i_buffer_index ],
+                            p_subpic, p_vout->i_bytes_per_pixel,
                             p_vout->i_bytes_per_line );
             break;
         case TEXT_SUBPICTURE:                            /* single line text */