Commit 4c5ad8e3 authored by Olivier Aubert's avatar Olivier Aubert

Remove CORBA module, which I is not used anymore (not even by me...)

parent bdfdc200
...@@ -35,7 +35,7 @@ S: Germany ...@@ -35,7 +35,7 @@ S: Germany
N: Olivier Aubert N: Olivier Aubert
E: oaubert at lisi dot univ-lyon1 dot fr E: oaubert at lisi dot univ-lyon1 dot fr
D: CORBA interface D: Mediacontrol API, Python bindings, svg module
S: France S: France
N: Sigmund Augdal Helberg N: Sigmund Augdal Helberg
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
- skins2 : [ipkiss] [asmax] - skins2 : [ipkiss] [asmax]
- macosx : [thedj] [bigben] [fkuehne] - macosx : [thedj] [bigben] [fkuehne]
- lirc, dummy, rc, ncurses : [sam] - lirc, dummy, rc, ncurses : [sam]
- corba : [oaubert]
- familiar : [jpsaman] - familiar : [jpsaman]
- http : [meuuh] - http : [meuuh]
......
...@@ -14,7 +14,6 @@ GOOM goom ...@@ -14,7 +14,6 @@ GOOM goom
SLP slp SLP slp
LIRC lirc LIRC lirc
JOYSTICK joystick JOYSTICK joystick
CORBA corba
LIVEDOTCOM livedotcom LIVEDOTCOM livedotcom
DVDREAD dvdread DVDREAD dvdread
DVDNAV dvdnav DVDNAV dvdnav
......
...@@ -38,7 +38,6 @@ if [ "$CONFIG_GOOM" = "y" ]; then ...@@ -38,7 +38,6 @@ if [ "$CONFIG_GOOM" = "y" ]; then
fi fi
bool 'GaLaktos visualization plugin' CONFIG_GALAKTOS bool 'GaLaktos visualization plugin' CONFIG_GALAKTOS
bool 'IR remote control support' CONFIG_LIRC bool 'IR remote control support' CONFIG_LIRC
bool 'Corba interface support' CONFIG_CORBA
endmenu endmenu
mainmenu_option next_comment mainmenu_option next_comment
......
...@@ -5095,30 +5095,6 @@ then ...@@ -5095,30 +5095,6 @@ then
fi fi
dnl
dnl corba (ORBit) plugin
dnl
dnl Default: do not enable corba
enablecorba=false
AC_ARG_ENABLE(corba,
[ --enable-corba corba interface support (default disabled)])
if test "${enable_corba}" = "yes"; then
GLIB_VERSION=2.3.2
PKG_CHECK_MODULES(CORBA,
ORBit-2.0 >= 2.8.0 \
glib-2.0 >= $GLIB_VERSION \
gobject-2.0 >= $GLIB_VERSION \
gthread-2.0 >= $GLIB_VERSION,
[
enablecorba=true
VLC_ADD_LDFLAGS([corba],[$CORBA_LIBS])
VLC_ADD_CFLAGS([corba],[$CORBA_CFLAGS])
VLC_ADD_PLUGINS([corba snapshot]) ],
[ enablecorba=false
AC_MSG_WARN(corba library not found) ])
fi
AM_CONDITIONAL(ENABLE_CORBA, test "$enablecorba" = "true")
AC_ARG_WITH(,[Misc options:]) AC_ARG_WITH(,[Misc options:])
dnl dnl
...@@ -5655,7 +5631,6 @@ AC_CONFIG_FILES([ ...@@ -5655,7 +5631,6 @@ AC_CONFIG_FILES([
modules/codec/spudec/Makefile modules/codec/spudec/Makefile
modules/control/Makefile modules/control/Makefile
modules/control/http/Makefile modules/control/http/Makefile
modules/control/corba/Makefile
modules/demux/Makefile modules/demux/Makefile
modules/demux/asf/Makefile modules/demux/asf/Makefile
modules/demux/avi/Makefile modules/demux/avi/Makefile
......
...@@ -23,7 +23,6 @@ CONFIG_VISUAL=y ...@@ -23,7 +23,6 @@ CONFIG_VISUAL=y
# CONFIG_SLP is not set # CONFIG_SLP is not set
# CONFIG_LIRC is not set # CONFIG_LIRC is not set
CONFIG_JOYSTICK=y CONFIG_JOYSTICK=y
# CONFIG_CORBA is not set
# #
# Input plugins # Input plugins
......
...@@ -48,7 +48,6 @@ $Id$ ...@@ -48,7 +48,6 @@ $Id$
* cinepak: Cinepack video decoder * cinepak: Cinepack video decoder
* clone: Clone video filter * clone: Clone video filter
* cmml: Continuous Media Markup Language annotations/hyperlinks decoder * cmml: Continuous Media Markup Language annotations/hyperlinks decoder
* corba: CORBA control module
* crop: Crop video filter * crop: Crop video filter
* cvdsub: CVD subtitles decoder * cvdsub: CVD subtitles decoder
* daap: iTunes shares services discovery * daap: iTunes shares services discovery
......
/*
Module inspired by the MediaControl IDL
*/
module VLC {
const float VERSION = 0.1;
enum PositionOrigin {
AbsolutePosition, RelativePosition, ModuloPosition
};
enum PositionKey {
ByteCount, SampleCount, MediaTime
};
struct Position {
PositionOrigin origin;
PositionKey key;
long long value;
};
exception PositionKeyNotSupported { string message; };
exception PositionOriginNotSupported { string message; };
exception InvalidPosition { string message; };
exception PlaylistException { string message; };
exception InternalException { string message; };
typedef sequence<string> PlaylistSeq;
typedef sequence<octet> ByteSeq;
struct RGBPicture {
short width;
short height;
long type;
ByteSeq data;
long long date;
};
typedef sequence<RGBPicture> RGBPictureSeq;
/* Cf stream_control.h */
enum PlayerStatus { PlayingStatus, PauseStatus, ForwardStatus, BackwardStatus, InitStatus, EndStatus, UndefinedStatus };
struct StreamInformation {
PlayerStatus streamstatus;
string url; /* The URL of the current media stream */
long long position; /* actual location in the stream (in ms) */
long long length; /* total length of the stream (in ms) */
};
// MediaControl interface is similar to
// ControlledStream interface in MSS.
// It can be inherited by flow endpoints or
// FlowConnection interfaces.
interface MediaControl
{
Position get_media_position(in PositionOrigin an_origin,
in PositionKey a_key)
raises (InternalException, PositionKeyNotSupported);
void set_media_position(in Position a_position)
raises (InternalException, PositionKeyNotSupported, InvalidPosition);
void start(in Position a_position)
raises (InternalException, InvalidPosition, PlaylistException);
void pause(in Position a_position)
raises (InternalException, InvalidPosition);
void resume(in Position a_position)
raises (InternalException, InvalidPosition);
void stop(in Position a_position)
raises (InternalException, InvalidPosition);
oneway void exit (); // Exits the player (not in the original spec)
void playlist_add_item (in string a_file)
raises (PlaylistException);
void playlist_clear ()
raises (PlaylistException);
// Returns the list of files in playlist
PlaylistSeq playlist_get_list ()
raises (PlaylistException);
// Returns a snapshot of the currently displayed picture
RGBPicture snapshot (in Position a_position)
raises (InternalException);
RGBPictureSeq all_snapshots ()
raises (InternalException);
// Displays the message string, between "begin" and "end" positions
void display_text (in string message, in Position begin, in Position end)
raises (InternalException);
StreamInformation get_stream_information ()
raises (InternalException);
unsigned short sound_get_volume()
raises (InternalException);
void sound_set_volume(in unsigned short volume)
raises (InternalException);
};
};
## corba module declaration
SOURCES_corba = corba.c ../../../src/control/mediacontrol_plugin.c
nodist_SOURCES_corba = \
MediaControl-common.c \
MediaControl-skels.c \
MediaControl-stubs.c \
MediaControl.h \
$(NULL)
if ENABLE_CORBA
GENERATEDFILES = MediaControl-common.c MediaControl-skels.c MediaControl.h
endif
CORBAIDLFILE = MediaControl.idl
EXTRA_DIST += $(CORBAIDLFILE)
BUILT_SOURCES += $(GENERATEDFILES)
if ENABLE_CORBA
corbaidldir = $(datadir)/idl
corbaidl_DATA = $(CORBAIDLFILE)
## orbittypelibdir = $(libdir)/orbit-2.0
orbittypelibdir = $(libdir)/advene
orbittypelib_DATA = MediaControl.so
orbittypelib_CFLAGS=`$(VLC_CONFIG) --cflags plugin corba`
orbittypelib_LIBS=`$(VLC_CONFIG) --libs plugin corba`
ORBIT_IDL=`$(PKG_CONFIG) --variable=orbit_idl ORBit-2.0`
## MediaControl.so rules
MediaControl-imodule.o: MediaControl-imodule.c
$(CC) -fPIC -o $@ -c $< $(orbittypelib_CFLAGS)
MediaControl.so: MediaControl-imodule.o
$(CC) -shared -o $@ $< $(orbittypelib_LIBS)
## We have to invoke 2 times $(ORBIT_IDL), else the --imodule
## invocation builds MediaControl-common.c without some
## glue code that is needed.
$(GENERATEDFILES): $(CORBAIDLFILE)
$(ORBIT_IDL) --imodule $<
$(ORBIT_IDL) $<
clean:
$(RM) -f $(GENERATEDFILES)
endif
* Corba module (server) side
** Dependencies
To compile the CORBA plugin, you need the orbit2 developpement files
(for Debian, install the package liborbit2-dev)
** How to run it ?
You run the CORBA module with the following command line :
vlc --intf corba
The CORBA module is initialized and saves its IOR into the file
/tmp/vlc-ior.ref
(it will soon move to $HOME/.vlc-ior.ref)
** Code architecture
The binding between VLC and the MediaControl API (at C-level) is done
through the mediacontrol-core.c file. This file implements an
object-oriented layer API accessible in C.
The corba.c itself only translates calls from CORBA to this C API,
which makes the code clearer overall. Moreover, the same
mediacontrol-core.c file is used by the vlc-python module to implement the
same API.
* Client side
A sample client code can be found at http://liris.cnrs.fr/advene/
** Dependencies
The python client uses the pyorbit library developped by James
Henstridge <james@daa.com.au>
** Typelib information
To simply access the server, you do not need any reference to the IDL
(CORBA2.0 provides introspection facilities). However, if you want to
use the structures defined in the IDL (Position, Origin, ...), you
need to use the IDL information, and compile a dynamic lib
(MediaControl.so) from the IDL.
* Interesting pointers
- GLib reference manual
http://developer.gnome.org/doc/API/glib/
- IDL quickref :
http://www.cs.rpi.edu/~musser/dsc/idl/idl-overview.html
/*****************************************************************************
* corba.c : CORBA (ORBit) remote control plugin for vlc
*****************************************************************************
* Copyright (C) 2001 the VideoLAN team
* $Id$
*
* Authors: Olivier Aubert <oaubert@lisi.univ-lyon1.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
* 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
/* For CORBA */
#include "MediaControl.h"
#include "orbit/poa/portableserver-poa-type.h"
#include <vlc/vlc.h>
#include <vlc/mediacontrol.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <vlc/aout.h>
#include <errno.h>
#include <unistd.h>
/* FIXME: replace this to ~/.vlc/vlc-ior.ref thanks to
config_GetHomeDir( ) */
#ifndef __WIN32__
#define VLC_IOR_FILE "/tmp/vlc-ior.ref"
#else
#define VLC_IOR_FILE "vlc-ior-ref"
#endif
#define MC_TRY exception = mediacontrol_exception_init( exception )
#define MC_EXCEPT( return_value ) \
if ( exception->code )\
{ \
corba_raise( ev, exception ); \
mediacontrol_exception_free( exception ); \
return return_value; \
} else { mediacontrol_exception_free( exception ); }
#define handle_exception( m ) if( ev->_major != CORBA_NO_EXCEPTION ) \
{ \
msg_Err( servant->p_intf, m ); \
return; \
}
#define handle_exception_no_servant( p,m ) if( ev->_major != CORBA_NO_EXCEPTION ) \
{ \
msg_Err( p, m ); \
return; \
}
static void corba_raise( CORBA_Environment *ev, mediacontrol_Exception *exception )
{
char *corba_exception=NULL;
char* i_type = NULL;
switch( exception->code )
{
case mediacontrol_InternalException:
corba_exception = ( char* )VLC_InternalException__alloc();
i_type = ex_VLC_InternalException;
break;
case mediacontrol_PlaylistException:
corba_exception = ( char* )VLC_PlaylistException__alloc();
i_type = ex_VLC_PlaylistException;
break;
case mediacontrol_InvalidPosition:
corba_exception = ( char* )VLC_InvalidPosition__alloc();
i_type = ex_VLC_InvalidPosition;
break;
case mediacontrol_PositionKeyNotSupported:
corba_exception = ( char* )VLC_PositionKeyNotSupported__alloc();
i_type = ex_VLC_PositionKeyNotSupported;
break;
case mediacontrol_PositionOriginNotSupported:
corba_exception = ( char* )VLC_PositionOriginNotSupported__alloc();
i_type = ex_VLC_PositionOriginNotSupported;
break;
}
( (VLC_InternalException* )corba_exception )->message = CORBA_string_dup( exception->message );
CORBA_exception_set( ev, CORBA_USER_EXCEPTION, i_type, corba_exception );
return;
}
static mediacontrol_Position* corba_position_corba_to_c( const VLC_Position* position )
{
mediacontrol_Position* retval;
retval = ( mediacontrol_Position* )malloc( sizeof( mediacontrol_Position ) );
if( ! retval )
return NULL;
retval->origin = position->origin;
retval->key = position->key;
retval->value = position->value;
return retval;
}
static VLC_Position* corba_position_c_to_corba( const mediacontrol_Position* position )
{
VLC_Position* retval;
retval = ( VLC_Position* )malloc( sizeof( VLC_Position ) );
if( ! retval )
return NULL;
retval->origin = position->origin;
retval->key = position->key;
retval->value = position->value;
return retval;
}
/*****************************************************************************
* intf_sys_t: description and status of corba interface
*****************************************************************************/
struct intf_sys_t
{
CORBA_ORB orb;
GMainLoop* corbaloop;
mediacontrol_Instance *mc;
msg_subscription_t* p_sub; /* message bank subscription */
};
/*** App-specific servant structures ***/
/* We can add attributes to this structure, which is both a pointer on a
specific structure, and on a POA_VLC_MediaControl ( servant ). Cf
http://developer.gnome.org/doc/guides/corba/html/corba-poa-example.html */
typedef struct
{
POA_VLC_MediaControl servant;
PortableServer_POA poa;
/* Ajouter ici les attributs utiles */
mediacontrol_Instance *mc;
intf_thread_t *p_intf;
} impl_POA_VLC_MediaControl;
/* Beginning of the CORBA code generated in Mediacontrol-skelimpl.c */
/* BEGIN INSERT */
/*** Implementation stub prototypes ***/
static void impl_VLC_MediaControl__destroy( impl_POA_VLC_MediaControl *
servant, CORBA_Environment * ev );
static VLC_Position
impl_VLC_MediaControl_get_media_position( impl_POA_VLC_MediaControl * servant,
const VLC_PositionOrigin an_origin,
const VLC_PositionKey a_key,
CORBA_Environment * ev );
static void
impl_VLC_MediaControl_set_media_position( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position,
CORBA_Environment * ev );
static void
impl_VLC_MediaControl_start( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position,
CORBA_Environment * ev );
static void
impl_VLC_MediaControl_pause( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position,
CORBA_Environment * ev );
static void
impl_VLC_MediaControl_resume( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position,
CORBA_Environment * ev );
static void
impl_VLC_MediaControl_stop( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position,
CORBA_Environment * ev );
static void
impl_VLC_MediaControl_exit( impl_POA_VLC_MediaControl * servant,
CORBA_Environment * ev );
static void
impl_VLC_MediaControl_playlist_add_item( impl_POA_VLC_MediaControl * servant,
const CORBA_char * a_file,
CORBA_Environment * ev );
static void
impl_VLC_MediaControl_playlist_clear( impl_POA_VLC_MediaControl * servant,
CORBA_Environment * ev );
static VLC_PlaylistSeq
*impl_VLC_MediaControl_playlist_get_list( impl_POA_VLC_MediaControl *
servant, CORBA_Environment * ev );
static VLC_RGBPicture
*impl_VLC_MediaControl_snapshot( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position,
CORBA_Environment * ev );
static VLC_RGBPictureSeq
*impl_VLC_MediaControl_all_snapshots( impl_POA_VLC_MediaControl * servant,
CORBA_Environment * ev );
static void
impl_VLC_MediaControl_display_text( impl_POA_VLC_MediaControl * servant,
const CORBA_char * message,
const VLC_Position * begin,
const VLC_Position * end,
CORBA_Environment * ev );
static VLC_StreamInformation
*impl_VLC_MediaControl_get_stream_information( impl_POA_VLC_MediaControl *
servant,
CORBA_Environment * ev );
static CORBA_unsigned_short
impl_VLC_MediaControl_sound_get_volume( impl_POA_VLC_MediaControl * servant,
CORBA_Environment * ev );
static void
impl_VLC_MediaControl_sound_set_volume( impl_POA_VLC_MediaControl * servant,
const CORBA_unsigned_short volume,
CORBA_Environment * ev );
/*** epv structures ***/
static PortableServer_ServantBase__epv impl_VLC_MediaControl_base_epv = {
NULL, /* _private data */
( gpointer ) & impl_VLC_MediaControl__destroy, /* finalize routine */
NULL, /* default_POA routine */
};
static POA_VLC_MediaControl__epv impl_VLC_MediaControl_epv = {
NULL, /* _private */
( gpointer ) & impl_VLC_MediaControl_get_media_position,
( gpointer ) & impl_VLC_MediaControl_set_media_position,
( gpointer ) & impl_VLC_MediaControl_start,
( gpointer ) & impl_VLC_MediaControl_pause,
( gpointer ) & impl_VLC_MediaControl_resume,
( gpointer ) & impl_VLC_MediaControl_stop,
( gpointer ) & impl_VLC_MediaControl_exit,
( gpointer ) & impl_VLC_MediaControl_playlist_add_item,
( gpointer ) & impl_VLC_MediaControl_playlist_clear,
( gpointer ) & impl_VLC_MediaControl_playlist_get_list,
( gpointer ) & impl_VLC_MediaControl_snapshot,
( gpointer ) & impl_VLC_MediaControl_all_snapshots,
( gpointer ) & impl_VLC_MediaControl_display_text,
( gpointer ) & impl_VLC_MediaControl_get_stream_information,
( gpointer ) & impl_VLC_MediaControl_sound_get_volume,
( gpointer ) & impl_VLC_MediaControl_sound_set_volume,
};
/*** vepv structures ***/
static POA_VLC_MediaControl__vepv impl_VLC_MediaControl_vepv = {
&impl_VLC_MediaControl_base_epv,
&impl_VLC_MediaControl_epv,
};
/*** Stub implementations ***/
static VLC_MediaControl
impl_VLC_MediaControl__create( PortableServer_POA poa, CORBA_Environment * ev )
{
VLC_MediaControl retval;
impl_POA_VLC_MediaControl *newservant;
PortableServer_ObjectId *objid;
newservant = g_new0( impl_POA_VLC_MediaControl, 1 );
newservant->servant.vepv = &impl_VLC_MediaControl_vepv;
newservant->poa =
( PortableServer_POA ) CORBA_Object_duplicate( (CORBA_Object ) poa, ev );
POA_VLC_MediaControl__init( (PortableServer_Servant ) newservant, ev );
/* Before servant is going to be activated all
* private attributes must be initialized. */
/* ------ init private attributes here ------ */
newservant->mc = NULL;
/* ------ ---------- end ------------- ------ */
objid = PortableServer_POA_activate_object( poa, newservant, ev );
CORBA_free( objid );
retval = PortableServer_POA_servant_to_reference( poa, newservant, ev );
return retval;
}
static void
impl_VLC_MediaControl__destroy( impl_POA_VLC_MediaControl * servant,
CORBA_Environment * ev )
{
CORBA_Object_release( (CORBA_Object ) servant->poa, ev );
/* No further remote method calls are delegated to
* servant and you may free your private attributes. */
/* ------ free private attributes here ------ */
/* ------ ---------- end ------------- ------ */
POA_VLC_MediaControl__fini( (PortableServer_Servant ) servant, ev );
}
/* END INSERT */
/* Beginning of the CORBA functions that we define */
/* Returns the current position in the stream. The returned value can
be relative or absolute ( according to PositionOrigin ) and the unit
is set by PositionKey */
static VLC_Position
impl_VLC_MediaControl_get_media_position( impl_POA_VLC_MediaControl * servant,
const VLC_PositionOrigin an_origin,
const VLC_PositionKey a_key,
CORBA_Environment * ev )
{
VLC_Position* retval = NULL;
mediacontrol_Position *p_pos;
mediacontrol_Exception *exception = NULL;
MC_TRY;
p_pos = mediacontrol_get_media_position( servant->mc, an_origin, a_key, exception );
MC_EXCEPT( *retval );
retval = corba_position_c_to_corba( p_pos );
free( p_pos );
return *retval;
}
/* Sets the media position */
static void
impl_VLC_MediaControl_set_media_position( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position,
CORBA_Environment * ev )
{
mediacontrol_Position *p_pos;
mediacontrol_Exception *exception = NULL;
p_pos = corba_position_corba_to_c( a_position );
MC_TRY;
mediacontrol_set_media_position( servant->mc, p_pos, exception );
MC_EXCEPT();
free( p_pos );
return;
}
/* Starts playing a stream */
static void
impl_VLC_MediaControl_start( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position, CORBA_Environment * ev )
{
mediacontrol_Position *p_pos;
mediacontrol_Exception *exception = NULL;
p_pos = corba_position_corba_to_c( a_position );
MC_TRY;
mediacontrol_start( servant->mc, p_pos, exception );
MC_EXCEPT();
free( p_pos );
return;
}
static void
impl_VLC_MediaControl_pause( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position, CORBA_Environment * ev )
{
mediacontrol_Position *p_pos;
mediacontrol_Exception *exception = NULL;
p_pos = corba_position_corba_to_c( a_position );
MC_TRY;
mediacontrol_pause( servant->mc, p_pos, exception );
MC_EXCEPT();
free( p_pos );
return;
}
static void
impl_VLC_MediaControl_resume( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position, CORBA_Environment * ev )
{
mediacontrol_Position *p_pos;
mediacontrol_Exception *exception = NULL;
p_pos = corba_position_corba_to_c( a_position );
MC_TRY;
mediacontrol_resume( servant->mc, p_pos, exception );
MC_EXCEPT();
free( p_pos );
return;
}
static void
impl_VLC_MediaControl_stop( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position, CORBA_Environment * ev )
{
mediacontrol_Position *p_pos;
mediacontrol_Exception *exception = NULL;
p_pos = corba_position_corba_to_c( a_position );
MC_TRY;
mediacontrol_pause( servant->mc, p_pos, exception );
MC_EXCEPT();
free( p_pos );
return;
}
static void
impl_VLC_MediaControl_exit( impl_POA_VLC_MediaControl * servant,
CORBA_Environment * ev )
{
mediacontrol_exit( servant->mc );
return;
}
static void
impl_VLC_MediaControl_playlist_add_item( impl_POA_VLC_MediaControl * servant,
const CORBA_char * psz_file,
CORBA_Environment * ev )
{
mediacontrol_Exception *exception = NULL;
MC_TRY;
mediacontrol_playlist_add_item( servant->mc, psz_file, exception );
MC_EXCEPT();
return;
}
static void
impl_VLC_MediaControl_playlist_clear( impl_POA_VLC_MediaControl * servant,
CORBA_Environment * ev )
{
mediacontrol_Exception *exception = NULL;
MC_TRY;
mediacontrol_playlist_clear( servant->mc, exception );
MC_EXCEPT();
return;
}
static VLC_PlaylistSeq *
impl_VLC_MediaControl_playlist_get_list( impl_POA_VLC_MediaControl * servant,
CORBA_Environment * ev )
{
VLC_PlaylistSeq *retval = NULL;
mediacontrol_Exception *exception = NULL;
mediacontrol_PlaylistSeq* p_ps;
int i_index;
MC_TRY;
p_ps = mediacontrol_playlist_get_list( servant->mc, exception );
MC_EXCEPT( retval );
retval = VLC_PlaylistSeq__alloc();
retval->_buffer = VLC_PlaylistSeq_allocbuf( p_ps->size );
retval->_length = p_ps->size;
for( i_index = 0 ; i_index < p_ps->size ; i_index++ )
{
retval->_buffer[i_index] = CORBA_string_dup( p_ps->data[i_index] );
}
CORBA_sequence_set_release( retval, TRUE );
mediacontrol_PlaylistSeq__free( p_ps );
return retval;
}
VLC_RGBPicture*
createRGBPicture( mediacontrol_RGBPicture* p_pic )
{
VLC_RGBPicture *retval;
retval = VLC_RGBPicture__alloc();
if( retval )
{
retval->width = p_pic->width;
retval->height = p_pic->height;
retval->type = p_pic->type;
retval->date = p_pic->date;
retval->data._maximum = p_pic->size;
retval->data._length = p_pic->size;
retval->data._buffer = VLC_ByteSeq_allocbuf( p_pic->size );
memcpy( retval->data._buffer, p_pic->data, p_pic->size );
/* CORBA_sequence_set_release( &( retval->data ), FALSE ); */
}
return retval;
}
static VLC_RGBPicture *
impl_VLC_MediaControl_snapshot( impl_POA_VLC_MediaControl * servant,
const VLC_Position * a_position,
CORBA_Environment * ev )
{
VLC_RGBPicture *retval = NULL;
mediacontrol_RGBPicture* p_pic = NULL;
mediacontrol_Position *p_pos;
mediacontrol_Exception *exception = NULL;
p_pos = corba_position_corba_to_c( a_position );
MC_TRY;
p_pic = mediacontrol_snapshot( servant->mc, p_pos, exception );
MC_EXCEPT( retval );
retval = createRGBPicture( p_pic );
mediacontrol_RGBPicture__free( p_pic );
return retval;
}
static VLC_RGBPictureSeq *
impl_VLC_MediaControl_all_snapshots( impl_POA_VLC_MediaControl * servant,
CORBA_Environment * ev )
{
VLC_RGBPictureSeq *retval = NULL;
mediacontrol_RGBPicture** p_piclist = NULL;
mediacontrol_RGBPicture** p_tmp = NULL;
mediacontrol_Exception *exception = NULL;
int i_size = 0;
int i_index;
MC_TRY;
p_piclist = mediacontrol_all_snapshots( servant->mc, exception );
MC_EXCEPT( retval );
for( p_tmp = p_piclist ; *p_tmp != NULL ; p_tmp++ )
i_size++;
retval = VLC_RGBPictureSeq__alloc();
retval->_buffer = VLC_RGBPictureSeq_allocbuf( i_size );
retval->_length = i_size;
for( i_index = 0 ; i_index < i_size ; i_index++ )
{
mediacontrol_RGBPicture *p_pic = p_piclist[i_index];
VLC_RGBPicture *p_rgb;
p_rgb = &( retval->_buffer[i_index] );
p_rgb->width = p_pic->width;
p_rgb->height = p_pic->height;
p_rgb->type = p_pic->type;
p_rgb->date = p_pic->date;
p_rgb->data._maximum = p_pic->size;
p_rgb->data._length = p_pic->size;
p_rgb->data._buffer = VLC_ByteSeq_allocbuf( p_pic->size );
memcpy( p_rgb->data._buffer, p_pic->data, p_pic->size );
mediacontrol_RGBPicture__free( p_pic );
}
free( p_piclist );
return retval;
}
static void
impl_VLC_MediaControl_display_text( impl_POA_VLC_MediaControl * servant,
const CORBA_char * message,
const VLC_Position * begin,
const VLC_Position * end,
CORBA_Environment * ev )
{
mediacontrol_Position *p_begin = NULL;
mediacontrol_Position *p_end = NULL;
mediacontrol_Exception *exception = NULL;
p_begin = corba_position_corba_to_c( begin );
p_end = corba_position_corba_to_c( end );
MC_TRY;
mediacontrol_display_text( servant->mc, message, p_begin, p_end, exception );
MC_EXCEPT();
free( p_begin );
free( p_end );
return;
}
static VLC_StreamInformation *
impl_VLC_MediaControl_get_stream_information( impl_POA_VLC_MediaControl *
servant, CORBA_Environment * ev )
{
mediacontrol_Exception *exception = NULL;
mediacontrol_StreamInformation *p_si = NULL;
VLC_StreamInformation *retval = NULL;
MC_TRY;
p_si = mediacontrol_get_stream_information( servant->mc, mediacontrol_MediaTime, exception );
MC_EXCEPT( retval );
retval = VLC_StreamInformation__alloc();
if( ! retval )
{
return NULL;
}
retval->streamstatus = p_si->streamstatus;
retval->url = CORBA_string_dup( p_si->url );
retval->position = p_si->position;
retval->length = p_si->length;
free( p_si->url );
free( p_si );
return retval;
}
static CORBA_unsigned_short
impl_VLC_MediaControl_sound_get_volume( impl_POA_VLC_MediaControl * servant,
CORBA_Environment * ev )
{
CORBA_short retval = 0;
mediacontrol_Exception *exception = NULL;
MC_TRY;
retval = mediacontrol_sound_get_volume( servant->mc, exception );
MC_EXCEPT( retval );
return retval;
}
static void
impl_VLC_MediaControl_sound_set_volume( impl_POA_VLC_MediaControl * servant,
const CORBA_unsigned_short volume,
CORBA_Environment * ev )
{
mediacontrol_Exception *exception = NULL;
MC_TRY;
mediacontrol_sound_set_volume( servant->mc, volume, exception );
MC_EXCEPT();
}
/* ( Real ) end of the CORBA code generated in Mediacontrol-skelimpl.c */
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static void Run ( intf_thread_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_category( CAT_INTERFACE );
set_subcategory( SUBCAT_INTERFACE_CONTROL );
add_category_hint( N_( "Corba control" ), NULL, VLC_FALSE );
#define REACTIVITY_TEXT N_("Reactivity" )
#define REACTIVITY_LONGTEXT N_( \
"The corba interface will handle events every 50ms/Reactivity. " \
"5000 appears to be a sensible value." )
set_description( _( "corba control module" ) );
set_capability( "interface", 10 );
add_integer( "corba-reactivity", 5000, NULL, REACTIVITY_TEXT,
REACTIVITY_LONGTEXT, VLC_TRUE );
set_callbacks( Open, Close );
vlc_module_end();
/*****************************************************************************
* intf_Open: initialize and create stuff
*****************************************************************************/
static int Open( vlc_object_t *p_this )
{
intf_thread_t *p_intf = ( intf_thread_t * )p_this;
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
msg_Err( p_intf, "Out of memory" );
return VLC_ENOMEM;
}
/* Initialize the fields of the p_intf struct */
p_intf->pf_run = Run;
p_intf->p_sys->mc = NULL;
p_intf->p_sys->orb = NULL;
p_intf->p_sys->corbaloop = NULL;
return VLC_SUCCESS;
}
/*****************************************************************************
* intf_Close: destroy interface
*****************************************************************************/
static void Close( vlc_object_t *p_this )
{
intf_thread_t *p_intf = ( intf_thread_t * )p_this;
CORBA_Environment* ev = NULL;
ev = CORBA_exception__alloc();
CORBA_ORB_shutdown( p_intf->p_sys->orb, FALSE, ev );
handle_exception_no_servant( p_intf, "Error in Close" );
/* Destroy structure */
free( p_intf->p_sys );
}
/*
Function called regularly to handle various tasks( mainly CORBA calls )
*/
static gboolean Manage( gpointer p_interface )
{
intf_thread_t *p_intf = ( intf_thread_t* )p_interface;
CORBA_boolean b_work_pending;
CORBA_Environment* ev;
ev = CORBA_exception__alloc();
/* CORBA */
b_work_pending = CORBA_ORB_work_pending( p_intf->p_sys->orb, ev );
if( ev->_major != CORBA_NO_EXCEPTION )
{
msg_Err( p_intf, "Exception in CORBA events check loop" );
return FALSE;
}
vlc_mutex_lock( &p_intf->change_lock );
if( b_work_pending )
CORBA_ORB_perform_work( p_intf->p_sys->orb, ev );
if( intf_ShouldDie( p_intf ) )
{
vlc_mutex_unlock( &p_intf->change_lock );
CORBA_ORB_shutdown( p_intf->p_sys->orb, TRUE, ev );
g_main_loop_quit( p_intf->p_sys->corbaloop );
/* Just in case */
return( TRUE );
}
vlc_mutex_unlock( &p_intf->change_lock );
return TRUE;
}
/*****************************************************************************
* Run: main loop
*****************************************************************************
* this part of the interface is in a separate thread so that we can call
* g_main_loop_run() from within it without annoying the rest of the program.
*****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
CORBA_Environment* ev = NULL;
PortableServer_POA root_poa;
PortableServer_POAManager root_poa_manager;
guint i_event_source;
CORBA_char* psz_objref;
impl_POA_VLC_MediaControl *servant = NULL;
VLC_MediaControl corba_instance;
mediacontrol_Instance *mc_instance;
mediacontrol_Exception *exception = NULL;
int i_argc = 1;
char* ppsz_argv[] = { "mc" };
int i_reactivity;
ev = CORBA_exception__alloc();
p_intf->p_sys->orb = CORBA_ORB_init( &i_argc, ppsz_argv, "orbit-local-orb", ev );
/* Should be cleaner this way ( cf
http://www.fifi.org/doc/gnome-dev-doc/html/C/orbitgtk.html ) but it
functions well enough in the ugly way so that I do not bother
cleaning it */
/* p_intf->p_sys->orb = gnome_CORBA_init ( "VLC", NULL, &argc, &argv, 0, NULL, ev ); */
handle_exception_no_servant( p_intf, "Exception during CORBA_ORB_init" );
root_poa = ( PortableServer_POA )CORBA_ORB_resolve_initial_references( p_intf->p_sys->orb, "RootPOA", ev );
handle_exception( "Exception during RootPOA initialization" );
corba_instance = impl_VLC_MediaControl__create( root_poa, ev );
handle_exception( "Exception during MediaControl initialization" );
servant = ( impl_POA_VLC_MediaControl* )PortableServer_POA_reference_to_servant( root_poa, corba_instance, ev );
handle_exception( "Exception during MediaControl access" );
MC_TRY;
mc_instance = mediacontrol_new_from_object((vlc_object_t* )p_intf, exception );
MC_EXCEPT();
p_intf->p_sys->mc = mc_instance;
servant->p_intf = p_intf;
servant->mc = p_intf->p_sys->mc;
psz_objref = CORBA_ORB_object_to_string( p_intf->p_sys->orb, corba_instance, ev );
handle_exception( "Exception during IOR generation" );
msg_Warn( p_intf, "MediaControl IOR :" );
msg_Warn( p_intf, psz_objref );
/* We write the IOR in a file. */
{
FILE* fp;
/* no need for Unicode transliteration as long as VLC_IOR_FILE
is pure ASCII */
fp = fopen( VLC_IOR_FILE, "w" );
if( fp == NULL )
{
msg_Err( p_intf, "Cannot write the IOR to %s ( %d ).", VLC_IOR_FILE, errno );
}
else
{
fprintf( fp, "%s", psz_objref );
fclose( fp );
msg_Warn( p_intf, "IOR written to %s", VLC_IOR_FILE );
}
}
root_poa_manager = PortableServer_POA__get_the_POAManager( root_poa, ev );
handle_exception( "Exception during POAManager resolution" );
PortableServer_POAManager_activate( root_poa_manager, ev );
handle_exception( "Exception during POAManager activation" );
msg_Info( p_intf, "corba remote control interface initialized" );
/*
// Tentative de gestion du nommage...
{
CosNaming_NamingContext name_service;
CosNaming_NameComponent name_component[3] = {{"GNOME", "subcontext"},
{"Servers", "subcontext"},
{"vlc", "server"} };
CosNaming_Name name = {3, 3, name_component, CORBA_FALSE};
name_service = CORBA_ORB_resolve_initial_references( p_intf->p_sys->orb,
"NameService",
ev );
handle_exception( "Error: could not get name service: %s\n",
CORBA_exception_id( ev ) );
msg_Warn( p_intf, "Name service OK" );
CosNaming_NamingContext_bind( name_service, &name, p_intf->p_sys->mc, ev );
handle_exception( "Error: could not register object: %s\n",
CORBA_exception_id( ev ) );
}
*/
/* The time factor should be 1/1000 but it is a little too
slow. Make it 1/10000 */
i_reactivity = config_GetInt( p_intf, "corba-reactivity" );
i_event_source = g_timeout_add( INTF_IDLE_SLEEP / i_reactivity, Manage, p_intf );
p_intf->p_sys->corbaloop = g_main_loop_new( NULL, FALSE );
g_main_loop_run( p_intf->p_sys->corbaloop );
/* Cleaning */
g_source_remove( i_event_source );
unlink( VLC_IOR_FILE );
/* Make sure we exit ( In case other interfaces have been spawned ) */
mediacontrol_exit( p_intf->p_sys->mc );
return;
}
...@@ -19,14 +19,12 @@ CC=mipsel-linux-gcc CXX=mipsel-linux-g++ AR=mipsel-linux-ar LD=mipsel-linux-ld R ...@@ -19,14 +19,12 @@ CC=mipsel-linux-gcc CXX=mipsel-linux-g++ AR=mipsel-linux-ar LD=mipsel-linux-ld R
--disable-macosx --disable-coreaudio --disable-quicktime \ --disable-macosx --disable-coreaudio --disable-quicktime \
--disable-qnx \ --disable-qnx \
--disable-ncurses \ --disable-ncurses \
--disable-corba \
--disable-mozilla \ --disable-mozilla \
--disable-mga \ --disable-mga \
--disable-svgalib --disable-ggi --disable-glide \ --disable-svgalib --disable-ggi --disable-glide \
--disable-aa --disable-caca \ --disable-aa --disable-caca \
--disable-qte --disable-qt_video \ --disable-qte --disable-qt_video \
--disable-livedotcom \ --disable-livedotcom \
--disable-corba \
--disable-v4l \ --disable-v4l \
--disable-pvr \ --disable-pvr \
--disable-satellite --disable-dvb \ --disable-satellite --disable-dvb \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment