]> git.sesse.net Git - vlc/commitdiff
few fixes in libvlc APis
authorDamien Fouilleul <damienf@videolan.org>
Sat, 29 Jul 2006 23:32:05 +0000 (23:32 +0000)
committerDamien Fouilleul <damienf@videolan.org>
Sat, 29 Jul 2006 23:32:05 +0000 (23:32 +0000)
- allow for libvlc_exception_t to be NULL in APIs
- remove X11 references from libvlc, as it breaks MacOS X

include/vlc/libvlc.h
modules/video_output/x11/xcommon.c
src/control/core.c
src/control/video.c

index c3a5bf80d747cb6ab429fb6a1601312b43c06835..4cb38b32ca4366538b9208a074a0276f497d70b2 100644 (file)
 
 #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 * );
 
 /** @} */
 
index 101f487654f099107589203ab70f47030ccc941c..f80b33b1646191d44c4a74ee45be721770781350 100644 (file)
@@ -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,
index c4fb362055ddc1c482a10ec5c955ebb6fbd62163..2934e09ee2c9f3d774b0e7b9884441f568cda3f6 100644 (file)
@@ -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;
+}
+
index 8b6d805dcda635c2fe065d607d7c1c370f191cc4..87dc4adc29da80c2c5103f6f939f87c47b3b7ec3 100644 (file)
@@ -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 )