changeset 4505:a849b8af8db6

- make a lot of stuff static - move PlaybackInfo to playback.h
author mf0102 <0102@gmx.at>
date Tue, 22 Apr 2008 11:28:53 +0200
parents a47288ced5d5
children f6bf0b7072c8
files src/audacious/playback.c src/audacious/playback.h src/audacious/playlist.c src/audacious/ui_main.c src/audacious/ui_playlist.c
diffstat 5 files changed, 83 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playback.c	Tue Apr 22 10:55:35 2008 +0200
+++ b/src/audacious/playback.c	Tue Apr 22 11:28:53 2008 +0200
@@ -51,6 +51,8 @@
 #include "playback.h"
 #include "playback_evlisteners.h"
 
+static PlaybackInfo playback_info = { 0, 0, 0 };
+
 static gint
 playback_set_pb_ready(InputPlayback *playback)
 {
@@ -469,3 +471,33 @@
                       0, playlist_get_current_length(playlist_get_active()) / 1000 - 1);
     playback_seek(time);
 }
+
+void
+playback_get_sample_params(gint * bitrate,
+                           gint * frequency,
+                           gint * n_channels)
+{
+    if (bitrate)
+        *bitrate = playback_info.bitrate;
+
+    if (frequency)
+        *frequency = playback_info.frequency;
+
+    if (n_channels)
+        *n_channels = playback_info.n_channels;
+}
+
+void
+playback_set_sample_params(gint bitrate,
+                           gint frequency,
+                           gint n_channels)
+{
+    if (bitrate >= 0)
+        playback_info.bitrate = bitrate;
+
+    if (frequency >= 0)
+        playback_info.frequency = frequency;
+
+    if (n_channels >= 0)
+        playback_info.n_channels = n_channels;
+}
--- a/src/audacious/playback.h	Tue Apr 22 10:55:35 2008 +0200
+++ b/src/audacious/playback.h	Tue Apr 22 11:28:53 2008 +0200
@@ -28,6 +28,14 @@
 #include "playlist.h"
 #include "plugin.h"
 
+typedef struct _PlaybackInfo PlaybackInfo;
+
+struct _PlaybackInfo {
+    gint bitrate;
+    gint frequency;
+    gint n_channels;
+};
+
 gint playback_get_time(void);
 gint playback_get_length(void);
 void playback_initiate(void);
@@ -43,5 +51,7 @@
 InputPlayback *playback_new(void);
 void playback_free(InputPlayback *);
 void playback_run(InputPlayback *);
+void playback_get_sample_params(gint *bitrate, gint *frequency, gint *n_channels);
+void playback_set_sample_params(gint bitrate, gint frequency, gint n_channels);
 
 #endif
--- a/src/audacious/playlist.c	Tue Apr 22 10:55:35 2008 +0200
+++ b/src/audacious/playlist.c	Tue Apr 22 11:28:53 2008 +0200
@@ -34,17 +34,16 @@
 
 #include "playlist.h"
 
-#include <mowgli.h>
 #include <glib.h>
 #include <glib/gprintf.h>
+#include <mowgli.h>
 #include <stdlib.h>
 #include <string.h>
-#include <time.h>
-
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/errno.h>
+#include <time.h>
+#include <unistd.h>
 
 #if defined(USE_REGEX_ONIGURUMA)
 #  include <onigposix.h>
@@ -54,36 +53,33 @@
 #  include <regex.h>
 #endif
 
+#include "configdb.h"
+#include "hook.h"
 #include "input.h"
+#include "playback.h"
+#include "playlist_container.h"
+#include "playlist_evmessages.h"
+#include "pluginenum.h"
+#include "strings.h"
+#include "ui_fileinfo.h"
 #include "ui_main.h"
-#include "util.h"
-#include "configdb.h"
-#include "vfs.h"
-#include "playback.h"
-#include "playlist.h"
-#include "playlist_container.h"
 #include "ui_playlist_manager.h"
 #include "ui_playlist.h"
-#include "strings.h"
-#include "ui_fileinfo.h"
+#include "util.h"
+#include "vfs.h"
 
 #include "debug.h"
 
