changeset 613:85a70ace8c02 trunk

[svn] - press F5 on not yet played stream no longer hangs. - some cleanups.
author yaz
date Wed, 07 Feb 2007 01:10:37 -0800
parents 951b24719ce9
children 354389b85dce
files ChangeLog src/madplug/TODO src/madplug/fileinfo.c src/madplug/input.c src/madplug/plugin.c
diffstat 5 files changed, 58 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 06 21:01:15 2007 -0800
+++ b/ChangeLog	Wed Feb 07 01:10:37 2007 -0800
@@ -1,3 +1,14 @@
+2007-02-07 05:01:15 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [1310]
+  - fix for audmad_is_our_fd()
+  - added my TODO list ;p
+  
+  trunk/src/madplug/TODO     |   15 ++++++++
+  trunk/src/madplug/input.c  |    2 -
+  trunk/src/madplug/plugin.c |   79 +++++++--------------------------------------
+  3 files changed, 30 insertions(+), 66 deletions(-)
+
+
 2007-02-06 20:11:42 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [1308]
   merge recent changes from yaz's branch.
--- a/src/madplug/TODO	Tue Feb 06 21:01:15 2007 -0800
+++ b/src/madplug/TODO	Wed Feb 07 01:10:37 2007 -0800
@@ -1,11 +1,11 @@
--: to do, X: done, x: test needed, ?: questionableness
+-: to do, X: done, x: test needed, ?: uncertainty
 
 X remove info->stop
 X frame_name == ID3_FRAME_COMMENT code highly depends on address of strings. strcmp() is safer way.
 X replace copy right notices
 X import title override feature
 x import neno's configure dialog
-- bug fix: press F5 on not yet played stream hangs.
+X bug fix: press F5 on not yet played stream hangs.
 - tidy up mad_info_t
 - remove pb_mutex ?
 x replace tag editor with neno's
--- a/src/madplug/fileinfo.c	Tue Feb 06 21:01:15 2007 -0800
+++ b/src/madplug/fileinfo.c	Wed Feb 07 01:10:37 2007 -0800
@@ -813,10 +813,9 @@
 #endif
     input_init(&info, filename);
 
-    if (!strncasecmp("http://", filename, strlen("http://")) ||
-	!strncasecmp("https://", filename, strlen("https://"))) {
+    if (!strncasecmp("http://", filename, 7) || !strncasecmp("https://", filename, 8)) {
         info.remote = TRUE;
-	return; //tentative
+	return; //file info dialog for remote streaming doesn't make sense.
     }
 
     utf_filename = str_to_utf8(filename);
--- a/src/madplug/input.c	Tue Feb 06 21:01:15 2007 -0800
+++ b/src/madplug/input.c	Wed Feb 07 01:10:37 2007 -0800
@@ -123,6 +123,7 @@
     info->remote = info->size == 0 ? TRUE : FALSE;
 
 #ifdef DEBUG
+    g_message("i: info->size == %lu", info->size);
     g_message("e: input_init");
 #endif
     return TRUE;
--- a/src/madplug/plugin.c	Tue Feb 06 21:01:15 2007 -0800
+++ b/src/madplug/plugin.c	Wed Feb 07 01:10:37 2007 -0800
@@ -197,10 +197,12 @@
     guchar tmp[4096];
     gint ret, i;
 
+    info.remote = FALSE;
+
 #if 1
     // XXX: temporary fix
-    if (!strncasecmp("http://", filename, 7) ||	!strncasecmp("https://", filename, 8)) {
-        g_message("audmad_is_our_fe: remote");
+    if (!strncasecmp("http://", filename, 7) || !strncasecmp("https://", filename, 8)) {
+        g_message("audmad_is_our_fd: remote");
         info.remote = TRUE;
     }
 #endif
@@ -320,9 +322,10 @@
         g_message("error reading input info");
         return;
     }
-
+    g_mutex_lock(pb_mutex);
     info.playback = playback;
     info.playback->playing = 1;
+    g_mutex_unlock(pb_mutex);
 
     decode_thread = g_thread_create(decode_loop, (void *) &info, TRUE, NULL);
 }
@@ -357,7 +360,16 @@
     g_message("f: audmad_get_song_info: %s", url);
 #endif                          /* DEBUG */
 
-    input_init(&myinfo, url);
+    if (input_init(&myinfo, url) == FALSE) {
+        g_message("error initialising input");
+        return;
+    }
+
+    // don't try to get from stopped stream.
+    if(myinfo.remote && (!myinfo.playback || !myinfo.playback->playing)){
+        g_print("get_song_info: remote!\n");
+        return;
+    }
 
     if (input_get_info(&myinfo, info.remote ? TRUE : audmad_config.fast_play_time_calc) == TRUE) {
         if(myinfo.tuple->track_name)
@@ -452,29 +464,36 @@
 #ifdef DEBUG
     string = str_to_utf8(filename);
     g_message("f: mad: audmad_get_song_tuple: %s", string);
-    if (string) {
-        g_free(string);
-        string = NULL;
-    }
+    g_free(string);
+    string = NULL;
 #endif
 
-    // can't re-open remote stream
     if(info.remote){
-        tuple = bmp_title_input_new();
-
-        tuple->track_name = vfs_get_metadata(info.infile, "track-name");
-        tuple->album_name = vfs_get_metadata(info.infile, "stream-name");
+        if(info.playback && info.playback->playing) {
+            tuple = bmp_title_input_new();
+#ifdef DEBUG
+            printf("info.playback->playing = %d\n",info.playback->playing);
+#endif
+            tuple->track_name = vfs_get_metadata(info.infile, "track-name");
+            tuple->album_name = vfs_get_metadata(info.infile, "stream-name");
 #ifdef DEBUG
-        printf("audmad_get_song_tuple: track_name = %s\n", tuple->track_name);
-        printf("audmad_get_song_tuple: stream_name = %s\n", tuple->album_name);
+            printf("audmad_get_song_tuple: track_name = %s\n", tuple->track_name);
+            printf("audmad_get_song_tuple: stream_name = %s\n", tuple->album_name);
 #endif
-        tuple->file_name = g_path_get_basename(filename);
-        tuple->file_path = g_path_get_dirname(filename);
-        tuple->file_ext = extname(filename);
-        tuple->length = -1;
-	tuple->mtime = 0; // this indicates streaming
-
-        return tuple;
+            tuple->file_name = g_path_get_basename(filename);
+            tuple->file_path = g_path_get_dirname(filename);
+            tuple->file_ext = extname(filename);
+            tuple->length = -1;
+            tuple->mtime = 0; // this indicates streaming
+#ifdef DEBUG
+            printf("get_song_tuple remote: tuple\n");
+#endif
+            return tuple;
+        }
+#ifdef DEBUG
+        printf("get_song_tuple: remote: NULL\n");
+#endif
+        return NULL;
     }
 
     if ((file = vfs_fopen(filename, "rb")) != NULL) {
@@ -528,7 +547,7 @@
                 // genre
                 tuple->genre = input_id3_get_string(tag, ID3_FRAME_GENRE);
 #ifdef DEBUG
-                g_message("genre = %s\n", tuple->genre);
+                g_message("genre = %s", tuple->genre);
 #endif
                 // comment
                 tuple->comment =