summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Ian Nartowicz <iann@crunchbang>2014-06-06 18:24:45 +0100
committerGravatar Ian Nartowicz <iann@crunchbang>2014-06-06 18:24:45 +0100
commit1cd417fc09faec13357268141767b24b8033eea7 (patch)
tree0d2f1057a9fcf255caea2064605f26fefdf0515c /plugins
parent80f2d9bf73c143f31a44d02c651e96b6e84f1e8b (diff)
#if USE_OGGEDIT changes, and pl_unlock() fixes
Diffstat (limited to 'plugins')
-rw-r--r--plugins/flac/flac.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c
index 036301d2..016a3c6a 100644
--- a/plugins/flac/flac.c
+++ b/plugins/flac/flac.c
@@ -46,7 +46,7 @@ static DB_functions_t *deadbeef;
static DB_artwork_plugin_t *coverart_plugin = NULL;
-// #define trace(...) { fprintf(stderr, __VA_ARGS__); }
+//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
#define trace(fmt,...)
#define min(x,y) ((x)<(y)?(x):(y))
@@ -872,13 +872,13 @@ cflac_read_metadata (DB_playItem_t *it) {
}
deadbeef->pl_lock ();
FLAC__bool res = FLAC__metadata_chain_read (chain, deadbeef->pl_find_meta (it, ":URI"));
+ if (!res && FLAC__metadata_chain_status(chain) == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE) {
+ res = FLAC__metadata_chain_read_ogg (chain, deadbeef->pl_find_meta (it, ":URI"));
+ }
deadbeef->pl_unlock ();
if (!res) {
- FLAC__bool res = FLAC__metadata_chain_read_ogg (chain, deadbeef->pl_find_meta (it, ":URI"));
- if (!res) {
- trace ("cflac_read_metadata: FLAC__metadata_chain_read failed\n");
- goto error;
- }
+ trace ("cflac_read_metadata: FLAC__metadata_chain_read(_ogg) failed\n");
+ goto error;
}
FLAC__metadata_chain_merge_padding (chain);
@@ -928,7 +928,7 @@ error:
return err;
}
-#if USE_OGGEDIT==1
+#if USE_OGGEDIT
int
cflac_write_metadata_ogg (DB_playItem_t *it, FLAC__StreamMetadata_VorbisComment *vc)
{
@@ -963,14 +963,16 @@ cflac_write_metadata (DB_playItem_t *it) {
}
deadbeef->pl_lock ();
FLAC__bool res = FLAC__metadata_chain_read (chain, deadbeef->pl_find_meta (it, ":URI"));
- deadbeef->pl_unlock ();
FLAC__bool isogg = false;
+#if USE_OGGEDIT
if (!res && FLAC__metadata_chain_status(chain) == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE) {
isogg = true;
res = FLAC__metadata_chain_read_ogg (chain, deadbeef->pl_find_meta (it, ":URI"));
}
+#endif
+ deadbeef->pl_unlock ();
if (!res) {
- trace ("cflac_write_metadata: FLAC__metadata_chain_read(_ogg) failed\n");
+ trace ("cflac_write_metadata: FLAC__metadata_chain_read(_ogg) failed - code %d\n", res);
goto error;
}
FLAC__metadata_chain_merge_padding (chain);
@@ -1162,7 +1164,7 @@ error2:
if (!isogg)
res = FLAC__metadata_chain_write (chain, 1, 0);
-#if USE_OGGEDIT==1
+#if USE_OGGEDIT
else
res = cflac_write_metadata_ogg(it, &data->data.vorbis_comment);
#endif