metadata.h
Go to the documentation of this file.
/* libFLAC++ - Free Lossless Audio Codec library
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2013 Xiph.Org Foundation
*
* 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 Xiph.org Foundation 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.
*/
#ifndef FLACPP__METADATA_H
#define FLACPP__METADATA_H
#include "export.h"
#include "FLAC/metadata.h"
// ===============================================================
//
// Full documentation for the metadata interface can be found
// in the C layer in include/FLAC/metadata.h
//
// ===============================================================
namespace FLAC {
namespace Metadata {
// ============================================================
//
// Metadata objects
//
// ============================================================
class FLACPP_API Prototype {
protected:
Prototype(const Prototype &);
Prototype(const ::FLAC__StreamMetadata &);
Prototype(const ::FLAC__StreamMetadata *);
Prototype(::FLAC__StreamMetadata *object, bool copy);
Prototype &operator=(const Prototype &);
Prototype &operator=(const ::FLAC__StreamMetadata &);
Prototype &operator=(const ::FLAC__StreamMetadata *);
Prototype &assign_object(::FLAC__StreamMetadata *object, bool copy);
virtual void clear();
::FLAC__StreamMetadata *object_;
public:
virtual ~Prototype();
inline bool operator==(const Prototype &) const;
inline bool operator==(const ::FLAC__StreamMetadata &) const;
inline bool operator==(const ::FLAC__StreamMetadata *) const;
inline bool operator!=(const Prototype &) const;
inline bool operator!=(const ::FLAC__StreamMetadata &) const;
inline bool operator!=(const ::FLAC__StreamMetadata *) const;
friend class SimpleIterator;
friend class Iterator;
inline bool is_valid() const;
bool get_is_last() const;
::FLAC__MetadataType get_type() const;
unsigned get_length() const;
void set_is_last(bool);
inline operator const ::FLAC__StreamMetadata *() const;
private:
Prototype();
// These are used only by Iterator
bool is_reference_;
inline void set_reference(bool x) { is_reference_ = x; }
};
#ifdef _MSC_VER
// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
#pragma warning ( disable : 4800 )
#endif
inline bool Prototype::operator==(const Prototype &object) const
{ return (bool)::FLAC__metadata_object_is_equal(object_, object.object_); }
inline bool Prototype::operator==(const ::FLAC__StreamMetadata &object) const
{ return (bool)::FLAC__metadata_object_is_equal(object_, &object); }
inline bool Prototype::operator==(const ::FLAC__StreamMetadata *object) const
{ return (bool)::FLAC__metadata_object_is_equal(object_, object); }
#ifdef _MSC_VER
// @@@ how to re-enable? the following doesn't work
// #pragma warning ( enable : 4800 )
#endif
inline bool Prototype::operator!=(const Prototype &object) const
{ return !operator==(object); }
inline bool Prototype::operator!=(const ::FLAC__StreamMetadata &object) const
{ return !operator==(object); }
inline bool Prototype::operator!=(const ::FLAC__StreamMetadata *object) const
{ return !operator==(object); }
inline bool Prototype::is_valid() const
{ return 0 != object_; }
inline Prototype::operator const ::FLAC__StreamMetadata *() const
{ return object_; }
FLACPP_API Prototype *clone(const Prototype *);
class FLACPP_API StreamInfo : public Prototype {
public:
StreamInfo();
inline StreamInfo(const StreamInfo &object): Prototype(object) { }
inline StreamInfo(const ::FLAC__StreamMetadata &object): Prototype(object) { }
inline StreamInfo(const ::FLAC__StreamMetadata *object): Prototype(object) { }
inline StreamInfo(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
~StreamInfo();
inline StreamInfo &operator=(const StreamInfo &object) { Prototype::operator=(object); return *this; }
inline StreamInfo &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
inline StreamInfo &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
inline StreamInfo &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
inline bool operator==(const StreamInfo &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
inline bool operator!=(const StreamInfo &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
unsigned get_min_blocksize() const;
unsigned get_max_blocksize() const;
unsigned get_min_framesize() const;
unsigned get_max_framesize() const;
unsigned get_sample_rate() const;
unsigned get_channels() const;
unsigned get_bits_per_sample() const;
FLAC__uint64 get_total_samples() const;
const FLAC__byte *get_md5sum() const;
void set_min_blocksize(unsigned value);
void set_max_blocksize(unsigned value);
void set_min_framesize(unsigned value);
void set_max_framesize(unsigned value);
void set_sample_rate(unsigned value);
void set_channels(unsigned value);
void set_bits_per_sample(unsigned value);
void set_total_samples(FLAC__uint64 value);
void set_md5sum(const FLAC__byte value[16]);
};
class FLACPP_API Padding : public Prototype {
public:
Padding();
inline Padding(const Padding &object): Prototype(object) { }
inline Padding(const ::FLAC__StreamMetadata &object): Prototype(object) { }
inline Padding(const ::FLAC__StreamMetadata *object): Prototype(object) { }
inline Padding(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Padding(unsigned length);
~Padding();
inline Padding &operator=(const Padding &object) { Prototype::operator=(object); return *this; }
inline Padding &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
inline Padding &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
inline Padding &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
inline bool operator==(const Padding &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
inline bool operator!=(const Padding &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
void set_length(unsigned length);
};
class FLACPP_API Application : public Prototype {
public:
Application();
//
inline Application(const Application &object): Prototype(object) { }
inline Application(const ::FLAC__StreamMetadata &object): Prototype(object) { }
inline Application(const ::FLAC__StreamMetadata *object): Prototype(object) { }
inline Application(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
~Application();
inline Application &operator=(const Application &object) { Prototype::operator=(object); return *this; }
inline Application &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
inline Application &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
inline Application &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
inline bool operator==(const Application &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
inline bool operator!=(const Application &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
const FLAC__byte *get_id() const;
const FLAC__byte *get_data() const;
void set_id(const FLAC__byte value[4]);
bool set_data(const FLAC__byte *data, unsigned length);
bool set_data(FLAC__byte *data, unsigned length, bool copy);
};
class FLACPP_API SeekTable : public Prototype {
public:
SeekTable();
inline SeekTable(const SeekTable &object): Prototype(object) { }
inline SeekTable(const ::FLAC__StreamMetadata &object): Prototype(object) { }
inline SeekTable(const ::FLAC__StreamMetadata *object): Prototype(object) { }
inline SeekTable(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
~SeekTable();
inline SeekTable &operator=(const SeekTable &object) { Prototype::operator=(object); return *this; }
inline SeekTable &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
inline SeekTable &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
inline SeekTable &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
inline bool operator==(const SeekTable &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
inline bool operator!=(const SeekTable &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
unsigned get_num_points() const;
::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const;
bool resize_points(unsigned new_num_points);
void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
bool delete_point(unsigned index);
bool is_legal() const;
bool template_append_placeholders(unsigned num);
bool template_append_point(FLAC__uint64 sample_number);
bool template_append_points(FLAC__uint64 sample_numbers[], unsigned num);
bool template_append_spaced_points(unsigned num, FLAC__uint64 total_samples);
bool template_append_spaced_points_by_samples(unsigned samples, FLAC__uint64 total_samples);
bool template_sort(bool compact);
};
class FLACPP_API VorbisComment : public Prototype {
public:
class FLACPP_API Entry {
public:
Entry();
Entry(const char *field, unsigned field_length);
Entry(const char *field); // assumes \a field is NUL-terminated
Entry(const char *field_name, const char *field_value, unsigned field_value_length);
Entry(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
Entry(const Entry &entry);
Entry &operator=(const Entry &entry);
virtual ~Entry();
virtual bool is_valid() const;
unsigned get_field_length() const;
unsigned get_field_name_length() const;
unsigned get_field_value_length() const;
::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const;
const char *get_field() const;
const char *get_field_name() const;
const char *get_field_value() const;
bool set_field(const char *field, unsigned field_length);
bool set_field(const char *field); // assumes \a field is NUL-terminated
bool set_field_name(const char *field_name);
bool set_field_value(const char *field_value, unsigned field_value_length);
bool set_field_value(const char *field_value); // assumes \a field_value is NUL-terminated
protected:
bool is_valid_;
::FLAC__StreamMetadata_VorbisComment_Entry entry_;
char *field_name_;
unsigned field_name_length_;
char *field_value_;
unsigned field_value_length_;
private:
void zero();
void clear();
void clear_entry();
void clear_field_name();
void clear_field_value();
void construct(const char *field, unsigned field_length);
void construct(const char *field); // assumes \a field is NUL-terminated
void construct(const char *field_name, const char *field_value, unsigned field_value_length);
void construct(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
void compose_field();
void parse_field();
};
VorbisComment();
inline VorbisComment(const VorbisComment &object): Prototype(object) { }
inline VorbisComment(const ::FLAC__StreamMetadata &object): Prototype(object) { }
inline VorbisComment(const ::FLAC__StreamMetadata *object): Prototype(object) { }
inline VorbisComment(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
~VorbisComment();
inline VorbisComment &operator=(const VorbisComment &object) { Prototype::operator=(object); return *this; }
inline VorbisComment &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
inline VorbisComment &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
inline VorbisComment &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
inline bool operator==(const VorbisComment &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
inline bool operator!=(const VorbisComment &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
unsigned get_num_comments() const;
const FLAC__byte *get_vendor_string() const; // NUL-terminated UTF-8 string
Entry get_comment(unsigned index) const;
bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string
bool resize_comments(unsigned new_num_comments);
bool set_comment(unsigned index, const Entry &entry);
bool insert_comment(unsigned index, const Entry &entry);
bool append_comment(const Entry &entry);
bool replace_comment(const Entry &entry, bool all);
bool delete_comment(unsigned index);
int find_entry_from(unsigned offset, const char *field_name);
int remove_entry_matching(const char *field_name);
int remove_entries_matching(const char *field_name);
};
class FLACPP_API CueSheet : public Prototype {
public:
class FLACPP_API Track {
protected:
::FLAC__StreamMetadata_CueSheet_Track *object_;
public:
Track();
Track(const ::FLAC__StreamMetadata_CueSheet_Track *track);
Track(const Track &track);
Track &operator=(const Track &track);
virtual ~Track();
virtual bool is_valid() const;
inline FLAC__uint64 get_offset() const { return object_->offset; }
inline FLAC__byte get_number() const { return object_->number; }
inline const char *get_isrc() const { return object_->isrc; }
inline unsigned get_type() const { return object_->type; }
inline bool get_pre_emphasis() const { return object_->pre_emphasis; }
inline FLAC__byte get_num_indices() const { return object_->num_indices; }
::FLAC__StreamMetadata_CueSheet_Index get_index(unsigned i) const;
inline const ::FLAC__StreamMetadata_CueSheet_Track *get_track() const { return object_; }
inline void set_offset(FLAC__uint64 value) { object_->offset = value; }
inline void set_number(FLAC__byte value) { object_->number = value; }
void set_isrc(const char value[12]);
void set_type(unsigned value);
inline void set_pre_emphasis(bool value) { object_->pre_emphasis = value? 1 : 0; }
void set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index);
//@@@ It's awkward but to insert/delete index points
//@@@ you must use the routines in the CueSheet class.
};
CueSheet();
inline CueSheet(const CueSheet &object): Prototype(object) { }
inline CueSheet(const ::FLAC__StreamMetadata &object): Prototype(object) { }
inline CueSheet(const ::FLAC__StreamMetadata *object): Prototype(object) { }
inline CueSheet(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
~CueSheet();
inline CueSheet &operator=(const CueSheet &object) { Prototype::operator=(object); return *this; }
inline CueSheet &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
inline CueSheet &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
inline CueSheet &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
inline bool operator==(const CueSheet &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
inline bool operator!=(const CueSheet &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
const char *get_media_catalog_number() const;
FLAC__uint64 get_lead_in() const;
bool get_is_cd() const;
unsigned get_num_tracks() const;
Track get_track(unsigned i) const;
void set_media_catalog_number(const char value[128]);
void set_lead_in(FLAC__uint64 value);
void set_is_cd(bool value);
void set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
bool resize_indices(unsigned track_num, unsigned new_num_indices);
bool insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
bool insert_blank_index(unsigned track_num, unsigned index_num);
bool delete_index(unsigned track_num, unsigned index_num);
bool resize_tracks(unsigned new_num_tracks);
bool set_track(unsigned i, const Track &track);
bool insert_track(unsigned i, const Track &track);
bool insert_blank_track(unsigned i);
bool delete_track(unsigned i);
bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const;
FLAC__uint32 calculate_cddb_id() const;
};
class FLACPP_API Picture : public Prototype {
public:
Picture();
inline Picture(const Picture &object): Prototype(object) { }
inline Picture(const ::FLAC__StreamMetadata &object): Prototype(object) { }
inline Picture(const ::FLAC__StreamMetadata *object): Prototype(object) { }
inline Picture(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
~Picture();
inline Picture &operator=(const Picture &object) { Prototype::operator=(object); return *this; }
inline Picture &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
inline Picture &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
inline Picture &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
inline bool operator==(const Picture &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
inline bool operator!=(const Picture &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
::FLAC__StreamMetadata_Picture_Type get_type() const;
const char *get_mime_type() const; // NUL-terminated printable ASCII string
const FLAC__byte *get_description() const; // NUL-terminated UTF-8 string
FLAC__uint32 get_width() const;
FLAC__uint32 get_height() const;
FLAC__uint32 get_depth() const;
FLAC__uint32 get_colors() const;
FLAC__uint32 get_data_length() const;
const FLAC__byte *get_data() const;
void set_type(::FLAC__StreamMetadata_Picture_Type type);
bool set_mime_type(const char *string); // NUL-terminated printable ASCII string
bool set_description(const FLAC__byte *string); // NUL-terminated UTF-8 string
void set_width(FLAC__uint32 value) const;
void set_height(FLAC__uint32 value) const;
void set_depth(FLAC__uint32 value) const;
void set_colors(FLAC__uint32 value) const;
bool set_data(const FLAC__byte *data, FLAC__uint32 data_length);
bool is_legal(const char **violation);
};
class FLACPP_API Unknown : public Prototype {
public:
Unknown();
//
inline Unknown(const Unknown &object): Prototype(object) { }
inline Unknown(const ::FLAC__StreamMetadata &object): Prototype(object) { }
inline Unknown(const ::FLAC__StreamMetadata *object): Prototype(object) { }
inline Unknown(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
~Unknown();
inline Unknown &operator=(const Unknown &object) { Prototype::operator=(object); return *this; }
inline Unknown &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
inline Unknown &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
inline Unknown &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
inline bool operator==(const Unknown &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
inline bool operator!=(const Unknown &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
const FLAC__byte *get_data() const;
bool set_data(const FLAC__byte *data, unsigned length);
bool set_data(FLAC__byte *data, unsigned length, bool copy);
};
/* \} */
FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo);
FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags);
FLACPP_API bool get_tags(const char *filename, VorbisComment &tags);
FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet);
FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet);
FLACPP_API bool get_picture(const char *filename, Picture *&picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors);
FLACPP_API bool get_picture(const char *filename, Picture &picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors);
/* \} */
class FLACPP_API SimpleIterator {
public:
class FLACPP_API Status {
public:
inline Status(::FLAC__Metadata_SimpleIteratorStatus status): status_(status) { }
inline operator ::FLAC__Metadata_SimpleIteratorStatus() const { return status_; }
inline const char *as_cstring() const { return ::FLAC__Metadata_SimpleIteratorStatusString[status_]; }
protected:
::FLAC__Metadata_SimpleIteratorStatus status_;
};
SimpleIterator();
virtual ~SimpleIterator();
bool is_valid() const;
bool init(const char *filename, bool read_only, bool preserve_file_stats);
Status status();
bool is_writable() const;
bool next();
bool prev();
bool is_last() const;
off_t get_block_offset() const;
::FLAC__MetadataType get_block_type() const;
unsigned get_block_length() const;
bool get_application_id(FLAC__byte *id);
Prototype *get_block();
bool set_block(Prototype *block, bool use_padding = true);
bool insert_block_after(Prototype *block, bool use_padding = true);
bool delete_block(bool use_padding = true);
protected:
::FLAC__Metadata_SimpleIterator *iterator_;
void clear();
};
/* \} */
class FLACPP_API Chain {
public:
class FLACPP_API Status {
public:
inline Status(::FLAC__Metadata_ChainStatus status): status_(status) { }
inline operator ::FLAC__Metadata_ChainStatus() const { return status_; }
inline const char *as_cstring() const { return ::FLAC__Metadata_ChainStatusString[status_]; }
protected:
::FLAC__Metadata_ChainStatus status_;
};
Chain();
virtual ~Chain();
friend class Iterator;
bool is_valid() const;
Status status();
bool read(const char *filename, bool is_ogg = false);
bool read(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, bool is_ogg = false);
bool check_if_tempfile_needed(bool use_padding);
bool write(bool use_padding = true, bool preserve_file_stats = false);
bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks);
bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks, ::FLAC__IOHandle temp_handle, ::FLAC__IOCallbacks temp_callbacks);
void merge_padding();
void sort_padding();
protected:
::FLAC__Metadata_Chain *chain_;
virtual void clear();
};
class FLACPP_API Iterator {
public:
Iterator();
virtual ~Iterator();
bool is_valid() const;
void init(Chain &chain);
bool next();
bool prev();
::FLAC__MetadataType get_block_type() const;
Prototype *get_block();
bool set_block(Prototype *block);
bool delete_block(bool replace_with_padding);
bool insert_block_before(Prototype *block);
bool insert_block_after(Prototype *block);
protected:
::FLAC__Metadata_Iterator *iterator_;
virtual void clear();
};
/* \} */
}
}
#endif

Copyright (c) 2000-2009 Josh Coalson Copyright (c) 2011-2013 Xiph.Org Foundation |