-#include "hook.h"
-
-#include "pluginenum.h"
-
-#include "playlist_evmessages.h"
-
 typedef gint (*PlaylistCompareFunc) (PlaylistEntry * a, PlaylistEntry * b);
 typedef void (*PlaylistSaveFunc) (FILE * file);
 
 /* If we manually change the song, p_p_b_j will show us where to go back to */
-PlaylistEntry *playlist_position_before_jump = NULL;
+static PlaylistEntry *playlist_position_before_jump = NULL;
 
 static GList *playlists = NULL;
 static GList *playlists_iter;
 
+
 /* If this is set to TRUE, we do not probe upon playlist add.
  *
  * Under Audacious 0.1.x, this was not a big deal because we used 
@@ -102,11 +98,8 @@
  * January 7, 2006, William Pitcock <nenolod@nenolod.net>
  */
 
-
-//static gchar *playlist_current_name = NULL;
-
 static gboolean playlist_get_info_scan_active = FALSE;
-GStaticRWLock playlist_get_info_rwlock = G_STATIC_RW_LOCK_INIT;
+static GStaticRWLock playlist_get_info_rwlock = G_STATIC_RW_LOCK_INIT;
 static gboolean playlist_get_info_going = FALSE;
 static GThread *playlist_get_info_thread;
 
--- a/src/audacious/ui_main.c	Tue Apr 22 10:55:35 2008 +0200
+++ b/src/audacious/ui_main.c	Tue Apr 22 11:28:53 2008 +0200
@@ -27,22 +27,19 @@
 #  include "config.h"
 #endif
 
-
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <glib/gprintf.h>
 #include <gtk/gtk.h>
 #include <gtk/gtkmessagedialog.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
 
 /* GDK including */
 #include "platform/smartinclude.h"
 
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <sys/types.h>
-
 #if defined(USE_REGEX_ONIGURUMA)
   #include <onigposix.h>
 #elif defined(USE_REGEX_PCRE)
@@ -55,29 +52,29 @@
 #include "icons-stock.h"
 
 #include "actions-mainwin.h"
-
-#include "main.h"
 #include "configdb.h"
 #include "dnd.h"
 #include "dock.h"
 #include "input.h"
+#include "main.h"
 #include "playback.h"
 #include "playlist.h"
 #include "pluginenum.h"
+#include "strings.h"
 #include "ui_credits.h"
 #include "ui_equalizer.h"
 #include "ui_fileopener.h"
 #include "ui_hints.h"
+#include "ui_jumptotrack.h"
+#include "ui_main_evlisteners.h"
 #include "ui_manager.h"
 #include "ui_playlist.h"
 #include "ui_preferences.h"
 #include "ui_skinselector.h"
 #include "ui_urlopener.h"
-#include "strings.h"
 #include "util.h"
 #include "visualization.h"
 
-#include "skin.h"
 #include "ui_skinned_window.h"
 #include "ui_skinned_button.h"
 #include "ui_skinned_textbox.h"
@@ -87,9 +84,6 @@
 #include "ui_skinned_playstatus.h"
 #include "ui_skinned_monostereo.h"
 #include "ui_skinned_playlist.h"
-#include "ui_jumptotrack.h"
-
-#include "ui_main_evlisteners.h"
 
 static GTimeVal cb_time; 
 static const int TRISTATE_THRESHOLD = 200;
@@ -100,23 +94,14 @@
     MAINWIN_SEEK_FWD
 };
 
-typedef struct _PlaybackInfo PlaybackInfo;
-
-struct _PlaybackInfo {
-    gchar *title;
-    gint bitrate;
-    gint frequency;
-    gint n_channels;
-};
-
 GtkWidget *mainwin = NULL;
 
 static gint balance;
 
 static GtkWidget *mainwin_jtt = NULL;
 
-gint seek_state = MAINWIN_SEEK_NIL;
-gint seek_initial_pos = 0;
+static gint seek_state = MAINWIN_SEEK_NIL;
+static gint seek_initial_pos = 0;
 
 static GtkWidget *mainwin_menubtn;
 static GtkWidget *mainwin_minimize, *mainwin_shade, *mainwin_close;
@@ -159,8 +144,6 @@
 static int ab_position_a = -1;
 static int ab_position_b = -1;
 
-static PlaybackInfo playback_info = { NULL, 0, 0, 0 };
-
 static void mainwin_refresh_visible(void);
 static gint mainwin_idle_func(gpointer data);
 
