/*****************************************************************************
* video_output.c : video output thread
- * (c)2000 VideoLAN
- *****************************************************************************
* This module describes the programming interface for video output threads.
* It includes functions allowing to open a new thread, send pictures to a
- * thread, and destroy a previously oppenned video output thread.
+ * thread, and destroy a previously oppened video output thread.
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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
+ * 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.
+ *
+ * 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <dlfcn.h> /* plugins */
+#include <errno.h> /* ENOMEM */
+#include <stdlib.h> /* free() */
+#include <stdio.h> /* sprintf() */
+#include <string.h> /* strerror() */
#include "common.h"
#include "config.h"
#include "mtime.h"
-#include "vlc_thread.h"
+#include "threads.h"
+#include "plugins.h"
#include "video.h"
#include "video_output.h"
#include "video_text.h"
#include "video_yuv.h"
+
#include "intf_msg.h"
#include "main.h"
int i_status; /* thread status */
int i_index; /* index for array initialization */
char * psz_method;
- char * psz_plugin;
/* Allocate descriptor */
intf_DbgMsg("\n");
return( NULL );
}
- /* Initialize method-dependent functions */
+ /* Request an interface plugin */
psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD );
+ p_vout->p_vout_plugin = RequestPlugin( "vout", psz_method );
- psz_plugin = malloc( sizeof("./video_output/vout_.so") + strlen(psz_method) );
- sprintf( psz_plugin, "./video_output/vout_%s.so", psz_method );
-
- p_vout->p_vout_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL );
-
- if( p_vout->p_vout_plugin == NULL )
+ if( !p_vout->p_vout_plugin )
{
- intf_ErrMsg( "error: could not open video plugin %s\n", psz_plugin );
- free( psz_plugin );
+ intf_ErrMsg( "error: could not open video plugin vout_%s.so\n", psz_method );
free( p_vout );
return( NULL );
}
- free( psz_plugin );
/* Get plugins */
- p_vout->p_sys_create = dlsym(p_vout->p_vout_plugin, "vout_SysCreate");
- p_vout->p_sys_init = dlsym(p_vout->p_vout_plugin, "vout_SysInit");
- p_vout->p_sys_end = dlsym(p_vout->p_vout_plugin, "vout_SysEnd");
- p_vout->p_sys_destroy = dlsym(p_vout->p_vout_plugin, "vout_SysDestroy");
- p_vout->p_sys_manage = dlsym(p_vout->p_vout_plugin, "vout_SysManage");
- p_vout->p_sys_display = dlsym(p_vout->p_vout_plugin, "vout_SysDisplay");
+ p_vout->p_sys_create = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysCreate" );
+ p_vout->p_sys_init = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysInit" );
+ p_vout->p_sys_end = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysEnd" );
+ p_vout->p_sys_destroy = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysDestroy" );
+ p_vout->p_sys_manage = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysManage" );
+ p_vout->p_sys_display = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysDisplay" );
/* Initialize thread properties - thread id and locks will be initialized
* later */
* own error messages */
if( p_vout->p_sys_create( p_vout, psz_display, i_root_window ) )
{
- dlclose( p_vout->p_vout_plugin );
+ TrashPlugin( p_vout->p_vout_plugin );
free( p_vout );
return( NULL );
}
if( p_vout->p_default_font == NULL )
{
p_vout->p_sys_destroy( p_vout );
- dlclose( p_vout->p_vout_plugin );
+ TrashPlugin( p_vout->p_vout_plugin );
free( p_vout );
return( NULL );
}
{
vout_UnloadFont( p_vout->p_default_font );
p_vout->p_sys_destroy( p_vout );
- dlclose( p_vout->p_vout_plugin );
+ TrashPlugin( p_vout->p_vout_plugin );
free( p_vout );
return( NULL );
}
vout_UnloadFont( p_vout->p_default_font );
vout_UnloadFont( p_vout->p_large_font );
p_vout->p_sys_destroy( p_vout );
- dlclose( p_vout->p_vout_plugin );
+ TrashPlugin( p_vout->p_vout_plugin );
free( p_vout );
return( NULL );
}
p_vout->p_sys_destroy( p_vout );
/* Close plugin */
- dlclose( p_vout->p_vout_plugin );
+ TrashPlugin( p_vout->p_vout_plugin );
/* Free structure */
free( p_vout );