]> git.sesse.net Git - vlc/blobdiff - src/video_output/video_yuv.c
* Mandatory step for video output IV and the audio output quality
[vlc] / src / video_output / video_yuv.c
index 2fea550ca8a544b7becee68bce1384efcbc1e87c..caaa1dc2ac3c4f1fb6e69bc225fe0becf05463f8 100644 (file)
@@ -3,8 +3,9 @@
  * These functions set up YUV tables for colorspace conversion
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: video_yuv.c,v 1.48 2001/05/01 04:18:18 sam Exp $
  *
- * Authors:
+ * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include "common.h"
 #include "threads.h"
 #include "mtime.h"
-#include "plugins.h"
+#include "modules.h"
+
 #include "video.h"
 #include "video_output.h"
 #include "video_yuv.h"
 
 #include "intf_msg.h"
 
-#include "main.h"
-
 /*****************************************************************************
  * vout_InitYUV: allocate and initialize translation tables
  *****************************************************************************
  *****************************************************************************/
 int vout_InitYUV( vout_thread_t *p_vout )
 {
-    typedef void ( yuv_getplugin_t ) ( vout_thread_t * p_vout );
-    int          i_index;
+    /* Choose the best module */
+    p_vout->yuv.p_module = module_Need( MODULE_CAPABILITY_YUV, NULL );
 
-    /* Get a suitable YUV plugin */
-    for( i_index = 0 ; i_index < p_main->p_bank->i_plugin_count ; i_index++ )
+    if( p_vout->yuv.p_module == NULL )
     {
-        /* If there's a plugin in p_info ... */
-        if( p_main->p_bank->p_info[ i_index ] != NULL )
-        {
-            /* ... and if this plugin provides the functions we want ... */
-            if( p_main->p_bank->p_info[ i_index ]->yuv_GetPlugin != NULL )
-            {
-                /* ... then get these functions */
-                ( (yuv_getplugin_t *)
-                  p_main->p_bank->p_info[ i_index ]->yuv_GetPlugin )( p_vout );
-            }
-        }
+        intf_ErrMsg( "vout error: no suitable yuv module" );
+        return( -1 );
     }
 
-    return p_vout->p_yuv_init( p_vout );
+#define yuv_functions p_vout->yuv.p_module->p_functions->yuv.functions.yuv
+    p_vout->yuv.pf_init       = yuv_functions.pf_init;
+    p_vout->yuv.pf_reset      = yuv_functions.pf_reset;
+    p_vout->yuv.pf_end        = yuv_functions.pf_end;
+#undef yuv_functions
+
+    return( p_vout->yuv.pf_init( p_vout ) );
 }
 
 /*****************************************************************************
@@ -83,8 +79,8 @@ int vout_InitYUV( vout_thread_t *p_vout )
  *****************************************************************************/
 int vout_ResetYUV( vout_thread_t *p_vout )
 {
-    p_vout->p_yuv_end( p_vout );
-    return( p_vout->p_yuv_init( p_vout ) );
+    p_vout->yuv.pf_end( p_vout );
+    return( p_vout->yuv.pf_init( p_vout ) );
 }
 
 /*****************************************************************************
@@ -94,6 +90,7 @@ int vout_ResetYUV( vout_thread_t *p_vout )
  *****************************************************************************/
 void vout_EndYUV( vout_thread_t *p_vout )
 {
-    p_vout->p_yuv_end( p_vout );
+    p_vout->yuv.pf_end( p_vout );
+    module_Unneed( p_vout->yuv.p_module );
 }