@@ -168,44 +151,12 @@
 static void set_timer_mode(TimerMode mode);
 static void change_timer_mode(void);
 
-void mainwin_position_motion_cb(GtkWidget *widget, gint pos);
-void mainwin_position_release_cb(GtkWidget *widget, gint pos);
-
-void set_scaled(gboolean scaled);
-void mainwin_eq_pushed(gboolean toggled);
-void mainwin_pl_pushed(gboolean toggled);
-
-
-/* FIXME: placed here for now */
-void
-playback_get_sample_params(gint * bitrate,
-                           gint * frequency,
-                           gint * n_channels)
-{
-    if (bitrate)
-        *bitrate = playback_info.bitrate;
-
-    if (frequency)
-        *frequency = playback_info.frequency;
-
-    if (n_channels)
-        *n_channels = playback_info.n_channels;
-}
-
-static void
-playback_set_sample_params(gint bitrate,
-                           gint frequency,
-                           gint n_channels)
-{
-    if (bitrate >= 0)
-        playback_info.bitrate = bitrate;
-
-    if (frequency >= 0)
-        playback_info.frequency = frequency;
-
-    if (n_channels >= 0)
-        playback_info.n_channels = n_channels;
-}
+static void mainwin_position_motion_cb(GtkWidget *widget, gint pos);
+static void mainwin_position_release_cb(GtkWidget *widget, gint pos);
+
+static void set_scaled(gboolean scaled);
+static void mainwin_eq_pushed(gboolean toggled);
+static void mainwin_pl_pushed(gboolean toggled);
 
 static void
 mainwin_set_title_scroll(gboolean scroll)
--- a/src/audacious/ui_playlist.c	Tue Apr 22 10:55:35 2008 +0200
+++ b/src/audacious/ui_playlist.c	Tue Apr 22 11:28:53 2008 +0200
@@ -47,13 +47,13 @@
 #include "playback.h"
 #include "playlist.h"
 #include "playlist_container.h"
-#include "ui_playlist_manager.h"
 #include "strings.h"
 #include "ui_equalizer.h"
 #include "ui_fileopener.h"
 #include "ui_main.h"
 #include "ui_manager.h"
 #include "ui_playlist_evlisteners.h"
+#include "ui_playlist_manager.h"
 #include "util.h"
 #include "config.h"
 
@@ -71,11 +71,11 @@
 static GMutex *resize_mutex = NULL;
 
 static GtkWidget *playlistwin_list = NULL;
-GtkWidget *playlistwin_shade, *playlistwin_close;
+static GtkWidget *playlistwin_shade, *playlistwin_close;
 
 static gboolean playlistwin_hint_flag = FALSE;
 
-static GtkWidget *playlistwin_slider = NULL;
+static GtkWidget *playlistwin_slider;
 static GtkWidget *playlistwin_time_min, *playlistwin_time_sec;
 static GtkWidget *playlistwin_info, *playlistwin_sinfo;
 static GtkWidget *playlistwin_srew, *playlistwin_splay;
@@ -83,10 +83,11 @@
 static GtkWidget *playlistwin_sfwd, *playlistwin_seject;
 static GtkWidget *playlistwin_sscroll_up, *playlistwin_sscroll_down;
 
-void playlistwin_select_search_cbt_cb( GtkWidget *called_cbt ,
-                                              gpointer other_cbt );
-static gboolean playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event ,
-                                                 gpointer searchdlg_win );
+static void playlistwin_select_search_cbt_cb(GtkWidget *called_cbt,
+                                             gpointer other_cbt);
+static gboolean playlistwin_select_search_kp_cb(GtkWidget *entry,
+                                                GdkEventKey *event,
+                                                gpointer searchdlg_win);
 
 static gboolean playlistwin_resizing = FALSE;
 static gint playlistwin_resize_x, playlistwin_resize_y;
@@ -1900,10 +1901,7 @@
 }
 
 
-
-/* playlistwin_select_search callback functions
-   placed here to avoid making the code messier :) */
-void
+static void
 playlistwin_select_search_cbt_cb(GtkWidget *called_cbt, gpointer other_cbt)
 {
     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(called_cbt)) == TRUE)