]> git.sesse.net Git - vlc/commitdiff
- added libvlc_video_set/get_crop_geometry() api
authorDamien Fouilleul <damienf@videolan.org>
Mon, 8 Jan 2007 17:37:01 +0000 (17:37 +0000)
committerDamien Fouilleul <damienf@videolan.org>
Mon, 8 Jan 2007 17:37:01 +0000 (17:37 +0000)
include/vlc/libvlc.h
src/control/video.c

index 8372e1db290dd2ed6dce35f116df9168960de2b3..125d1a4345a34afe1be1841cbb7b65c10eb6479c 100644 (file)
@@ -290,8 +290,24 @@ int         libvlc_input_get_state      ( libvlc_input_t *, libvlc_exception_t *
  * @{
  */
 
+/**
+* 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;
 
+/**
+* Rectangle type for video geometry
+*/
+typedef struct
+{
+    int top, left;
+    int bottom, right;
+}
+libvlc_rectangle_t;
+
 /**
  * Does this input have a video output ?
  * \param p_input the input
@@ -355,6 +371,22 @@ char *libvlc_video_get_aspect_ratio( libvlc_input_t *, libvlc_exception_t * );
  */
 void libvlc_video_set_aspect_ratio( libvlc_input_t *, char *, libvlc_exception_t * );
 
+/**
+ * Get current crop filter geometry
+ * \param p_input the input
+ * \param p_exception an initialized exception
+ * \return the crop filter geometry
+ */
+char *libvlc_video_get_crop_geometry( libvlc_input_t *, libvlc_exception_t * );
+
+/**
+ * Set new crop filter geometry
+ * \param p_input the input
+ * \param psz_geometry new crop filter geometry
+ * \param p_exception an initialized exception
+ */
+void libvlc_video_set_crop_geometry( libvlc_input_t *, char *, libvlc_exception_t * );
+
 /**
  * Take a snapshot of the current video window
  * \param p_input the input
@@ -375,13 +407,6 @@ int libvlc_video_destroy( libvlc_input_t *, libvlc_exception_t *);
  */
 void libvlc_video_resize( libvlc_input_t *, int, int, libvlc_exception_t *);
 
-/**
-* Downcast to this general type as placeholder for a platform specific one, such as:
-*  Drawable on X11,
-*  CGrafPort on MacOSX,
-*  HWND on win32
-*/
-
 /**
  * change the parent for the current the video output
  * \param p_instance libvlc instance
@@ -410,19 +435,6 @@ void libvlc_video_set_parent( libvlc_instance_t *, libvlc_drawable_t, libvlc_exc
  */
 void libvlc_video_set_size( libvlc_instance_t *, int, int, libvlc_exception_t * );
 
-/**
-* Downcast to this general type as placeholder for a platform specific one, such as:
-*  Drawable on X11,
-*  CGrafPort on MacOSX,
-*  HWND on win32
-*/
-typedef struct
-{
-    int top, left;
-    int bottom, right;
-}
-libvlc_rectangle_t;
-
 /**
  * Set the default video output viewport for a windowless video output (MacOS X only)
  *  this settings will be used as default for all video outputs
index d6d850bbf117b663e844d1f8d7952a812ff659e6..16dcc07655a512c586667232aaa4eaf2ce0c8e87 100644 (file)
@@ -357,6 +357,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 )
 {