changeset 2057:cf4fa45ffd80

playlist API vtabling
author William Pitcock <nenolod@atheme.org>
date Sat, 13 Oct 2007 23:09:40 -0500
parents 1428a79d6706
children fffa7e3d39e0
files src/aosd/aosd_trigger.c src/cdaudio-ng/cdaudio-ng.c src/cue/cuesheet.c src/filewriter/filewriter.c src/m3u/m3u.c src/mtp_up/mtp.c src/pls/pls.c src/pulse_audio/pulse_audio.c src/scrobbler/plugin.c src/statusicon/si_ui.c src/xspf/xspf.c
diffstat 11 files changed, 47 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/src/aosd/aosd_trigger.c	Sat Oct 13 21:06:30 2007 -0500
+++ b/src/aosd/aosd_trigger.c	Sat Oct 13 23:09:40 2007 -0500
@@ -190,9 +190,9 @@
     else
     {
       /* pick what we have as song title */
-      Playlist *active = playlist_get_active();
-      gint pos = playlist_get_position(active);
-      title = playlist_get_songtitle(active, pos);
+      Playlist *active = aud_playlist_get_active();
+      gint pos = aud_playlist_get_position(active);
+      title = aud_playlist_get_songtitle(active, pos);
     }
     utf8_title = aosd_trigger_utf8convert( title );
     if ( g_utf8_validate( utf8_title , -1 , NULL ) == TRUE )
