Commit da73802e authored by Olivier Aubert's avatar Olivier Aubert

* All C files: coding style update

* mediacontrol-core.c: update to the new control API
* configure.ac, Modules.am: (unfinished) build changes
parent f0bb8873
......@@ -3547,36 +3547,23 @@ then
)
fi
dnl
dnl corba (ORBit) plugin
dnl
AC_ARG_ENABLE(corba,
[ --enable-corba corba interface support (default disabled)])
if test "${enable_corba}" = "yes"; then
ORBIT_PATH="${PATH}"
AC_ARG_WITH(orbit-config-path,
[ --with-orbit-config-path=PATH orbit-config path (default search in \$PATH)])
if test "${with_orbit_config_path}" != "no"; then
ORBIT_PATH="${with_orbit_config_path}:${PATH}"
fi
# look for orbit2-config
AC_PATH_PROG(ORBIT_CONFIG, orbit2-config, no, ${ORBIT_PATH})
if test "${ORBIT_CONFIG}" != "no"; then
AX_ADD_CFLAGS(corba,[`${ORBIT_CONFIG} --cflags server`])
AX_ADD_LDFLAGS(corba,[`${ORBIT_CONFIG} --libs server | sed 's,-rdynamic,,'`])
# now look for the orbit.h header
CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_corba}"
ac_cv_corba_headers=yes
AC_CHECK_HEADERS(orbit/orbit.h, , [
ac_cv_corba_headers=no
AC_MSG_ERROR([Could not find corba development headers])
])
if test "${ac_cv_corba_headers}" = "yes"; then
AX_ADD_PLUGINS([corba snapshot])
fi
CPPFLAGS="${CPPFLAGS_save}"
fi
GLIB_VERSION=2.3.2
PKG_CHECK_MODULES(LIBMEDIACONTROL,
ORBit-2.0 >= 2.8.0 \
glib-2.0 >= $GLIB_VERSION \
gobject-2.0 >= $GLIB_VERSION \
gthread-2.0 >= $GLIB_VERSION,
[
AX_ADD_LDFLAGS([corba],[$LIBMEDIACONTROL_LIBS])
AX_ADD_CFLAGS([corba],[$LIBMEDIACONTROL_CFLAGS])
AX_ADD_PLUGINS([corba snapshot]) ],
[AC_MSG_WARN(corba library not found)])
fi
AC_ARG_WITH(,[Misc options:])
......
......@@ -2,30 +2,45 @@
SOURCES_corba = corba.c mediacontrol-core.c mediacontrol-plugin.c
EXTRA_DIST += MediaControl.so
nodist_SOURCES_corba = \
MediaControl-common.c \
MediaControl-skels.c \
MediaControl-skelimpl.c \
MediaControl-stubs.c \
MediaControl-imodule.c \
MediaControl.h \
$(NULL)
ORBITIDL = orbit-idl-2
corbaidldir = $(datadir)/idl
corbaidl_DATA = MediaControl.idl
GENERATEDFILES=MediaControl-common.c MediaControl-skels.c MediaControl.h MediaControl-imodule.c
## orbittypelibdir = $(libdir)/orbit-2.0
orbittypelibdir = $(libdir)/advene
orbittypelib_DATA = MediaControl.so
corba.c: MediaControl.h MediaControl-common.c
EXTRA_DIST += $(corbaidl_DATA)
$(GENERATEDFILES): MediaControl.idl
$(ORBITIDL) --skeleton-impl MediaControl.idl
ORBIT_IDL=$(shell pkg-config --variable=orbit_idl ORBit-2.0)
GENERATEDFILES = MediaControl-common.c MediaControl-skels.c MediaControl.h
BUILT_SOURCES += $(GENERATEDFILES) MediaControl-imodule.c
corba.c: MediaControl.h
MediaControl-imodule.c:
$(ORBITIDL) --imodule MediaControl.idl
## Needed for both MediaControl.so and libcorba_plugin compilation
INCLUDES = $(LIBMEDIACONTROL_CFLAGS)
## MediaControl.so rules
MediaControl.so: MediaControl-imodule.c
$(CC) -fPIC -o MediaControl-imodule.o -c MediaControl-imodule.c `pkg-config --cflags ORBit-2.0`
$(CC) -shared -o $@ MediaControl-imodule.o `pkg-config --libs ORBit-2.0`
$(CC) -fPIC -o MediaControl-imodule.o -c $< $(LIBMEDIACONTROL_CFLAGS)
$(CC) -shared -o $@ MediaControl-imodule.o $(LIBMEDIACONTROL_LIBS)
$(GENERATEDFILES): MediaControl.idl
$(ORBIT_IDL) --skeleton-impl $(corbaidl_DATA)
MediaControl-imodule.c: $(corbaidl_DATA)
$(ORBIT_IDL) --imodule $<
clean:
$(RM) -f $(GENERATEDFILES)
$(RM) -f MediaControl-imodule.c
......@@ -38,90 +38,91 @@
#include <unistd.h>
/* FIXME: replace this to ~/.vlc/vlc-ior.ref thanks to
config_GetHomeDir() */
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 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) \
#define handle_exception( m ) if( ev->_major != CORBA_NO_EXCEPTION ) \
{ \
msg_Err (servant->p_intf, m); \
return; \
msg_Err( servant->p_intf, m ); \
return; \
}
#define handle_exception_no_servant(p,m) if(ev->_major != CORBA_NO_EXCEPTION) \
#define handle_exception_no_servant( p,m ) if( ev->_major != CORBA_NO_EXCEPTION ) \
{ \
msg_Err (p, m); \
return; \
msg_Err( p, m ); \
return; \
}
static void corba_raise(CORBA_Environment *ev, mediacontrol_Exception *exception)
static void corba_raise( CORBA_Environment *ev, mediacontrol_Exception *exception )
{
char *corba_exception=NULL;
char* i_type = NULL;
char *corba_exception=NULL;
char* i_type = NULL;
switch (exception->code)
switch( exception->code )
{
case mediacontrol_InternalException:
corba_exception = (char*)VLC_InternalException__alloc ();
i_type = ex_VLC_InternalException;
break;
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;
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;
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;
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;
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;
( (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)
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;
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)
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;
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;
}
/*****************************************************************************
......@@ -129,203 +130,203 @@ static VLC_Position* corba_position_c_to_corba(const mediacontrol_Position* posi
*****************************************************************************/
struct intf_sys_t
{
CORBA_ORB orb;
GMainLoop* corbaloop;
mediacontrol_Instance *mc;
msg_subscription_t* p_sub; /* message bank subscription */
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
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;
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 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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
*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);
*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);
*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);
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);
*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);
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);
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 */
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 */
NULL, /* _private */
(gpointer) & impl_VLC_MediaControl_get_media_position,
( gpointer ) & impl_VLC_MediaControl_get_media_position,
(gpointer) & impl_VLC_MediaControl_set_media_position,
( gpointer ) & impl_VLC_MediaControl_set_media_position,
(gpointer) & impl_VLC_MediaControl_start,
( gpointer ) & impl_VLC_MediaControl_start,
(gpointer) & impl_VLC_MediaControl_pause,
( gpointer ) & impl_VLC_MediaControl_pause,
(gpointer) & impl_VLC_MediaControl_resume,
( gpointer ) & impl_VLC_MediaControl_resume,
(gpointer) & impl_VLC_MediaControl_stop,
( gpointer ) & impl_VLC_MediaControl_stop,
(gpointer) & impl_VLC_MediaControl_exit,
( gpointer ) & impl_VLC_MediaControl_exit,
(gpointer) & impl_VLC_MediaControl_playlist_add_item,
( gpointer ) & impl_VLC_MediaControl_playlist_add_item,
(gpointer) & impl_VLC_MediaControl_playlist_clear,
( gpointer ) & impl_VLC_MediaControl_playlist_clear,
(gpointer) & impl_VLC_MediaControl_playlist_get_list,
( gpointer ) & impl_VLC_MediaControl_playlist_get_list,
(gpointer) & impl_VLC_MediaControl_snapshot,
( gpointer ) & impl_VLC_MediaControl_snapshot,
(gpointer) & impl_VLC_MediaControl_all_snapshots,
( gpointer ) & impl_VLC_MediaControl_all_snapshots,
(gpointer) & impl_VLC_MediaControl_display_text,
( gpointer ) & impl_VLC_MediaControl_display_text,
(gpointer) & impl_VLC_MediaControl_get_stream_information,
( gpointer ) & impl_VLC_MediaControl_get_stream_information,
(gpointer) & impl_VLC_MediaControl_sound_get_volume,
( gpointer ) & impl_VLC_MediaControl_sound_get_volume,
(gpointer) & impl_VLC_MediaControl_sound_set_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,
&impl_VLC_MediaControl_base_epv,
&impl_VLC_MediaControl_epv,
};
/*** Stub implementations ***/
static VLC_MediaControl
impl_VLC_MediaControl__create(PortableServer_POA poa, CORBA_Environment * ev)
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;
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)
impl_VLC_MediaControl__destroy( impl_POA_VLC_MediaControl * servant,
CORBA_Environment * ev )
{
CORBA_Object_release((CORBA_Object) servant->poa, 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 ------------- ------ */
/* 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);
POA_VLC_MediaControl__fini( (PortableServer_Servant ) servant, ev );
}
/* END INSERT */
......@@ -333,342 +334,342 @@ impl_VLC_MediaControl__destroy(impl_POA_VLC_MediaControl * servant,
/* 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
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)
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;
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);
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;
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)
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;