From 3a5ec777c6ebdb84f8b908c7613a73499e0c8a43 Mon Sep 17 00:00:00 2001 From: Gildas Bazin Date: Tue, 14 Oct 2003 22:41:41 +0000 Subject: [PATCH] * modules/gui/wxwindows/*: don't forget to delete the timer. Use wxApp::OnExit() to cleanup the dialogs provider. Added a "Miscellaneous" section to the menu. Added a "Switch interface" and "Add interface" entries to this menu. * modules/gui/skins/src/*: dialog providers have object types of VLC_OBJECT_DIALOGS. Don't forget to attach/detach the dialogs provider to its parent intf. Work around a bug in imlib2 when we close the plugin. * src/misc/objects.c, include/vlc_objects.h: added VLC_OBJECT_DIALOGS for dialogs providers. * src/interface/interface.c, include/vlc_interface.h: added 2 object variables to switch/add interfaces on the fly (intf-switch and intf-add). --- include/vlc_interface.h | 9 ++- include/vlc_objects.h | 3 +- modules/gui/skins/src/dialogs.cpp | 11 ++- modules/gui/skins/src/skin_main.cpp | 7 +- modules/gui/wxwindows/interface.cpp | 38 ++++++++- modules/gui/wxwindows/menus.cpp | 57 +++++++++++++- modules/gui/wxwindows/timer.cpp | 4 +- modules/gui/wxwindows/wxwindows.cpp | 19 ++++- modules/gui/wxwindows/wxwindows.h | 5 +- src/interface/interface.c | 116 ++++++++++++++++++++++++++-- src/misc/objects.c | 12 ++- 11 files changed, 253 insertions(+), 28 deletions(-) diff --git a/include/vlc_interface.h b/include/vlc_interface.h index cbf10ea380..cb75b7325c 100644 --- a/include/vlc_interface.h +++ b/include/vlc_interface.h @@ -4,7 +4,7 @@ * interface, such as message output. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vlc_interface.h,v 1.6 2003/09/18 17:54:02 zorglub Exp $ + * $Id: vlc_interface.h,v 1.7 2003/10/14 22:41:41 gbazin Exp $ * * Authors: Vincent Seguin * @@ -52,8 +52,8 @@ struct intf_thread_t vlc_bool_t b_block; /* Specific interfaces */ - intf_console_t * p_console; /** console */ - intf_sys_t * p_sys; /** system interface */ + intf_console_t * p_console; /** console */ + intf_sys_t * p_sys; /** system interface */ /** Interface module */ module_t * p_module; @@ -67,6 +67,9 @@ struct intf_thread_t vlc_mutex_t change_lock; vlc_bool_t b_menu_change; vlc_bool_t b_menu; + + /* Provides the ability to switch an interface on the fly */ + char *psz_switch_intf; }; /***************************************************************************** diff --git a/include/vlc_objects.h b/include/vlc_objects.h index 116bda76a2..5ced55bffa 100644 --- a/include/vlc_objects.h +++ b/include/vlc_objects.h @@ -2,7 +2,7 @@ * vlc_objects.h: vlc_object_t definition. ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: vlc_objects.h,v 1.19 2003/10/08 21:01:07 gbazin Exp $ + * $Id: vlc_objects.h,v 1.20 2003/10/14 22:41:41 gbazin Exp $ * * Authors: Samuel Hocevar * @@ -48,6 +48,7 @@ #define VLC_OBJECT_HTTPD (-12) #define VLC_OBJECT_PACKETIZER (-13) #define VLC_OBJECT_ENCODER (-14) +#define VLC_OBJECT_DIALOGS (-15) #define VLC_OBJECT_GENERIC (-666) diff --git a/modules/gui/skins/src/dialogs.cpp b/modules/gui/skins/src/dialogs.cpp index 38b65247cb..cfd6a1bca7 100644 --- a/modules/gui/skins/src/dialogs.cpp +++ b/modules/gui/skins/src/dialogs.cpp @@ -2,7 +2,7 @@ * dialogs.cpp: Handles all the different dialog boxes we provide. ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: dialogs.cpp,v 1.14 2003/09/05 15:55:30 asmax Exp $ + * $Id: dialogs.cpp,v 1.15 2003/10/14 22:41:41 gbazin Exp $ * * Authors: Gildas Bazin * @@ -55,7 +55,8 @@ Dialogs::Dialogs( intf_thread_t *_p_intf ) b_popup_change = VLC_FALSE; /* Allocate descriptor */ - p_provider = (intf_thread_t *)vlc_object_create( p_intf, VLC_OBJECT_INTF ); + p_provider = (intf_thread_t *)vlc_object_create( p_intf, + VLC_OBJECT_DIALOGS ); if( p_provider == NULL ) { msg_Err( p_intf, "out of memory" ); @@ -71,6 +72,9 @@ Dialogs::Dialogs( intf_thread_t *_p_intf ) return; } + /* Attach the dialogs provider to its parent interface */ + vlc_object_attach( p_provider, p_intf ); + /* Initialize dialogs provider * (returns as soon as initialization is done) */ if( p_provider->pf_run ) p_provider->pf_run( p_provider ); @@ -91,6 +95,9 @@ Dialogs::~Dialogs() { if( p_provider && p_module ) { + /* Detach the dialogs provider from its parent interface */ + vlc_object_detach( p_provider ); + module_Unneed( p_provider, p_module ); vlc_object_destroy( p_provider ); } diff --git a/modules/gui/skins/src/skin_main.cpp b/modules/gui/skins/src/skin_main.cpp index 0ed57c2923..a780ec84ba 100644 --- a/modules/gui/skins/src/skin_main.cpp +++ b/modules/gui/skins/src/skin_main.cpp @@ -2,7 +2,7 @@ * skin-main.cpp: skins plugin for VLC ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: skin_main.cpp,v 1.47 2003/07/20 10:38:49 gbazin Exp $ + * $Id: skin_main.cpp,v 1.48 2003/10/14 22:41:41 gbazin Exp $ * * Authors: Olivier Teulière * Emmanuel Puig @@ -204,7 +204,10 @@ static void Close ( vlc_object_t *p_this ) #if defined X11_SKINS XDestroyWindow( p_intf->p_sys->display, p_intf->p_sys->mainWin ); - XCloseDisplay( p_intf->p_sys->display ); + + // There is a bug in imlib2 which prevents us from closing the display + // (__imlib_RenderImage() can free old GC with already closed display) + //XCloseDisplay( p_intf->p_sys->display ); #endif // Unsuscribe to messages bank diff --git a/modules/gui/wxwindows/interface.cpp b/modules/gui/wxwindows/interface.cpp index 0ee1c8d4ca..5350a3f649 100644 --- a/modules/gui/wxwindows/interface.cpp +++ b/modules/gui/wxwindows/interface.cpp @@ -2,7 +2,7 @@ * interface.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: interface.cpp,v 1.64 2003/10/08 12:18:50 zorglub Exp $ + * $Id: interface.cpp,v 1.65 2003/10/14 22:41:41 gbazin Exp $ * * Authors: Gildas Bazin * @@ -127,6 +127,7 @@ enum Prefs_Event, Extra_Event, + Skins_Event, SliderScroll_Event, StopStream_Event, @@ -258,6 +259,9 @@ Interface::Interface( intf_thread_t *_p_intf ): #endif UpdateAcceleratorTable(); + + /* Start timer */ + timer = new Timer( p_intf, this ); } Interface::~Interface() @@ -266,7 +270,9 @@ Interface::~Interface() { delete p_intf->p_sys->p_wxwindow; } + /* Clean up */ + delete timer; } /***************************************************************************** @@ -327,7 +333,6 @@ void Interface::CreateOurMenuBar() settings_menu->AppendCheckItem( Extra_Event, wxU(_("&Extended GUI") ), wxU(_(EXTRA_PREFS)) ); - /* Create the "Audio" menu */ p_audio_menu = new wxMenu; b_audio_menu = 1; @@ -340,6 +345,10 @@ void Interface::CreateOurMenuBar() p_navig_menu = new wxMenu; b_navig_menu = 1; + /* Create the "Miscellaneous" menu */ + p_misc_menu = new wxMenu; + b_misc_menu = 1; + /* Create the "Help" menu */ wxMenu *help_menu = new wxMenu; help_menu->Append( About_Event, wxU(_("&About...")), wxU(_(HELP_ABOUT)) ); @@ -352,6 +361,7 @@ void Interface::CreateOurMenuBar() menubar->Append( p_audio_menu, wxU(_("&Audio")) ); menubar->Append( p_video_menu, wxU(_("&Video")) ); menubar->Append( p_navig_menu, wxU(_("&Navigation")) ); + menubar->Append( p_misc_menu, wxU(_("&Miscellaneous")) ); menubar->Append( help_menu, wxU(_("&Help")) ); /* Attach the menu bar to the frame */ @@ -739,6 +749,25 @@ void Interface::OnMenuOpen(wxMenuEvent& event) } else b_navig_menu = 1; } + else if( event.GetEventObject() == p_misc_menu ) + { + if( b_misc_menu ) + { + p_misc_menu = MiscMenu( p_intf, this ); + + /* Work-around for buggy wxGTK */ + wxMenu *menu = GetMenuBar()->GetMenu( 6 ); + RecursiveDestroy( menu ); + /* End work-around */ + + menu = GetMenuBar()->Replace( 6, p_misc_menu, + wxU(_("&Miscellaneous"))); + if( menu ) delete menu; + + b_misc_menu = 0; + } + else b_misc_menu = 1; + } #else p_audio_menu = AudioMenu( p_intf, this ); @@ -753,6 +782,9 @@ void Interface::OnMenuOpen(wxMenuEvent& event) menu = GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")) ); if( menu ) delete menu; + p_misc_menu = MiscMenu( p_intf, this ); + menu = GetMenuBar()->Replace( 6, p_misc_menu, wxU(_("&Miscellaneous")) ); + if( menu ) delete menu; #endif } @@ -1242,7 +1274,7 @@ void wxVolCtrl::OnChange( wxMouseEvent& event ) void wxVolCtrl::Change( int i_volume ) { - aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 ); + aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 / 2 ); SetValue( i_volume ); SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"), i_volume ) ); diff --git a/modules/gui/wxwindows/menus.cpp b/modules/gui/wxwindows/menus.cpp index 0a41867dd1..22ab145058 100644 --- a/modules/gui/wxwindows/menus.cpp +++ b/modules/gui/wxwindows/menus.cpp @@ -2,7 +2,7 @@ * menus.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: menus.cpp,v 1.20 2003/08/28 15:59:04 gbazin Exp $ + * $Id: menus.cpp,v 1.21 2003/10/14 22:41:41 gbazin Exp $ * * Authors: Gildas Bazin * @@ -72,7 +72,8 @@ enum AudioMenu_Events = wxID_HIGHEST + 2000, VideoMenu_Events = wxID_HIGHEST + 3000, NavigMenu_Events = wxID_HIGHEST + 4000, - PopupMenu_Events = wxID_HIGHEST + 5000 + MiscMenu_Events = wxID_HIGHEST + 5000, + PopupMenu_Events = wxID_HIGHEST + 6000 }; BEGIN_EVENT_TABLE(Menu, wxMenu) @@ -135,6 +136,10 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent, pi_objects[i++] = p_object->i_object_id; ppsz_varnames[i] = "deinterlace"; pi_objects[i++] = p_object->i_object_id; + ppsz_varnames[i] = "aspect-ratio"; + pi_objects[i++] = p_object->i_object_id; + ppsz_varnames[i] = "crop"; + pi_objects[i++] = p_object->i_object_id; ppsz_varnames[i] = "directx-on-top"; pi_objects[i++] = p_object->i_object_id; vlc_object_release( p_object ); @@ -170,6 +175,24 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent, vlc_object_release( p_object ); } + /* Interface menu */ + ppsz_varnames[i++] = NULL; /* Separator */ + ppsz_varnames[i++] = _("Interface menu"); + ppsz_varnames[i++] = NULL; /* Separator */ + + /* vlc_object_find is needed because of the dialogs provider case */ + p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INTF, + FIND_PARENT ); + if( p_object != NULL ) + { + ppsz_varnames[i] = "intf-switch"; + pi_objects[i++] = p_object->i_object_id; + ppsz_varnames[i] = "intf-add"; + pi_objects[i++] = p_object->i_object_id; + + vlc_object_release( p_object ); + } + /* Build menu */ Menu popupmenu( p_intf, p_parent, i, ppsz_varnames, pi_objects, PopupMenu_Events ); @@ -239,6 +262,10 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent ) pi_objects[i++] = p_object->i_object_id; ppsz_varnames[i] = "deinterlace"; pi_objects[i++] = p_object->i_object_id; + ppsz_varnames[i] = "aspect-ratio"; + pi_objects[i++] = p_object->i_object_id; + ppsz_varnames[i] = "crop"; + pi_objects[i++] = p_object->i_object_id; ppsz_varnames[i] = "directx-on-top"; pi_objects[i++] = p_object->i_object_id; vlc_object_release( p_object ); @@ -302,6 +329,32 @@ wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent ) ppsz_varnames, pi_objects, NavigMenu_Events ); } +wxMenu *MiscMenu( intf_thread_t *_p_intf, wxWindow *p_parent ) +{ + vlc_object_t *p_object; + char *ppsz_varnames[10]; + int pi_objects[10]; + int i = 0; + + /* Initializations */ + memset( pi_objects, 0, 4 * sizeof(int) ); + + p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INTF, + FIND_PARENT ); + if( p_object != NULL ) + { + ppsz_varnames[i] = "intf-switch"; + pi_objects[i++] = p_object->i_object_id; + ppsz_varnames[i] = "intf-add"; + pi_objects[i++] = p_object->i_object_id; + vlc_object_release( p_object ); + } + + /* Build menu */ + return new Menu( _p_intf, p_parent, i, + ppsz_varnames, pi_objects, MiscMenu_Events ); +} + /***************************************************************************** * Constructor. *****************************************************************************/ diff --git a/modules/gui/wxwindows/timer.cpp b/modules/gui/wxwindows/timer.cpp index 1b07d2f7c8..5ae906441e 100644 --- a/modules/gui/wxwindows/timer.cpp +++ b/modules/gui/wxwindows/timer.cpp @@ -2,7 +2,7 @@ * timer.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: timer.cpp,v 1.32 2003/09/07 22:53:09 fenrir Exp $ + * $Id: timer.cpp,v 1.33 2003/10/14 22:41:41 gbazin Exp $ * * Authors: Gildas Bazin * @@ -113,7 +113,7 @@ void Timer::Notify() /* Take care of the volume */ audio_volume_t i_volume; aout_VolumeGet( p_intf, &i_volume ); - p_main_interface->volctrl->SetValue( i_volume * 200 / + p_main_interface->volctrl->SetValue( i_volume * 200 * 2 / AOUT_VOLUME_MAX ); p_main_interface->volctrl->SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"), diff --git a/modules/gui/wxwindows/wxwindows.cpp b/modules/gui/wxwindows/wxwindows.cpp index eb734cc61a..90c14023b5 100644 --- a/modules/gui/wxwindows/wxwindows.cpp +++ b/modules/gui/wxwindows/wxwindows.cpp @@ -2,7 +2,7 @@ * wxwindows.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: wxwindows.cpp,v 1.33 2003/10/04 14:59:38 gbazin Exp $ + * $Id: wxwindows.cpp,v 1.34 2003/10/14 22:41:41 gbazin Exp $ * * Authors: Gildas Bazin * @@ -66,6 +66,7 @@ public: Instance( intf_thread_t *_p_intf ); bool OnInit(); + int OnExit(); private: intf_thread_t *p_intf; @@ -272,9 +273,6 @@ bool Instance::OnInit() MainInterface->Show( TRUE ); SetTopWindow( MainInterface ); - - /* Start timer */ - new Timer( p_intf, MainInterface ); } /* Creates the dialogs provider */ @@ -291,6 +289,19 @@ bool Instance::OnInit() return TRUE; } +/***************************************************************************** + * Instance::OnExit: called when the interface execution stops + *****************************************************************************/ +int Instance::OnExit() +{ + if( p_intf->pf_show_dialog ) + { + /* We need to manually clean up the dialogs class */ + if( p_intf->p_sys->p_wxwindow ) delete p_intf->p_sys->p_wxwindow; + } + return 0; +} + static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg, intf_dialog_args_t *p_arg ) { diff --git a/modules/gui/wxwindows/wxwindows.h b/modules/gui/wxwindows/wxwindows.h index 45e38ad27d..35e8e0004c 100644 --- a/modules/gui/wxwindows/wxwindows.h +++ b/modules/gui/wxwindows/wxwindows.h @@ -2,7 +2,7 @@ * wxwindows.h: private wxWindows interface description ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: wxwindows.h,v 1.64 2003/10/08 19:40:42 gbazin Exp $ + * $Id: wxwindows.h,v 1.65 2003/10/14 22:41:41 gbazin Exp $ * * Authors: Gildas Bazin * @@ -225,6 +225,8 @@ private: vlc_bool_t b_video_menu; wxMenu *p_navig_menu; vlc_bool_t b_navig_menu; + wxMenu *p_misc_menu; + vlc_bool_t b_misc_menu; }; /* Dialogs Provider */ @@ -802,6 +804,7 @@ void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent ); wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent ); wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent ); +wxMenu *MiscMenu( intf_thread_t *_p_intf, wxWindow *p_parent ); class MenuEvtHandler : public wxEvtHandler { diff --git a/src/interface/interface.c b/src/interface/interface.c index 4807777807..657532b395 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.106 2003/09/18 17:54:02 zorglub Exp $ + * $Id: interface.c,v 1.107 2003/10/14 22:41:41 gbazin Exp $ * * Authors: Vincent Seguin * @@ -52,6 +52,12 @@ * Local prototypes *****************************************************************************/ static void Manager( intf_thread_t *p_intf ); +static void RunInterface( intf_thread_t *p_intf ); + +static int SwitchIntfCallback( vlc_object_t *, char const *, + vlc_value_t , vlc_value_t , void * ); +static int AddIntfCallback( vlc_object_t *, char const *, + vlc_value_t , vlc_value_t , void * ); /***************************************************************************** * intf_Create: prepare interface before main loop @@ -142,7 +148,7 @@ int intf_RunThread( intf_thread_t *p_intf ) return VLC_EGENERIC; } - p_intf->pf_run( p_intf ); + RunInterface( p_intf ); p_intf->b_die = VLC_TRUE; @@ -151,7 +157,7 @@ int intf_RunThread( intf_thread_t *p_intf ) else { /* Run the interface in a separate thread */ - if( vlc_thread_create( p_intf, "interface", p_intf->pf_run, + if( vlc_thread_create( p_intf, "interface", RunInterface, VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) ) { msg_Err( p_intf, "cannot spawn interface thread" ); @@ -209,9 +215,8 @@ void intf_Destroy( intf_thread_t *p_intf ) vlc_object_destroy( p_intf ); } -/* Following functions are local */ - +/* Following functions are local */ /***************************************************************************** * Manager: helper thread for blocking interfaces @@ -246,3 +251,104 @@ static void Manager( intf_thread_t *p_intf ) } } +/***************************************************************************** + * RunInterface: setups necessary data and give control to the interface + *****************************************************************************/ +static void RunInterface( intf_thread_t *p_intf ) +{ + vlc_value_t val, text; + + /* Variable used for interface switching */ + p_intf->psz_switch_intf = NULL; + var_Create( p_intf, "intf-switch", VLC_VAR_STRING | + VLC_VAR_HASCHOICE | VLC_VAR_ISCOMMAND ); + text.psz_string = _("Switch interface"); + var_Change( p_intf, "intf-switch", VLC_VAR_SETTEXT, &text, NULL ); + + val.psz_string = "skins"; text.psz_string = "Skins"; + var_Change( p_intf, "intf-switch", VLC_VAR_ADDCHOICE, &val, &text ); + val.psz_string = "wxwin"; text.psz_string = "wxWindows"; + var_Change( p_intf, "intf-switch", VLC_VAR_ADDCHOICE, &val, &text ); + + var_AddCallback( p_intf, "intf-switch", SwitchIntfCallback, NULL ); + + /* Variable used for interface spawning */ + var_Create( p_intf, "intf-add", VLC_VAR_STRING | + VLC_VAR_HASCHOICE | VLC_VAR_ISCOMMAND ); + text.psz_string = _("Add interface"); + var_Change( p_intf, "intf-add", VLC_VAR_SETTEXT, &text, NULL ); + + val.psz_string = "rc"; text.psz_string = "Console"; + var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); + val.psz_string = "logger"; text.psz_string = "Debug logging"; + var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); + val.psz_string = "http"; text.psz_string = "HTTP remote control"; + var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); + + var_AddCallback( p_intf, "intf-add", AddIntfCallback, NULL ); + + /* Give control to the interface */ + p_intf->pf_run( p_intf ); + + /* Provide ability to switch the main interface on the fly */ + while( p_intf->psz_switch_intf ) + { + char *psz_intf = p_intf->psz_switch_intf; + p_intf->psz_switch_intf = NULL; + p_intf->b_die = VLC_FALSE; + + /* Make sure the old interface is completely uninitialised */ + module_Unneed( p_intf, p_intf->p_module ); + + p_intf->p_module = module_Need( p_intf, "interface", psz_intf ); + free( psz_intf ); + + if( p_intf->p_module ) + { + p_intf->pf_run( p_intf ); + } + else break; + } +} + +static int SwitchIntfCallback( vlc_object_t *p_this, char const *psz_cmd, + vlc_value_t oldval, vlc_value_t newval, void *p_data ) +{ + intf_thread_t *p_intf = (intf_thread_t *)p_this; + + p_intf->psz_switch_intf = + malloc( strlen(newval.psz_string) + sizeof(",none") ); + sprintf( p_intf->psz_switch_intf, "%s,none", newval.psz_string ); + p_intf->b_die = VLC_TRUE; + + return VLC_SUCCESS; +} + +static int AddIntfCallback( vlc_object_t *p_this, char const *psz_cmd, + vlc_value_t oldval, vlc_value_t newval, void *p_data ) +{ + intf_thread_t *p_intf; + char *psz_intf = malloc( strlen(newval.psz_string) + sizeof(",none") ); + + /* Try to create the interface */ + sprintf( psz_intf, "%s,none", newval.psz_string ); + p_intf = intf_Create( p_this, psz_intf ); + free( psz_intf ); + if( p_intf == NULL ) + { + msg_Err( p_this, "interface \"%s\" initialization failed", + newval.psz_string ); + return VLC_EGENERIC; + } + + /* Try to run the interface */ + p_intf->b_block = VLC_FALSE; + if( intf_RunThread( p_intf ) != VLC_SUCCESS ) + { + vlc_object_detach( p_intf ); + intf_Destroy( p_intf ); + return VLC_EGENERIC; + } + + return VLC_SUCCESS; +} diff --git a/src/misc/objects.c b/src/misc/objects.c index 6ba26c6cad..68593f9d3e 100644 --- a/src/misc/objects.c +++ b/src/misc/objects.c @@ -2,7 +2,7 @@ * objects.c: vlc_object_t handling ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: objects.c,v 1.41 2003/10/08 21:01:07 gbazin Exp $ + * $Id: objects.c,v 1.42 2003/10/14 22:41:41 gbazin Exp $ * * Authors: Samuel Hocevar * @@ -115,6 +115,10 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type ) i_size = sizeof(intf_thread_t); psz_type = "interface"; break; + case VLC_OBJECT_DIALOGS: + i_size = sizeof(intf_thread_t); + psz_type = "dialogs provider"; + break; case VLC_OBJECT_PLAYLIST: i_size = sizeof(playlist_t); psz_type = "playlist"; @@ -274,13 +278,15 @@ void __vlc_object_destroy( vlc_object_t *p_this ) if( p_this->i_children ) { - msg_Err( p_this, "cannot delete object with children" ); + msg_Err( p_this, "cannot delete object (%i, %s) with children" , + p_this->i_object_id, p_this->psz_object_name ); return; } if( p_this->p_parent ) { - msg_Err( p_this, "cannot delete object with a parent" ); + msg_Err( p_this, "cannot delete object (%i, %s) with a parent", + p_this->i_object_id, p_this->psz_object_name ); return; } -- 2.39.2