include/FLAC++/metadata.h Source File

Main Page Modules Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# include/FLAC++/metadata.h

Go to the documentation of this file.

    00001 /* libFLAC++ - Free Lossless Audio Codec library
    00002  * Copyright (C) 2002,2003,2004,2005  Josh Coalson
    00003  *
    00004  * Redistribution and use in source and binary forms, with or without
    00005  * modification, are permitted provided that the following conditions
    00006  * are met:
    00007  *
    00008  * - Redistributions of source code must retain the above copyright
    00009  * notice, this list of conditions and the following disclaimer.
    00010  *
    00011  * - Redistributions in binary form must reproduce the above copyright
    00012  * notice, this list of conditions and the following disclaimer in the
    00013  * documentation and/or other materials provided with the distribution.
    00014  *
    00015  * - Neither the name of the Xiph.org Foundation nor the names of its
    00016  * contributors may be used to endorse or promote products derived from
    00017  * this software without specific prior written permission.
    00018  *
    00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    00020  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    00021  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    00022  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
    00023  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    00024  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    00025  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    00026  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    00027  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    00028  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00029  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00030  */
    00031
    00032 #ifndef FLACPP__METADATA_H
    00033 #define FLACPP__METADATA_H
    00034
    00035 #include "export.h"
    00036
    00037 #include "FLAC/metadata.h"
    00038
    00039 // ===============================================================
    00040 //
    00041 //  Full documentation for the metadata interface can be found
    00042 //  in the C layer in include/FLAC/metadata.h
    00043 //
    00044 // ===============================================================
    00045
    00071 namespace FLAC {
    00072     namespace Metadata {
    00073
    00074         // ============================================================
    00075         //
    00076         //  Metadata objects
    00077         //
    00078         // ============================================================
    00079
    00104         class FLACPP_API Prototype {
    00105         protected:
    00107
    00110             Prototype(const Prototype &);
    00111             Prototype(const ::FLAC__StreamMetadata &);
    00112             Prototype(const ::FLAC__StreamMetadata *);
    00114
    00125             Prototype(::FLAC__StreamMetadata *object, bool copy);
    00126
    00128
    00129             Prototype &operator=(const Prototype &);
    00130             Prototype &operator=(const ::FLAC__StreamMetadata &);
    00131             Prototype &operator=(const ::FLAC__StreamMetadata *);
    00133
    00137             Prototype &assign_object(::FLAC__StreamMetadata *object, bool copy);
    00138
    00141             virtual void clear();
    00142
    00143             ::FLAC__StreamMetadata *object_;
    00144         public:
    00147             virtual ~Prototype();
    00148
    00150
    00151             inline bool operator==(const Prototype &) const;
    00152             inline bool operator==(const ::FLAC__StreamMetadata &) const;
    00153             inline bool operator==(const ::FLAC__StreamMetadata *) const;
    00155
    00157
    00158             inline bool operator!=(const Prototype &) const;
    00159             inline bool operator!=(const ::FLAC__StreamMetadata &) const;
    00160             inline bool operator!=(const ::FLAC__StreamMetadata *) const;
    00162
    00163             friend class SimpleIterator;
    00164             friend class Iterator;
    00165
    00170             inline bool is_valid() const;
    00171
    00178             bool get_is_last() const;
    00179
    00185             ::FLAC__MetadataType get_type() const;
    00186
    00196             unsigned get_length() const;
    00197
    00204             void set_is_last(bool);
    00205
    00213             inline operator const ::FLAC__StreamMetadata *() const;
    00214         private:
    00216             Prototype();
    00217
    00218             // These are used only by Iterator
    00219             bool is_reference_;
    00220             inline void set_reference(bool x) { is_reference_ = x; }
    00221         };
    00222
    00223 #ifdef _MSC_VER
    00224 // warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
    00225 #pragma warning ( disable : 4800 )
    00226 #endif
    00227
    00228         inline bool Prototype::operator==(const Prototype &object) const
    00229         { return (bool)::FLAC__metadata_object_is_equal(object_, object.object_); }
    00230
    00231         inline bool Prototype::operator==(const ::FLAC__StreamMetadata &object) const
    00232         { return (bool)::FLAC__metadata_object_is_equal(object_, &object); }
    00233
    00234         inline bool Prototype::operator==(const ::FLAC__StreamMetadata *object) const
    00235         { return (bool)::FLAC__metadata_object_is_equal(object_, object); }
    00236
    00237 #ifdef _MSC_VER
    00238 // @@@ how to re-enable?  the following doesn't work
    00239 // #pragma warning ( enable : 4800 )
    00240 #endif
    00241
    00242         inline bool Prototype::operator!=(const Prototype &object) const
    00243         { return !operator==(object); }
    00244
    00245         inline bool Prototype::operator!=(const ::FLAC__StreamMetadata &object) const
    00246         { return !operator==(object); }
    00247
    00248         inline bool Prototype::operator!=(const ::FLAC__StreamMetadata *object) const
    00249         { return !operator==(object); }
    00250
    00251         inline bool Prototype::is_valid() const
    00252         { return 0 != object_; }
    00253
    00254         inline Prototype::operator const ::FLAC__StreamMetadata *() const
    00255         { return object_; }
    00256
    00258         FLACPP_API Prototype *clone(const Prototype *);
    00259
    00260
    00264         class FLACPP_API StreamInfo : public Prototype {
    00265         public:
    00266             StreamInfo();
    00267
    00269
    00272             inline StreamInfo(const StreamInfo &object): Prototype(object) { }
    00273             inline StreamInfo(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00274             inline StreamInfo(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00276
    00280             inline StreamInfo(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00281
    00282             ~StreamInfo();
    00283
    00285
    00286             inline StreamInfo &operator=(const StreamInfo &object) { Prototype::operator=(object); return *this; }
    00287             inline StreamInfo &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00288             inline StreamInfo &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00290
    00294             inline StreamInfo &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00295
    00297
    00298             inline bool operator==(const StreamInfo &object) const { return Prototype::operator==(object); }
    00299             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00300             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00302
    00304
    00305             inline bool operator!=(const StreamInfo &object) const { return Prototype::operator!=(object); }
    00306             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00307             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00309
    00311
    00312             unsigned get_min_blocksize() const;
    00313             unsigned get_max_blocksize() const;
    00314             unsigned get_min_framesize() const;
    00315             unsigned get_max_framesize() const;
    00316             unsigned get_sample_rate() const;
    00317             unsigned get_channels() const;
    00318             unsigned get_bits_per_sample() const;
    00319             FLAC__uint64 get_total_samples() const;
    00320             const FLAC__byte *get_md5sum() const;
    00321
    00322             void set_min_blocksize(unsigned value);
    00323             void set_max_blocksize(unsigned value);
    00324             void set_min_framesize(unsigned value);
    00325             void set_max_framesize(unsigned value);
    00326             void set_sample_rate(unsigned value);
    00327             void set_channels(unsigned value);
    00328             void set_bits_per_sample(unsigned value);
    00329             void set_total_samples(FLAC__uint64 value);
    00330             void set_md5sum(const FLAC__byte value[16]);
    00332         };
    00333
    00337         class FLACPP_API Padding : public Prototype {
    00338         public:
    00339             Padding();
    00340
    00342
    00345             inline Padding(const Padding &object): Prototype(object) { }
    00346             inline Padding(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00347             inline Padding(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00349
    00353             inline Padding(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00354
    00355             ~Padding();
    00356
    00358
    00359             inline Padding &operator=(const Padding &object) { Prototype::operator=(object); return *this; }
    00360             inline Padding &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00361             inline Padding &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00363
    00367             inline Padding &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00368
    00370
    00371             inline bool operator==(const Padding &object) const { return Prototype::operator==(object); }
    00372             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00373             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00375
    00377
    00378             inline bool operator!=(const Padding &object) const { return Prototype::operator!=(object); }
    00379             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00380             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00382
    00383             void set_length(unsigned length);
    00384         };
    00385
    00389         class FLACPP_API Application : public Prototype {
    00390         public:
    00391             Application();
    00392             //
    00394             /** Constructs a copy of the given object.  This form
    00395              *  always performs a deep copy.
    00396              */
    00397             inline Application(const Application &object): Prototype(object) { }
    00398             inline Application(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00399             inline Application(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00401
    00405             inline Application(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00406
    00407             ~Application();
    00408
    00410
    00411             inline Application &operator=(const Application &object) { Prototype::operator=(object); return *this; }
    00412             inline Application &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00413             inline Application &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00415
    00419             inline Application &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00420
    00422
    00423             inline bool operator==(const Application &object) const { return Prototype::operator==(object); }
    00424             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00425             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00427
    00429
    00430             inline bool operator!=(const Application &object) const { return Prototype::operator!=(object); }
    00431             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00432             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00434
    00435             const FLAC__byte *get_id() const;
    00436             const FLAC__byte *get_data() const;
    00437
    00438             void set_id(const FLAC__byte value[4]);
    00440             bool set_data(const FLAC__byte *data, unsigned length);
    00441             bool set_data(FLAC__byte *data, unsigned length, bool copy);
    00442         };
    00443
    00447         class FLACPP_API SeekTable : public Prototype {
    00448         public:
    00449             SeekTable();
    00450
    00452
    00455             inline SeekTable(const SeekTable &object): Prototype(object) { }
    00456             inline SeekTable(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00457             inline SeekTable(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00459
    00463             inline SeekTable(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00464
    00465             ~SeekTable();
    00466
    00468
    00469             inline SeekTable &operator=(const SeekTable &object) { Prototype::operator=(object); return *this; }
    00470             inline SeekTable &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00471             inline SeekTable &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00473
    00477             inline SeekTable &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00478
    00480
    00481             inline bool operator==(const SeekTable &object) const { return Prototype::operator==(object); }
    00482             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00483             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00485
    00487
    00488             inline bool operator!=(const SeekTable &object) const { return Prototype::operator!=(object); }
    00489             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00490             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00492
    00493             unsigned get_num_points() const;
    00494             ::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const;
    00495
    00497             void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
    00498
    00500             bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
    00501
    00503             bool delete_point(unsigned index);
    00504
    00506             bool is_legal() const;
    00507         };
    00508
    00512         class FLACPP_API VorbisComment : public Prototype {
    00513         public:
    00543             class FLACPP_API Entry {
    00544             public:
    00545                 Entry();
    00546
    00547                 Entry(const char *field, unsigned field_length);
    00548                 Entry(const char *field); // assumes \a field is NUL-terminated
    00549
    00550                 Entry(const char *field_name, const char *field_value, unsigned field_value_length);
    00551                 Entry(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
    00552
    00553                 Entry(const Entry &entry);
    00554
    00555                 Entry &operator=(const Entry &entry);
    00556
    00557                 virtual ~Entry();
    00558
    00559                 virtual bool is_valid() const;
    00560
    00561                 unsigned get_field_length() const;
    00562                 unsigned get_field_name_length() const;
    00563                 unsigned get_field_value_length() const;
    00564
    00565                 ::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const;
    00566                 const char *get_field() const;
    00567                 const char *get_field_name() const;
    00568                 const char *get_field_value() const;
    00569
    00570                 bool set_field(const char *field, unsigned field_length);
    00571                 bool set_field(const char *field); // assumes \a field is NUL-terminated
    00572                 bool set_field_name(const char *field_name);
    00573                 bool set_field_value(const char *field_value, unsigned field_value_length);
    00574                 bool set_field_value(const char *field_value); // assumes \a field_value is NUL-terminated
    00575             protected:
    00576                 bool is_valid_;
    00577                 ::FLAC__StreamMetadata_VorbisComment_Entry entry_;
    00578                 char *field_name_;
    00579                 unsigned field_name_length_;
    00580                 char *field_value_;
    00581                 unsigned field_value_length_;
    00582             private:
    00583                 void zero();
    00584                 void clear();
    00585                 void clear_entry();
    00586                 void clear_field_name();
    00587                 void clear_field_value();
    00588                 void construct(const char *field, unsigned field_length);
    00589                 void construct(const char *field); // assumes \a field is NUL-terminated
    00590                 void construct(const char *field_name, const char *field_value, unsigned field_value_length);
    00591                 void construct(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
    00592                 void compose_field();
    00593                 void parse_field();
    00594             };
    00595
    00596             VorbisComment();
    00597
    00599
    00602             inline VorbisComment(const VorbisComment &object): Prototype(object) { }
    00603             inline VorbisComment(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00604             inline VorbisComment(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00606
    00610             inline VorbisComment(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00611
    00612             ~VorbisComment();
    00613
    00615
    00616             inline VorbisComment &operator=(const VorbisComment &object) { Prototype::operator=(object); return *this; }
    00617             inline VorbisComment &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00618             inline VorbisComment &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00620
    00624             inline VorbisComment &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00625
    00627
    00628             inline bool operator==(const VorbisComment &object) const { return Prototype::operator==(object); }
    00629             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00630             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00632
    00634
    00635             inline bool operator!=(const VorbisComment &object) const { return Prototype::operator!=(object); }
    00636             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00637             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00639
    00640             unsigned get_num_comments() const;
    00641             const FLAC__byte *get_vendor_string() const; // NUL-terminated UTF-8 string
    00642             Entry get_comment(unsigned index) const;
    00643
    00645             bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string
    00646
    00648             bool set_comment(unsigned index, const Entry &entry);
    00649
    00651             bool insert_comment(unsigned index, const Entry &entry);
    00652
    00654             bool append_comment(const Entry &entry);
    00655
    00657             bool delete_comment(unsigned index);
    00658         };
    00659
    00663         class FLACPP_API CueSheet : public Prototype {
    00664         public:
    00671             class FLACPP_API Track {
    00672             protected:
    00673                 ::FLAC__StreamMetadata_CueSheet_Track *object_;
    00674             public:
    00675                 Track();
    00676                 Track(const ::FLAC__StreamMetadata_CueSheet_Track *track);
    00677                 Track(const Track &track);
    00678                 Track &operator=(const Track &track);
    00679
    00680                 virtual ~Track();
    00681
    00682                 virtual bool is_valid() const;
    00683
    00684                 inline FLAC__uint64 get_offset() const { return object_->offset; }
    00685                 inline FLAC__byte get_number() const { return object_->number; }
    00686                 inline const char *get_isrc() const { return object_->isrc; }
    00687                 inline unsigned get_type() const { return object_->type; }
    00688                 inline bool get_pre_emphasis() const { return object_->pre_emphasis; }
    00689
    00690                 inline FLAC__byte get_num_indices() const { return object_->num_indices; }
    00691                 ::FLAC__StreamMetadata_CueSheet_Index get_index(unsigned i) const;
    00692
    00693                 inline const ::FLAC__StreamMetadata_CueSheet_Track *get_track() const { return object_; }
    00694
    00695                 inline void set_offset(FLAC__uint64 value) { object_->offset = value; }
    00696                 inline void set_number(FLAC__byte value) { object_->number = value; }
    00697                 void set_isrc(const char value[12]);
    00698                 void set_type(unsigned value);
    00699                 inline void set_pre_emphasis(bool value) { object_->pre_emphasis = value? 1 : 0; }
    00700
    00701                 void set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index);
    00702                 //@@@ It's awkward but to insert/delete index points
    00703                 //@@@ you must use the routines in the CueSheet class.
    00704             };
    00705
    00706             CueSheet();
    00707
    00709
    00712             inline CueSheet(const CueSheet &object): Prototype(object) { }
    00713             inline CueSheet(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00714             inline CueSheet(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00716
    00720             inline CueSheet(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00721
    00722             ~CueSheet();
    00723
    00725
    00726             inline CueSheet &operator=(const CueSheet &object) { Prototype::operator=(object); return *this; }
    00727             inline CueSheet &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00728             inline CueSheet &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00730
    00734             inline CueSheet &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00735
    00737
    00738             inline bool operator==(const CueSheet &object) const { return Prototype::operator==(object); }
    00739             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00740             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00742
    00744
    00745             inline bool operator!=(const CueSheet &object) const { return Prototype::operator!=(object); }
    00746             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00747             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00749
    00750             const char *get_media_catalog_number() const;
    00751             FLAC__uint64 get_lead_in() const;
    00752             bool get_is_cd() const;
    00753
    00754             unsigned get_num_tracks() const;
    00755             Track get_track(unsigned i) const;
    00756
    00757             void set_media_catalog_number(const char value[128]);
    00758             void set_lead_in(FLAC__uint64 value);
    00759             void set_is_cd(bool value);
    00760
    00761             void set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
    00762
    00764             bool insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
    00765
    00767             bool delete_index(unsigned track_num, unsigned index_num);
    00768
    00770             bool set_track(unsigned i, const Track &track);
    00771
    00773             bool insert_track(unsigned i, const Track &track);
    00774
    00776             bool delete_track(unsigned i);
    00777
    00779             bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const;
    00780         };
    00781
    00787         class FLACPP_API Unknown : public Prototype {
    00788         public:
    00789             Unknown();
    00790             //
    00792             /** Constructs a copy of the given object.  This form
    00793              *  always performs a deep copy.
    00794              */
    00795             inline Unknown(const Unknown &object): Prototype(object) { }
    00796             inline Unknown(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00797             inline Unknown(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00799
    00803             inline Unknown(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00804
    00805             ~Unknown();
    00806
    00808
    00809             inline Unknown &operator=(const Unknown &object) { Prototype::operator=(object); return *this; }
    00810             inline Unknown &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00811             inline Unknown &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00813
    00817             inline Unknown &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00818
    00820
    00821             inline bool operator==(const Unknown &object) const { return Prototype::operator==(object); }
    00822             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00823             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00825
    00827
    00828             inline bool operator!=(const Unknown &object) const { return Prototype::operator!=(object); }
    00829             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00830             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00832
    00833             const FLAC__byte *get_data() const;
    00834
    00836             bool set_data(const FLAC__byte *data, unsigned length);
    00837             bool set_data(FLAC__byte *data, unsigned length, bool copy);
    00838         };
    00839
    00840         /* \} */
    00841
    00842
    00855
    00856         FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo);
    00857
    00859         FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags);
    00860         FLACPP_API bool get_tags(const char *filename, VorbisComment &tags);
    00861
    00862         /* \} */
    00863
    00864
    00897         class FLACPP_API SimpleIterator {
    00898         public:
    00899             class FLACPP_API Status {
    00900             public:
    00901                 inline Status(::FLAC__Metadata_SimpleIteratorStatus status): status_(status) { }
    00902                 inline operator ::FLAC__Metadata_SimpleIteratorStatus() const { return status_; }
    00903                 inline const char *as_cstring() const { return ::FLAC__Metadata_SimpleIteratorStatusString[status_]; }
    00904             protected:
    00905                 ::FLAC__Metadata_SimpleIteratorStatus status_;
    00906             };
    00907
    00908             SimpleIterator();
    00909             virtual ~SimpleIterator();
    00910
    00911             bool init(const char *filename, bool read_only, bool preserve_file_stats);
    00912
    00913             bool is_valid() const;
    00914             Status status();
    00915             bool is_writable() const;
    00916
    00917             bool next();
    00918             bool prev();
    00919
    00920             ::FLAC__MetadataType get_block_type() const;
    00921             Prototype *get_block();
    00922             bool set_block(Prototype *block, bool use_padding = true);
    00923             bool insert_block_after(Prototype *block, bool use_padding = true);
    00924             bool delete_block(bool use_padding = true);
    00925
    00926         protected:
    00927             ::FLAC__Metadata_SimpleIterator *iterator_;
    00928             void clear();
    00929         };
    00930
    00931         /* \} */
    00932
    00933
    00974         class FLACPP_API Chain {
    00975         public:
    00976             class FLACPP_API Status {
    00977             public:
    00978                 inline Status(::FLAC__Metadata_ChainStatus status): status_(status) { }
    00979                 inline operator ::FLAC__Metadata_ChainStatus() const { return status_; }
    00980                 inline const char *as_cstring() const { return ::FLAC__Metadata_ChainStatusString[status_]; }
    00981             protected:
    00982                 ::FLAC__Metadata_ChainStatus status_;
    00983             };
    00984
    00985             Chain();
    00986             virtual ~Chain();
    00987
    00988             friend class Iterator;
    00989
    00990             bool is_valid() const;
    00991             Status status();
    00992
    00993             bool read(const char *filename);
    00994             bool read(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks);
    00995
    00996             bool check_if_tempfile_needed(bool use_padding);
    00997
    00998             bool write(bool use_padding = true, bool preserve_file_stats = false);
    00999             bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks);
    01000             bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks, ::FLAC__IOHandle temp_handle, ::FLAC__IOCallbacks temp_callbacks);
    01001
    01002             void merge_padding();
    01003             void sort_padding();
    01004
    01005         protected:
    01006             ::FLAC__Metadata_Chain *chain_;
    01007             virtual void clear();
    01008         };
    01009
    01013         class FLACPP_API Iterator {
    01014         public:
    01015             Iterator();
    01016             virtual ~Iterator();
    01017
    01018             bool is_valid() const;
    01019
    01020             void init(Chain &chain);
    01021
    01022             bool next();
    01023             bool prev();
    01024
    01025             ::FLAC__MetadataType get_block_type() const;
    01026             Prototype *get_block();
    01027             bool set_block(Prototype *block);
    01028             bool delete_block(bool replace_with_padding);
    01029             bool insert_block_before(Prototype *block);
    01030             bool insert_block_after(Prototype *block);
    01031
    01032         protected:
    01033             ::FLAC__Metadata_Iterator *iterator_;
    01034             virtual void clear();
    01035         };
    01036
    01037         /* \} */
    01038
    01039     }
    01040 }
    01041
    01042 #endif