summaryrefslogtreecommitdiff
path: root/plugins/tta/ttaplug.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/tta/ttaplug.c')
-rw-r--r--plugins/tta/ttaplug.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/tta/ttaplug.c b/plugins/tta/ttaplug.c
index 5b433e44..cb6f35f7 100644
--- a/plugins/tta/ttaplug.c
+++ b/plugins/tta/ttaplug.c
@@ -61,16 +61,21 @@ static int
tta_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
tta_info_t *info = (tta_info_t *)_info;
- trace ("open_tta_file %s\n", deadbeef->pl_find_meta (it, ":URI"));
- if (open_tta_file (deadbeef->pl_find_meta (it, ":URI"), &info->tta, 0) != 0) {
- fprintf (stderr, "tta: failed to open %s\n", deadbeef->pl_find_meta (it, ":URI"));
+ deadbeef->pl_lock ();
+ const char *fname = deadbeef->pl_find_meta (it, ":URI")
+ trace ("open_tta_file %s\n", fname);
+ if (open_tta_file (fname, &info->tta, 0) != 0) {
+ deadbeef->pl_unlock ();
+ fprintf (stderr, "tta: failed to open %s\n", fname);
return -1;
}
if (player_init (&info->tta) != 0) {
- fprintf (stderr, "tta: failed to init player for %s\n", deadbeef->pl_find_meta (it, ":URI"));
+ deadbeef->pl_unlock ();
+ fprintf (stderr, "tta: failed to init player for %s\n", fname);
return -1;
}
+ deadbeef->pl_unlock ();
_info->fmt.bps = info->tta.BPS;
_info->fmt.channels = info->tta.NCH;
@@ -251,7 +256,9 @@ tta_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
}
static int tta_read_metadata (DB_playItem_t *it) {
+ deadbeef->pl_lock ();
DB_FILE *fp = deadbeef->fopen (deadbeef->pl_find_meta (it, ":URI"));
+ deadbeef->pl_unlock ();
if (!fp) {
return -1;
}