From 823a4064ebcd2662f8e480f99326ac75dd6404a7 Mon Sep 17 00:00:00 2001 From: Ian Nartowicz Date: Wed, 4 Jun 2014 22:45:30 +0100 Subject: Full release of oggedit --- plugins/flac/Makefile.am | 2 +- plugins/flac/flac.c | 119 +++++++++++++++++++++++++++++++---------------- 2 files changed, 79 insertions(+), 42 deletions(-) (limited to 'plugins/flac') diff --git a/plugins/flac/Makefile.am b/plugins/flac/Makefile.am index 02e594d3..c87ca53d 100644 --- a/plugins/flac/Makefile.am +++ b/plugins/flac/Makefile.am @@ -2,7 +2,7 @@ if HAVE_FLAC flacdir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = flac.la flac_la_SOURCES = flac.c -flac_la_LDFLAGS = -module -avoid-version +flac_la_LDFLAGS = -module -avoid-version -export-symbols-regex flac_load flac_la_LIBADD = $(LDADD) $(FLAC_LIBS) ../liboggedit/liboggedit.a AM_CFLAGS = $(CFLAGS) $(FLAC_CFLAGS) -std=c99 diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index 9a823b9e..e48f30a4 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -1,49 +1,52 @@ /* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009-2013 Alexey Yakovenko - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - - Neither the name of the DeaDBeeF Player nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + DeaDBeeF - ultimate music player for GNU/Linux systems with X11 + Copyright (C) 2009-2013 Alexey Yakovenko + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + - Neither the name of the DeaDBeeF Player nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #include #include #include +#include +#include #include #include -#include #include "../../deadbeef.h" #include "../artwork/artwork.h" +#include "../liboggedit/oggedit.h" static DB_decoder_t plugin; 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)) @@ -653,9 +656,9 @@ cflac_insert_with_embedded_cue (ddb_playlist_t *plt, DB_playItem_t *after, DB_pl deadbeef->pl_item_unref (it); } deadbeef->pl_item_ref (after); - + DB_playItem_t *first = deadbeef->pl_get_next (ins, PL_MAIN); - + if (!first) { first = deadbeef->plt_get_first (plt, PL_MAIN); } @@ -871,8 +874,11 @@ cflac_read_metadata (DB_playItem_t *it) { FLAC__bool res = FLAC__metadata_chain_read (chain, deadbeef->pl_find_meta (it, ":URI")); deadbeef->pl_unlock (); if (!res) { - trace ("cflac_read_metadata: FLAC__metadata_chain_read failed\n"); - goto error; + 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; + } } FLAC__metadata_chain_merge_padding (chain); @@ -923,6 +929,27 @@ error: return err; } +int +cflac_write_metadata_ogg (DB_playItem_t *it, FLAC__StreamMetadata_VorbisComment *vc) +{ + char fname[PATH_MAX]; + deadbeef->pl_get_meta (it, ":URI", fname, sizeof (fname)); + + size_t num_tags = vc->num_comments; + char **tags = calloc(num_tags+1, sizeof(char **)); + for (size_t i = 0; i < num_tags; i++) + tags[i] = vc->comments[i].entry; + const off_t file_size = oggedit_write_flac_metadata (deadbeef->fopen(fname), fname, 0, num_tags, tags); + if (file_size <= 0) { + trace ("cflac_write_metadata_ogg: oggedit_write_flac_metadata failed: code %d\n", file_size); + return -1; + } + + free(tags); + + return 0; +} + int cflac_write_metadata (DB_playItem_t *it) { int err = -1; @@ -937,8 +964,13 @@ 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 (!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")); + } if (!res) { - trace ("cflac_write_metadata: FLAC__metadata_chain_read failed\n"); + trace ("cflac_write_metadata: FLAC__metadata_chain_read(_ogg) failed\n"); goto error; } FLAC__metadata_chain_merge_padding (chain); @@ -1128,10 +1160,15 @@ error2: } #endif - if (!FLAC__metadata_chain_write (chain, 1, 0)) { - trace ("cflac_write_metadata: FLAC__metadata_chain_write failed\n"); + if (isogg) + res = cflac_write_metadata_ogg(it, &data->data.vorbis_comment); + else + res = FLAC__metadata_chain_write (chain, 1, 0); + if (res) { + trace ("cflac_write_metadata: failed to write tags: code %d\n", res); goto error; } + err = 0; error: FLAC__metadata_iterator_delete (iter); @@ -1154,9 +1191,9 @@ static DB_decoder_t plugin = { .plugin.id = "stdflac", .plugin.name = "FLAC decoder", .plugin.descr = "FLAC decoder using libFLAC", - .plugin.copyright = + .plugin.copyright = "Copyright (C) 2009-2013 Alexey Yakovenko et al.\n" - "Uses libFLAC (C) Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson\n" + "Uses libFLAC (C) Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson\n" "Uses libogg Copyright (c) 2002, Xiph.org Foundation\n" "\n" "Redistribution and use in source and binary forms, with or without\n" @@ -1177,7 +1214,7 @@ static DB_decoder_t plugin = { "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" "``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" "LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n" - "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR\n" + "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR\n" "CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n" "EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n" "PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n" -- cgit v1.2.3 From dcce1ca9f69299e3c341abfe4ef04019a7847611 Mon Sep 17 00:00:00 2001 From: Ian Nartowicz Date: Thu, 5 Jun 2014 16:16:30 +0100 Subject: indentation --- plugins/flac/flac.c | 58 ++++++++++++------------ plugins/vorbis/vorbis.c | 118 ++++++++++++++++++++++++------------------------ 2 files changed, 88 insertions(+), 88 deletions(-) (limited to 'plugins/flac') diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index e48f30a4..3564bfb0 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -1,33 +1,33 @@ /* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009-2013 Alexey Yakovenko - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - - Neither the name of the DeaDBeeF Player nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + DeaDBeeF - ultimate music player for GNU/Linux systems with X11 + Copyright (C) 2009-2013 Alexey Yakovenko + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + - Neither the name of the DeaDBeeF Player nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index 00577268..7d029367 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -11,12 +11,12 @@ freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. + misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ @@ -778,61 +778,61 @@ static DB_decoder_t plugin = { .plugin.name = "OggVorbis decoder", .plugin.descr = "OggVorbis decoder using standard xiph.org libraries", .plugin.copyright = - "OggVorbis plugin for DeaDBeeF\n" - "Copyright (C) 2009-2014 Alexey Yakovenko et al.\n" - "\n" - "vcedit.c\n" - "Ogg Vorbis plugin Ogg edit functions\n" - "\n" - "Copyright (C) 2014 Ian Nartowicz \n" - "This software is provided 'as-is', without any express or implied\n" - "warranty. In no event will the authors be held liable for any damages\n" - "arising from the use of this software.\n" - "\n" - "Permission is granted to anyone to use this software for any purpose,\n" - "including commercial applications, and to alter it and redistribute it\n" - "freely, subject to the following restrictions:\n" - "\n" - "1. The origin of this software must not be misrepresented; you must not\n" - " claim that you wrote the original software. If you use this software\n" - " in a product, an acknowledgment in the product documentation would be\n" - " appreciated but is not required.\n" - "\n" - "2. Altered source versions must be plainly marked as such, and must not be\n" - " misrepresented as being the original software.\n" - "\n" - "3. This notice may not be removed or altered from any source distribution.\n" - "\n" - "\n" - "\n" - "Uses libogg,libvorbis Copyright (c) 2002, Xiph.org Foundation\n" - "\n" - "Redistribution and use in source and binary forms, with or without\n" - "modification, are permitted provided that the following conditions\n" - "are met:\n" - "\n" - "- Redistributions of source code must retain the above copyright\n" - "notice, this list of conditions and the following disclaimer.\n" - "\n" - "- Redistributions in binary form must reproduce the above copyright\n" - "notice, this list of conditions and the following disclaimer in the\n" - "documentation and/or other materials provided with the distribution.\n" - "\n" - "- Neither the name of the DeaDBeeF Player nor the names of its\n" - "contributors may be used to endorse or promote products derived from\n" - "this software without specific prior written permission.\n" - "\n" - "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" - "``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" - "LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n" - "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR\n" - "CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n" - "EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n" - "PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n" - "PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n" - "LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n" - "NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n" - "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + "OggVorbis plugin for DeaDBeeF\n" + "Copyright (C) 2009-2014 Alexey Yakovenko et al.\n" + "\n" + "vcedit.c\n" + "Ogg Vorbis plugin Ogg edit functions\n" + "\n" + "Copyright (C) 2014 Ian Nartowicz \n" + "This software is provided 'as-is', without any express or implied\n" + "warranty. In no event will the authors be held liable for any damages\n" + "arising from the use of this software.\n" + "\n" + "Permission is granted to anyone to use this software for any purpose,\n" + "including commercial applications, and to alter it and redistribute it\n" + "freely, subject to the following restrictions:\n" + "\n" + "1. The origin of this software must not be misrepresented; you must not\n" + " claim that you wrote the original software. If you use this software\n" + " in a product, an acknowledgment in the product documentation would be\n" + " appreciated but is not required.\n" + "\n" + "2. Altered source versions must be plainly marked as such, and must not be\n" + " misrepresented as being the original software.\n" + "\n" + "3. This notice may not be removed or altered from any source distribution.\n" + "\n" + "\n" + "\n" + "Uses libogg,libvorbis Copyright (c) 2002, Xiph.org Foundation\n" + "\n" + "Redistribution and use in source and binary forms, with or without\n" + "modification, are permitted provided that the following conditions\n" + "are met:\n" + "\n" + "- Redistributions of source code must retain the above copyright\n" + "notice, this list of conditions and the following disclaimer.\n" + "\n" + "- Redistributions in binary form must reproduce the above copyright\n" + "notice, this list of conditions and the following disclaimer in the\n" + "documentation and/or other materials provided with the distribution.\n" + "\n" + "- Neither the name of the DeaDBeeF Player nor the names of its\n" + "contributors may be used to endorse or promote products derived from\n" + "this software without specific prior written permission.\n" + "\n" + "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" + "``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" + "LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n" + "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR\n" + "CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n" + "EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n" + "PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n" + "PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n" + "LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n" + "NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n" + "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" , .plugin.website = "http://deadbeef.sf.net", .plugin.start = vorbis_start, -- cgit v1.2.3 From 79a4e8c6e305cf4db47c13721418543df945bbc5 Mon Sep 17 00:00:00 2001 From: Ian Nartowicz Date: Thu, 5 Jun 2014 16:29:09 +0100 Subject: more minor indentation --- plugins/flac/flac.c | 6 +++--- plugins/vorbis/vorbis.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'plugins/flac') diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index 3564bfb0..c0522352 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -20,7 +20,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -1193,7 +1193,7 @@ static DB_decoder_t plugin = { .plugin.descr = "FLAC decoder using libFLAC", .plugin.copyright = "Copyright (C) 2009-2013 Alexey Yakovenko et al.\n" - "Uses libFLAC (C) Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson\n" + "Uses libFLAC (C) Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson\n" "Uses libogg Copyright (c) 2002, Xiph.org Foundation\n" "\n" "Redistribution and use in source and binary forms, with or without\n" @@ -1214,7 +1214,7 @@ static DB_decoder_t plugin = { "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" "``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" "LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n" - "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR\n" + "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR\n" "CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n" "EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n" "PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n" diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index 7d029367..3fb6bef2 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -3,7 +3,7 @@ Copyright (C) 2009-2014 Alexey Yakovenko and other contributors This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages + warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, @@ -37,7 +37,7 @@ #define min(x,y) ((x)<(y)?(x):(y)) #define max(x,y) ((x)>(y)?(x):(y)) -// #define trace(...) { fprintf (stderr, __VA_ARGS__); } +//#define trace(...) { fprintf (stderr, __VA_ARGS__); } #define trace(fmt,...) #if WORDS_BIGENDIAN @@ -786,7 +786,7 @@ static DB_decoder_t plugin = { "\n" "Copyright (C) 2014 Ian Nartowicz \n" "This software is provided 'as-is', without any express or implied\n" - "warranty. In no event will the authors be held liable for any damages\n" + "warranty. In no event will the authors be held liable for any damages\n" "arising from the use of this software.\n" "\n" "Permission is granted to anyone to use this software for any purpose,\n" @@ -825,7 +825,7 @@ static DB_decoder_t plugin = { "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" "``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" "LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n" - "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR\n" + "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR\n" "CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n" "EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n" "PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n" -- cgit v1.2.3 From 80f2d9bf73c143f31a44d02c651e96b6e84f1e8b Mon Sep 17 00:00:00 2001 From: Ian Nartowicz Date: Thu, 5 Jun 2014 22:38:24 +0100 Subject: Conditional compilation of oggedit call --- plugins/flac/flac.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'plugins/flac') diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index c0522352..036301d2 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -928,7 +928,7 @@ error: return err; } - +#if USE_OGGEDIT==1 int cflac_write_metadata_ogg (DB_playItem_t *it, FLAC__StreamMetadata_VorbisComment *vc) { @@ -949,7 +949,7 @@ cflac_write_metadata_ogg (DB_playItem_t *it, FLAC__StreamMetadata_VorbisComment return 0; } - +#endif int cflac_write_metadata (DB_playItem_t *it) { int err = -1; @@ -1010,7 +1010,7 @@ cflac_write_metadata (DB_playItem_t *it) { } else { // create new and add to chain - data = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); + data = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); if (!data) { fprintf (stderr, "flac: failed to allocate new vorbis comment block\n"); goto error; @@ -1160,10 +1160,12 @@ error2: } #endif - if (isogg) - res = cflac_write_metadata_ogg(it, &data->data.vorbis_comment); - else + if (!isogg) res = FLAC__metadata_chain_write (chain, 1, 0); +#if USE_OGGEDIT==1 + else + res = cflac_write_metadata_ogg(it, &data->data.vorbis_comment); +#endif if (res) { trace ("cflac_write_metadata: failed to write tags: code %d\n", res); goto error; -- cgit v1.2.3 From 1cd417fc09faec13357268141767b24b8033eea7 Mon Sep 17 00:00:00 2001 From: Ian Nartowicz Date: Fri, 6 Jun 2014 18:24:45 +0100 Subject: #if USE_OGGEDIT changes, and pl_unlock() fixes --- plugins/flac/flac.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'plugins/flac') 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 -- cgit v1.2.3