summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rw-r--r--src/decoder/plugins/FlacMetadata.cxx1
-rw-r--r--src/decoder/plugins/FlacMetadata.hxx25
-rw-r--r--src/lib/xiph/FlacMetadataIterator.hxx52
4 files changed, 54 insertions, 25 deletions
diff --git a/Makefile.am b/Makefile.am
index 64e4b1d4e..a0ee2273b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1198,6 +1198,7 @@ endif
if ENABLE_FLAC
libdecoder_a_SOURCES += \
+ src/lib/xiph/FlacMetadataIterator.hxx \
src/decoder/plugins/FlacInput.cxx src/decoder/plugins/FlacInput.hxx \
src/decoder/plugins/FlacIOHandle.cxx src/decoder/plugins/FlacIOHandle.hxx \
src/decoder/plugins/FlacMetadata.cxx src/decoder/plugins/FlacMetadata.hxx \
diff --git a/src/decoder/plugins/FlacMetadata.cxx b/src/decoder/plugins/FlacMetadata.cxx
index 9f1bc9073..916e05ade 100644
--- a/src/decoder/plugins/FlacMetadata.cxx
+++ b/src/decoder/plugins/FlacMetadata.cxx
@@ -20,6 +20,7 @@
#include "config.h"
#include "FlacMetadata.hxx"
#include "lib/xiph/XiphTags.hxx"
+#include "lib/xiph/FlacMetadataIterator.hxx"
#include "MixRampInfo.hxx"
#include "tag/Handler.hxx"
#include "tag/Table.hxx"
diff --git a/src/decoder/plugins/FlacMetadata.hxx b/src/decoder/plugins/FlacMetadata.hxx
index e84119b31..35564a35b 100644
--- a/src/decoder/plugins/FlacMetadata.hxx
+++ b/src/decoder/plugins/FlacMetadata.hxx
@@ -85,31 +85,6 @@ public:
void Scan(TagHandler &handler) noexcept;
};
-class FLACMetadataIterator {
- FLAC__Metadata_Iterator *iterator;
-
-public:
- FLACMetadataIterator():iterator(::FLAC__metadata_iterator_new()) {}
-
- FLACMetadataIterator(FLAC__Metadata_Chain *chain)
- :iterator(::FLAC__metadata_iterator_new()) {
- ::FLAC__metadata_iterator_init(iterator, chain);
- }
-
- ~FLACMetadataIterator() {
- ::FLAC__metadata_iterator_delete(iterator);
- }
-
- bool Next() noexcept {
- return ::FLAC__metadata_iterator_next(iterator);
- }
-
- gcc_pure
- FLAC__StreamMetadata *GetBlock() noexcept {
- return ::FLAC__metadata_iterator_get_block(iterator);
- }
-};
-
struct Tag;
struct ReplayGainInfo;
diff --git a/src/lib/xiph/FlacMetadataIterator.hxx b/src/lib/xiph/FlacMetadataIterator.hxx
new file mode 100644
index 000000000..6890e1342
--- /dev/null
+++ b/src/lib/xiph/FlacMetadataIterator.hxx
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2003-2018 The Music Player Daemon Project
+ * http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPD_FLAC_METADATA_ITERATOR_HXX
+#define MPD_FLAC_METADATA_ITERATOR_HXX
+
+#include "Compiler.h"
+
+#include <FLAC/metadata.h>
+
+class FLACMetadataIterator {
+ FLAC__Metadata_Iterator *iterator;
+
+public:
+ FLACMetadataIterator():iterator(::FLAC__metadata_iterator_new()) {}
+
+ FLACMetadataIterator(FLAC__Metadata_Chain *chain)
+ :iterator(::FLAC__metadata_iterator_new()) {
+ ::FLAC__metadata_iterator_init(iterator, chain);
+ }
+
+ ~FLACMetadataIterator() {
+ ::FLAC__metadata_iterator_delete(iterator);
+ }
+
+ bool Next() noexcept {
+ return ::FLAC__metadata_iterator_next(iterator);
+ }
+
+ gcc_pure
+ FLAC__StreamMetadata *GetBlock() noexcept {
+ return ::FLAC__metadata_iterator_get_block(iterator);
+ }
+};
+
+#endif