@@ -388,20 +388,20 @@
 static void
 aosd_trigger_func_pb_pauseoff_cb ( gpointer unused1 , gpointer unused2 )
 {
-  Playlist *active = playlist_get_active();
-  gint pos = playlist_get_position(active);
+  Playlist *active = aud_playlist_get_active();
+  gint pos = aud_playlist_get_position(active);
   gchar *title, *utf8_title, *utf8_title_markup;
   gint time_cur, time_tot;
   gint time_cur_m, time_cur_s, time_tot_m, time_tot_s;
 
-  time_tot = playlist_get_songtime(active, pos) / 1000;
+  time_tot = aud_playlist_get_songtime(active, pos) / 1000;
   time_cur = audacious_drct_get_time() / 1000;
   time_cur_s = time_cur % 60;
   time_cur_m = (time_cur - time_cur_s) / 60;
   time_tot_s = time_tot % 60;
   time_tot_m = (time_tot - time_tot_s) / 60;
 
-  title = playlist_get_songtitle(active, pos);
+  title = aud_playlist_get_songtitle(active, pos);
   utf8_title = aosd_trigger_utf8convert( title );
   utf8_title_markup = g_markup_printf_escaped(
     "<span font_desc='%s'>%s (%i:%02i/%i:%02i)</span>" ,
--- a/src/cdaudio-ng/cdaudio-ng.c	Sat Oct 13 21:06:30 2007 -0500
+++ b/src/cdaudio-ng/cdaudio-ng.c	Sat Oct 13 23:09:40 2007 -0500
@@ -815,7 +815,7 @@
 
 	for (node = list; node; node = g_list_next(node)) {
 		filename = g_build_filename(CDDA_DEFAULT, node->data, NULL);
-		playlist_add(playlist_get_active(), filename);
+		aud_playlist_add(aud_playlist_get_active(), filename);
 		g_free(filename);
 		g_free(node->data);
 	}
--- a/src/cue/cuesheet.c	Sat Oct 13 21:06:30 2007 -0500
+++ b/src/cue/cuesheet.c	Sat Oct 13 23:09:40 2007 -0500
@@ -166,7 +166,7 @@
 			gchar _buf[65535];
 
 			g_snprintf(_buf, 65535, "cue://%s?%d", filename, i);
-			playlist_add_url(playlist_get_active(), _buf);
+			aud_playlist_add_url(aud_playlist_get_active(), _buf);
 		}
 
 		free_cue_info();
@@ -382,8 +382,8 @@
 
 static gboolean do_setpos(gpointer data)
 {
-    Playlist *playlist = playlist_get_active();
-    gint pos = playlist_get_position_nolock(playlist);
+    Playlist *playlist = aud_playlist_get_active();
+    gint pos = aud_playlist_get_position_nolock(playlist);
     gint incr = *(gint *)data;
 
     pos = pos + incr;
@@ -398,7 +398,7 @@
         return FALSE;
 
     /* being done from the main loop thread, does not require locks */
-    playlist_set_position(playlist, (guint)pos);
+    aud_playlist_set_position(playlist, (guint)pos);
 
     return FALSE; //one-shot
 }
@@ -412,15 +412,15 @@
 static void set_info_override(gchar * unused, gint length, gint rate, gint freq, gint nch)
 {
 	gchar *title;
-	Playlist *playlist = playlist_get_active();
+	Playlist *playlist = aud_playlist_get_active();
 
 	g_return_if_fail(playlist != NULL);
 
 	/* annoying. */
 	if (playlist->position->tuple == NULL)
 	{
-		gint pos = playlist_get_position(playlist);
-		playlist_get_tuple(playlist, pos);
+		gint pos = aud_playlist_get_position(playlist);
+		aud_playlist_get_tuple(playlist, pos);
 	}
 
 	title = g_strdup(playlist->position->title);
@@ -576,7 +576,7 @@
             break;
         case RUN:
             if(!playlist)
-                playlist = playlist_get_active();
+                playlist = aud_playlist_get_active();
             g_cond_timed_wait(cue_cond, cue_mutex, &sleep_time);
             break;
         case STOP:
@@ -584,7 +584,7 @@
             g_print("watchdog deactivated\n");
 #endif
             g_cond_wait(cue_cond, cue_mutex);
-            playlist = playlist_get_active();
+            playlist = aud_playlist_get_active();
             break;
         }
         g_mutex_unlock(cue_mutex);
@@ -679,8 +679,8 @@
             (cue_tracks[last_cue_track].index - time < 500 ||
              time > cue_tracks[last_cue_track].index) ){ // may not happen. for safety.
             if(!real_ip->output->buffer_playing()) {
-                gint pos = playlist_get_position(playlist);
-                if (pos + 1 == playlist_get_length(playlist)) {
+                gint pos = aud_playlist_get_position(playlist);
+                if (pos + 1 == aud_playlist_get_length(playlist)) {
 #ifdef DEBUG
                     g_print("i: watchdog eof reached\n\n");
 #endif
--- a/src/filewriter/filewriter.c	Sat Oct 13 21:06:30 2007 -0500
+++ b/src/filewriter/filewriter.c	Sat Oct 13 23:09:40 2007 -0500
@@ -192,12 +192,12 @@
     input.frequency = rate;
     input.channels = nch;
 
-    playlist = playlist_get_active();
+    playlist = aud_playlist_get_active();
     if(!playlist)
         return 0;
 
-    pos = playlist_get_position(playlist);
-    tuple = playlist_get_tuple(playlist, pos);
+    pos = aud_playlist_get_position(playlist);
+    tuple = aud_playlist_get_tuple(playlist, pos);
     if(!tuple)
         return 0;
 
--- a/src/m3u/m3u.c	Sat Oct 13 21:06:30 2007 -0500
+++ b/src/m3u/m3u.c	Sat Oct 13 23:09:40 2007 -0500
@@ -83,7 +83,7 @@
     gsize line_len = 1024;
     gint ext_len = -1;
     gboolean is_extm3u = FALSE;
-    Playlist *playlist = playlist_get_active();
+    Playlist *playlist = aud_playlist_get_active();
     gchar *uri;
     
     uri = g_filename_to_uri(filename, NULL, NULL);
@@ -131,7 +131,7 @@
         }
 
         uri = g_filename_to_uri(line, NULL, NULL);
-        playlist_load_ins_file(playlist, uri ? uri : line, filename, pos, ext_title, ext_len);
+        aud_playlist_load_ins_file(playlist, uri ? uri : line, filename, pos, ext_title, ext_len);
         g_free(uri);
 
         aud_str_replace_in(&ext_title, NULL);
@@ -151,7 +151,7 @@
     GList *node;
     gchar *outstr = NULL;
     VFSFile *file;
-    Playlist *playlist = playlist_get_active();
+    Playlist *playlist = aud_playlist_get_active();
     gchar *fn = NULL;
 
     g_return_if_fail(filename != NULL);
--- a/src/mtp_up/mtp.c	Sat Oct 13 21:06:30 2007 -0500
+++ b/src/mtp_up/mtp.c	Sat Oct 13 23:09:40 2007 -0500
@@ -107,7 +107,7 @@
     Tuple *tuple;
     GList *node=NULL,*up_list=NULL;
     PlaylistEntry *entry;
-    Playlist *current_play = playlist_get_active();
+    Playlist *current_play = aud_playlist_get_active();
 
     node = current_play->entries;
     PLAYLIST_LOCK(current_play);            /*needed so that the user doesn't modify the selection*/ 
--- a/src/pls/pls.c	Sat Oct 13 21:06:30 2007 -0500
+++ b/src/pls/pls.c	Sat Oct 13 23:09:40 2007 -0500
@@ -44,7 +44,7 @@
     guint i, count, added_count = 0;
     gchar line_key[10], title_key[10];
     gchar *line, *title;
-    Playlist *playlist = playlist_get_active();
+    Playlist *playlist = aud_playlist_get_active();
 
     g_return_if_fail(filename != NULL);
 
@@ -77,12 +77,12 @@
                 g_snprintf(title_key, sizeof(title_key), "Title%d", i);
 
                 if ((title = read_ini_string(inifile, "playlist", title_key)))
-                    playlist_load_ins_file(playlist, uri, filename, pos, title, -1);
+                    aud_playlist_load_ins_file(playlist, uri, filename, pos, title, -1);
                 else
-                    playlist_load_ins_file(playlist, uri, filename, pos, NULL, -1);
+                    aud_playlist_load_ins_file(playlist, uri, filename, pos, NULL, -1);
             }
             else
-                playlist_load_ins_file(playlist, uri, filename, pos, NULL, -1);
+                aud_playlist_load_ins_file(playlist, uri, filename, pos, NULL, -1);
 
             added_count++;
 
@@ -101,13 +101,13 @@
 {
     GList *node;
     VFSFile *file = aud_vfs_fopen(filename, "wb");
-    Playlist *playlist = playlist_get_active();
+    Playlist *playlist = aud_playlist_get_active();
 
     g_return_if_fail(file != NULL);
     g_return_if_fail(playlist != NULL);
 
     aud_vfs_fprintf(file, "[playlist]\n");
-    aud_vfs_fprintf(file, "NumberOfEntries=%d\n", playlist_get_length(playlist));
+    aud_vfs_fprintf(file, "NumberOfEntries=%d\n", aud_playlist_get_length(playlist));
 
     PLAYLIST_LOCK(playlist);
 
--- a/src/pulse_audio/pulse_audio.c	Sat Oct 13 21:06:30 2007 -0500
+++ b/src/pulse_audio/pulse_audio.c	Sat Oct 13 23:09:40 2007 -0500
@@ -72,10 +72,10 @@
     static char t[256];
     gint session, pos;
     char *str, *u;
-    Playlist *playlist = playlist_get_active();
+    Playlist *playlist = aud_playlist_get_active();
 
-    pos = playlist_get_position(playlist);
-    if (!(str = playlist_get_songtitle(playlist, pos)))
+    pos = aud_playlist_get_position(playlist);
+    if (!(str = aud_playlist_get_songtitle(playlist, pos)))
         return "Playback Stream";
 
     snprintf(t, sizeof(t), "%s", u = pa_locale_to_utf8(str));
--- a/src/scrobbler/plugin.c	Sat Oct 13 21:06:30 2007 -0500
+++ b/src/scrobbler/plugin.c	Sat Oct 13 23:09:40 2007 -0500
@@ -234,8 +234,8 @@
 
 			pdebug("Submitting song.", DEBUG);
 
-			playlist = playlist_get_active();
-			tuple = playlist_get_tuple(playlist, playlist_get_position(playlist));
+			playlist = aud_playlist_get_active();
+			tuple = aud_playlist_get_tuple(playlist, aud_playlist_get_position(playlist));
 
 			if (tuple == NULL)
 				continue;
--- a/src/statusicon/si_ui.c	Sat Oct 13 21:06:30 2007 -0500
+++ b/src/statusicon/si_ui.c	Sat Oct 13 23:09:40 2007 -0500
@@ -145,14 +145,14 @@
   if ( GPOINTER_TO_INT(g_object_get_data( G_OBJECT(evbox) , "timer_active" )) == 1 )
   {
     Tuple *tuple;
-    Playlist *pl_active = playlist_get_active();
-    gint pos = playlist_get_position(pl_active);
+    Playlist *pl_active = aud_playlist_get_active();
+    gint pos = aud_playlist_get_position(pl_active);
     GtkWidget *popup = g_object_get_data( G_OBJECT(evbox) , "popup" );
 
-    tuple = playlist_get_tuple( pl_active , pos );
+    tuple = aud_playlist_get_tuple( pl_active , pos );
     if ( ( tuple == NULL ) || ( aud_tuple_get_int(tuple, FIELD_LENGTH, NULL) < 1 ) )
     {
-      gchar *title = playlist_get_songtitle( pl_active , pos );
+      gchar *title = aud_playlist_get_songtitle( pl_active , pos );
       audacious_fileinfopopup_show_from_title( popup , title );
       g_free( title );
     }
--- a/src/xspf/xspf.c	Sat Oct 13 21:06:30 2007 -0500
+++ b/src/xspf/xspf.c	Sat Oct 13 23:09:40 2007 -0500
@@ -129,7 +129,7 @@
     xmlNode *nptr;
     Tuple *tuple;
     gchar *location = NULL;
-    Playlist *playlist = playlist_get_active();
+    Playlist *playlist = aud_playlist_get_active();
 
 
     tuple = aud_tuple_new();
@@ -211,7 +211,7 @@
         // add file to playlist
         uri = g_filename_to_uri(location, NULL, NULL);
         // uri would be NULL if location is already uri. --yaz
-        playlist_load_ins_file_tuple(playlist, uri ? uri: location, filename, pos, tuple);
+        aud_playlist_load_ins_file_tuple(playlist, uri ? uri: location, filename, pos, tuple);
         g_free(uri);
         pos++;
     }
@@ -237,7 +237,7 @@
 static void xspf_find_audoptions(xmlNode *tracklist, const gchar *filename, gint pos)
 {
     xmlNode *nptr;
-    Playlist *playlist = playlist_get_active();
+    Playlist *playlist = aud_playlist_get_active();
 
     for (nptr = tracklist->children; nptr != NULL; nptr = nptr->next) {
         if (nptr->type == XML_ELEMENT_NODE &&
@@ -304,11 +304,11 @@
                 } else
                 if (nptr2->type == XML_ELEMENT_NODE &&
                     !xmlStrcmp(nptr2->name, (xmlChar *)"title")) {
-                    Playlist *plist = playlist_get_active();
+                    Playlist *plist = aud_playlist_get_active();
                     xmlChar *title = xmlNodeGetContent(nptr2);
                     
                     if (title && *title) {
-                        playlist_set_current_name(plist, (gchar*)title);
+                        aud_playlist_set_current_name(plist, (gchar*)title);
                     }
                     xmlFree(title);
                 } else
@@ -361,7 +361,7 @@
     GList *node;
     gint baselen = 0;
     gchar *base = NULL;
-    Playlist *playlist = playlist_get_active();
+    Playlist *playlist = aud_playlist_get_active();
 
     XSDEBUG("filename='%s', pos=%d\n", filename, pos);