X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Fwave.c;h=0c281231d87f64ca8f198167152cadc1adf77b69;hb=2d55ac821c1b75407cece163e9e20c19b49e4212;hp=b30ce551f34c738a73a6cb0fbf3b6e1f4e7998b1;hpb=99fab9089e9e1709d9c3a4bc5ced0c137ac59134;p=vlc diff --git a/modules/video_filter/wave.c b/modules/video_filter/wave.c index b30ce551f3..0c281231d8 100644 --- a/modules/video_filter/wave.c +++ b/modules/video_filter/wave.c @@ -1,7 +1,7 @@ /***************************************************************************** * wave.c : Wave video effect plugin for vlc ***************************************************************************** - * Copyright (C) 2000-2006 the VideoLAN team + * Copyright (C) 2000-2008 the VideoLAN team * $Id$ * * Authors: Samuel Hocevar @@ -26,16 +26,17 @@ * Preamble *****************************************************************************/ -#include /* sin(), cos() */ - #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include -#include +#include /* sin(), cos() */ + +#include +#include -#include "vlc_filter.h" +#include +#include "filter_picture.h" /***************************************************************************** * Local prototypes @@ -48,19 +49,19 @@ static picture_t *Filter( filter_t *, picture_t * ); /***************************************************************************** * Module descriptor *****************************************************************************/ -vlc_module_begin(); - set_description( _("Wave video filter") ); - set_shortname( _( "Wave" )); - set_capability( "video filter2", 0 ); - set_category( CAT_VIDEO ); - set_subcategory( SUBCAT_VIDEO_VFILTER ); +vlc_module_begin () + set_description( N_("Wave video filter") ) + set_shortname( N_( "Wave" )) + set_capability( "video filter2", 0 ) + set_category( CAT_VIDEO ) + set_subcategory( SUBCAT_VIDEO_VFILTER ) - add_shortcut( "wave" ); - set_callbacks( Create, Destroy ); -vlc_module_end(); + add_shortcut( "wave" ) + set_callbacks( Create, Destroy ) +vlc_module_end () /***************************************************************************** - * 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. @@ -83,10 +84,7 @@ static int Create( vlc_object_t *p_this ) /* 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; @@ -123,12 +121,10 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) 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; } @@ -151,7 +147,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) i_pixel_pitch = p_pic->p[i_index].i_pixel_pitch; i_visible_pixels = i_visible_pitch/i_pixel_pitch; - black_pixel = ( i_index == Y_PLANE ) ? 0x00 : 0x80; + black_pixel = ( p_pic->i_planes > 1 && i_index == Y_PLANE ) ? 0x00 + : 0x80; /* Ok, we do 3 times the sin() calculation for each line. So what ? */ for( i_line = 0 ; i_line < i_num_lines ; i_line++ ) @@ -166,27 +163,24 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) { if( i_offset < 0 ) { - p_filter->p_libvlc->pf_memcpy( p_out, p_in - i_offset, - i_visible_pitch + i_offset ); + vlc_memcpy( p_out, p_in - i_offset, + i_visible_pitch + i_offset ); p_in += p_pic->p[i_index].i_pitch; p_out += p_outpic->p[i_index].i_pitch; - p_filter->p_libvlc->pf_memset( p_out + i_offset, - black_pixel, -i_offset ); + vlc_memset( p_out + i_offset, black_pixel, -i_offset ); } else { - p_filter->p_libvlc->pf_memcpy( p_out + i_offset, p_in, - i_visible_pitch - i_offset ); - p_filter->p_libvlc->pf_memset( p_out, black_pixel, - i_offset ); + vlc_memcpy( p_out + i_offset, p_in, + i_visible_pitch - i_offset ); + vlc_memset( p_out, black_pixel, i_offset ); p_in += p_pic->p[i_index].i_pitch; p_out += p_outpic->p[i_index].i_pitch; } } else { - p_filter->p_libvlc->pf_memcpy( p_out, p_in, - i_visible_pitch ); + vlc_memcpy( p_out, p_in, i_visible_pitch ); p_in += p_pic->p[i_index].i_pitch; p_out += p_outpic->p[i_index].i_pitch; } @@ -194,14 +188,5 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) } } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); }