# HG changeset patch # User Yoshiki Yazawa # Date 1188700061 -32400 # Node ID c8c7259576439411212312c65378051aa2bede5a # Parent 16b2bc9b9763d1d2aafd95317add7af8013426d2 make cuesheet plugin work again. diff -r 16b2bc9b9763 -r c8c725957643 src/cue/cuesheet.c --- a/src/cue/cuesheet.c Sun Sep 02 03:13:17 2007 +0100 +++ b/src/cue/cuesheet.c Sun Sep 02 11:27:41 2007 +0900 @@ -178,7 +178,7 @@ gint i; /* add the files, build cue urls, etc. */ - cache_cue_file(filename); + cache_cue_file(filename); //filename should be uri. for (i = 0; i < last_cue_track; i++) { @@ -203,10 +203,11 @@ static void play(InputPlayback *data) { - gchar *uri = data->filename; + gchar *uri = g_strdup(data->filename); #ifdef DEBUG g_print("play: playback = %p\n", data); + g_print("play: uri = %s\n", uri); #endif caller_ip = data; @@ -214,13 +215,13 @@ if (strncasecmp("cue://", uri, 6)) { gchar *tmp = g_strdup_printf("cue://%s?0", uri); - play_cue_uri(data, tmp); - g_free(tmp); - return; + g_free(uri); + uri = tmp; } play_thread = g_thread_self(); - data->set_pb_ready(data); + data->set_pb_ready(data); // it should be done in real input plugin? --yaz play_cue_uri(data, uri); + g_free(uri); uri = NULL; } static Tuple *get_tuple(gchar *uri) @@ -264,11 +265,13 @@ track = atoi(_path); } - cache_cue_file(path2); + cache_cue_file(path2); //path2 should be uri. if (cue_file == NULL) return NULL; - +#ifdef DEBUG + g_print("cue_file = %s\n", cue_file); +#endif pr = input_check_file(cue_file, FALSE); if (pr == NULL) return NULL; @@ -303,7 +306,8 @@ cue_tracks[track].performer : cue_performer); tuple_associate_string(out, "album", cue_title); tuple_associate_string(out, "genre", cue_genre); - tuple_associate_int(out, "year", atoi(cue_year)); + if(cue_year) + tuple_associate_int(out, "year", atoi(cue_year)); tuple_associate_int(out, "track-number", track + 1); return out; @@ -467,7 +471,7 @@ static void play_cue_uri(InputPlayback * data, gchar *uri) { - gchar *path2 = g_strdup(uri + 6); + gchar *path2 = g_strdup(uri + 6); // "cue://" is stripped. gchar *_path = strchr(path2, '?'); gint file_length = 0; gint track = 0; @@ -478,6 +482,7 @@ #ifdef DEBUG g_print("f: play_cue_uri\n"); g_print("play_cue_uri: playback = %p\n", data); + g_print("play_cue_uri: path2 = %s\n", path2); #endif /* stop watchdog thread */ @@ -493,7 +498,7 @@ track = atoi(_path); } cur_cue_track = track; - cache_cue_file(path2); + cache_cue_file(path2); //path2 should be uri. if (cue_file == NULL || !vfs_file_test(cue_file, G_FILE_TEST_EXISTS)) return; @@ -518,6 +523,12 @@ real_ip->output = data->output; real_ip->data = data->data; + /* we have to copy set_pb_ready things too. */ + real_ip->pb_ready_mutex = data->pb_ready_mutex; + real_ip->pb_ready_cond = data->pb_ready_cond; + real_ip->pb_ready_val = data->pb_ready_val; + real_ip->set_pb_ready = data->set_pb_ready; + real_play_thread = g_thread_create((GThreadFunc)(real_ip->plugin->play_file), (gpointer)real_ip, TRUE, NULL); g_usleep(50000); // wait for 50msec while real input plugin is initializing.