aboutsummaryrefslogtreecommitdiff
path: root/src/song_update.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/song_update.c')
-rw-r--r--src/song_update.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/song_update.c b/src/song_update.c
index e2a845ee..e7279a6f 100644
--- a/src/song_update.c
+++ b/src/song_update.c
@@ -131,6 +131,9 @@ song_file_update(struct song *song)
song->mtime = st.st_mtime;
+ GMutex *mutex = NULL;
+ GCond *cond;
+
do {
/* load file tag */
song->tag = decoder_plugin_tag_dup(plugin, path_fs);
@@ -141,8 +144,12 @@ song_file_update(struct song *song)
if (plugin->stream_tag != NULL) {
/* open the input_stream (if not already
open) */
- if (is == NULL)
- is = input_stream_open(path_fs, NULL);
+ if (is == NULL) {
+ mutex = g_mutex_new();
+ cond = g_cond_new();
+ is = input_stream_open(path_fs, mutex, cond,
+ NULL);
+ }
/* now try the stream_tag() method */
if (is != NULL) {
@@ -151,7 +158,7 @@ song_file_update(struct song *song)
if (song->tag != NULL)
break;
- input_stream_seek(is, 0, SEEK_SET, NULL);
+ input_stream_lock_seek(is, 0, SEEK_SET, NULL);
}
}
@@ -161,6 +168,11 @@ song_file_update(struct song *song)
if (is != NULL)
input_stream_close(is);
+ if (mutex != NULL) {
+ g_cond_free(cond);
+ g_mutex_free(mutex);
+ }
+
if (song->tag != NULL && tag_is_empty(song->tag))
song->tag = tag_fallback(path_fs, song->tag);