metadata.h

Go to the documentation of this file.
00001 /* libFLAC++ - Free Lossless Audio Codec library
00002  * Copyright (C) 2002-2009  Josh Coalson
00003  * Copyright (C) 2011-2014  Xiph.Org Foundation
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  * notice, this list of conditions and the following disclaimer.
00011  *
00012  * - Redistributions in binary form must reproduce the above copyright
00013  * notice, this list of conditions and the following disclaimer in the
00014  * documentation and/or other materials provided with the distribution.
00015  *
00016  * - Neither the name of the Xiph.org Foundation nor the names of its
00017  * contributors may be used to endorse or promote products derived from
00018  * this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00023  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
00024  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00026  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00027  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00028  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00029  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00030  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  */
00032 
00033 #ifndef FLACPP__METADATA_H
00034 #define FLACPP__METADATA_H
00035 
00036 #include "export.h"
00037 
00038 #include "FLAC/metadata.h"
00039 
00040 // ===============================================================
00041 //
00042 //  Full documentation for the metadata interface can be found
00043 //  in the C layer in include/FLAC/metadata.h
00044 //
00045 // ===============================================================
00046 
00075 namespace FLAC {
00076     namespace Metadata {
00077 
00078         // ============================================================
00079         //
00080         //  Metadata objects
00081         //
00082         // ============================================================
00083 
00109         class FLACPP_API Prototype {
00110         protected:
00112 
00115             Prototype(const Prototype &);
00116             Prototype(const ::FLAC__StreamMetadata &);
00117             Prototype(const ::FLAC__StreamMetadata *);
00119 
00130             Prototype(::FLAC__StreamMetadata *object, bool copy);
00131 
00133 
00134             Prototype &operator=(const Prototype &);
00135             Prototype &operator=(const ::FLAC__StreamMetadata &);
00136             Prototype &operator=(const ::FLAC__StreamMetadata *);
00138 
00142             Prototype &assign_object(::FLAC__StreamMetadata *object, bool copy);
00143 
00146             virtual void clear();
00147 
00148 			::FLAC__StreamMetadata *object_;
00149         public:
00152             virtual ~Prototype();
00153 
00155 
00157             inline bool operator==(const Prototype &) const;
00158             inline bool operator==(const ::FLAC__StreamMetadata &) const;
00159             inline bool operator==(const ::FLAC__StreamMetadata *) const;
00161 
00163 
00164             inline bool operator!=(const Prototype &) const;
00165             inline bool operator!=(const ::FLAC__StreamMetadata &) const;
00166             inline bool operator!=(const ::FLAC__StreamMetadata *) const;
00168 
00169             friend class SimpleIterator;
00170             friend class Iterator;
00171 
00176             inline bool is_valid() const;
00177 
00184             bool get_is_last() const;
00185 
00191 			::FLAC__MetadataType get_type() const;
00192 
00202             unsigned get_length() const;
00203 
00210             void set_is_last(bool);
00211 
00219             inline operator const ::FLAC__StreamMetadata *() const;
00220         private:
00222             Prototype();
00223 
00224             // These are used only by Iterator
00225             bool is_reference_;
00226             inline void set_reference(bool x) { is_reference_ = x; }
00227         };
00228 
00229 #ifdef _MSC_VER
00230 // warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
00231 #pragma warning ( disable : 4800 )
00232 #endif
00233 
00234         inline bool Prototype::operator==(const Prototype &object) const
00235         { return (bool)::FLAC__metadata_object_is_equal(object_, object.object_); }
00236 
00237         inline bool Prototype::operator==(const ::FLAC__StreamMetadata &object) const
00238         { return (bool)::FLAC__metadata_object_is_equal(object_, &object); }
00239 
00240         inline bool Prototype::operator==(const ::FLAC__StreamMetadata *object) const
00241         { return (bool)::FLAC__metadata_object_is_equal(object_, object); }
00242 
00243 #ifdef _MSC_VER
00244 #pragma warning ( default : 4800 )
00245 #endif
00246 
00247         inline bool Prototype::operator!=(const Prototype &object) const
00248         { return !operator==(object); }
00249 
00250         inline bool Prototype::operator!=(const ::FLAC__StreamMetadata &object) const
00251         { return !operator==(object); }
00252 
00253         inline bool Prototype::operator!=(const ::FLAC__StreamMetadata *object) const
00254         { return !operator==(object); }
00255 
00256         inline bool Prototype::is_valid() const
00257         { return 0 != object_; }
00258 
00259         inline Prototype::operator const ::FLAC__StreamMetadata *() const
00260         { return object_; }
00261 
00263         FLACPP_API Prototype *clone(const Prototype *);
00264 
00265 
00270         class FLACPP_API StreamInfo : public Prototype {
00271         public:
00272             StreamInfo();
00273 
00275 
00278             inline StreamInfo(const StreamInfo &object): Prototype(object) { }
00279             inline StreamInfo(const ::FLAC__StreamMetadata &object): Prototype(object) { }
00280             inline StreamInfo(const ::FLAC__StreamMetadata *object): Prototype(object) { }
00282 
00286             inline StreamInfo(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
00287 
00288             ~StreamInfo();
00289 
00291 
00292             inline StreamInfo &operator=(const StreamInfo &object) { Prototype::operator=(object); return *this; }
00293             inline StreamInfo &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
00294             inline StreamInfo &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
00296 
00300             inline StreamInfo &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
00301 
00303 
00304             inline bool operator==(const StreamInfo &object) const { return Prototype::operator==(object); }
00305             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
00306             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
00308 
00310 
00311             inline bool operator!=(const StreamInfo &object) const { return Prototype::operator!=(object); }
00312             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
00313             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
00315 
00317 
00318             unsigned get_min_blocksize() const;
00319             unsigned get_max_blocksize() const;
00320             unsigned get_min_framesize() const;
00321             unsigned get_max_framesize() const;
00322             unsigned get_sample_rate() const;
00323             unsigned get_channels() const;
00324             unsigned get_bits_per_sample() const;
00325             FLAC__uint64 get_total_samples() const;
00326             const FLAC__byte *get_md5sum() const;
00327 
00328             void set_min_blocksize(unsigned value);
00329             void set_max_blocksize(unsigned value);
00330             void set_min_framesize(unsigned value);
00331             void set_max_framesize(unsigned value);
00332             void set_sample_rate(unsigned value);
00333             void set_channels(unsigned value);
00334             void set_bits_per_sample(unsigned value);
00335             void set_total_samples(FLAC__uint64 value);
00336             void set_md5sum(const FLAC__byte value[16]);
00338         };
00339 
00344         class FLACPP_API Padding : public Prototype {
00345         public:
00346             Padding();
00347 
00349 
00352             inline Padding(const Padding &object): Prototype(object) { }
00353             inline Padding(const ::FLAC__StreamMetadata &object): Prototype(object) { }
00354             inline Padding(const ::FLAC__StreamMetadata *object): Prototype(object) { }
00356 
00360             inline Padding(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
00361 
00364             Padding(unsigned length);
00365 
00366             ~Padding();
00367 
00369 
00370             inline Padding &operator=(const Padding &object) { Prototype::operator=(object); return *this; }
00371             inline Padding &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
00372             inline Padding &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
00374 
00378             inline Padding &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
00379 
00381 
00382             inline bool operator==(const Padding &object) const { return Prototype::operator==(object); }
00383             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
00384             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
00386 
00388 
00389             inline bool operator!=(const Padding &object) const { return Prototype::operator!=(object); }
00390             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
00391             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
00393 
00396             void set_length(unsigned length);
00397         };
00398 
00403         class FLACPP_API Application : public Prototype {
00404         public:
00405             Application();
00406             //
00408 
00411             inline Application(const Application &object): Prototype(object) { }
00412             inline Application(const ::FLAC__StreamMetadata &object): Prototype(object) { }
00413             inline Application(const ::FLAC__StreamMetadata *object): Prototype(object) { }
00415 
00419             inline Application(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
00420 
00421             ~Application();
00422 
00424 
00425             inline Application &operator=(const Application &object) { Prototype::operator=(object); return *this; }
00426             inline Application &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
00427             inline Application &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
00429 
00433             inline Application &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
00434 
00436 
00437             inline bool operator==(const Application &object) const { return Prototype::operator==(object); }
00438             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
00439             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
00441 
00443 
00444             inline bool operator!=(const Application &object) const { return Prototype::operator!=(object); }
00445             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
00446             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
00448 
00449             const FLAC__byte *get_id() const;
00450             const FLAC__byte *get_data() const;
00451 
00452             void set_id(const FLAC__byte value[4]);
00454             bool set_data(const FLAC__byte *data, unsigned length);
00455             bool set_data(FLAC__byte *data, unsigned length, bool copy);
00456         };
00457 
00462         class FLACPP_API SeekTable : public Prototype {
00463         public:
00464             SeekTable();
00465 
00467 
00470             inline SeekTable(const SeekTable &object): Prototype(object) { }
00471             inline SeekTable(const ::FLAC__StreamMetadata &object): Prototype(object) { }
00472             inline SeekTable(const ::FLAC__StreamMetadata *object): Prototype(object) { }
00474 
00478             inline SeekTable(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
00479 
00480             ~SeekTable();
00481 
00483 
00484             inline SeekTable &operator=(const SeekTable &object) { Prototype::operator=(object); return *this; }
00485             inline SeekTable &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
00486             inline SeekTable &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
00488 
00492             inline SeekTable &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
00493 
00495 
00496             inline bool operator==(const SeekTable &object) const { return Prototype::operator==(object); }
00497             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
00498             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
00500 
00502 
00503             inline bool operator!=(const SeekTable &object) const { return Prototype::operator!=(object); }
00504             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
00505             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
00507 
00508             unsigned get_num_points() const;
00509 			::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const;
00510 
00512             bool resize_points(unsigned new_num_points);
00513 
00515             void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
00516 
00518             bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
00519 
00521             bool delete_point(unsigned index);
00522 
00524             bool is_legal() const;
00525 
00527             bool template_append_placeholders(unsigned num);
00528 
00530             bool template_append_point(FLAC__uint64 sample_number);
00531 
00533             bool template_append_points(FLAC__uint64 sample_numbers[], unsigned num);
00534 
00536             bool template_append_spaced_points(unsigned num, FLAC__uint64 total_samples);
00537 
00539             bool template_append_spaced_points_by_samples(unsigned samples, FLAC__uint64 total_samples);
00540 
00542             bool template_sort(bool compact);
00543         };
00544 
00549         class FLACPP_API VorbisComment : public Prototype {
00550         public:
00580             class FLACPP_API Entry {
00581             public:
00582                 Entry();
00583 
00584                 Entry(const char *field, unsigned field_length);
00585                 Entry(const char *field); // assumes \a field is NUL-terminated
00586 
00587                 Entry(const char *field_name, const char *field_value, unsigned field_value_length);
00588                 Entry(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
00589 
00590                 Entry(const Entry &entry);
00591 
00592                 Entry &operator=(const Entry &entry);
00593 
00594                 virtual ~Entry();
00595 
00596                 virtual bool is_valid() const; 
00597 
00598                 unsigned get_field_length() const;
00599                 unsigned get_field_name_length() const;
00600                 unsigned get_field_value_length() const;
00601 
00602 				::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const;
00603                 const char *get_field() const;
00604                 const char *get_field_name() const;
00605                 const char *get_field_value() const;
00606 
00607                 bool set_field(const char *field, unsigned field_length);
00608                 bool set_field(const char *field); // assumes \a field is NUL-terminated
00609                 bool set_field_name(const char *field_name);
00610                 bool set_field_value(const char *field_value, unsigned field_value_length);
00611                 bool set_field_value(const char *field_value); // assumes \a field_value is NUL-terminated
00612             protected:
00613                 bool is_valid_;
00614 				::FLAC__StreamMetadata_VorbisComment_Entry entry_;
00615                 char *field_name_;
00616                 unsigned field_name_length_;
00617                 char *field_value_;
00618                 unsigned field_value_length_;
00619             private:
00620                 void zero();
00621                 void clear();
00622                 void clear_entry();
00623                 void clear_field_name();
00624                 void clear_field_value();
00625                 void construct(const char *field, unsigned field_length);
00626                 void construct(const char *field); // assumes \a field is NUL-terminated
00627                 void construct(const char *field_name, const char *field_value, unsigned field_value_length);
00628                 void construct(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
00629                 void compose_field();
00630                 void parse_field();
00631             };
00632 
00633             VorbisComment();
00634 
00636 
00639             inline VorbisComment(const VorbisComment &object): Prototype(object) { }
00640             inline VorbisComment(const ::FLAC__StreamMetadata &object): Prototype(object) { }
00641             inline VorbisComment(const ::FLAC__StreamMetadata *object): Prototype(object) { }
00643 
00647             inline VorbisComment(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
00648 
00649             ~VorbisComment();
00650 
00652 
00653             inline VorbisComment &operator=(const VorbisComment &object) { Prototype::operator=(object); return *this; }
00654             inline VorbisComment &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
00655             inline VorbisComment &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
00657 
00661             inline VorbisComment &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
00662 
00664 
00665             inline bool operator==(const VorbisComment &object) const { return Prototype::operator==(object); }
00666             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
00667             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
00669 
00671 
00672             inline bool operator!=(const VorbisComment &object) const { return Prototype::operator!=(object); }
00673             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
00674             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
00676 
00677             unsigned get_num_comments() const;
00678             const FLAC__byte *get_vendor_string() const; // NUL-terminated UTF-8 string
00679             Entry get_comment(unsigned index) const;
00680 
00682             bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string
00683 
00685             bool resize_comments(unsigned new_num_comments);
00686 
00688             bool set_comment(unsigned index, const Entry &entry);
00689 
00691             bool insert_comment(unsigned index, const Entry &entry);
00692 
00694             bool append_comment(const Entry &entry);
00695 
00697             bool replace_comment(const Entry &entry, bool all);
00698 
00700             bool delete_comment(unsigned index);
00701 
00703             int find_entry_from(unsigned offset, const char *field_name);
00704 
00706             int remove_entry_matching(const char *field_name);
00707 
00709             int remove_entries_matching(const char *field_name);
00710         };
00711 
00716         class FLACPP_API CueSheet : public Prototype {
00717         public:
00724             class FLACPP_API Track {
00725             protected:
00726 				::FLAC__StreamMetadata_CueSheet_Track *object_;
00727             public:
00728                 Track();
00729                 Track(const ::FLAC__StreamMetadata_CueSheet_Track *track);
00730                 Track(const Track &track);
00731                 Track &operator=(const Track &track);
00732 
00733                 virtual ~Track();
00734 
00735                 virtual bool is_valid() const; 
00736 
00737 
00738                 inline FLAC__uint64 get_offset() const { return object_->offset; }
00739                 inline FLAC__byte get_number() const { return object_->number; }
00740                 inline const char *get_isrc() const { return object_->isrc; }
00741                 inline unsigned get_type() const { return object_->type; }
00742                 inline bool get_pre_emphasis() const { return object_->pre_emphasis; }
00743 
00744                 inline FLAC__byte get_num_indices() const { return object_->num_indices; }
00745 				::FLAC__StreamMetadata_CueSheet_Index get_index(unsigned i) const;
00746 
00747                 inline const ::FLAC__StreamMetadata_CueSheet_Track *get_track() const { return object_; }
00748 
00749                 inline void set_offset(FLAC__uint64 value) { object_->offset = value; }
00750                 inline void set_number(FLAC__byte value) { object_->number = value; }
00751                 void set_isrc(const char value[12]);
00752                 void set_type(unsigned value);
00753                 inline void set_pre_emphasis(bool value) { object_->pre_emphasis = value? 1 : 0; }
00754 
00755                 void set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index);
00756                 //@@@ It's awkward but to insert/delete index points
00757                 //@@@ you must use the routines in the CueSheet class.
00758             };
00759 
00760             CueSheet();
00761 
00763 
00766             inline CueSheet(const CueSheet &object): Prototype(object) { }
00767             inline CueSheet(const ::FLAC__StreamMetadata &object): Prototype(object) { }
00768             inline CueSheet(const ::FLAC__StreamMetadata *object): Prototype(object) { }
00770 
00774             inline CueSheet(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
00775 
00776             ~CueSheet();
00777 
00779 
00780             inline CueSheet &operator=(const CueSheet &object) { Prototype::operator=(object); return *this; }
00781             inline CueSheet &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
00782             inline CueSheet &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
00784 
00788             inline CueSheet &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
00789 
00791 
00792             inline bool operator==(const CueSheet &object) const { return Prototype::operator==(object); }
00793             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
00794             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
00796 
00798 
00799             inline bool operator!=(const CueSheet &object) const { return Prototype::operator!=(object); }
00800             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
00801             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
00803 
00804             const char *get_media_catalog_number() const;
00805             FLAC__uint64 get_lead_in() const;
00806             bool get_is_cd() const;
00807 
00808             unsigned get_num_tracks() const;
00809             Track get_track(unsigned i) const;
00810 
00811             void set_media_catalog_number(const char value[128]);
00812             void set_lead_in(FLAC__uint64 value);
00813             void set_is_cd(bool value);
00814 
00815             void set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
00816 
00818             bool resize_indices(unsigned track_num, unsigned new_num_indices);
00819 
00821             bool insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
00822 
00824             bool insert_blank_index(unsigned track_num, unsigned index_num);
00825 
00827             bool delete_index(unsigned track_num, unsigned index_num);
00828 
00830             bool resize_tracks(unsigned new_num_tracks);
00831 
00833             bool set_track(unsigned i, const Track &track);
00834 
00836             bool insert_track(unsigned i, const Track &track);
00837 
00839             bool insert_blank_track(unsigned i);
00840 
00842             bool delete_track(unsigned i);
00843 
00845             bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const;
00846 
00848             FLAC__uint32 calculate_cddb_id() const;
00849         };
00850 
00855         class FLACPP_API Picture : public Prototype {
00856         public:
00857             Picture();
00858 
00860 
00863             inline Picture(const Picture &object): Prototype(object) { }
00864             inline Picture(const ::FLAC__StreamMetadata &object): Prototype(object) { }
00865             inline Picture(const ::FLAC__StreamMetadata *object): Prototype(object) { }
00867 
00871             inline Picture(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
00872 
00873             ~Picture();
00874 
00876 
00877             inline Picture &operator=(const Picture &object) { Prototype::operator=(object); return *this; }
00878             inline Picture &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
00879             inline Picture &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
00881 
00885             inline Picture &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
00886 
00888 
00889             inline bool operator==(const Picture &object) const { return Prototype::operator==(object); }
00890             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
00891             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
00893 
00895 
00896             inline bool operator!=(const Picture &object) const { return Prototype::operator!=(object); }
00897             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
00898             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
00900 
00901 			::FLAC__StreamMetadata_Picture_Type get_type() const;
00902             const char *get_mime_type() const; // NUL-terminated printable ASCII string
00903             const FLAC__byte *get_description() const; // NUL-terminated UTF-8 string
00904             FLAC__uint32 get_width() const;
00905             FLAC__uint32 get_height() const;
00906             FLAC__uint32 get_depth() const;
00907             FLAC__uint32 get_colors() const; 
00908             FLAC__uint32 get_data_length() const;
00909             const FLAC__byte *get_data() const;
00910 
00911             void set_type(::FLAC__StreamMetadata_Picture_Type type);
00912 
00914             bool set_mime_type(const char *string); // NUL-terminated printable ASCII string
00915 
00917             bool set_description(const FLAC__byte *string); // NUL-terminated UTF-8 string
00918 
00919             void set_width(FLAC__uint32 value) const;
00920             void set_height(FLAC__uint32 value) const;
00921             void set_depth(FLAC__uint32 value) const;
00922             void set_colors(FLAC__uint32 value) const; 
00923 
00925             bool set_data(const FLAC__byte *data, FLAC__uint32 data_length);
00926 
00928             bool is_legal(const char **violation);
00929         };
00930 
00937         class FLACPP_API Unknown : public Prototype {
00938         public:
00939             Unknown();
00940             //
00942 
00945             inline Unknown(const Unknown &object): Prototype(object) { }
00946             inline Unknown(const ::FLAC__StreamMetadata &object): Prototype(object) { }
00947             inline Unknown(const ::FLAC__StreamMetadata *object): Prototype(object) { }
00949 
00953             inline Unknown(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
00954 
00955             ~Unknown();
00956 
00958 
00959             inline Unknown &operator=(const Unknown &object) { Prototype::operator=(object); return *this; }
00960             inline Unknown &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
00961             inline Unknown &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
00963 
00967             inline Unknown &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
00968 
00970 
00971             inline bool operator==(const Unknown &object) const { return Prototype::operator==(object); }
00972             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
00973             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
00975 
00977 
00978             inline bool operator!=(const Unknown &object) const { return Prototype::operator!=(object); }
00979             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
00980             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
00982 
00983             const FLAC__byte *get_data() const;
00984 
00986             bool set_data(const FLAC__byte *data, unsigned length);
00987             bool set_data(FLAC__byte *data, unsigned length, bool copy);
00988         };
00989 
00990         /* \} */
00991 
00992 
01005         FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo); 
01006 
01007         FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags); 
01008         FLACPP_API bool get_tags(const char *filename, VorbisComment &tags); 
01009 
01010         FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet); 
01011         FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet); 
01012 
01013         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); 
01014         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); 
01015 
01016         /* \} */
01017 
01018 
01053         class FLACPP_API SimpleIterator {
01054         public:
01057             class FLACPP_API Status {
01058             public:
01059                 inline Status(::FLAC__Metadata_SimpleIteratorStatus status): status_(status) { }
01060                 inline operator ::FLAC__Metadata_SimpleIteratorStatus() const { return status_; }
01061                 inline const char *as_cstring() const { return ::FLAC__Metadata_SimpleIteratorStatusString[status_]; }
01062             protected:
01063 				::FLAC__Metadata_SimpleIteratorStatus status_;
01064             };
01065 
01066             SimpleIterator();
01067             virtual ~SimpleIterator();
01068 
01069             bool is_valid() const; 
01070 
01071             bool init(const char *filename, bool read_only, bool preserve_file_stats); 
01072 
01073             Status status();                                                    
01074             bool is_writable() const;                                           
01075 
01076             bool next();                                                        
01077             bool prev();                                                        
01078             bool is_last() const;                                               
01079 
01080             off_t get_block_offset() const;                                     
01081 			::FLAC__MetadataType get_block_type() const;                        
01082             unsigned get_block_length() const;                                  
01083             bool get_application_id(FLAC__byte *id);                            
01084             Prototype *get_block();                                             
01085             bool set_block(Prototype *block, bool use_padding = true);          
01086             bool insert_block_after(Prototype *block, bool use_padding = true); 
01087             bool delete_block(bool use_padding = true);                         
01088 
01089         protected:
01090 			::FLAC__Metadata_SimpleIterator *iterator_;
01091             void clear();
01092 
01093         private: // Do not use.
01094             SimpleIterator(const SimpleIterator&);
01095             SimpleIterator&operator=(const SimpleIterator&);
01096         };
01097 
01098         /* \} */
01099 
01100 
01143         class FLACPP_API Chain {
01144         public:
01147             class FLACPP_API Status {
01148             public:
01149                 inline Status(::FLAC__Metadata_ChainStatus status): status_(status) { }
01150                 inline operator ::FLAC__Metadata_ChainStatus() const { return status_; }
01151                 inline const char *as_cstring() const { return ::FLAC__Metadata_ChainStatusString[status_]; }
01152             protected:
01153 				::FLAC__Metadata_ChainStatus status_;
01154             };
01155 
01156             Chain();
01157             virtual ~Chain();
01158 
01159             friend class Iterator;
01160 
01161             bool is_valid() const; 
01162 
01163             Status status();                                                
01164 
01165             bool read(const char *filename, bool is_ogg = false);                                
01166             bool read(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, bool is_ogg = false);  
01167 
01168             bool check_if_tempfile_needed(bool use_padding);                
01169 
01170             bool write(bool use_padding = true, bool preserve_file_stats = false); 
01171             bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks); 
01172             bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks, ::FLAC__IOHandle temp_handle, ::FLAC__IOCallbacks temp_callbacks); 
01173 
01174             void merge_padding();                                           
01175             void sort_padding();                                            
01176 
01177         protected:
01178 			::FLAC__Metadata_Chain *chain_;
01179             virtual void clear();
01180 
01181         private: // Do not use.
01182             Chain(const Chain&);
01183             Chain&operator=(const Chain&);
01184         };
01185 
01191         class FLACPP_API Iterator {
01192         public:
01193             Iterator();
01194             virtual ~Iterator();
01195 
01196             bool is_valid() const; 
01197 
01198 
01199             void init(Chain &chain);                       
01200 
01201             bool next();                                   
01202             bool prev();                                   
01203 
01204 			::FLAC__MetadataType get_block_type() const;   
01205             Prototype *get_block();                        
01206             bool set_block(Prototype *block);              
01207             bool delete_block(bool replace_with_padding);  
01208             bool insert_block_before(Prototype *block);    
01209             bool insert_block_after(Prototype *block);     
01210 
01211         protected:
01212 			::FLAC__Metadata_Iterator *iterator_;
01213             virtual void clear();
01214 
01215         private: // Do not use.
01216             Iterator(const Iterator&);
01217             Iterator&operator=(const Iterator&);
01218         };
01219 
01220         /* \} */
01221 
01222     }
01223 }
01224 
01225 #endif