* Preamble
*****************************************************************************/
-#include <math.h> /* sin(), cos() */
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#include <math.h> /* sin(), cos() */
+
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
#define FILTER_PREFIX "gradient-"
-vlc_module_begin();
- set_description( N_("Gradient video filter") );
- set_shortname( N_( "Gradient" ));
- set_capability( "video filter2", 0 );
- set_category( CAT_VIDEO );
- set_subcategory( SUBCAT_VIDEO_VFILTER );
+vlc_module_begin ()
+ set_description( N_("Gradient video filter") )
+ set_shortname( N_( "Gradient" ))
+ set_capability( "video filter2", 0 )
+ set_category( CAT_VIDEO )
+ set_subcategory( SUBCAT_VIDEO_VFILTER )
add_string( FILTER_PREFIX "mode", "gradient", NULL,
- MODE_TEXT, MODE_LONGTEXT, false );
- change_string_list( mode_list, mode_list_text, 0 );
+ MODE_TEXT, MODE_LONGTEXT, false )
+ change_string_list( mode_list, mode_list_text, 0 )
add_integer_with_range( FILTER_PREFIX "type", 0, 0, 1, NULL,
- GRADIENT_TEXT, GRADIENT_LONGTEXT, false );
+ GRADIENT_TEXT, GRADIENT_LONGTEXT, false )
add_bool( FILTER_PREFIX "cartoon", 1, NULL,
- CARTOON_TEXT, CARTOON_LONGTEXT, false );
+ CARTOON_TEXT, CARTOON_LONGTEXT, false )
- add_shortcut( "gradient" );
- set_callbacks( Create, Destroy );
-vlc_module_end();
+ add_shortcut( "gradient" )
+ set_callbacks( Create, Destroy )
+vlc_module_end ()
static const char *const ppsz_filter_options[] = {
"mode", "type", "cartoon", NULL
};
/*****************************************************************************
- * vout_sys_t: Distort video output method descriptor
+ * filter_sys_t: Distort video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the Distort specific properties of an output thread.
/* Allocate structure */
p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
if( p_filter->p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
- }
p_filter->pf_video_filter = Filter;
if( !p_pic ) return NULL;
- p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+ p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
- msg_Warn( p_filter, "can't get output picture" );
- if( p_pic->pf_release )
- p_pic->pf_release( p_pic );
+ picture_Release( p_pic );
return NULL;
}
double d_sin;
double d_cos;
uint32_t *p_smooth;
+
int *p_hough = malloc( i_diag * i_nb_steps * sizeof(int) );
if( ! p_hough ) return;
+
p_smooth = (uint32_t *)malloc( i_num_lines*i_src_visible*sizeof(uint32_t));
- if( !p_smooth ) return;
+ if( !p_smooth )
+ {
+ free( p_hough );
+ return;
+ }
if( ! p_pre_hough )
{
msg_Dbg(p_filter, "Starting precalculation");
p_pre_hough = malloc( i_num_lines*i_src_visible*i_nb_steps*sizeof(int));
- if( ! p_pre_hough ) return;
+ if( ! p_pre_hough )
+ {
+ free( p_smooth );
+ free( p_hough );
+ return;
+ }
for( i = 0 ; i < i_nb_steps ; i++)
{
d_sin = sin(d_step * i);