FLAC: include/FLAC++/metadata.h Source File

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

# metadata.h

Go to the documentation of this file.

    00001 /* libFLAC++ - Free Lossless Audio Codec library
    00002  * Copyright (C) 2002,2003,2004,2005,2006,2007  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
    00074 namespace FLAC {
    00075     namespace Metadata {
    00076
    00077         // ============================================================
    00078         //
    00079         //  Metadata objects
    00080         //
    00081         // ============================================================
    00082
    00108         class FLACPP_API Prototype {
    00109         protected:
    00111
    00114             Prototype(const Prototype &);
    00115             Prototype(const ::FLAC__StreamMetadata &);
    00116             Prototype(const ::FLAC__StreamMetadata *);
    00118
    00129             Prototype(::FLAC__StreamMetadata *object, bool copy);
    00130
    00132
    00133             Prototype &operator=(const Prototype &);
    00134             Prototype &operator=(const ::FLAC__StreamMetadata &);
    00135             Prototype &operator=(const ::FLAC__StreamMetadata *);
    00137
    00141             Prototype &assign_object(::FLAC__StreamMetadata *object, bool copy);
    00142
    00145             virtual void clear();
    00146
    00147             ::FLAC__StreamMetadata *object_;
    00148         public:
    00151             virtual ~Prototype();
    00152
    00154
    00156             inline bool operator==(const Prototype &) const;
    00157             inline bool operator==(const ::FLAC__StreamMetadata &) const;
    00158             inline bool operator==(const ::FLAC__StreamMetadata *) const;
    00160
    00162
    00163             inline bool operator!=(const Prototype &) const;
    00164             inline bool operator!=(const ::FLAC__StreamMetadata &) const;
    00165             inline bool operator!=(const ::FLAC__StreamMetadata *) const;
    00167
    00168             friend class SimpleIterator;
    00169             friend class Iterator;
    00170
    00175             inline bool is_valid() const;
    00176
    00183             bool get_is_last() const;
    00184
    00190 			::FLAC__MetadataType get_type() const;
    00191
    00201             unsigned get_length() const;
    00202
    00209             void set_is_last(bool);
    00210
    00218             inline operator const ::FLAC__StreamMetadata *() const;
    00219         private:
    00221             Prototype();
    00222
    00223             // These are used only by Iterator
    00224             bool is_reference_;
    00225             inline void set_reference(bool x) { is_reference_ = x; }
    00226         };
    00227
    00228 #ifdef _MSC_VER
    00229 // warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
    00230 #pragma warning ( disable : 4800 )
    00231 #endif
    00232
    00233         inline bool Prototype::operator==(const Prototype &object) const
    00234         { return (bool)::FLAC__metadata_object_is_equal(object_, object.object_); }
    00235
    00236         inline bool Prototype::operator==(const ::FLAC__StreamMetadata &object) const
    00237         { return (bool)::FLAC__metadata_object_is_equal(object_, &object); }
    00238
    00239         inline bool Prototype::operator==(const ::FLAC__StreamMetadata *object) const
    00240         { return (bool)::FLAC__metadata_object_is_equal(object_, object); }
    00241
    00242 #ifdef _MSC_VER
    00243 // @@@ how to re-enable?  the following doesn't work
    00244 // #pragma warning ( enable : 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
    00362             ~Padding();
    00363
    00365
    00366             inline Padding &operator=(const Padding &object) { Prototype::operator=(object); return *this; }
    00367             inline Padding &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00368             inline Padding &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00370
    00374             inline Padding &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    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
    00384
    00385             inline bool operator!=(const Padding &object) const { return Prototype::operator!=(object); }
    00386             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00387             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00389
    00390             void set_length(unsigned length);
    00391         };
    00392
    00397         class FLACPP_API Application : public Prototype {
    00398         public:
    00399             Application();
    00400             //
    00402
    00405             inline Application(const Application &object): Prototype(object) { }
    00406             inline Application(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00407             inline Application(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00409
    00413             inline Application(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00414
    00415             ~Application();
    00416
    00418
    00419             inline Application &operator=(const Application &object) { Prototype::operator=(object); return *this; }
    00420             inline Application &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00421             inline Application &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00423
    00427             inline Application &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00428
    00430
    00431             inline bool operator==(const Application &object) const { return Prototype::operator==(object); }
    00432             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00433             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00435
    00437
    00438             inline bool operator!=(const Application &object) const { return Prototype::operator!=(object); }
    00439             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00440             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00442
    00443             const FLAC__byte *get_id() const;
    00444             const FLAC__byte *get_data() const;
    00445
    00446             void set_id(const FLAC__byte value[4]);
    00448             bool set_data(const FLAC__byte *data, unsigned length);
    00449             bool set_data(FLAC__byte *data, unsigned length, bool copy);
    00450         };
    00451
    00456         class FLACPP_API SeekTable : public Prototype {
    00457         public:
    00458             SeekTable();
    00459
    00461
    00464             inline SeekTable(const SeekTable &object): Prototype(object) { }
    00465             inline SeekTable(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00466             inline SeekTable(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00468
    00472             inline SeekTable(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00473
    00474             ~SeekTable();
    00475
    00477
    00478             inline SeekTable &operator=(const SeekTable &object) { Prototype::operator=(object); return *this; }
    00479             inline SeekTable &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00480             inline SeekTable &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00482
    00486             inline SeekTable &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00487
    00489
    00490             inline bool operator==(const SeekTable &object) const { return Prototype::operator==(object); }
    00491             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00492             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00494
    00496
    00497             inline bool operator!=(const SeekTable &object) const { return Prototype::operator!=(object); }
    00498             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00499             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00501
    00502             unsigned get_num_points() const;
    00503             ::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const;
    00504
    00506             void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
    00507
    00509             bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
    00510
    00512             bool delete_point(unsigned index);
    00513
    00515             bool is_legal() const;
    00516         };
    00517
    00522         class FLACPP_API VorbisComment : public Prototype {
    00523         public:
    00553             class FLACPP_API Entry {
    00554             public:
    00555                 Entry();
    00556
    00557                 Entry(const char *field, unsigned field_length);
    00558                 Entry(const char *field); // assumes \a field is NUL-terminated
    00559
    00560                 Entry(const char *field_name, const char *field_value, unsigned field_value_length);
    00561                 Entry(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
    00562
    00563                 Entry(const Entry &entry);
    00564
    00565                 Entry &operator=(const Entry &entry);
    00566
    00567                 virtual ~Entry();
    00568
    00569                 virtual bool is_valid() const;
    00570
    00571                 unsigned get_field_length() const;
    00572                 unsigned get_field_name_length() const;
    00573                 unsigned get_field_value_length() const;
    00574
    00575                 ::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const;
    00576                 const char *get_field() const;
    00577                 const char *get_field_name() const;
    00578                 const char *get_field_value() const;
    00579
    00580                 bool set_field(const char *field, unsigned field_length);
    00581                 bool set_field(const char *field); // assumes \a field is NUL-terminated
    00582                 bool set_field_name(const char *field_name);
    00583                 bool set_field_value(const char *field_value, unsigned field_value_length);
    00584                 bool set_field_value(const char *field_value); // assumes \a field_value is NUL-terminated
    00585             protected:
    00586                 bool is_valid_;
    00587                 ::FLAC__StreamMetadata_VorbisComment_Entry entry_;
    00588                 char *field_name_;
    00589                 unsigned field_name_length_;
    00590                 char *field_value_;
    00591                 unsigned field_value_length_;
    00592             private:
    00593                 void zero();
    00594                 void clear();
    00595                 void clear_entry();
    00596                 void clear_field_name();
    00597                 void clear_field_value();
    00598                 void construct(const char *field, unsigned field_length);
    00599                 void construct(const char *field); // assumes \a field is NUL-terminated
    00600                 void construct(const char *field_name, const char *field_value, unsigned field_value_length);
    00601                 void construct(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
    00602                 void compose_field();
    00603                 void parse_field();
    00604             };
    00605
    00606             VorbisComment();
    00607
    00609
    00612             inline VorbisComment(const VorbisComment &object): Prototype(object) { }
    00613             inline VorbisComment(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00614             inline VorbisComment(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00616
    00620             inline VorbisComment(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00621
    00622             ~VorbisComment();
    00623
    00625
    00626             inline VorbisComment &operator=(const VorbisComment &object) { Prototype::operator=(object); return *this; }
    00627             inline VorbisComment &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00628             inline VorbisComment &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00630
    00634             inline VorbisComment &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00635
    00637
    00638             inline bool operator==(const VorbisComment &object) const { return Prototype::operator==(object); }
    00639             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00640             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00642
    00644
    00645             inline bool operator!=(const VorbisComment &object) const { return Prototype::operator!=(object); }
    00646             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00647             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00649
    00650             unsigned get_num_comments() const;
    00651             const FLAC__byte *get_vendor_string() const; // NUL-terminated UTF-8 string
    00652             Entry get_comment(unsigned index) const;
    00653
    00655             bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string
    00656
    00658             bool set_comment(unsigned index, const Entry &entry);
    00659
    00661             bool insert_comment(unsigned index, const Entry &entry);
    00662
    00664             bool append_comment(const Entry &entry);
    00665
    00667             bool delete_comment(unsigned index);
    00668         };
    00669
    00674         class FLACPP_API CueSheet : public Prototype {
    00675         public:
    00682             class FLACPP_API Track {
    00683             protected:
    00684                 ::FLAC__StreamMetadata_CueSheet_Track *object_;
    00685             public:
    00686                 Track();
    00687                 Track(const ::FLAC__StreamMetadata_CueSheet_Track *track);
    00688                 Track(const Track &track);
    00689                 Track &operator=(const Track &track);
    00690
    00691                 virtual ~Track();
    00692
    00693                 virtual bool is_valid() const;
    00694
    00695
    00696                 inline FLAC__uint64 get_offset() const { return object_->offset; }
    00697                 inline FLAC__byte get_number() const { return object_->number; }
    00698                 inline const char *get_isrc() const { return object_->isrc; }
    00699                 inline unsigned get_type() const { return object_->type; }
    00700                 inline bool get_pre_emphasis() const { return object_->pre_emphasis; }
    00701
    00702                 inline FLAC__byte get_num_indices() const { return object_->num_indices; }
    00703                 ::FLAC__StreamMetadata_CueSheet_Index get_index(unsigned i) const;
    00704
    00705                 inline const ::FLAC__StreamMetadata_CueSheet_Track *get_track() const { return object_; }
    00706
    00707                 inline void set_offset(FLAC__uint64 value) { object_->offset = value; }
    00708                 inline void set_number(FLAC__byte value) { object_->number = value; }
    00709                 void set_isrc(const char value[12]);
    00710                 void set_type(unsigned value);
    00711                 inline void set_pre_emphasis(bool value) { object_->pre_emphasis = value? 1 : 0; }
    00712
    00713                 void set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index);
    00714                 //@@@ It's awkward but to insert/delete index points
    00715                 //@@@ you must use the routines in the CueSheet class.
    00716             };
    00717
    00718             CueSheet();
    00719
    00721
    00724             inline CueSheet(const CueSheet &object): Prototype(object) { }
    00725             inline CueSheet(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00726             inline CueSheet(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00728
    00732             inline CueSheet(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00733
    00734             ~CueSheet();
    00735
    00737
    00738             inline CueSheet &operator=(const CueSheet &object) { Prototype::operator=(object); return *this; }
    00739             inline CueSheet &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00740             inline CueSheet &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00742
    00746             inline CueSheet &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00747
    00749
    00750             inline bool operator==(const CueSheet &object) const { return Prototype::operator==(object); }
    00751             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00752             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00754
    00756
    00757             inline bool operator!=(const CueSheet &object) const { return Prototype::operator!=(object); }
    00758             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00759             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00761
    00762             const char *get_media_catalog_number() const;
    00763             FLAC__uint64 get_lead_in() const;
    00764             bool get_is_cd() const;
    00765
    00766             unsigned get_num_tracks() const;
    00767             Track get_track(unsigned i) const;
    00768
    00769             void set_media_catalog_number(const char value[128]);
    00770             void set_lead_in(FLAC__uint64 value);
    00771             void set_is_cd(bool value);
    00772
    00773             void set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
    00774
    00776             bool insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
    00777
    00779             bool delete_index(unsigned track_num, unsigned index_num);
    00780
    00782             bool set_track(unsigned i, const Track &track);
    00783
    00785             bool insert_track(unsigned i, const Track &track);
    00786
    00788             bool delete_track(unsigned i);
    00789
    00791             bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const;
    00792
    00794             FLAC__uint32 calculate_cddb_id() const;
    00795         };
    00796
    00801         class FLACPP_API Picture : public Prototype {
    00802         public:
    00803             Picture();
    00804
    00806
    00809             inline Picture(const Picture &object): Prototype(object) { }
    00810             inline Picture(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00811             inline Picture(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00813
    00817             inline Picture(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00818
    00819             ~Picture();
    00820
    00822
    00823             inline Picture &operator=(const Picture &object) { Prototype::operator=(object); return *this; }
    00824             inline Picture &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00825             inline Picture &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00827
    00831             inline Picture &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00832
    00834
    00835             inline bool operator==(const Picture &object) const { return Prototype::operator==(object); }
    00836             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00837             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00839
    00841
    00842             inline bool operator!=(const Picture &object) const { return Prototype::operator!=(object); }
    00843             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00844             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00846
    00847 			::FLAC__StreamMetadata_Picture_Type get_type() const;
    00848             const char *get_mime_type() const; // NUL-terminated printable ASCII string
    00849             const FLAC__byte *get_description() const; // NUL-terminated UTF-8 string
    00850             FLAC__uint32 get_width() const;
    00851             FLAC__uint32 get_height() const;
    00852             FLAC__uint32 get_depth() const;
    00853             FLAC__uint32 get_colors() const;
    00854             FLAC__uint32 get_data_length() const;
    00855             const FLAC__byte *get_data() const;
    00856
    00857             void set_type(::FLAC__StreamMetadata_Picture_Type type);
    00858
    00860             bool set_mime_type(const char *string); // NUL-terminated printable ASCII string
    00861
    00863             bool set_description(const FLAC__byte *string); // NUL-terminated UTF-8 string
    00864
    00865             void set_width(FLAC__uint32 value) const;
    00866             void set_height(FLAC__uint32 value) const;
    00867             void set_depth(FLAC__uint32 value) const;
    00868             void set_colors(FLAC__uint32 value) const;
    00869
    00871             bool set_data(const FLAC__byte *data, FLAC__uint32 data_length);
    00872         };
    00873
    00880         class FLACPP_API Unknown : public Prototype {
    00881         public:
    00882             Unknown();
    00883             //
    00885
    00888             inline Unknown(const Unknown &object): Prototype(object) { }
    00889             inline Unknown(const ::FLAC__StreamMetadata &object): Prototype(object) { }
    00890             inline Unknown(const ::FLAC__StreamMetadata *object): Prototype(object) { }
    00892
    00896             inline Unknown(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
    00897
    00898             ~Unknown();
    00899
    00901
    00902             inline Unknown &operator=(const Unknown &object) { Prototype::operator=(object); return *this; }
    00903             inline Unknown &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
    00904             inline Unknown &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
    00906
    00910             inline Unknown &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
    00911
    00913
    00914             inline bool operator==(const Unknown &object) const { return Prototype::operator==(object); }
    00915             inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
    00916             inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
    00918
    00920
    00921             inline bool operator!=(const Unknown &object) const { return Prototype::operator!=(object); }
    00922             inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
    00923             inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
    00925
    00926             const FLAC__byte *get_data() const;
    00927
    00929             bool set_data(const FLAC__byte *data, unsigned length);
    00930             bool set_data(FLAC__byte *data, unsigned length, bool copy);
    00931         };
    00932
    00933         /* \} */
    00934
    00935
    00948         FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo);
    00949
    00950         FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags);
    00951         FLACPP_API bool get_tags(const char *filename, VorbisComment &tags);
    00952
    00953         FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet);
    00954         FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet);
    00955
    00956         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);
    00957         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);
    00958
    00959         /* \} */
    00960
    00961
    00996         class FLACPP_API SimpleIterator {
    00997         public:
    01000             class FLACPP_API Status {
    01001             public:
    01002                 inline Status(::FLAC__Metadata_SimpleIteratorStatus status): status_(status) { }
    01003                 inline operator ::FLAC__Metadata_SimpleIteratorStatus() const { return status_; }
    01004                 inline const char *as_cstring() const { return ::FLAC__Metadata_SimpleIteratorStatusString[status_]; }
    01005             protected:
    01006 				::FLAC__Metadata_SimpleIteratorStatus status_;
    01007             };
    01008
    01009             SimpleIterator();
    01010             virtual ~SimpleIterator();
    01011
    01012             bool is_valid() const;
    01013
    01014             bool init(const char *filename, bool read_only, bool preserve_file_stats);
    01015
    01016             Status status();
    01017             bool is_writable() const;
    01018
    01019             bool next();
    01020             bool prev();
    01021             bool is_last() const;
    01022
    01023             off_t get_block_offset() const;
    01024 			::FLAC__MetadataType get_block_type() const;
    01025             unsigned get_block_length() const;
    01026             bool get_application_id(FLAC__byte *id);
    01027             Prototype *get_block();
    01028             bool set_block(Prototype *block, bool use_padding = true);
    01029             bool insert_block_after(Prototype *block, bool use_padding = true);
    01030             bool delete_block(bool use_padding = true);
    01031
    01032         protected:
    01033 			::FLAC__Metadata_SimpleIterator *iterator_;
    01034             void clear();
    01035         };
    01036
    01037         /* \} */
    01038
    01039
    01082         class FLACPP_API Chain {
    01083         public:
    01086             class FLACPP_API Status {
    01087             public:
    01088                 inline Status(::FLAC__Metadata_ChainStatus status): status_(status) { }
    01089                 inline operator ::FLAC__Metadata_ChainStatus() const { return status_; }
    01090                 inline const char *as_cstring() const { return ::FLAC__Metadata_ChainStatusString[status_]; }
    01091             protected:
    01092 				::FLAC__Metadata_ChainStatus status_;
    01093             };
    01094
    01095             Chain();
    01096             virtual ~Chain();
    01097
    01098             friend class Iterator;
    01099
    01100             bool is_valid() const;
    01101
    01102             Status status();
    01103
    01104             bool read(const char *filename, bool is_ogg = false);
    01105             bool read(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, bool is_ogg = false);
    01106
    01107             bool check_if_tempfile_needed(bool use_padding);
    01108
    01109             bool write(bool use_padding = true, bool preserve_file_stats = false);
    01110             bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks);
    01111             bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks, ::FLAC__IOHandle temp_handle, ::FLAC__IOCallbacks temp_callbacks);
    01112
    01113             void merge_padding();
    01114             void sort_padding();
    01115
    01116         protected:
    01117 			::FLAC__Metadata_Chain *chain_;
    01118             virtual void clear();
    01119         };
    01120
    01126         class FLACPP_API Iterator {
    01127         public:
    01128             Iterator();
    01129             virtual ~Iterator();
    01130
    01131             bool is_valid() const;
    01132
    01133
    01134             void init(Chain &chain);
    01135
    01136             bool next();
    01137             bool prev();
    01138
    01139 			::FLAC__MetadataType get_block_type() const;
    01140             Prototype *get_block();
    01141             bool set_block(Prototype *block);
    01142             bool delete_block(bool replace_with_padding);
    01143             bool insert_block_before(Prototype *block);
    01144             bool insert_block_after(Prototype *block);
    01145
    01146         protected:
    01147 			::FLAC__Metadata_Iterator *iterator_;
    01148             virtual void clear();
    01149         };
    01150
    01151         /* \} */
    01152
    01153     }
    01154 }
    01155
    01156 #endif

Copyright (c) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson |