From b8fdb452be9d79492b4bff84d2990cfcb1da282b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 4 Oct 2012 07:09:31 +0200 Subject: decoder/flac: support FLAC files inside archives Implement the "scan_stream" method that can read tags from any input_stream object. This requires a FLAC__IOCallbacks implementation based on the input_stream API. --- src/decoder/FLACMetaData.hxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/decoder/FLACMetaData.hxx') diff --git a/src/decoder/FLACMetaData.hxx b/src/decoder/FLACMetaData.hxx index 9808852f3..7b5eb8b0c 100644 --- a/src/decoder/FLACMetaData.hxx +++ b/src/decoder/FLACMetaData.hxx @@ -21,6 +21,7 @@ #define MPD_FLAC_METADATA_H #include "gcc.h" +#include "FLACIOHandle.hxx" #include @@ -45,10 +46,30 @@ public: return ::FLAC__metadata_chain_read(chain, path); } + bool Read(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks) { + return ::FLAC__metadata_chain_read_with_callbacks(chain, + handle, + callbacks); + } + + bool Read(input_stream *is) { + return Read(::ToFLACIOHandle(is), ::GetFLACIOCallbacks(is)); + } + bool ReadOgg(const char *path) { return ::FLAC__metadata_chain_read_ogg(chain, path); } + bool ReadOgg(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks) { + return ::FLAC__metadata_chain_read_ogg_with_callbacks(chain, + handle, + callbacks); + } + + bool ReadOgg(input_stream *is) { + return ReadOgg(::ToFLACIOHandle(is), ::GetFLACIOCallbacks(is)); + } + gcc_pure FLAC__Metadata_ChainStatus GetStatus() const { return ::FLAC__metadata_chain_status(chain); -- cgit v1.2.3