Commit 12cbd4c8 authored by Clément Stenac's avatar Clément Stenac

* include/vlc_playlist.h

  src/playlist/playlist.c:
     * Implemented a boolean b_enabled to disable a playlist item
     * Implemented the idea of group (p_item->i_group), that allows
       to enable/disable and to sort some series of items
     * Implemented an unused (at the moment), psz_author field
     * Started to implement a new playlist format to store all of these

* modules/gui/wxwindows/interface.cpp:
     Added a hiddeable panel to put some important options.
     (Menu Preferences->Extra GUI)
     At the moment, we put the adjust filter and aspect ratio, and must
     decide what options we want here

* modules/gui/wxwindows/playlist.cpp
  modules/gui/wxwindows/iteminfo.cpp:
     Added "Enable/disable group button", options to enable/disable selection
     Added an item info dialog box

* modules/misc/sap.c :
     Added a sap-group-id option: the SAP playlist items are in a separate group
     (defaults to 42)

* modules/visualization/visual/effects.c:
     Minor coding style fixes

Todo:
-----

* Advanced sort (alphabetical and/or by group)
* Ability to load 0_6 playlists
* Really use the libid3tag
parent de2868c4
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc_playlist.h : Playlist functions * vlc_playlist.h : Playlist functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: vlc_playlist.h,v 1.13 2003/09/08 12:02:16 zorglub Exp $ * $Id: vlc_playlist.h,v 1.14 2003/10/06 16:23:30 zorglub Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
...@@ -48,10 +48,15 @@ struct playlist_item_t ...@@ -48,10 +48,15 @@ struct playlist_item_t
* ppsz_options array */ * ppsz_options array */
int i_type; /**< unused yet */ int i_type; /**< unused yet */
int i_status; /**< unused yet */ int i_status; /**< unused yet */
vlc_bool_t b_autodeletion; /**< Indicates wether this item is to vlc_bool_t b_autodeletion; /**< Indicates whther this item is to
* be deleted after playback. True mean * be deleted after playback. True mean
* that this item is to be deleted * that this item is to be deleted
* after playback, false otherwise */ * after playback, false otherwise */
vlc_bool_t b_enabled; /**< Indicates whether this item is to be
* played or skipped */
int i_group; /**< unused yet */
char * psz_author; /**< Author */
}; };
/** /**
...@@ -73,7 +78,7 @@ struct playlist_t ...@@ -73,7 +78,7 @@ struct playlist_t
int i_index; /**< current index into the playlist */ int i_index; /**< current index into the playlist */
playlist_status_t i_status; /**< current status of playlist */ playlist_status_t i_status; /**< current status of playlist */
int i_size; /**< total size of the list */ int i_size; /**< total size of the list */
int i_enabled; /**< How many items are enabled ? */
playlist_item_t ** pp_items; /**< array of pointers to the playlist_item_t ** pp_items; /**< array of pointers to the
* playlist items */ * playlist items */
...@@ -85,6 +90,9 @@ struct playlist_t ...@@ -85,6 +90,9 @@ struct playlist_t
#define SORT_NORMAL 0 #define SORT_NORMAL 0
#define SORT_REVERSE 1 #define SORT_REVERSE 1
#define PLAYLIST_TYPE_MANUAL 0
#define PLAYLIST_TYPE_SAP 1
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -105,6 +113,10 @@ VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, const char **, ...@@ -105,6 +113,10 @@ VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, const char **,
VLC_EXPORT( int, playlist_AddExt, ( playlist_t *, const char *, const char *, mtime_t, const char **, int, int, int ) ); VLC_EXPORT( int, playlist_AddExt, ( playlist_t *, const char *, const char *, mtime_t, const char **, int, int, int ) );
VLC_EXPORT( int, playlist_AddItem, ( playlist_t *, playlist_item_t *, int, int ) ); VLC_EXPORT( int, playlist_AddItem, ( playlist_t *, playlist_item_t *, int, int ) );
VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) ); VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_Disable, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_Enable, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_DisableGroup, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_EnableGroup, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_Sort, ( playlist_t *, int) ); VLC_EXPORT( int, playlist_Sort, ( playlist_t *, int) );
VLC_EXPORT( int, playlist_Move, ( playlist_t *, int, int ) ); VLC_EXPORT( int, playlist_Move, ( playlist_t *, int, int ) );
VLC_EXPORT( int, playlist_LoadFile, ( playlist_t *, const char * ) ); VLC_EXPORT( int, playlist_LoadFile, ( playlist_t *, const char * ) );
......
...@@ -7,6 +7,7 @@ SOURCES_wxwindows = \ ...@@ -7,6 +7,7 @@ SOURCES_wxwindows = \
streamout.cpp \ streamout.cpp \
messages.cpp \ messages.cpp \
playlist.cpp \ playlist.cpp \
iteminfo.cpp \
menus.cpp \ menus.cpp \
preferences.cpp \ preferences.cpp \
timer.cpp \ timer.cpp \
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.62 2003/09/22 14:40:10 zorglub Exp $ * $Id: wxwindows.h,v 1.63 2003/10/06 16:23:30 zorglub Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -141,19 +141,33 @@ public: ...@@ -141,19 +141,33 @@ public:
virtual ~Interface(); virtual ~Interface();
void TogglePlayButton( int i_playing_status ); void TogglePlayButton( int i_playing_status );
// wxFlexGridSizer *frame_sizer;
wxBoxSizer *frame_sizer; wxBoxSizer *frame_sizer;
wxStatusBar *statusbar; wxStatusBar *statusbar;
wxSlider *slider; wxSlider *slider;
wxWindow *slider_frame; wxWindow *slider_frame;
wxWindow *extra_frame;
wxStaticBox *slider_box; wxStaticBox *slider_box;
vlc_bool_t b_extra;
wxStaticBox *adjust_box;
wxSlider *brightness_slider;
wxSlider *contrast_slider;
wxSlider *saturation_slider;
wxSlider *hue_slider;
wxStaticBox *other_box;
wxComboBox *ratio_combo;
wxGauge *volctrl; wxGauge *volctrl;
private: private:
void UpdateAcceleratorTable(); void UpdateAcceleratorTable();
void CreateOurMenuBar(); void CreateOurMenuBar();
void CreateOurToolBar(); void CreateOurToolBar();
void CreateOurExtraPanel();
void CreateOurSlider(); void CreateOurSlider();
void Open( int i_access_method ); void Open( int i_access_method );
...@@ -167,6 +181,7 @@ private: ...@@ -167,6 +181,7 @@ private:
void OnOpenNet( wxCommandEvent& event ); void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event ); void OnOpenSat( wxCommandEvent& event );
void OnOpenV4L( wxCommandEvent& event ); void OnOpenV4L( wxCommandEvent& event );
void OnExtra( wxCommandEvent& event );
void OnShowDialog( wxCommandEvent& event ); void OnShowDialog( wxCommandEvent& event );
void OnPlayStream( wxCommandEvent& event ); void OnPlayStream( wxCommandEvent& event );
void OnStopStream( wxCommandEvent& event ); void OnStopStream( wxCommandEvent& event );
...@@ -176,6 +191,14 @@ private: ...@@ -176,6 +191,14 @@ private:
void OnSlowStream( wxCommandEvent& event ); void OnSlowStream( wxCommandEvent& event );
void OnFastStream( wxCommandEvent& event ); void OnFastStream( wxCommandEvent& event );
void OnEnableAdjust( wxCommandEvent& event );
void OnHueUpdate( wxScrollEvent& event );
void OnContrastUpdate( wxScrollEvent& event );
void OnBrightnessUpdate( wxScrollEvent& event );
void OnSaturationUpdate( wxScrollEvent& event );
void OnRatio( wxCommandEvent& event );
void OnMenuOpen( wxMenuEvent& event ); void OnMenuOpen( wxMenuEvent& event );
#if defined( __WXMSW__ ) || defined( __WXMAC__ ) #if defined( __WXMSW__ ) || defined( __WXMAC__ )
...@@ -638,6 +661,7 @@ private: ...@@ -638,6 +661,7 @@ private:
}; };
/* Playlist */ /* Playlist */
class ItemInfoDialog;
class Playlist: public wxFrame class Playlist: public wxFrame
{ {
public: public:
...@@ -661,9 +685,13 @@ private: ...@@ -661,9 +685,13 @@ private:
void OnRSort( wxCommandEvent& event ); void OnRSort( wxCommandEvent& event );
void OnClose( wxCommandEvent& event ); void OnClose( wxCommandEvent& event );
void OnSearch( wxCommandEvent& event ); void OnSearch( wxCommandEvent& event );
void OnEnDis( wxCommandEvent& event );
void OnInfos( wxCommandEvent& event );
void OnSearchTextChange( wxCommandEvent& event ); void OnSearchTextChange( wxCommandEvent& event );
void OnOpen( wxCommandEvent& event ); void OnOpen( wxCommandEvent& event );
void OnSave( wxCommandEvent& event ); void OnSave( wxCommandEvent& event );
void OnEnableSelection( wxCommandEvent& event );
void OnDisableSelection( wxCommandEvent& event );
void OnInvertSelection( wxCommandEvent& event ); void OnInvertSelection( wxCommandEvent& event );
void OnDeleteSelection( wxCommandEvent& event ); void OnDeleteSelection( wxCommandEvent& event );
void OnSelectAll( wxCommandEvent& event ); void OnSelectAll( wxCommandEvent& event );
...@@ -675,14 +703,59 @@ private: ...@@ -675,14 +703,59 @@ private:
void Rebuild(); void Rebuild();
wxTextCtrl *search_text; wxTextCtrl *search_text;
wxButton *search_button; wxButton *search_button;
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
ItemInfoDialog *iteminfo_dialog;
intf_thread_t *p_intf; intf_thread_t *p_intf;
wxListView *listview; wxListView *listview;
int i_update_counter; int i_update_counter;
}; };
/* ItemInfo Dialog */
class ItemInfoDialog: public wxDialog
{
public:
/* Constructor */
ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
wxWindow *p_parent );
virtual ~ItemInfoDialog();
wxArrayString GetOptions();
private:
wxPanel *InfoPanel( wxWindow* parent );
wxPanel *GroupPanel( wxWindow* parent );
/* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
playlist_item_t *p_item;
wxWindow *p_parent;
/* Controls for the iteminfo dialog box */
wxPanel *info_subpanel;
wxPanel *info_panel;
wxPanel *group_subpanel;
wxPanel *group_panel;
wxTextCtrl *uri_text;
wxTextCtrl *name_text;
wxTextCtrl *author_text;
wxCheckBox *enabled_checkbox;
wxSpinCtrl *group_spin;
};
/* File Info */ /* File Info */
class FileInfo: public wxFrame class FileInfo: public wxFrame
{ {
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
* sap.c : SAP interface module * sap.c : SAP interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: sap.c,v 1.23 2003/09/15 08:33:29 zorglub Exp $ * $Id: sap.c,v 1.24 2003/10/06 16:23:30 zorglub Exp $
* *
* Authors: Arnaud Schauly <gitan@via.ecp.fr> * Authors: Arnaud Schauly <gitan@via.ecp.fr>
* Clment Stenac <zorglub@via.ecp.fr> * Clment Stenac <zorglub@via.ecp.fr>
* Damien Lucas <nitrox@videolan.org> * Damien Lucas <nitrox@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
...@@ -160,12 +160,15 @@ struct attr_descr_t ...@@ -160,12 +160,15 @@ struct attr_descr_t
#define SAP_IPV6_LONGTEXT N_("Set this if you want SAP to listen for IPv6 announces") #define SAP_IPV6_LONGTEXT N_("Set this if you want SAP to listen for IPv6 announces")
#define SAP_SCOPE_TEXT N_("IPv6 SAP scope") #define SAP_SCOPE_TEXT N_("IPv6 SAP scope")
#define SAP_SCOPE_LONGTEXT N_("Sets the scope for IPv6 announces (default is 8)") #define SAP_SCOPE_LONGTEXT N_("Sets the scope for IPv6 announces (default is 8)")
#define SAP_GROUP_ID_TEXT N_("SAP Playlist group ID")
#define SAP_GROUP_ID_LONGTEXT N_("Sets the default group ID in which" \
"SAP items are put" )
vlc_module_begin(); vlc_module_begin();
add_category_hint( N_("SAP"), NULL, VLC_TRUE ); add_category_hint( N_("SAP"), NULL, VLC_TRUE );
add_string( "sap-addr", NULL, NULL, add_string( "sap-addr", NULL, NULL,
SAP_ADDR_TEXT, SAP_ADDR_LONGTEXT, VLC_TRUE ); SAP_ADDR_TEXT, SAP_ADDR_LONGTEXT, VLC_TRUE );
add_bool( "no-sap-ipv4", 0 , NULL, add_bool( "no-sap-ipv4", 0 , NULL,
SAP_IPV4_TEXT,SAP_IPV4_LONGTEXT, VLC_TRUE); SAP_IPV4_TEXT,SAP_IPV4_LONGTEXT, VLC_TRUE);
...@@ -175,6 +178,9 @@ vlc_module_begin(); ...@@ -175,6 +178,9 @@ vlc_module_begin();
add_string( "sap-ipv6-scope", "8" , NULL, add_string( "sap-ipv6-scope", "8" , NULL,
SAP_SCOPE_TEXT, SAP_SCOPE_LONGTEXT, VLC_TRUE); SAP_SCOPE_TEXT, SAP_SCOPE_LONGTEXT, VLC_TRUE);
add_integer( "sap-group-id", 42, NULL,
SAP_GROUP_ID_TEXT, SAP_GROUP_ID_LONGTEXT, VLC_TRUE);
set_description( _("SAP interface") ); set_description( _("SAP interface") );
set_capability( "interface", 0 ); set_capability( "interface", 0 );
set_callbacks( Activate, NULL); set_callbacks( Activate, NULL);
...@@ -412,8 +418,8 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd ) ...@@ -412,8 +418,8 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
} }
} }
/* Filling p_item->psz_uri */ /* Filling p_item->psz_uri */
if( b_http == VLC_FALSE ) if( b_http == VLC_FALSE )
{ {
...@@ -421,7 +427,7 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd ) ...@@ -421,7 +427,7 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
p_item->psz_uri = malloc( strlen( psz_proto ) + strlen( psz_uri ) + p_item->psz_uri = malloc( strlen( psz_proto ) + strlen( psz_uri ) +
strlen( psz_port ) + 5 +i_multicast ); strlen( psz_port ) + 5 +i_multicast );
if( p_item->psz_uri == NULL ) if( p_item->psz_uri == NULL )
{ {
msg_Err( p_intf, "Not enough memory"); msg_Err( p_intf, "Not enough memory");
...@@ -442,27 +448,30 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd ) ...@@ -442,27 +448,30 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
} }
else else
{ {
if( psz_http_path == NULL ) if( psz_http_path == NULL )
psz_http_path = strdup("/"); psz_http_path = strdup("/");
p_item->psz_uri = malloc( strlen( psz_proto ) + strlen( psz_uri ) + p_item->psz_uri = malloc( strlen( psz_proto ) + strlen( psz_uri ) +
strlen( psz_port ) + 3 + strlen(psz_http_path) ); strlen( psz_port ) + 3 + strlen(psz_http_path) );
if( p_item->psz_uri == NULL ) if( p_item->psz_uri == NULL )
{ {
msg_Err( p_intf, "Not enough memory"); msg_Err( p_intf, "Not enough memory");
free( p_item ); free( p_item );
return 0; return 0;
} }
sprintf( p_item->psz_uri, "%s://%s:%s%s", psz_proto, sprintf( p_item->psz_uri, "%s://%s:%s%s", psz_proto,
psz_uri, psz_port,psz_http_path ); psz_uri, psz_port,psz_http_path );
} }
/* Enqueueing p_item in the playlist */ /* Enqueueing p_item in the playlist */
if( p_item ) if( p_item )
{ {
p_item->i_group = config_GetInt( p_intf, "sap-group-id" );
p_item->b_enabled = VLC_TRUE;
p_item->psz_author = NULL;
p_playlist = vlc_object_find( p_intf, p_playlist = vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
...@@ -470,8 +479,8 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd ) ...@@ -470,8 +479,8 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
PLAYLIST_CHECK_INSERT, PLAYLIST_END); PLAYLIST_CHECK_INSERT, PLAYLIST_END);
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
if( psz_http_path ) if( psz_http_path )
free(psz_http_path); free(psz_http_path);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* effects.c : Effects for the visualization system * effects.c : Effects for the visualization system
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: effects.c,v 1.7 2003/09/20 00:37:53 fenrir Exp $ * $Id: effects.c,v 1.8 2003/10/06 16:23:30 zorglub Exp $
* *
* Authors: Clment Stenac <zorglub@via.ecp.fr> * Authors: Clment Stenac <zorglub@via.ecp.fr>
* *
...@@ -61,13 +61,13 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -61,13 +61,13 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
int i_amp; /* Vertical amplification */ int i_amp; /* Vertical amplification */
int i_peak; /* Should we draw peaks ? */ int i_peak; /* Should we draw peaks ? */
char *psz_parse = NULL; /* Args line */ char *psz_parse = NULL; /* Args line */
/* Horizontal scale for 20-band equalizer */ /* Horizontal scale for 20-band equalizer */
const int xscale1[]={0,1,2,3,4,5,6,7,8,11,15,20,27, const int xscale1[]={0,1,2,3,4,5,6,7,8,11,15,20,27,
36,47,62,82,107,141,184,255}; 36,47,62,82,107,141,184,255};
/* Horizontal scale for 80-band equalizer */ /* Horizontal scale for 80-band equalizer */
const int xscale2[] = const int xscale2[] =
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18, {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34, 19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,
35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51, 35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,
...@@ -75,9 +75,9 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -75,9 +75,9 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
110,115,121,130,141,152,163,174,185,200,255}; 110,115,121,130,141,152,163,174,185,200,255};
const int *xscale; const int *xscale;
const double y_scale = 3.60673760222; /* (log 256) */ const double y_scale = 3.60673760222; /* (log 256) */
fft_state *p_state; /* internal FFT data */ fft_state *p_state; /* internal FFT data */
int i , j , y , k; int i , j , y , k;
int i_line; int i_line;
s16 p_dest[FFT_BUFFER_SIZE]; /* Adapted FFT result */ s16 p_dest[FFT_BUFFER_SIZE]; /* Adapted FFT result */
...@@ -89,8 +89,8 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -89,8 +89,8 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
s16 *p_buffs; /* s16 converted buffer */ s16 *p_buffs; /* s16 converted buffer */
s16 *p_s16_buff = NULL; /* s16 converted buffer */ s16 *p_s16_buff = NULL; /* s16 converted buffer */
p_s16_buff = (s16*)malloc( p_s16_buff = (s16*)malloc(
p_buffer->i_nb_samples * p_effect->i_nb_chans * sizeof(s16)); p_buffer->i_nb_samples * p_effect->i_nb_chans * sizeof(s16));
if( !p_s16_buff ) if( !p_s16_buff )
...@@ -98,7 +98,7 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -98,7 +98,7 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
msg_Err(p_aout,"Out of memory"); msg_Err(p_aout,"Out of memory");
return -1; return -1;
} }
p_buffs = p_s16_buff; p_buffs = p_s16_buff;
i_nb_bands = config_GetInt ( p_aout, "visual-nbbands" ); i_nb_bands = config_GetInt ( p_aout, "visual-nbbands" );
i_separ = config_GetInt( p_aout, "visual-separ" ); i_separ = config_GetInt( p_aout, "visual-separ" );
...@@ -114,7 +114,7 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -114,7 +114,7 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
i_nb_bands = 80; i_nb_bands = 80;
xscale = xscale2; xscale = xscale2;
} }
if( !p_effect->p_data ) if( !p_effect->p_data )
{ {
p_effect->p_data=(void *)malloc(i_nb_bands * sizeof(int) ); p_effect->p_data=(void *)malloc(i_nb_bands * sizeof(int) );
...@@ -128,14 +128,14 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -128,14 +128,14 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
{ {
peaks[i] = 0; peaks[i] = 0;
} }
} }
else else
{ {
peaks =(int *)p_effect->p_data; peaks =(int *)p_effect->p_data;
} }
height = (int *)malloc( i_nb_bands * sizeof(int) ); height = (int *)malloc( i_nb_bands * sizeof(int) );
if( !height) if( !height)
{ {
...@@ -152,7 +152,7 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -152,7 +152,7 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
if(i_in > 0x43c07fff ) * p_buffs = 32767; if(i_in > 0x43c07fff ) * p_buffs = 32767;
else if ( i_in < 0x43bf8000 ) *p_buffs = -32768; else if ( i_in < 0x43bf8000 ) *p_buffs = -32768;
else *p_buffs = i_in - 0x43c00000; else *p_buffs = i_in - 0x43c00000;
p_buffl++ ; p_buffs++ ; p_buffl++ ; p_buffs++ ;
} }
p_state = fft_init(); p_state = fft_init();
...@@ -167,11 +167,11 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -167,11 +167,11 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
p_output[i] = 0; p_output[i] = 0;
p_buffer1[i] = *p_buffs; p_buffer1[i] = *p_buffs;
p_buffs = p_buffs + p_effect->i_nb_chans; p_buffs = p_buffs + p_effect->i_nb_chans;
} }
fft_perform( p_buffer1, p_output, p_state); fft_perform( p_buffer1, p_output, p_state);
for(i= 0; i< FFT_BUFFER_SIZE ; i++ ) for(i= 0; i< FFT_BUFFER_SIZE ; i++ )
p_dest[i] = ( (int) sqrt( p_output [ i + 1 ] ) ) >> 8; p_dest[i] = ( (int) sqrt( p_output [ i + 1 ] ) ) >> 8;
for ( i = 0 ; i< i_nb_bands ;i++) for ( i = 0 ; i< i_nb_bands ;i++)
{ {
/* We search the maximum on one scale */ /* We search the maximum on one scale */
...@@ -192,7 +192,7 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -192,7 +192,7 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
{ {
height[i] = 0 ; height[i] = 0 ;
} }
/* Draw the bar now */ /* Draw the bar now */
i_band_width = floor( p_effect->i_width / i_nb_bands) ; i_band_width = floor( p_effect->i_width / i_nb_bands) ;
...@@ -215,39 +215,39 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -215,39 +215,39 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
if( peaks[i] > 0 && i_peak ) if( peaks[i] > 0 && i_peak )
{ {
if( peaks[i] >= p_effect->i_height ) if( peaks[i] >= p_effect->i_height )
peaks[i] = p_effect->i_height - 2; peaks[i] = p_effect->i_height - 2;
i_line = peaks[i]; i_line = peaks[i];
for( j = 0 ; j< i_band_width - i_separ; j++) for( j = 0 ; j< i_band_width - i_separ; j++)
{ {
for( k = 0 ; k< 3 ; k ++) for( k = 0 ; k< 3 ; k ++)
{ {
/* Draw the peak */ /* Draw the peak */
*(p_picture->p[0].p_pixels + *(p_picture->p[0].p_pixels +
(p_picture->p[0].i_lines - i_line -1 -k ) * (p_picture->p[0].i_lines - i_line -1 -k ) *
p_picture->p[0].i_pitch + (i_band_width*i +j) ) p_picture->p[0].i_pitch + (i_band_width*i +j) )
= 0xff; = 0xff;
*(p_picture->p[1].p_pixels + *(p_picture->p[1].p_pixels +
(p_picture->p[1].i_lines - i_line /2 -1 -k/2 ) * (p_picture->p[1].i_lines - i_line /2 -1 -k/2 ) *
p_picture->p[1].i_pitch + p_picture->p[1].i_pitch +
( ( i_band_width * i + j ) /2 ) ) ( ( i_band_width * i + j ) /2 ) )
= 0x00; = 0x00;
if( 0x04 * (i_line + k ) - 0x0f > 0 ) if( 0x04 * (i_line + k ) - 0x0f > 0 )
{ {
if ( 0x04 * (i_line + k ) -0x0f < 0xff) if ( 0x04 * (i_line + k ) -0x0f < 0xff)
*(p_picture->p[2].p_pixels + *(p_picture->p[2].p_pixels +
(p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) * (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
p_picture->p[2].i_pitch + p_picture->p[2].i_pitch +
( ( i_band_width * i + j ) /2 ) ) ( ( i_band_width * i + j ) /2 ) )
= ( 0x04 * ( i_line + k ) ) -0x0f ; = ( 0x04 * ( i_line + k ) ) -0x0f ;
else else
*(p_picture->p[2].p_pixels + *(p_picture->p[2].p_pixels +
(p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) * (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
p_picture->p[2].i_pitch + p_picture->p[2].i_pitch +
( ( i_band_width * i + j ) /2 ) ) ( ( i_band_width * i + j ) /2 ) )
= 0xff; = 0xff;
} }
else else
...@@ -269,13 +269,13 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -269,13 +269,13 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
{ {
for( j = 0 ; j< i_band_width - i_separ ; j++) for( j = 0 ; j< i_band_width - i_separ ; j++)
{ {
*(p_picture->p[0].p_pixels + *(p_picture->p[0].p_pixels +
(p_picture->p[0].i_lines - i_line -1) * (p_picture->p[0].i_lines - i_line -1) *
p_picture->p[0].i_pitch + (i_band_width*i +j) ) = 0xff; p_picture->p[0].i_pitch + (i_band_width*i +j) ) = 0xff;
*(p_picture->p[1].p_pixels + *(p_picture->p[1].p_pixels +
(p_picture->p[1].i_lines - i_line /2 -1) * (p_picture->p[1].i_lines - i_line /2 -1) *
p_picture->p[1].i_pitch + p_picture->p[1].i_pitch +
( ( i_band_width * i + j ) /2 ) ) = 0x00; ( ( i_band_width * i + j ) /2 ) ) = 0x00;
...@@ -321,7 +321,7 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -321,7 +321,7 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
return 0; return 0;
} }
/***************************************************************************** /*****************************************************************************
* scope_Run: scope effect * scope_Run: scope effect
*****************************************************************************/ *****************************************************************************/
...@@ -331,8 +331,8 @@ int scope_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -331,8 +331,8 @@ int scope_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
int i_index; int i_index;
float *p_sample ; float *p_sample ;
u8 *ppp_area[2][3]; u8 *ppp_area[2][3];
for( i_index = 0 ; i_index < 2 ; i_index++ ) for( i_index = 0 ; i_index < 2 ; i_index++ )
{ {
int j; int j;
...@@ -351,7 +351,7 @@ int scope_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -351,7 +351,7 @@ int scope_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
u8 i_value; u8 i_value;
/* Left channel */ /* Left channel */
i_value = (*p_sample++ +1) * 127; i_value = (*p_sample++ +1) * 127;
*(ppp_area[0][0] *(ppp_area[0][0]
+ p_picture->p[0].i_pitch * i_index / p_effect->i_width + 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_lines * i_value / 512
...@@ -361,7 +361,7 @@ int scope_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -361,7 +361,7 @@ int scope_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
+ p_picture->p[1].i_lines * i_value / 512 + p_picture->p[1].i_lines * i_value / 512
* p_picture->p[1].i_pitch) = 0xff; * p_picture->p[1].i_pitch) = 0xff;
/* Right channel */ /* Right channel */
i_value = ( *p_sample++ +1 ) * 127; i_value = ( *p_sample++ +1 ) * 127;
*(ppp_area[1][0] *(ppp_area[1][0]
......
This diff is collapsed.
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