diff options
author | waker <wakeroid@gmail.com> | 2012-05-17 23:12:00 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-05-17 23:12:00 +0200 |
commit | 6b97a160c2db19b808cbfc320a8a92da203d49ca (patch) | |
tree | 2c3d6594d65d0196c876719120da0d3908c9cbd2 /plugins/converter | |
parent | 816d87e1d38dc0fecbe1fa47794b2d7a18d2e321 (diff) |
fixed remaining pl_find_meta calls lacking pl_lock
Diffstat (limited to 'plugins/converter')
-rw-r--r-- | plugins/converter/converter.c | 7 | ||||
-rw-r--r-- | plugins/converter/convgui.c | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/plugins/converter/converter.c b/plugins/converter/converter.c index 7c884eb1..ad68bab9 100644 --- a/plugins/converter/converter.c +++ b/plugins/converter/converter.c @@ -685,7 +685,9 @@ get_output_field (DB_playItem_t *it, const char *field, char *out, int sz) void get_output_path (DB_playItem_t *it, const char *outfolder_user, const char *outfile, ddb_encoder_preset_t *encoder_preset, int preserve_folder_structure, const char *root_folder, int write_to_source_folder, char *out, int sz) { trace ("get_output_path: %s %s %s\n", outfolder_user, outfile, root_folder); + deadbeef->pl_lock (); const char *uri = strdupa (deadbeef->pl_find_meta (it, ":URI")); + deadbeef->pl_unlock (); char outfolder_preserve[2000]; if (preserve_folder_structure) { // generate new outfolder @@ -800,8 +802,7 @@ int convert (DB_playItem_t *it, const char *out, int output_bps, int output_is_float, ddb_encoder_preset_t *encoder_preset, ddb_dsp_preset_t *dsp_preset, int *abort) { if (deadbeef->pl_get_item_duration (it) <= 0) { deadbeef->pl_lock (); - const char *fname = deadbeef->pl_find_meta (it, ":URI"); - fprintf (stderr, "converter: stream %s doesn't have finite length, skipped\n", fname); + fprintf (stderr, "converter: stream %s doesn't have finite length, skipped\n", deadbeef->pl_find_meta (it, ":URI")); deadbeef->pl_unlock (); return -1; } @@ -812,7 +813,9 @@ convert (DB_playItem_t *it, const char *out, int output_bps, int output_is_float DB_decoder_t *dec = NULL; DB_fileinfo_t *fileinfo = NULL; char input_file_name[PATH_MAX] = ""; + deadbeef->pl_lock (); dec = (DB_decoder_t *)deadbeef->plug_get_for_id (deadbeef->pl_find_meta (it, ":DECODER")); + deadbeef->pl_unlock (); if (dec) { fileinfo = dec->open (0); diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c index 6e1fb335..27517022 100644 --- a/plugins/converter/convgui.c +++ b/plugins/converter/convgui.c @@ -130,7 +130,7 @@ converter_worker (void *ctx) { // prepare for preserving folder struct if (conv->preserve_folder_structure && conv->convert_items_count >= 1) { // start with the 1st track path - strncpy (root, deadbeef->pl_find_meta (conv->convert_items[0], ":URI"), sizeof (root)); + deadbeef->pl_get_meta (conv->convert_items[0], ":URI", root, sizeof (root)); char *sep = strrchr (root, '/'); if (sep) { *sep = 0; @@ -138,6 +138,7 @@ converter_worker (void *ctx) { // reduce rootlen = strlen (root); for (int n = 1; n < conv->convert_items_count; n++) { + deadbeef->pl_lock (); const char *path = deadbeef->pl_find_meta (conv->convert_items[n], ":URI"); if (strncmp (path, root, rootlen)) { // find where path splits @@ -156,6 +157,7 @@ converter_worker (void *ctx) { r++; } } + deadbeef->pl_unlock (); } fprintf (stderr, "common root path: %s\n", root); } @@ -164,7 +166,9 @@ converter_worker (void *ctx) { update_progress_info_t *info = malloc (sizeof (update_progress_info_t)); info->entry = conv->progress_entry; g_object_ref (info->entry); + deadbeef->pl_lock (); info->text = strdup (deadbeef->pl_find_meta (conv->convert_items[n], ":URI")); + deadbeef->pl_unlock (); g_idle_add (update_progress_cb, info); char outpath[2000]; |