diff options
author | Max Kellermann <max@duempel.org> | 2012-10-02 11:24:05 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-10-02 17:37:07 +0200 |
commit | c645b906f32b5ed0f9b206ca5680b19983ce25e2 (patch) | |
tree | 366b6c54e1e0187fe483f2d2ef51a4f708a6eec2 /src/decoder/FLACDecoderPlugin.cxx | |
parent | 9c1d1ef2687050d7e0f9dd51d7e06d79321cda74 (diff) | |
download | mpd-c645b906f32b5ed0f9b206ca5680b19983ce25e2.tar.gz mpd-c645b906f32b5ed0f9b206ca5680b19983ce25e2.tar.xz mpd-c645b906f32b5ed0f9b206ca5680b19983ce25e2.zip |
decoder/flac: add C++ libFLAC wrappers
Not using libFLAC++ because this library adds a lot of overhead due to
virtual method calls. This new class library is zero-overhead.
Diffstat (limited to '')
-rw-r--r-- | src/decoder/FLACDecoderPlugin.cxx | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/decoder/FLACDecoderPlugin.cxx b/src/decoder/FLACDecoderPlugin.cxx index d541e6990..5de0ccef3 100644 --- a/src/decoder/FLACDecoderPlugin.cxx +++ b/src/decoder/FLACDecoderPlugin.cxx @@ -366,27 +366,22 @@ static bool oggflac_scan_file(const char *file, const struct tag_handler *handler, void *handler_ctx) { - FLAC__Metadata_Iterator *it; - FLAC__StreamMetadata *block; - FLAC__Metadata_Chain *chain = FLAC__metadata_chain_new(); - - if (!(FLAC__metadata_chain_read_ogg(chain, file))) { - FLAC__metadata_chain_delete(chain); + FLACMetadataChain chain; + if (!chain.ReadOgg(file)) { + g_debug("Failed to read OggFLAC tags: %s", + chain.GetStatusString()); return false; } - it = FLAC__metadata_iterator_new(); - FLAC__metadata_iterator_init(it, chain); - + FLACMetadataIterator iterator(chain); do { - if (!(block = FLAC__metadata_iterator_get_block(it))) + FLAC__StreamMetadata *block = iterator.GetBlock(); + if (block == nullptr) break; flac_scan_metadata(block, handler, handler_ctx); - } while (FLAC__metadata_iterator_next(it)); - FLAC__metadata_iterator_delete(it); + } while (iterator.Next()); - FLAC__metadata_chain_delete(chain); return true; } |