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
This diff is collapsed.
This diff is collapsed.
#include "mediacontrol-core.h"
mediacontrol_Instance* mediacontrol_new(char** args, mediacontrol_Exception *exception)
mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *exception )
{
mediacontrol_Instance* retval;
vlc_object_t *p_vlc;
int p_vlc_id;
char **ppsz_argv;
int i_count = 0;
int i_index;
char **p_tmp;
if (args)
mediacontrol_Instance* retval;
vlc_object_t *p_vlc;
int p_vlc_id;
char **ppsz_argv;
int i_count = 0;
int i_index;
char **p_tmp;
if( args )
{
for (p_tmp = args ; *p_tmp != NULL; p_tmp++)
i_count++;
for ( p_tmp = args ; *p_tmp != NULL ; p_tmp++ )
i_count++;
}
ppsz_argv = malloc(i_count + 2);
ppsz_argv[0] = strdup("vlc");
for (i_index = 0; i_index < i_count; i_index++)
ppsz_argv[i_index+1] = strdup(args[i_index]);
ppsz_argv[i_count + 1] = NULL;
ppsz_argv = malloc( i_count + 2 );
ppsz_argv[0] = strdup( "vlc" );
for ( i_index = 0; i_index < i_count; i_index++ )
ppsz_argv[i_index + 1] = strdup( args[i_index] );
ppsz_argv[i_count + 1] = NULL;
p_vlc_id = VLC_Create();
p_vlc_id = VLC_Create();
p_vlc = (vlc_object_t*)vlc_current_object (p_vlc_id);
p_vlc = ( vlc_object_t* )vlc_current_object( p_vlc_id );
if (! p_vlc)
if( ! p_vlc )
{
exception->code = mediacontrol_InternalException;
exception->message = strdup("Unable to initialize VLC");
return NULL;
exception->code = mediacontrol_InternalException;
exception->message = strdup( "Unable to initialize VLC" );
return NULL;
}
retval = (mediacontrol_Instance*)malloc(sizeof(mediacontrol_Instance));
retval = ( mediacontrol_Instance* )malloc( sizeof( mediacontrol_Instance ) );
VLC_Init(p_vlc_id, i_count + 1, ppsz_argv);
VLC_Init( p_vlc_id, i_count + 1, ppsz_argv );
retval->p_vlc = p_vlc;
retval->vlc_object_id = p_vlc_id;
retval->p_vlc = p_vlc;
retval->vlc_object_id = p_vlc_id;
/* We can keep references on these, which should not change. Is it true ? */
retval->p_playlist = vlc_object_find(p_vlc, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);
retval->p_intf = vlc_object_find(p_vlc, VLC_OBJECT_INTF, FIND_ANYWHERE);
/* We can keep references on these, which should not change. Is it true ? */
retval->p_playlist = vlc_object_find( p_vlc, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
retval->p_intf = vlc_object_find( p_vlc, VLC_OBJECT_INTF, FIND_ANYWHERE );
if (! retval->p_playlist || ! retval->p_intf)
if( ! retval->p_playlist || ! retval->p_intf )
{
exception->code=mediacontrol_InternalException;
exception->message=strdup("No available interface");
return NULL;
exception->code = mediacontrol_InternalException;
exception->message = strdup( "No available interface" );
return NULL;
}
return retval;
return retval;
};
void
mediacontrol_exit(mediacontrol_Instance *self)
mediacontrol_exit( mediacontrol_Instance *self )
{
vlc_object_release((vlc_object_t*)self->p_playlist);
vlc_object_release((vlc_object_t*)self->p_intf);
VLC_CleanUp(self->vlc_object_id);
VLC_Destroy(self->vlc_object_id);
vlc_object_release( (vlc_object_t* )self->p_playlist );
vlc_object_release( (vlc_object_t* )self->p_intf );
VLC_CleanUp( self->vlc_object_id );
VLC_Destroy( self->vlc_object_id );
}
#include "mediacontrol-core.h"
#include <vlc/intf.h>
mediacontrol_Instance* mediacontrol_new(char** args, mediacontrol_Exception *exception)
mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *exception )
{
exception->code = mediacontrol_InternalException;
exception->message = strdup("The mediacontrol extension was compiled for plugin use only.");
return NULL;
exception->code = mediacontrol_InternalException;
exception->message = strdup( "The mediacontrol extension was compiled for plugin use only." );
return NULL;
};
void
mediacontrol_exit(mediacontrol_Instance *self)
mediacontrol_exit( mediacontrol_Instance *self )
{
vlc_object_release(self->p_playlist);
vlc_mutex_lock( &self->p_intf->change_lock );
self->p_intf->b_die = 1;
vlc_mutex_unlock( &self->p_intf->change_lock );
vlc_object_release(self->p_intf);
vlc_object_release(self->p_vlc);
vlc_object_release( self->p_playlist );
vlc_mutex_lock( &self->p_intf->change_lock );
self->p_intf->b_die = 1;
vlc_mutex_unlock( &self->p_intf->change_lock );
vlc_object_release( self->p_intf );
vlc_object_release( self->p_vlc );
}
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