Commit de277e80 authored by Damien Fouilleul's avatar Damien Fouilleul

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
parent 56c76843
......@@ -34,10 +34,6 @@
#include <vlc/vlc.h>
#ifndef WIN32
#include <X11/Xlib.h>
#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 * );
/** @} */
......
......@@ -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,
......
......@@ -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;
}
......@@ -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 )
......
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