changeset 2438:8750a62abed8 trunk

[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a useful default get_time().
author iabervon
date Sun, 28 Jan 2007 22:09:12 -0800
parents 62d8f9c05832
children f2b3d6428b67
files ChangeLog src/audacious/playback.c src/audacious/plugin.h
diffstat 3 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jan 28 21:08:08 2007 -0800
+++ b/ChangeLog	Sun Jan 28 22:09:12 2007 -0800
@@ -1,3 +1,12 @@
+2007-01-29 05:08:08 +0000  Daniel Barkalow <barkalow@iabervon.org>
+  revision [3884]
+  More input plugin API work
+  
+  trunk/src/audacious/input.c  |    6 +++---
+  trunk/src/audacious/plugin.h |    6 +++---
+  2 files changed, 6 insertions(+), 6 deletions(-)
+
+
 2007-01-29 01:02:15 +0000  Daniel Barkalow <barkalow@iabervon.org>
   revision [3882]
   Change the input plugin API to use a struct for the currently-playing file.
--- a/src/audacious/playback.c	Sun Jan 28 21:08:08 2007 -0800
+++ b/src/audacious/playback.c	Sun Jan 28 22:09:12 2007 -0800
@@ -70,10 +70,19 @@
 gint
 playback_get_time(void)
 {
+    InputPlayback *playback;
     g_return_val_if_fail(playback_get_playing(), -1);
-    g_return_val_if_fail(get_current_input_playback(), -1);
+    playback = get_current_input_playback();
+    g_return_val_if_fail(playback, -1);
 
-    return get_current_input_playback()->plugin->get_time(get_current_input_playback());
+    if (playback->plugin->get_time)
+        return playback->plugin->get_time(playback);
+    if (playback->error)
+        return -2;
+    if (!playback->playing || 
+	(playback->eof && !playback->output->buffer_playing()))
+        return -1;
+    return playback->output->output_time();
 }
 
 void
@@ -183,6 +192,7 @@
             mainwin_set_info_text();
         }
 
+	g_free(get_current_input_playback()->filename);
 	g_free(get_current_input_playback());
 	set_current_input_playback(NULL);
     }
@@ -249,7 +259,7 @@
 
     playback->plugin = entry->decoder;
     playback->output = &psuedo_output_plugin;
-    playback->filename = entry->filename;
+    playback->filename = g_strdup(entry->filename);
     
     set_current_input_playback(playback);
 
--- a/src/audacious/plugin.h	Sun Jan 28 21:08:08 2007 -0800
+++ b/src/audacious/plugin.h	Sun Jan 28 22:09:12 2007 -0800
@@ -152,6 +152,10 @@
     InputPlugin *plugin;
     void *data;
     OutputPlugin *output;
+
+    int playing;
+    gboolean error;
+    gboolean eof;
 };
 
 struct _InputPlugin {