X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvisualization%2Fgoom.c;h=90572e4dea87f55eac0802a155f7c260aa658a19;hb=5d99f7d3d511734c10f462f74114e85fa794d21b;hp=08b1d6c0a65d2d5461a5cace957774b84fac1df4;hpb=89b6530d8abd99b96b9f33af022022241fe97ee2;p=vlc diff --git a/modules/visualization/goom.c b/modules/visualization/goom.c index 08b1d6c0a6..90572e4dea 100644 --- a/modules/visualization/goom.c +++ b/modules/visualization/goom.c @@ -37,6 +37,7 @@ #include #include #include +#include #ifdef USE_GOOM_TREE # ifdef OLD_GOOM @@ -74,10 +75,10 @@ vlc_module_begin () set_description( N_("Goom effect") ) set_category( CAT_AUDIO ) set_subcategory( SUBCAT_AUDIO_VISUAL ) - set_capability( "visualization", 0 ) - add_integer( "goom-width", 320, NULL, + set_capability( "visualization2", 0 ) + add_integer( "goom-width", 800, NULL, WIDTH_TEXT, RES_LONGTEXT, false ) - add_integer( "goom-height", 240, NULL, + add_integer( "goom-height", 640, NULL, HEIGHT_TEXT, RES_LONGTEXT, false ) add_integer( "goom-speed", 6, NULL, SPEED_TEXT, SPEED_LONGTEXT, false ) @@ -102,24 +103,23 @@ typedef struct vlc_cond_t wait; /* Audio properties */ - int i_channels; + unsigned i_channels; /* Audio samples queue */ block_t *pp_blocks[MAX_BLOCKS]; int i_blocks; - audio_date_t date; + date_t date; } goom_thread_t; -struct aout_filter_sys_t +struct filter_sys_t { goom_thread_t *p_thread; }; -static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *, - aout_buffer_t * ); +static block_t *DoWork ( filter_t *, block_t * ); static void* Thread ( vlc_object_t * ); @@ -130,30 +130,29 @@ static char *TitleGet( vlc_object_t * ); *****************************************************************************/ static int Open( vlc_object_t *p_this ) { - aout_filter_t *p_filter = (aout_filter_t *)p_this; - aout_filter_sys_t *p_sys; - goom_thread_t *p_thread; - int width, height; - video_format_t fmt; + filter_t *p_filter = (filter_t *)p_this; + filter_sys_t *p_sys; + goom_thread_t *p_thread; + int width, height; + video_format_t fmt; - if( p_filter->input.i_format != VLC_CODEC_FL32 || - p_filter->output.i_format != VLC_CODEC_FL32 ) + if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 || + p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 ) { msg_Warn( p_filter, "bad input or output format" ); return VLC_EGENERIC; } - if( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) ) + if( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) ) { msg_Warn( p_filter, "input and output formats are not similar" ); return VLC_EGENERIC; } - p_filter->pf_do_work = DoWork; - p_filter->b_in_place = 1; + p_filter->pf_audio_filter = DoWork; /* Allocate structure */ - p_sys = p_filter->p_sys = malloc( sizeof( aout_filter_sys_t ) ); + p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) ); /* Create goom thread */ p_sys->p_thread = p_thread = @@ -184,9 +183,9 @@ static int Open( vlc_object_t *p_this ) vlc_cond_init( &p_thread->wait ); p_thread->i_blocks = 0; - aout_DateInit( &p_thread->date, p_filter->output.i_rate ); - aout_DateSet( &p_thread->date, 0 ); - p_thread->i_channels = aout_FormatNbChannels( &p_filter->input ); + date_Init( &p_thread->date, p_filter->fmt_out.audio.i_rate, 1 ); + date_Set( &p_thread->date, 0 ); + p_thread->i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio ); p_thread->psz_title = TitleGet( VLC_OBJECT( p_filter ) ); @@ -212,38 +211,34 @@ static int Open( vlc_object_t *p_this ) ***************************************************************************** * This function queues the audio buffer to be processed by the goom thread *****************************************************************************/ -static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, - aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) +static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf ) { - VLC_UNUSED( p_aout ); - - aout_filter_sys_t *p_sys = p_filter->p_sys; + filter_sys_t *p_sys = p_filter->p_sys; block_t *p_block; - p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; - p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes; - /* Queue sample */ vlc_mutex_lock( &p_sys->p_thread->lock ); if( p_sys->p_thread->i_blocks == MAX_BLOCKS ) { vlc_mutex_unlock( &p_sys->p_thread->lock ); - return; + return p_in_buf; } - p_block = block_New( p_sys->p_thread, p_in_buf->i_nb_bytes ); + p_block = block_New( p_sys->p_thread, p_in_buf->i_buffer ); if( !p_block ) { vlc_mutex_unlock( &p_sys->p_thread->lock ); - return; + return p_in_buf; } - memcpy( p_block->p_buffer, p_in_buf->p_buffer, p_in_buf->i_nb_bytes ); - p_block->i_pts = p_in_buf->start_date; + memcpy( p_block->p_buffer, p_in_buf->p_buffer, p_in_buf->i_buffer ); + p_block->i_pts = p_in_buf->i_pts; p_sys->p_thread->pp_blocks[p_sys->p_thread->i_blocks++] = p_block; vlc_cond_signal( &p_sys->p_thread->wait ); vlc_mutex_unlock( &p_sys->p_thread->lock ); + + return p_in_buf; } /***************************************************************************** @@ -263,7 +258,7 @@ static inline int16_t FloatToInt16( float f ) * Fill buffer *****************************************************************************/ static int FillBuffer( int16_t *p_data, int *pi_data, - audio_date_t *pi_date, audio_date_t *pi_date_end, + date_t *pi_date, date_t *pi_date_end, goom_thread_t *p_this ) { int i_samples = 0; @@ -274,18 +269,18 @@ static int FillBuffer( int16_t *p_data, int *pi_data, if( !p_this->i_blocks ) return VLC_EGENERIC; p_block = p_this->pp_blocks[0]; - i_samples = __MIN( 512 - *pi_data, p_block->i_buffer / - sizeof(float) / p_this->i_channels ); + i_samples = __MIN( (unsigned)(512 - *pi_data), + p_block->i_buffer / sizeof(float) / p_this->i_channels ); /* Date management */ if( p_block->i_pts > 0 && - p_block->i_pts != aout_DateGet( pi_date_end ) ) + p_block->i_pts != date_Get( pi_date_end ) ) { - aout_DateSet( pi_date_end, p_block->i_pts ); + date_Set( pi_date_end, p_block->i_pts ); } p_block->i_pts = 0; - aout_DateIncrement( pi_date_end, i_samples ); + date_Increment( pi_date_end, i_samples ); while( i_samples > 0 ) { @@ -323,7 +318,7 @@ static void* Thread( vlc_object_t *p_this ) { goom_thread_t *p_thread = (goom_thread_t*)p_this; int width, height, speed; - audio_date_t i_pts; + date_t i_pts; int16_t p_data[2][512]; int i_data = 0, i_count = 0; PluginInfo *p_plugin_info; @@ -354,7 +349,7 @@ static void* Thread( vlc_object_t *p_this ) if( speed && (++i_count % (speed+1)) ) continue; /* Frame dropping if necessary */ - if( aout_DateGet( &i_pts ) + GOOM_DELAY <= mdate() ) continue; + if( date_Get( &i_pts ) + GOOM_DELAY <= mdate() ) continue; plane = goom_update( p_plugin_info, p_data, 0, 0.0, p_thread->psz_title, NULL ); @@ -372,7 +367,7 @@ static void* Thread( vlc_object_t *p_this ) memcpy( p_pic->p[0].p_pixels, plane, width * height * 4 ); - p_pic->date = aout_DateGet( &i_pts ) + GOOM_DELAY; + p_pic->date = date_Get( &i_pts ) + GOOM_DELAY; vout_DisplayPicture( p_thread->p_vout, p_pic ); } @@ -386,8 +381,8 @@ static void* Thread( vlc_object_t *p_this ) *****************************************************************************/ static void Close( vlc_object_t *p_this ) { - aout_filter_t *p_filter = (aout_filter_t *)p_this; - aout_filter_sys_t *p_sys = p_filter->p_sys; + filter_t *p_filter = (filter_t *)p_this; + filter_sys_t *p_sys = p_filter->p_sys; /* Stop Goom Thread */ vlc_object_kill( p_sys->p_thread );