From f7c92985ff7210bedb09c3d5d33a963d595adc6f Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 6 Feb 2003 23:59:40 +0000 Subject: [PATCH] * ./modules/access/dvdplay/demux.c: the dvdplay plugin no longer sets the "interface" variable to "dvdplay" (Closes: #178, #210, and probably a bunch of others). * ./src/interface/interface.c: added a safety check to circumvent the bug, allowing a smooth upgrade. --- include/interface.h | 7 ++++--- modules/access/dvdplay/demux.c | 20 ++++++-------------- modules/control/rc/rc.c | 12 ++---------- modules/gui/win32/menu.cpp | 12 ++---------- src/interface/interface.c | 19 ++++++++++++++++--- src/libvlc.c | 20 ++------------------ 6 files changed, 32 insertions(+), 58 deletions(-) diff --git a/include/interface.h b/include/interface.h index ad9f43cb16..dd5f70d5f4 100644 --- a/include/interface.h +++ b/include/interface.h @@ -4,7 +4,7 @@ * interface, such as message output. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: interface.h,v 1.37 2002/11/11 14:39:11 sam Exp $ + * $Id: interface.h,v 1.38 2003/02/06 23:59:40 sam Exp $ * * Authors: Vincent Seguin * @@ -53,8 +53,9 @@ struct intf_thread_t /***************************************************************************** * Prototypes *****************************************************************************/ -#define intf_Create(a) __intf_Create(VLC_OBJECT(a)) -VLC_EXPORT( intf_thread_t *, __intf_Create, ( vlc_object_t * ) ); +#define intf_Create(a,b) __intf_Create(VLC_OBJECT(a),b) +VLC_EXPORT( intf_thread_t *, __intf_Create, ( vlc_object_t *, + const char * ) ); VLC_EXPORT( int, intf_RunThread, ( intf_thread_t * ) ); VLC_EXPORT( void, intf_StopThread, ( intf_thread_t * ) ); VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) ); diff --git a/modules/access/dvdplay/demux.c b/modules/access/dvdplay/demux.c index 0a36083643..d14c679350 100644 --- a/modules/access/dvdplay/demux.c +++ b/modules/access/dvdplay/demux.c @@ -2,7 +2,7 @@ * demux.c: demux functions for dvdplay. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: demux.c,v 1.3 2002/08/12 09:34:15 sam Exp $ + * $Id: demux.c,v 1.4 2003/02/06 23:59:40 sam Exp $ * * Author: Stéphane Borel * @@ -79,17 +79,16 @@ int E_(InitDVD) ( vlc_object_t *p_this ) input_thread_t *p_input = (input_thread_t *)p_this; dvd_data_t * p_dvd = (dvd_data_t *)p_input->p_access_data; demux_sys_t * p_demux; - char * psz_intf = NULL; if( p_input->stream.i_method != INPUT_METHOD_DVD ) { - return -1; + return VLC_EGENERIC; } p_demux = p_input->p_demux_data = malloc( sizeof(demux_sys_t ) ); if( p_demux == NULL ) { - return -1; + return VLC_ENOMEM; } p_input->p_private = (void*)&p_demux->mpeg; @@ -97,7 +96,7 @@ int E_(InitDVD) ( vlc_object_t *p_this ) if( p_demux->p_module == NULL ) { free( p_input->p_demux_data ); - return -1; + return VLC_ENOMOD; } p_input->p_demux_data->p_dvd = p_dvd; @@ -105,18 +104,11 @@ int E_(InitDVD) ( vlc_object_t *p_this ) p_input->pf_demux = Demux; p_input->pf_rewind = NULL; - psz_intf = config_GetPsz( p_input, "intf" ); - config_PutPsz( p_input, "intf", "dvdplay" ); - p_dvd->p_intf = intf_Create( p_input ); + p_dvd->p_intf = intf_Create( p_input, "dvdplay" ); p_dvd->p_intf->b_block = VLC_FALSE; intf_RunThread( p_dvd->p_intf ); - - if( psz_intf != NULL ) - { - config_PutPsz( p_input, "intf", psz_intf ); - } - return 0; + return VLC_SUCCESS; } /***************************************************************************** diff --git a/modules/control/rc/rc.c b/modules/control/rc/rc.c index 7ea37310d0..1ed405ce65 100644 --- a/modules/control/rc/rc.c +++ b/modules/control/rc/rc.c @@ -2,7 +2,7 @@ * rc.c : remote control stdin/stdout plugin for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: rc.c,v 1.23 2003/01/23 10:25:40 gbazin Exp $ + * $Id: rc.c,v 1.24 2003/02/06 23:59:40 sam Exp $ * * Authors: Peter Surda * @@ -662,16 +662,8 @@ static int Intf( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { intf_thread_t *p_newintf; - char *psz_oldmodule = config_GetPsz( p_this->p_vlc, "intf" ); - config_PutPsz( p_this->p_vlc, "intf", newval.psz_string ); - p_newintf = intf_Create( p_this->p_vlc ); - config_PutPsz( p_this->p_vlc, "intf", psz_oldmodule ); - - if( psz_oldmodule ) - { - free( psz_oldmodule ); - } + p_newintf = intf_Create( p_this->p_vlc, newval.psz_string ); if( p_newintf ) { diff --git a/modules/gui/win32/menu.cpp b/modules/gui/win32/menu.cpp index 5af25e05a1..8edd1d5963 100644 --- a/modules/gui/win32/menu.cpp +++ b/modules/gui/win32/menu.cpp @@ -2,7 +2,7 @@ * menu.cpp: functions to handle menu items ***************************************************************************** * Copyright (C) 2002-2003 VideoLAN - * $Id: menu.cpp,v 1.12 2003/02/01 22:21:44 ipkiss Exp $ + * $Id: menu.cpp,v 1.13 2003/02/06 23:59:40 sam Exp $ * * Authors: Olivier Teuliere * @@ -97,16 +97,8 @@ void __fastcall TMenusGen::InterfaceModuleClick( TObject *Sender ) AnsiString IntfName = CleanCaption( Item->Caption ); intf_thread_t *p_newintf; - char *psz_oldmodule = config_GetPsz( p_intf->p_vlc, "intf" ); - config_PutPsz( p_intf->p_vlc, "intf", IntfName.c_str() ); - p_newintf = intf_Create( p_intf->p_vlc ); - config_PutPsz( p_intf->p_vlc, "intf", psz_oldmodule ); - - if( psz_oldmodule ) - { - free( psz_oldmodule ); - } + p_newintf = intf_Create( p_intf->p_vlc, IntfName.c_str() ); if( p_newintf ) { diff --git a/src/interface/interface.c b/src/interface/interface.c index a0c6fa56f8..57c6f88621 100644 --- a/src/interface/interface.c +++ b/src/interface/interface.c @@ -4,7 +4,7 @@ * interface, such as command line. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: interface.c,v 1.101 2002/11/10 18:04:23 sam Exp $ + * $Id: interface.c,v 1.102 2003/02/06 23:59:40 sam Exp $ * * Authors: Vincent Seguin * @@ -53,9 +53,10 @@ static void Manager( intf_thread_t *p_intf ); * This function opens output devices and creates specific interfaces. It sends * its own error messages. *****************************************************************************/ -intf_thread_t* __intf_Create( vlc_object_t *p_this ) +intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module ) { intf_thread_t * p_intf; + char *psz_intf; /* Allocate structure */ p_intf = vlc_object_create( p_this, VLC_OBJECT_INTF ); @@ -65,8 +66,20 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this ) return NULL; } + /* XXX: workaround for a bug in VLC 0.5.0 where the dvdplay plugin was + * registering itself in $interface, which we do not want to happen. */ + psz_intf = config_GetPsz( p_intf, "interface" ); + if( psz_intf ) + { + if( !strcasecmp( psz_intf, "dvdplay" ) ) + { + config_PutPsz( p_intf, "interface", "" ); + } + free( psz_intf ); + } + /* Choose the best module */ - p_intf->p_module = module_Need( p_intf, "interface", "$intf" ); + p_intf->p_module = module_Need( p_intf, "interface", psz_module ); if( p_intf->p_module == NULL ) { diff --git a/src/libvlc.c b/src/libvlc.c index 35fdb013f0..177ce6980e 100644 --- a/src/libvlc.c +++ b/src/libvlc.c @@ -2,7 +2,7 @@ * libvlc.c: main libvlc source ***************************************************************************** * Copyright (C) 1998-2002 VideoLAN - * $Id: libvlc.c,v 1.62 2003/02/01 23:39:02 sam Exp $ + * $Id: libvlc.c,v 1.63 2003/02/06 23:59:40 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -547,7 +547,6 @@ int VLC_AddIntf( int i_object, char const *psz_module, vlc_bool_t b_block ) int i_err; intf_thread_t *p_intf; vlc_t *p_vlc; - char *psz_oldmodule = NULL; p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; @@ -556,23 +555,8 @@ int VLC_AddIntf( int i_object, char const *psz_module, vlc_bool_t b_block ) return VLC_ENOOBJ; } - if( psz_module ) - { - psz_oldmodule = config_GetPsz( p_vlc, "intf" ); - config_PutPsz( p_vlc, "intf", psz_module ); - } - /* Try to create the interface */ - p_intf = intf_Create( p_vlc ); - - if( psz_module ) - { - config_PutPsz( p_vlc, "intf", psz_oldmodule ); - if( psz_oldmodule ) - { - free( psz_oldmodule ); - } - } + p_intf = intf_Create( p_vlc, psz_module ? psz_module : "$intf" ); if( p_intf == NULL ) {