From: Damien Fouilleul Date: Sat, 29 Jul 2006 23:32:05 +0000 (+0000) Subject: few fixes in libvlc APis X-Git-Tag: 0.9.0-test0~10748 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=de277e80b5445affffbb17b8e2d16c6d525c0f7c;p=vlc few fixes in libvlc APis - allow for libvlc_exception_t to be NULL in APIs - remove X11 references from libvlc, as it breaks MacOS X --- diff --git a/include/vlc/libvlc.h b/include/vlc/libvlc.h index c3a5bf80d7..4cb38b32ca 100644 --- a/include/vlc/libvlc.h +++ b/include/vlc/libvlc.h @@ -34,10 +34,6 @@ #include -#ifndef WIN32 -#include -#endif - # ifdef __cplusplus extern "C" { # endif @@ -117,6 +113,12 @@ typedef struct libvlc_instance_t libvlc_instance_t; */ libvlc_instance_t * libvlc_new( int , char **, libvlc_exception_t *); +/** + * returns a libvlc instance identifier for legacy APIs + * \param p_instance the instance to destroy + */ +int libvlc_get_vlc_id( libvlc_instance_t *p_instance ); + /** * Destroy a libvlc instance * \param p_instance the instance to destroy @@ -333,10 +335,15 @@ void libvlc_video_take_snapshot( libvlc_input_t *, char *, libvlc_exception_t * int libvlc_video_destroy( libvlc_input_t *, libvlc_exception_t *); -#ifndef WIN32 -int libvlc_video_reparent( libvlc_input_t *, Drawable, libvlc_exception_t * ); -#endif +/** +* Downcast to this general type as placeholder for a platform specific one, such as: +* Drawable on X11, +* CGrafPort on MacOSX, +* HWND on win32 +*/ +typedef int libvlc_drawable_t; +int libvlc_video_reparent( libvlc_input_t *, libvlc_drawable_t, libvlc_exception_t * ); /** @} */ diff --git a/modules/video_output/x11/xcommon.c b/modules/video_output/x11/xcommon.c index 101f487654..f80b33b164 100644 --- a/modules/video_output/x11/xcommon.c +++ b/modules/video_output/x11/xcommon.c @@ -2393,7 +2393,7 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) case VOUT_REPARENT: vlc_mutex_lock( &p_vout->p_sys->lock ); - d = va_arg( args, Drawable ); + d = (Drawable)va_arg( args, int ); if ( !d ) XReparentWindow( p_vout->p_sys->p_display, p_vout->p_sys->original_window.base_window, diff --git a/src/control/core.c b/src/control/core.c index c4fb362055..2934e09ee2 100644 --- a/src/control/core.c +++ b/src/control/core.c @@ -61,11 +61,22 @@ inline void libvlc_exception_raise( libvlc_exception_t *p_exception, char *psz_format, ... ) { va_list args; + + /* does caller care about exceptions ? */ + if( p_exception == NULL ) + return; + + /* remove previous exception if it wasn't cleared */ + if( p_exception->b_raised && p_exception->psz_message ) + { + free(p_exception->psz_message); + p_exception->psz_message = NULL; + } + va_start( args, psz_format ); vasprintf( &p_exception->psz_message, psz_format, args ); va_end( args ); - if( p_exception == NULL ) return; p_exception->b_raised = 1; } @@ -120,3 +131,9 @@ void libvlc_destroy( libvlc_instance_t *p_instance ) VLC_CleanUp( p_instance->i_vlc_id ); VLC_Destroy( p_instance->i_vlc_id ); } + +int libvlc_get_vlc_id( libvlc_instance_t *p_instance ) +{ + return p_instance->i_vlc_id; +} + diff --git a/src/control/video.c b/src/control/video.c index 8b6d805dcd..87dc4adc29 100644 --- a/src/control/video.c +++ b/src/control/video.c @@ -210,8 +210,7 @@ vlc_bool_t libvlc_input_has_vout( libvlc_input_t *p_input, } -#ifndef WIN32 -int libvlc_video_reparent( libvlc_input_t *p_input, Drawable d, +int libvlc_video_reparent( libvlc_input_t *p_input, libvlc_drawable_t d, libvlc_exception_t *p_e ) { vout_thread_t *p_vout = GetVout( p_input, p_e ); @@ -219,7 +218,6 @@ int libvlc_video_reparent( libvlc_input_t *p_input, Drawable d, return 0; } -#endif int libvlc_video_destroy( libvlc_input_t *p_input, libvlc_exception_t *p_e )