]> git.sesse.net Git - vlc/blobdiff - src/control/video.c
libvlc_video_get_handle renamed to _get_parent
[vlc] / src / control / video.c
index fd176cb0ad94c235c6846ca5df674ef92ea4e2a2..8adac83d14eea020e17b81ad61699a9771c050e1 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include <libvlc_internal.h>
+#include "libvlc_internal.h"
 #include <vlc/libvlc.h>
-
-#include <vlc/vout.h>
-#include <vlc/intf.h>
+#include <vlc_input.h>
+#include <vlc_vout.h>
 
 /*
  * Remember to release the returned vout_thread_t since it is locked at
@@ -69,18 +68,6 @@ static vout_thread_t *GetVout( libvlc_input_t *p_input,
  * Exported functions
  **********************************************************************/
 
-void libvlc_set_video_drawable( libvlc_instance_t *p_instance,
-                                libvlc_drawable_t drawable,
-                                libvlc_exception_t *p_e )
-{
-    vlc_value_t value;
-    value.i_int = drawable;
-    
-    var_Set( p_instance->p_libvlc_int, "drawable", value);
-}
-
-
-
 void libvlc_set_fullscreen( libvlc_input_t *p_input, int b_fullscreen,
                             libvlc_exception_t *p_e )
 {
@@ -210,10 +197,12 @@ vlc_bool_t libvlc_input_has_vout( libvlc_input_t *p_input,
                                   libvlc_exception_t *p_e )
 {
     vout_thread_t *p_vout = GetVout( p_input, p_e );
-
-    /* GetVout will raise the exception for us */
-    if( !p_vout )
+    if ( libvlc_exception_raised( p_e ) )
     {
+        if ( strcmp( "No active video output", libvlc_exception_get_message( p_e ) ) == 0 )
+        {
+            libvlc_exception_clear( p_e );
+        }
         return VLC_FALSE;
     }
 
@@ -226,6 +215,13 @@ 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 );
+
+    if ( p_vout == NULL)
+    {
+        /// \todo: set exception
+        return 0;
+    }
+
     vout_Control( p_vout , VOUT_REPARENT, d);
     vlc_object_release( p_vout );
 
@@ -242,7 +238,7 @@ void libvlc_video_resize( libvlc_input_t *p_input, int width, int height, libvlc
 /* global video settings */
 
 void libvlc_video_set_parent( libvlc_instance_t *p_instance, libvlc_drawable_t d,
-                           libvlc_exception_t *p_e )
+                              libvlc_exception_t *p_e )
 {
     /* set as default for future vout instances */
     var_SetInteger(p_instance->p_libvlc_int, "drawable", (int)d);
@@ -264,6 +260,16 @@ void libvlc_video_set_parent( libvlc_instance_t *p_instance, libvlc_drawable_t d
     }
 }
 
+libvlc_drawable_t libvlc_video_get_parent( libvlc_instance_t *p_instance, libvlc_exception_t *p_e )
+{
+    libvlc_drawable_t result;
+    
+    result = var_GetInteger( p_instance->p_libvlc_int, "drawable" );
+    
+    return result;
+}
+
+
 void libvlc_video_set_size( libvlc_instance_t *p_instance, int width, int height,
                            libvlc_exception_t *p_e )
 {
@@ -361,6 +367,37 @@ void libvlc_video_set_aspect_ratio( libvlc_input_t *p_input,
     vlc_object_release( p_vout );
 }
 
+char *libvlc_video_get_crop_geometry( libvlc_input_t *p_input,
+                                   libvlc_exception_t *p_e )
+{
+    char *psz_geometry = 0;
+    vout_thread_t *p_vout = GetVout( p_input, p_e );
+
+    if( !p_vout )
+        return 0;
+
+    psz_geometry = var_GetString( p_vout, "crop" );
+    vlc_object_release( p_vout );
+    return psz_geometry;
+}
+
+void libvlc_video_set_crop_geometry( libvlc_input_t *p_input,
+                                    char *psz_geometry, libvlc_exception_t *p_e )
+{
+    vout_thread_t *p_vout = GetVout( p_input, p_e );
+    int i_ret = -1;
+
+    if( !p_vout )
+        return;
+
+    i_ret = var_SetString( p_vout, "crop", psz_geometry );
+    if( i_ret )
+        libvlc_exception_raise( p_e,
+                        "Unexpected error while setting crop geometry" );
+
+    vlc_object_release( p_vout );
+}
+
 int libvlc_video_destroy( libvlc_input_t *p_input,
                           libvlc_exception_t *p_e )
 {