Here, have a patch that gets this working again.  As soon as I'd
nailed semantics of a the function calls versus g_free() and str_unref()
it's been working 100% here.

--- audacious-plugins-3.5/src/song_change/song_change.c 2014-04-23 
03:37:46.000000000 +0100
+++ new-audacious-plugins-3.5/src/song_change/song_change.c     2016-02-25 
00:05:31.937064865 +0000
@@ -32,7 +32,7 @@
 static void songchange_playback_begin(gpointer unused, gpointer unused2);
 static void songchange_playback_end(gpointer unused, gpointer unused2);
 static void songchange_playlist_eof(gpointer unused, gpointer unused2);
-//static void songchange_playback_ttc(gpointer, gpointer);
+static void songchange_playback_ttc(gpointer, gpointer);
 
 typedef struct
 {
@@ -252,7 +252,7 @@
     hook_dissociate("playback begin", songchange_playback_begin);
     hook_dissociate("playback end", songchange_playback_end);
     hook_dissociate("playlist end reached", songchange_playlist_eof);
-    // hook_dissociate( "playlist set info" , songchange_playback_ttc);
+    hook_dissociate("title change" , songchange_playback_ttc);
 
     if ( ttc_prevs != NULL )
     {
@@ -320,7 +320,7 @@
     ttc_prevs = g_malloc0(sizeof(songchange_playback_ttc_prevs_t));
     ttc_prevs->title = NULL;
     ttc_prevs->filename = NULL;
-    // hook_associate( "playlist set info" , songchange_playback_ttc , 
ttc_prevs );
+    hook_associate("title change" , songchange_playback_ttc , ttc_prevs );
 
     return TRUE;
 }
@@ -335,53 +335,54 @@
     do_command (cmd_line_after);
 }
 
-#if 0
     static void
 songchange_playback_ttc(gpointer plentry_gp, gpointer prevs_gp)
 {
-    if ( ( aud_ip_state->playing ) && ( strcmp(cmd_line_ttc,"") ) )
+    if ( aud_drct_get_playing() && ( strcmp(cmd_line_ttc,"") ) )
     {
         songchange_playback_ttc_prevs_t *prevs = prevs_gp;
-        PlaylistEntry *pl_entry = plentry_gp;
+       int playlist = aud_playlist_get_playing ();
+       int pl_entry = aud_playlist_get_position(playlist);
+       gchar *pl_entry_filename = aud_playlist_entry_get_filename(playlist, 
pl_entry);
+       gchar *pl_entry_title = aud_playlist_entry_get_title(playlist, 
pl_entry, FALSE);
 
         /* same filename but title changed, useful to detect http stream song 
changes */
 
         if ( ( prevs->title != NULL ) && ( prevs->filename != NULL ) )
         {
-            if ( ( pl_entry->filename != NULL ) && ( 
!strcmp(pl_entry->filename,prevs->filename) ) )
+            if ( ( pl_entry_filename != NULL ) && ( 
!strcmp(pl_entry_filename,prevs->filename) ) )
             {
-                if ( ( pl_entry->title != NULL ) && ( 
strcmp(pl_entry->title,prevs->title) ) )
+                if ( ( pl_entry_title != NULL ) && ( 
strcmp(pl_entry_title,prevs->title) ) )
                 {
-                    int pos = aud_drct_pl_get_pos();
-                    char *current_file = aud_drct_pl_get_file(pos);
-                    do_command(cmd_line_ttc, current_file, pos);
-                    g_free(current_file);
+                    do_command(cmd_line_ttc);
                     g_free(prevs->title);
-                    prevs->title = g_strdup(pl_entry->title);
+                    prevs->title = g_strdup(pl_entry_title);
                 }
             }
             else
             {
                 g_free(prevs->filename);
-                prevs->filename = g_strdup(pl_entry->filename);
+                prevs->filename = g_strdup(pl_entry_filename);
                 /* if filename changes, reset title as well */
                 if ( prevs->title != NULL )
                     g_free(prevs->title);
-                prevs->title = g_strdup(pl_entry->title);
+                prevs->title = g_strdup(pl_entry_title);
             }
         }
         else
         {
             if ( prevs->title != NULL )
                 g_free(prevs->title);
-            prevs->title = g_strdup(pl_entry->title);
+            prevs->title = g_strdup(pl_entry_title);
             if ( prevs->filename != NULL )
                 g_free(prevs->filename);
-            prevs->filename = g_strdup(pl_entry->filename);
+            prevs->filename = g_strdup(pl_entry_filename);
         }
+
+       str_unref (pl_entry_filename);
+       str_unref (pl_entry_title);
     }
 }
-#endif
 
 static void songchange_playlist_eof(gpointer unused, gpointer unused2)
 {

_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers

Reply via email to