]> git.sesse.net Git - vlc/commitdiff
Real VOUT_REPARENT (UNIX only ATM).
authorFilippo Carone <littlejohn@videolan.org>
Fri, 28 Jul 2006 15:24:07 +0000 (15:24 +0000)
committerFilippo Carone <littlejohn@videolan.org>
Fri, 28 Jul 2006 15:24:07 +0000 (15:24 +0000)
if (vout_Control VOUT_REPARENT is called giving a Drawable in args)
then
     that Drawable is used as new parent
otherwise
     DefaultRootWindow will be the parent

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

index f8e2361217e865ba80e7cde155f58403df75e4dc..e3f3c4520094c416bfc75eb05d81d404cc160f3c 100644 (file)
@@ -31,6 +31,10 @@ extern "C" {
 
 #include <vlc/vlc.h>
 
+#ifndef WIN32
+#include <X11/Xlib.h>
+#endif
+    
 struct libvlc_instance_t
 {
     vlc_t *p_vlc;
index 90b159b651c473ee248966e03a9b62186fa49bae..c3a5bf80d747cb6ab429fb6a1601312b43c06835 100644 (file)
 
 #include <vlc/vlc.h>
 
+#ifndef WIN32
+#include <X11/Xlib.h>
+#endif
+
 # ifdef __cplusplus
 extern "C" {
 # endif
@@ -327,6 +331,12 @@ int libvlc_video_get_width( libvlc_input_t *, libvlc_exception_t * );
  */
 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    
+
 
 /** @} */
 
index 0ac793fdd0d1cd1fff17fc61c64d6f335227e077..101f487654f099107589203ab70f47030ccc941c 100644 (file)
@@ -2346,7 +2346,8 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
     vlc_bool_t b_arg;
     unsigned int i_width, i_height;
     unsigned int *pi_width, *pi_height;
-
+    Drawable d;
+    
     switch( i_query )
     {
         case VOUT_GET_SIZE:
@@ -2392,10 +2393,17 @@ 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 );
+           if ( !d ) 
             XReparentWindow( p_vout->p_sys->p_display,
                              p_vout->p_sys->original_window.base_window,
                              DefaultRootWindow( p_vout->p_sys->p_display ),
                              0, 0 );
+           else
+            XReparentWindow( p_vout->p_sys->p_display,
+                             p_vout->p_sys->original_window.base_window,
+                            d,
+                            0, 0); 
             XSync( p_vout->p_sys->p_display, False );
             p_vout->p_sys->original_window.owner_window = 0;
             vlc_mutex_unlock( &p_vout->p_sys->lock );
index 288e31f8d1541fa2b89a432cc4878e542c866da5..8b6d805dcda635c2fe065d607d7c1c370f191cc4 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * video.c: ibvlc new API video functions
+ * video.c: libvlc new API video functions
  *****************************************************************************
  * Copyright (C) 2005 the VideoLAN team
  * $Id: core.c 14187 2006-02-07 16:37:40Z courmisch $
@@ -208,3 +208,27 @@ vlc_bool_t libvlc_input_has_vout( libvlc_input_t *p_input,
     
     return VLC_TRUE;
 }
+
+
+#ifndef WIN32
+int libvlc_video_reparent( libvlc_input_t *p_input, Drawable d,
+                           libvlc_exception_t *p_e )
+{
+    vout_thread_t *p_vout = GetVout( p_input, p_e );
+    vout_Control( p_vout , VOUT_REPARENT, d);
+    return 0;
+    
+}
+#endif
+
+int libvlc_video_destroy( libvlc_input_t *p_input,
+                          libvlc_exception_t *p_e )
+{
+    vout_thread_t *p_vout = GetVout( p_input, p_e );
+    vlc_object_detach( p_vout ); 
+    vlc_object_release( p_vout );
+    vout_Destroy( p_vout );
+    
+    return 0;
+    
+}