* crop.c : Crop video plugin for vlc
*****************************************************************************
* Copyright (C) 2002, 2003 VideoLAN
- * $Id: crop.c,v 1.7 2003/01/17 16:18:03 sam Exp $
+ * $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
/*****************************************************************************
* Module descriptor
*****************************************************************************/
-#define GEOMETRY_TEXT N_("crop geometry")
-#define GEOMETRY_LONGTEXT N_("Set the geometry of the zone to crop")
+#define GEOMETRY_TEXT N_("Crop geometry (pixels)")
+#define GEOMETRY_LONGTEXT N_("Set the geometry of the zone to crop. This is set as <width> x <height> + <left offset> + <top offset>.")
-#define AUTOCROP_TEXT N_("automatic cropping")
-#define AUTOCROP_LONGTEXT N_("Activate automatic black border cropping")
+#define AUTOCROP_TEXT N_("Automatic cropping")
+#define AUTOCROP_LONGTEXT N_("Activate automatic black border cropping.")
vlc_module_begin();
- add_category_hint( N_("Miscellaneous"), NULL );
- add_string( "crop-geometry", NULL, NULL, GEOMETRY_TEXT, GEOMETRY_LONGTEXT );
- add_bool( "autocrop", 0, NULL, AUTOCROP_TEXT, AUTOCROP_LONGTEXT );
- set_description( _("image crop video module") );
+ set_description( _("Crop video filter") );
+ set_shortname( N_("Crop" ));
+ set_category( CAT_VIDEO );
+ set_subcategory( SUBCAT_VIDEO_VFILTER );
set_capability( "video filter", 0 );
+
+ add_string( "crop-geometry", NULL, NULL, GEOMETRY_TEXT, GEOMETRY_LONGTEXT, VLC_FALSE );
+ add_bool( "autocrop", 0, NULL, AUTOCROP_TEXT, AUTOCROP_LONGTEXT, VLC_FALSE );
+
add_shortcut( "crop" );
set_callbacks( Create, Destroy );
vlc_module_end();
vlc_bool_t b_changed;
};
+/*****************************************************************************
+ * Control: control facility for the vout (forwards to child vout)
+ *****************************************************************************/
+static int Control( vout_thread_t *p_vout, int i_query, va_list args )
+{
+ return vout_vaControl( p_vout->p_sys->p_vout, i_query, args );
+}
+
/*****************************************************************************
* Create: allocates Crop video thread output method
*****************************************************************************
p_vout->pf_manage = Manage;
p_vout->pf_render = Render;
p_vout->pf_display = NULL;
+ p_vout->pf_control = Control;
return VLC_SUCCESS;
}
ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+ ADD_PARENT_CALLBACKS( SendEventsToChild );
+
return VLC_SUCCESS;
}
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
- DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
- vout_Destroy( p_vout->p_sys->p_vout );
+ if( p_vout->p_sys->p_vout )
+ {
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+ vlc_object_detach( p_vout->p_sys->p_vout );
+ vout_Destroy( p_vout->p_sys->p_vout );
+ }
+
+ DEL_PARENT_CALLBACKS( SendEventsToChild );
free( p_vout->p_sys );
}
p_in = p_pic->p[i_plane].p_pixels
/* Skip the right amount of lines */
- + i_in_pitch * ( p_pic->p[i_plane].i_lines * p_vout->p_sys->i_y
- / p_vout->output.i_height )
+ + i_in_pitch * ( p_pic->p[i_plane].i_visible_lines *
+ p_vout->p_sys->i_y / p_vout->output.i_height )
/* Skip the right amount of columns */
+ i_in_pitch * p_vout->p_sys->i_x / p_vout->output.i_width;
p_out = p_outpic->p[i_plane].p_pixels;
- p_out_end = p_out + i_out_pitch * p_outpic->p[i_plane].i_lines;
+ p_out_end = p_out + i_out_pitch * p_outpic->p[i_plane].i_visible_lines;
while( p_out < p_out_end )
{
uint8_t *p_in = p_pic->p[0].p_pixels;
int i_pitch = p_pic->p[0].i_pitch;
int i_visible_pitch = p_pic->p[0].i_visible_pitch;
- int i_lines = p_pic->p[0].i_lines;
+ int i_lines = p_pic->p[0].i_visible_lines;
int i_firstwhite = -1, i_lastwhite = -1, i;
/* Determine where black borders are */
return VLC_SUCCESS;
}
+/*****************************************************************************
+ * SendEventsToChild: forward events to the child/children vout
+ *****************************************************************************/
+static int SendEventsToChild( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+ vout_thread_t *p_vout = (vout_thread_t *)p_this;
+ var_Set( p_vout->p_sys->p_vout, psz_var, newval );
+ return VLC_SUCCESS;
+}