Commit 6db05717 authored by Clément Stenac's avatar Clément Stenac

* src/audio_output/input.c: forgot to free something

* modules/visualisation/visual/* :
	visualization system. It supports multi-effects.
At the moment:
	-dummy (guess what ? it does nothing)
	-scope (adapted and fixed from sam's one)
	-random (displays random plots)
Todo:
	- spectrum analyser
	- movement effects (rotations, scrolls,...)
	- blur effect ?
parent 84c6ecb2
dnl Autoconf settings for vlc dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.62 2003/08/17 20:58:44 alexis Exp $ dnl $Id: configure.ac,v 1.63 2003/08/19 21:20:00 zorglub Exp $
AC_INIT(vlc,0.6.3-cvs) AC_INIT(vlc,0.6.3-cvs)
...@@ -2820,6 +2820,16 @@ then ...@@ -2820,6 +2820,16 @@ then
fi fi
fi fi
dnl
dnl Visualisation plugin
dnl
AC_ARG_ENABLE(visual,
[ --enable-visual visualisation plugin (default enabled)])
if test "${enable_visual}" != "no"
then
AX_ADD_PLUGINS([visual])
fi
dnl dnl
dnl SLP access plugin dnl SLP access plugin
dnl dnl
...@@ -3272,6 +3282,7 @@ AC_OUTPUT([ ...@@ -3272,6 +3282,7 @@ AC_OUTPUT([
modules/visualization/Makefile modules/visualization/Makefile
modules/visualization/scope/Makefile modules/visualization/scope/Makefile
modules/visualization/xosd/Makefile modules/visualization/xosd/Makefile
modules/visualization/visual/Makefile
],[ ],[
chmod 0755 vlc-config chmod 0755 vlc-config
]) ])
......
SOURCES_visual = visual.c \
effects.c
/*****************************************************************************
* effects.c : Effects for the visualization system
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: effects.c,v 1.1 2003/08/19 21:20:00 zorglub Exp $
*
* Authors: Clment Stenac <zorglub@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "visual.h"
#include <math.h>
/*****************************************************************************
* Argument list parsers *
*****************************************************************************/
int args_getint(char *psz_parse, char * name,const int defaut)
{
char *psz_eof;
int i_value;
if( psz_parse != NULL )
{
if(!strncmp( psz_parse, name, strlen(name) ) )
{
psz_parse += strlen( name );
psz_eof = strchr( psz_parse , ',' );
if( !psz_eof)
psz_eof = psz_parse + strlen(psz_parse);
if( psz_eof )
{
*psz_eof = '\0' ;
}
i_value = atoi(++psz_parse);
psz_parse= psz_eof;
psz_parse++;
return i_value;
}
}
return defaut;
}
char * args_getpsz(char *psz_parse, char * name,const char * defaut)
{
char *psz_eof;
char *psz_value;
if( psz_parse != NULL )
{
if(!strncmp( psz_parse, name, strlen(name) ) )
{
psz_parse += strlen( name );
psz_eof = strchr( psz_parse , ',' );
if( !psz_eof)
psz_eof = psz_parse + strlen(psz_parse);
if( psz_eof )
{
*psz_eof = '\0' ;
}
psz_value = strdup(++psz_parse);
psz_parse= psz_eof;
psz_parse++;
return psz_value;
}
}
return strdup(defaut);
}
/*****************************************************************************
* dummy_Run
*****************************************************************************/
int dummy_Run( visual_effect_t * p_effect, aout_instance_t *p_aout,
aout_buffer_t * p_buffer , picture_t * p_picture)
{
return 0;
}
/*****************************************************************************
* spectrum_Run: spectrum analyser
*****************************************************************************/
int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
aout_buffer_t * p_buffer , picture_t * p_picture)
{
return 0;
}
/*****************************************************************************
* scope_Run: scope effect
*****************************************************************************/
int scope_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
aout_buffer_t * p_buffer , picture_t * p_picture)
{
int i_index;
float *p_sample ;
u8 *ppp_area[2][3];
for( i_index = 0 ; i_index < 2 ; i_index++ )
{
int j;
for( j = 0 ; j < 3 ; j++ )
{
ppp_area[i_index][j] =
p_picture->p[j].p_pixels + i_index * p_picture->p[j].i_lines
/ 2 * p_picture->p[j].i_pitch;
}
}
for( i_index = 0, p_sample = (float *)p_buffer->p_buffer;
i_index < p_effect->i_width;
i_index++ )
{
u8 i_value;
/* Left channel */
i_value = (*p_sample++ +1) * 127;
*(ppp_area[0][0]
+ p_picture->p[0].i_pitch * i_index / p_effect->i_width
+ p_picture->p[0].i_lines * i_value / 512
* p_picture->p[0].i_pitch) = 0xbf;
*(ppp_area[0][1]
+ p_picture->p[1].i_pitch * i_index / p_effect->i_width
+ p_picture->p[1].i_lines * i_value / 512
* p_picture->p[1].i_pitch) = 0xff;
/* Right channel */
i_value = ( *p_sample++ +1 ) * 127;
*(ppp_area[1][0]
+ p_picture->p[0].i_pitch * i_index / p_effect->i_width
+ p_picture->p[0].i_lines * i_value / 512
* p_picture->p[0].i_pitch) = 0x9f;
*(ppp_area[1][2]
+ p_picture->p[2].i_pitch * i_index / p_effect->i_width
+ p_picture->p[2].i_lines * i_value / 512
* p_picture->p[2].i_pitch) = 0xdd;
}
return 0;
}
/*****************************************************************************
* random_Run: random plots display effect
*****************************************************************************/
int random_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
aout_buffer_t * p_buffer , picture_t * p_picture)
{
int i_nb_plots;
char *psz_parse= NULL;
int i , i_y , i_u , i_v;
int i_position;
srand((unsigned int)mdate());
if( p_effect->psz_args )
{
psz_parse = strdup( p_effect->psz_args );
while(1)
{
i_nb_plots = args_getint ( psz_parse , "nb" , 200 );
if(i_nb_plots) break;
if( *psz_parse )
psz_parse ++;
else
break;
}
}
else
{
i_nb_plots = 200;
}
for( i = 0 ; i < i_nb_plots ; i++ )
{
i_position = rand() % (p_effect->i_width * p_effect->i_height );
i_y = rand() % 256;
i_u = rand() % 256;
i_v = rand() % 256;
*(p_picture->p[0].p_pixels + i_position )= i_u;
}
return 0;
}
This diff is collapsed.
/*****************************************************************************
* visual.h : Header for the visualisation system
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: visual.h,v 1.1 2003/08/19 21:20:00 zorglub Exp $
*
* Authors: Clment Stenac <zorglub@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */
#include <errno.h>
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include "audio_output.h"
#include "aout_internal.h"
/*****************************************************************************
* aout_filter_sys_t: visualizer audio filter method descriptor
*****************************************************************************
* This structure is part of the audio filter descriptor.
* It describes some visualizer specific variables.
*****************************************************************************/
typedef struct visual_effect_t
{
int (*pf_run)
(struct visual_effect_t * , aout_instance_t *,
aout_buffer_t *, picture_t *);
void * p_data; /* The effect stores whatever it wants here */
struct visual_effect_t * p_next;
int i_width;
int i_height;
char * psz_args;
} visual_effect_t ;
struct aout_filter_sys_t
{
vout_thread_t *p_vout;
visual_effect_t *p_first_effect;
int i_width;
int i_height;
};
/* Prototypes */
int scope_Run
(visual_effect_t * , aout_instance_t *, aout_buffer_t *, picture_t *);
int dummy_Run
(visual_effect_t * , aout_instance_t *, aout_buffer_t *, picture_t *);
int random_Run
(visual_effect_t * , aout_instance_t *, aout_buffer_t *, picture_t *);
int spectrum_Run
(visual_effect_t * , aout_instance_t *, aout_buffer_t *, picture_t *);
/* Default vout size */
#define VOUT_WIDTH 320
#define VOUT_HEIGHT 240
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input.c : internal management of input streams for the audio output * input.c : internal management of input streams for the audio output
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: input.c,v 1.35 2003/08/18 13:16:43 zorglub Exp $ * $Id: input.c,v 1.36 2003/08/19 21:20:00 zorglub Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -272,6 +272,16 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input ) ...@@ -272,6 +272,16 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
} }
} }
/* Free the list */
p_current_filter = p_first_filter;
while (p_current_filter)
{
user_filter_t * p_old_filter = p_current_filter;
p_current_filter = p_current_filter->p_next;
free(p_old_filter);
}
#if 0 #if 0
/* Headphone filter add-ons. */ /* Headphone filter add-ons. */
if ( b_use_headphone_filter == VLC_TRUE ) if ( b_use_headphone_filter == VLC_TRUE )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment