1 /*****************************************************************************
2 * corba.c : CORBA (ORBit) remote control plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
5 * $Id: corba.c,v 1.3 2004/01/05 13:07:02 zorglub Exp $
7 * Authors: Olivier Aubert <oaubert at lisi dot univ-lyon1 dot fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
28 #include "mediacontrol.h"
29 #include "orbit/poa/portableserver-poa-type.h"
30 #define VLC_IOR_FILE "/tmp/vlc-ior.ref"
32 #define handle_exception(m) if(ev->_major != CORBA_NO_EXCEPTION) \
34 msg_Err (servant->p_intf, m); \
39 #define handle_exception_no_servant(p,m) if(ev->_major != CORBA_NO_EXCEPTION) \
50 #include <stdlib.h> /* malloc(), free() */
53 #include <errno.h> /* ENOMEM */
61 #ifdef HAVE_SYS_TIME_H
62 # include <sys/time.h>
64 #include <sys/types.h>
66 /*****************************************************************************
67 * intf_sys_t: description and status of corba interface
68 *****************************************************************************/
73 PortableServer_POA root_poa;
74 PortableServer_POAManager root_poa_manager;
79 input_thread_t * p_input; /* The input thread */
81 msg_subscription_t* p_sub; /* message bank subscription */
84 /* Convert an offset into seconds. Taken from input_ext-intf.c.
85 The 50 hardcoded constant comes from the definition of i_mux_rate :
86 i_mux_rate : the rate we read the stream (in units of 50 bytes/s) ;
88 long long offsetToSeconds (input_thread_t *p_input, off_t l_offset)
93 if (p_input != NULL && p_input->stream.i_mux_rate != 0)
95 l_res = (long long) l_offset / 50 / p_input->stream.i_mux_rate;
100 /* Convert an offset into milliseconds */
101 long long offsetToMilliseconds (input_thread_t *p_input, off_t l_offset)
106 if (p_input != NULL && p_input->stream.i_mux_rate != 0)
108 l_res = (long long) 1000 * l_offset / 50 / p_input->stream.i_mux_rate;
113 /* Convert seconds to an offset */
114 off_t secondsToOffset (input_thread_t *p_input, long long l_seconds)
122 l_res = (off_t) l_seconds * 50 * p_input->stream.i_mux_rate;
128 /* Convert milliseconds to an offset */
129 off_t millisecondsToOffset (input_thread_t *p_input, long long l_milliseconds)
136 l_res = (off_t) l_milliseconds * 50 * p_input->stream.i_mux_rate / 1000;
141 /* Returns the current offset. */
142 off_t currentOffset (input_thread_t *p_input)
146 if( p_input == NULL )
151 /* offset contient la valeur en unités arbitraires (cf
152 include/input_ext-intf.h) */
153 vlc_mutex_lock( &p_input->stream.stream_lock );
155 #define A p_input->stream.p_selected_area
156 l_offset = A->i_tell + A->i_start;
158 vlc_mutex_unlock( &p_input->stream.stream_lock );
163 /*** App-specific servant structures ***/
165 /* We can add attributes to this structure, which is both a pointer on a
166 specific structure, and on a POA_VLC_MediaControl (servant). Cf
167 http://developer.gnome.org/doc/guides/corba/html/corba-poa-example.html */
171 POA_VLC_MediaControl servant;
172 PortableServer_POA poa;
173 /* Ajouter ici les attributs utiles */
174 intf_thread_t *p_intf;
176 impl_POA_VLC_MediaControl;
178 /* Beginning of the CORBA code generated in Mediacontrol-skelimpl.c */
181 /*** Implementation stub prototypes ***/
183 static void impl_VLC_MediaControl__destroy(impl_POA_VLC_MediaControl *
184 servant, CORBA_Environment * ev);
187 impl_VLC_MediaControl_get_media_position(impl_POA_VLC_MediaControl * servant,
188 const VLC_PositionOrigin an_origin,
189 const VLC_PositionKey a_key,
190 CORBA_Environment * ev);
193 impl_VLC_MediaControl_set_media_position(impl_POA_VLC_MediaControl * servant,
194 const VLC_Position * a_position,
195 CORBA_Environment * ev);
198 impl_VLC_MediaControl_start(impl_POA_VLC_MediaControl * servant,
199 const VLC_Position * a_position,
200 CORBA_Environment * ev);
203 impl_VLC_MediaControl_pause(impl_POA_VLC_MediaControl * servant,
204 const VLC_Position * a_position,
205 CORBA_Environment * ev);
208 impl_VLC_MediaControl_resume(impl_POA_VLC_MediaControl * servant,
209 const VLC_Position * a_position,
210 CORBA_Environment * ev);
213 impl_VLC_MediaControl_stop(impl_POA_VLC_MediaControl * servant,
214 const VLC_Position * a_position,
215 CORBA_Environment * ev);
218 impl_VLC_MediaControl_exit(impl_POA_VLC_MediaControl * servant,
219 CORBA_Environment * ev);
222 impl_VLC_MediaControl_add_to_playlist(impl_POA_VLC_MediaControl * servant,
223 const CORBA_char * a_file,
224 CORBA_Environment * ev);
226 static VLC_PlaylistSeq
227 *impl_VLC_MediaControl_get_playlist(impl_POA_VLC_MediaControl * servant,
228 CORBA_Environment * ev);
230 /*** epv structures ***/
232 static PortableServer_ServantBase__epv impl_VLC_MediaControl_base_epv = {
233 NULL, /* _private data */
234 NULL, /* finalize routine */
235 NULL, /* default_POA routine */
237 static POA_VLC_MediaControl__epv impl_VLC_MediaControl_epv = {
240 (gpointer) & impl_VLC_MediaControl_get_media_position,
242 (gpointer) & impl_VLC_MediaControl_set_media_position,
244 (gpointer) & impl_VLC_MediaControl_start,
246 (gpointer) & impl_VLC_MediaControl_pause,
248 (gpointer) & impl_VLC_MediaControl_resume,
250 (gpointer) & impl_VLC_MediaControl_stop,
252 (gpointer) & impl_VLC_MediaControl_exit,
254 (gpointer) & impl_VLC_MediaControl_add_to_playlist,
256 (gpointer) & impl_VLC_MediaControl_get_playlist,
260 /*** vepv structures ***/
262 static POA_VLC_MediaControl__vepv impl_VLC_MediaControl_vepv = {
263 &impl_VLC_MediaControl_base_epv,
264 &impl_VLC_MediaControl_epv,
267 /*** Stub implementations ***/
269 static VLC_MediaControl
270 impl_VLC_MediaControl__create(PortableServer_POA poa, CORBA_Environment * ev)
272 VLC_MediaControl retval;
273 impl_POA_VLC_MediaControl *newservant;
274 PortableServer_ObjectId *objid;
276 newservant = g_new0(impl_POA_VLC_MediaControl, 1);
277 newservant->servant.vepv = &impl_VLC_MediaControl_vepv;
278 newservant->poa = poa;
279 POA_VLC_MediaControl__init((PortableServer_Servant) newservant, ev);
280 objid = PortableServer_POA_activate_object(poa, newservant, ev);
282 retval = PortableServer_POA_servant_to_reference(poa, newservant, ev);
288 impl_VLC_MediaControl__destroy(impl_POA_VLC_MediaControl * servant,
289 CORBA_Environment * ev)
291 PortableServer_ObjectId *objid;
293 objid = PortableServer_POA_servant_to_id(servant->poa, servant, ev);
294 PortableServer_POA_deactivate_object(servant->poa, objid, ev);
297 POA_VLC_MediaControl__fini((PortableServer_Servant) servant, ev);
302 /* Beginning of the CORBA functions that we define */
304 /* Returns the current position in the stream. The returned value can
305 be relative or absolute (according to PositionOrigin) and the unit
306 is set by PositionKey */
308 impl_VLC_MediaControl_get_media_position(impl_POA_VLC_MediaControl * servant,
309 const VLC_PositionOrigin an_origin,
310 const VLC_PositionKey a_key,
311 CORBA_Environment * ev)
315 VLC_PositionKeyNotSupported *exception;
316 input_thread_t * p_input = servant->p_intf->p_sys->p_input;
318 /* msg_Warn (servant->p_intf, "Calling MediaControl::get_media_position"); */
320 retval.origin = an_origin;
323 if ( an_origin == VLC_RelativePosition
324 || an_origin == VLC_ModuloPosition )
326 /* Relative or ModuloPosition make no sense */
327 /* FIXME: should we return 0 or raise an exception ? */
332 if ( p_input == NULL )
334 /* FIXME: should we return 0 or raise an exception ? */
339 /* We are asked for an AbsolutePosition. */
340 /* Cf plugins/gtk/gtk_display.c */
342 /* The lock is taken by the currentOffset function */
343 l_offset = currentOffset (p_input);
345 if (a_key == VLC_ByteCount)
347 retval.value = l_offset;
350 if (a_key == VLC_MediaTime)
352 retval.value = offsetToSeconds (p_input, l_offset);
355 if (a_key == VLC_SampleCount)
357 /* Raising exceptions in C : cf the good explanations in
358 http://developer.gnome.org/doc/guides/corba/html/corba-module-complete-helloworld.html
360 exception = VLC_PositionKeyNotSupported__alloc ();
361 memcpy (&exception->key, &a_key, sizeof (a_key));
362 CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
363 ex_VLC_PositionKeyNotSupported,
369 /* http://catb.org/~esr/jargon/html/entry/can't-happen.html */
373 /* Sets the media position */
375 impl_VLC_MediaControl_set_media_position(impl_POA_VLC_MediaControl * servant,
376 const VLC_Position * a_position,
377 CORBA_Environment * ev)
379 VLC_InvalidPosition *pe_exception;
380 VLC_PositionKeyNotSupported *pe_key_exception;
381 off_t l_offset_destination = 0;
383 input_thread_t * p_input = servant->p_intf->p_sys->p_input;
385 msg_Warn (servant->p_intf, "Calling MediaControl::set_media_position");
387 if( p_input == NULL )
390 if ( !p_input->stream.b_seekable )
392 pe_exception = VLC_InvalidPosition__alloc ();
393 memcpy (&pe_exception->key, &a_position->key, sizeof (&a_position->key));
394 CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
395 ex_VLC_InvalidPosition,
400 switch ( a_position->key )
402 case VLC_SampleCount:
403 /* The SampleCount unit is still a bit mysterious... */
404 pe_key_exception = VLC_PositionKeyNotSupported__alloc ();
405 memcpy (&pe_key_exception->key, &a_position->key, sizeof (&a_position->key));
406 CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
407 ex_VLC_PositionKeyNotSupported,
412 i_whence |= INPUT_SEEK_SECONDS;
415 i_whence |= INPUT_SEEK_BYTES;
418 i_whence |= INPUT_SEEK_BYTES;
422 switch ( a_position->origin)
424 case VLC_RelativePosition:
425 i_whence |= INPUT_SEEK_CUR;
427 case VLC_ModuloPosition:
428 i_whence |= INPUT_SEEK_END;
430 case VLC_AbsolutePosition:
431 i_whence |= INPUT_SEEK_SET;
434 i_whence |= INPUT_SEEK_SET;
438 l_offset_destination = a_position->value;
440 /* msg_Warn (servant->p_intf, "Offset destination : %d", l_offset_destination); */
441 /* Now we can set the position. The lock is taken in the input_Seek
442 function (cf input_ext-intf.c) */
443 input_Seek (p_input, l_offset_destination, i_whence);
447 /* Starts playing a stream */
449 impl_VLC_MediaControl_start(impl_POA_VLC_MediaControl * servant,
450 const VLC_Position * a_position, CORBA_Environment * ev)
452 intf_thread_t * p_intf = servant->p_intf;
453 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
456 msg_Warn (servant->p_intf, "Calling MediaControl::start");
458 if( p_playlist == NULL )
460 /* FIXME: we should raise an appropriate exception, but we must
461 define it in the IDL first */
462 msg_Err (servant->p_intf, "Error: no playlist available.");
466 vlc_mutex_lock( &p_playlist->object_lock );
467 if( p_playlist->i_size )
469 vlc_mutex_unlock( &p_playlist->object_lock );
470 playlist_Play( p_playlist );
471 vlc_object_release( p_playlist );
475 vlc_mutex_unlock( &p_playlist->object_lock );
476 vlc_object_release( p_playlist );
477 msg_Err (servant->p_intf, "Error: playlist empty.");
484 impl_VLC_MediaControl_pause(impl_POA_VLC_MediaControl * servant,
485 const VLC_Position * a_position, CORBA_Environment * ev)
487 input_thread_t *p_input = servant->p_intf->p_sys->p_input;
489 msg_Warn (servant->p_intf, "Calling MediaControl::pause");
491 if( p_input != NULL )
493 input_SetStatus( p_input, INPUT_STATUS_PAUSE );
500 impl_VLC_MediaControl_resume(impl_POA_VLC_MediaControl * servant,
501 const VLC_Position * a_position, CORBA_Environment * ev)
503 input_thread_t *p_input = servant->p_intf->p_sys->p_input;
505 msg_Warn (servant->p_intf, "Calling MediaControl::resume");
507 if( p_input != NULL )
509 input_SetStatus( p_input, INPUT_STATUS_PAUSE );
516 impl_VLC_MediaControl_stop(impl_POA_VLC_MediaControl * servant,
517 const VLC_Position * a_position, CORBA_Environment * ev)
519 intf_thread_t * p_intf = servant->p_intf;
520 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
523 msg_Warn (servant->p_intf, "Calling MediaControl::stop");
525 if( p_playlist != NULL )
527 playlist_Stop( p_playlist );
528 vlc_object_release( p_playlist );
535 impl_VLC_MediaControl_exit(impl_POA_VLC_MediaControl * servant,
536 CORBA_Environment * ev)
538 msg_Warn (servant->p_intf, "Calling MediaControl::exit");
540 vlc_mutex_lock( &servant->p_intf->change_lock );
541 servant->p_intf->b_die = TRUE;
542 vlc_mutex_unlock( &servant->p_intf->change_lock );
546 impl_VLC_MediaControl_add_to_playlist(impl_POA_VLC_MediaControl * servant,
547 const CORBA_char * psz_file,
548 CORBA_Environment * ev)
550 intf_thread_t * p_intf = servant->p_intf;
551 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
554 msg_Warn (servant->p_intf, "Calling MediaControl::add_to_playlist %s", psz_file);
556 if ( p_playlist == NULL )
558 msg_Err (servant->p_intf, "Error: no playlist defined");
559 /* FIXME: should return an exception */
563 playlist_Add (p_playlist, psz_file, psz_file , PLAYLIST_REPLACE, 0);
564 vlc_object_release( p_playlist );
569 static VLC_PlaylistSeq *
570 impl_VLC_MediaControl_get_playlist(impl_POA_VLC_MediaControl * servant,
571 CORBA_Environment * ev)
573 VLC_PlaylistSeq *retval;
575 intf_thread_t * p_intf = servant->p_intf;
576 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
580 msg_Warn (servant->p_intf, "Calling MediaControl::get_playlist");
582 vlc_mutex_lock( &p_playlist->object_lock );
583 i_playlist_size = p_playlist->i_size;
585 retval = VLC_PlaylistSeq__alloc ();
586 retval->_buffer = VLC_PlaylistSeq_allocbuf (i_playlist_size);
587 retval->_length = i_playlist_size;
589 for (i_index = 0 ; i_index < i_playlist_size ; i_index++)
591 retval->_buffer[i_index] =
592 CORBA_string_dup (p_playlist->pp_items[i_index]->psz_name);
594 vlc_mutex_unlock( &p_playlist->object_lock );
595 vlc_object_release( p_playlist );
597 CORBA_sequence_set_release (retval, TRUE);
601 /* (Real) end of the CORBA code generated in Mediacontrol-skelimpl.c */
603 /*****************************************************************************
605 *****************************************************************************/
606 static int Open ( vlc_object_t * );
607 static void Close ( vlc_object_t * );
608 static void Run ( intf_thread_t * );
610 /*****************************************************************************
612 *****************************************************************************/
614 add_category_hint( N_("Corba control"), NULL, VLC_FALSE );
615 set_description( _("corba control module") );
616 set_capability( "interface", 10 );
617 set_callbacks( Open, Close );
620 /*****************************************************************************
621 * intf_Open: initialize and create stuff
622 *****************************************************************************/
623 static int Open( vlc_object_t *p_this )
625 intf_thread_t *p_intf = (intf_thread_t *)p_this;
627 /* Allocate instance and initialize some members */
628 p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
629 if( p_intf->p_sys == NULL )
631 msg_Err( p_intf, "out of memory" );
635 /* Initialize the fields of the p_intf struct */
636 p_intf->pf_run = Run;
637 p_intf->p_sys->b_playing = VLC_FALSE;
638 p_intf->p_sys->p_input = NULL;
640 p_intf->p_sys->orb = NULL;
641 p_intf->p_sys->mc = NULL;
642 p_intf->p_sys->root_poa = NULL;
643 p_intf->p_sys->root_poa_manager = NULL;
644 p_intf->p_sys->corbaloop = NULL;
651 /*****************************************************************************
652 * intf_Close: destroy interface
653 *****************************************************************************/
654 static void Close( vlc_object_t *p_this )
656 intf_thread_t *p_intf = (intf_thread_t *)p_this;
657 CORBA_Environment* ev = NULL;
659 ev = CORBA_exception__alloc ();
660 CORBA_ORB_shutdown (p_intf->p_sys->orb, FALSE, ev);
661 handle_exception_no_servant (p_intf, "Erreur dans Close");
663 if( p_intf->p_sys->p_input )
665 vlc_object_release( p_intf->p_sys->p_input );
668 /* Destroy structure */
669 free( p_intf->p_sys );
673 Function called regularly to handle various tasks (mainly CORBA calls)
675 static gboolean Manage (gpointer p_interface)
677 intf_thread_t *p_intf = (intf_thread_t*)p_interface;
678 CORBA_boolean b_work_pending;
679 CORBA_Environment* ev;
681 ev = CORBA_exception__alloc ();
684 b_work_pending = CORBA_ORB_work_pending (p_intf->p_sys->orb, ev);
685 if(ev->_major != CORBA_NO_EXCEPTION)
687 msg_Err (p_intf, "Exception dans la vérif d'événements CORBA");
691 vlc_mutex_lock( &p_intf->change_lock );
693 /* Update the input */
694 if( p_intf->p_sys->p_input == NULL )
696 p_intf->p_sys->p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
699 else if( p_intf->p_sys->p_input->b_dead )
701 vlc_object_release( p_intf->p_sys->p_input );
702 p_intf->p_sys->p_input = NULL;
705 if( p_intf->p_sys->p_input )
707 input_thread_t *p_input = p_intf->p_sys->p_input;
709 vlc_mutex_lock( &p_input->stream.stream_lock );
711 if ( !p_input->b_die )
713 /* New input or stream map change */
714 if( p_input->stream.b_changed )
716 /* FIXME: We should notify our client that the input changed */
717 /* E_(GtkModeManage)( p_intf ); */
718 p_intf->p_sys->b_playing = 1;
721 vlc_mutex_unlock( &p_input->stream.stream_lock );
723 else if( p_intf->p_sys->b_playing && !p_intf->b_die )
725 /* FIXME: We should notify our client that the input changed */
726 /* E_(GtkModeManage)( p_intf ); */
727 p_intf->p_sys->b_playing = 0;
730 /* CORBA calls handling. Beware: no lock is taken (since p_pinput
733 CORBA_ORB_perform_work (p_intf->p_sys->orb, ev);
737 vlc_mutex_unlock( &p_intf->change_lock );
738 g_main_loop_quit (p_intf->p_sys->corbaloop);
743 vlc_mutex_unlock( &p_intf->change_lock );
748 /*****************************************************************************
750 *****************************************************************************
751 * this part of the interface is in a separate thread so that we can call
752 * g_main_loop_run() from within it without annoying the rest of the program.
753 *****************************************************************************/
754 static void Run ( intf_thread_t *p_intf )
756 CORBA_Environment* ev = NULL;
757 guint i_event_source;
758 CORBA_char* psz_objref;
759 impl_POA_VLC_MediaControl *servant = NULL;
761 char* ppsz_argv[] = { "mc" };
763 msg_Warn (p_intf, "Entering Run");
765 ev = CORBA_exception__alloc ();
767 /* To be able to use CORBA in a MT app */
768 linc_set_threaded (TRUE);
770 p_intf->p_sys->orb = CORBA_ORB_init(&i_argc, ppsz_argv, "orbit-local-orb", ev);
772 /* Should be cleaner this way (cf
773 http://www.fifi.org/doc/gnome-dev-doc/html/C/orbitgtk.html) but it
774 functions well enough in the ugly way so that I do not bother
776 /* p_intf->p_sys->orb = gnome_CORBA_init ("VLC", NULL, &argc, &argv, 0, NULL, ev); */
778 handle_exception_no_servant (p_intf, "Exception during CORBA_ORB_init");
780 p_intf->p_sys->root_poa = (PortableServer_POA)CORBA_ORB_resolve_initial_references(p_intf->p_sys->orb, "RootPOA", ev);
781 handle_exception ("Exception during RootPOA initialization");
783 p_intf->p_sys->mc = impl_VLC_MediaControl__create(p_intf->p_sys->root_poa, ev);
784 handle_exception ("Exception during MediaControl initialization");
786 servant = (impl_POA_VLC_MediaControl*)PortableServer_POA_reference_to_servant(p_intf->p_sys->root_poa, p_intf->p_sys->mc, ev);
787 handle_exception ("Exception during MediaControl access");
789 servant->p_intf = p_intf;
791 psz_objref = CORBA_ORB_object_to_string(p_intf->p_sys->orb, p_intf->p_sys->mc, ev);
792 handle_exception ("Exception during IOR generation");
794 msg_Warn (p_intf, "MediaControl IOR :");
795 msg_Warn (p_intf, psz_objref);
797 /* We write the IOR in a file. */
800 fp = fopen (VLC_IOR_FILE, "w");
803 msg_Err (servant->p_intf, "Cannot write the IOR to %s (%d).", VLC_IOR_FILE, errno);
807 fprintf (fp, "%s", psz_objref);
809 msg_Warn (servant->p_intf, "IOR written to %s", VLC_IOR_FILE);
813 msg_Warn (p_intf, "get_the_POAManager (state %s)", p_intf->p_sys->root_poa);
814 p_intf->p_sys->root_poa_manager = PortableServer_POA__get_the_POAManager(p_intf->p_sys->root_poa, ev);
815 handle_exception ("Exception during POAManager resolution");
817 msg_Warn (p_intf, "Activating POAManager");
818 PortableServer_POAManager_activate(p_intf->p_sys->root_poa_manager, ev);
819 handle_exception ("Exception during POAManager activation");
821 msg_Info(p_intf, "corba remote control interface initialized" );
824 // Tentative de gestion du nommage...
826 CosNaming_NamingContext name_service;
827 CosNaming_NameComponent name_component[3] = {{"GNOME", "subcontext"},
828 {"Servers", "subcontext"},
830 CosNaming_Name name = {3, 3, name_component, CORBA_FALSE};
832 name_service = CORBA_ORB_resolve_initial_references (p_intf->p_sys->orb,
835 handle_exception ("Error: could not get name service: %s\n",
836 CORBA_exception_id(ev));
837 msg_Warn (p_intf, "Name service OK");
839 CosNaming_NamingContext_bind (name_service, &name, p_intf->p_sys->mc, ev);
840 handle_exception ("Error: could not register object: %s\n",
841 CORBA_exception_id(ev));
845 /* The time factor should be 1/1000 but it is a little too
846 slow. Make it 1/10000 */
847 i_event_source = g_timeout_add (INTF_IDLE_SLEEP / 10000,
850 msg_Warn (p_intf, "Entering mainloop");
852 p_intf->p_sys->corbaloop = g_main_loop_new (NULL, FALSE);
853 g_main_loop_run (p_intf->p_sys->corbaloop);
856 g_source_remove( i_event_source );
857 unlink (VLC_IOR_FILE);
859 msg_Warn (p_intf, "Normal termination of VLC corba plugin");