+ 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 )
+{
+ /* set as default for future vout instances */
+ config_PutInt(p_instance->p_libvlc_int, "width", width);
+ config_PutInt(p_instance->p_libvlc_int, "height", height);
+
+ if( libvlc_playlist_isplaying(p_instance, p_e) )
+ {
+ libvlc_input_t *p_input = libvlc_playlist_get_input(p_instance, p_e);
+ if( p_input )
+ {
+ vout_thread_t *p_vout = GetVout( p_input, p_e );
+ if( p_vout )
+ {
+ /* tell running vout to re-size */
+ vout_Control( p_vout , VOUT_SET_SIZE, width, height);
+ vlc_object_release( p_vout );
+ }
+ libvlc_input_free(p_input);
+ }
+ }
+}
+
+void libvlc_video_set_viewport( libvlc_instance_t *p_instance,
+ const libvlc_rectangle_t *view, const libvlc_rectangle_t *clip,
+ libvlc_exception_t *p_e )
+{
+ if( NULL == view )
+ {
+ libvlc_exception_raise( p_e, "viewport is NULL" );
+ }
+
+ /* if clip is NULL, then use view rectangle as clip */
+ if( NULL == clip )
+ clip = view;
+
+ /* set as default for future vout instances */
+ var_SetInteger( p_instance->p_libvlc_int, "drawable-view-top", view->top );
+ var_SetInteger( p_instance->p_libvlc_int, "drawable-view-left", view->left );
+ var_SetInteger( p_instance->p_libvlc_int, "drawable-view-bottom", view->bottom );
+ var_SetInteger( p_instance->p_libvlc_int, "drawable-view-right", view->right );
+ var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-top", clip->top );
+ var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-left", clip->left );
+ var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-bottom", clip->bottom );
+ var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-right", clip->right );
+
+ if( libvlc_playlist_isplaying(p_instance, p_e) )
+ {
+ libvlc_input_t *p_input = libvlc_playlist_get_input(p_instance, p_e);
+ if( p_input )
+ {
+ vout_thread_t *p_vout = GetVout( p_input, p_e );
+ if( p_vout )
+ {
+ /* change viewport for running vout */
+ vout_Control( p_vout , VOUT_SET_VIEWPORT,
+ view->top, view->left, view->bottom, view->right,
+ clip->top, clip->left, clip->bottom, clip->right );
+ vlc_object_release( p_vout );
+ }
+ libvlc_input_free(p_input);
+ }
+ }
+}
+
+char *libvlc_video_get_aspect_ratio( libvlc_input_t *p_input,
+ libvlc_exception_t *p_e )
+{
+ char *psz_aspect = 0;
+ vout_thread_t *p_vout = GetVout( p_input, p_e );
+
+ if( !p_vout )
+ return 0;
+
+ psz_aspect = var_GetString( p_vout, "aspect-ratio" );
+ vlc_object_release( p_vout );
+ return psz_aspect;
+}
+
+void libvlc_video_set_aspect_ratio( libvlc_input_t *p_input,
+ char *psz_aspect, 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, "aspect-ratio", psz_aspect );
+ if( i_ret )
+ libvlc_exception_raise( p_e,
+ "Unexpected error while setting aspect-ratio value" );
+
+ 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 )
+{
+ 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;