Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 1 | /* libFLAC++ - Free Lossless Audio Codec library |
Josh Coalson | afae69f | 2003-01-02 07:03:16 +0000 | [diff] [blame] | 2 | * Copyright (C) 2002,2003 Josh Coalson |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public |
| 15 | * License along with this library; if not, write to the |
| 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 17 | * Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | |
| 20 | #ifndef FLACPP__METADATA_H |
| 21 | #define FLACPP__METADATA_H |
| 22 | |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 23 | #include "export.h" |
| 24 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 25 | #include "FLAC/metadata.h" |
| 26 | |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 27 | // =============================================================== |
| 28 | // |
| 29 | // Full documentation for the metadata interface can be found |
| 30 | // in the C layer in include/FLAC/metadata.h |
| 31 | // |
| 32 | // =============================================================== |
| 33 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 34 | /** \file include/FLAC++/metadata.h |
| 35 | * |
| 36 | * \brief |
| 37 | * This module provides classes for creating and manipulating FLAC |
| 38 | * metadata blocks in memory, and three progressively more powerful |
| 39 | * interfaces for traversing and editing metadata in FLAC files. |
| 40 | * |
| 41 | * See the detailed documentation for each interface in the |
| 42 | * \link flacpp_metadata metadata \endlink module. |
| 43 | */ |
| 44 | |
| 45 | /** \defgroup flacpp_metadata FLAC++/metadata.h: metadata interfaces |
| 46 | * \ingroup flacpp |
| 47 | * |
| 48 | * \brief |
| 49 | * This module provides classes for creating and manipulating FLAC |
| 50 | * metadata blocks in memory, and three progressively more powerful |
| 51 | * interfaces for traversing and editing metadata in FLAC files. |
| 52 | * |
| 53 | * The behavior closely mimics the C layer interface; be sure to read |
| 54 | * the detailed description of the |
| 55 | * \link flac_metadata C metadata module \endlink. |
| 56 | */ |
| 57 | |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 58 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 59 | namespace FLAC { |
| 60 | namespace Metadata { |
| 61 | |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 62 | // ============================================================ |
| 63 | // |
| 64 | // Metadata objects |
| 65 | // |
| 66 | // ============================================================ |
| 67 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 68 | /** \defgroup flacpp_metadata_object FLAC++/metadata.h: metadata object classes |
| 69 | * \ingroup flacpp_metadata |
| 70 | * |
| 71 | * This module contains classes representing FLAC metadata |
| 72 | * blocks in memory. |
| 73 | * |
| 74 | * The behavior closely mimics the C layer interface; be |
| 75 | * sure to read the detailed description of the |
| 76 | * \link flac_metadata_object C metadata object module \endlink. |
| 77 | * |
| 78 | * Any time a metadata object is constructed or assigned, you |
| 79 | * should check is_valid() to make sure the underlying |
| 80 | * ::FLAC__StreamMetadata object was able to be created. |
| 81 | * |
| 82 | * \warning |
| 83 | * When the get_*() methods of any metadata object method |
| 84 | * return you a const pointer, DO NOT disobey and write into it. |
| 85 | * Always use the set_*() methods. |
| 86 | * |
| 87 | * \{ |
| 88 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 89 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 90 | /** Base class for all metadata block types. |
| 91 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 92 | class FLACPP_API Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 93 | protected: |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 94 | //@{ |
| 95 | /** Constructs a copy of the given object. This form |
| 96 | * always performs a deep copy. |
| 97 | */ |
| 98 | Prototype(const Prototype &); |
| 99 | Prototype(const ::FLAC__StreamMetadata &); |
| 100 | Prototype(const ::FLAC__StreamMetadata *); |
| 101 | //@} |
Josh Coalson | 8396175 | 2002-07-09 06:12:59 +0000 | [diff] [blame] | 102 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 103 | /** Constructs an object with copy control. When \a copy |
| 104 | * is \c true, behaves identically to |
| 105 | * FLAC::Metadata::Prototype::Prototype(const ::FLAC__StreamMetadata *object). |
| 106 | * When \a copy is \c false, the instance takes ownership of |
| 107 | * the pointer and the ::FLAC__StreamMetadata object will |
| 108 | * be freed by the destructor. |
| 109 | * |
| 110 | * \assert |
| 111 | * \code object != NULL \endcode |
| 112 | */ |
Josh Coalson | 8396175 | 2002-07-09 06:12:59 +0000 | [diff] [blame] | 113 | Prototype(::FLAC__StreamMetadata *object, bool copy); |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 114 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 115 | //@{ |
| 116 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 117 | void operator=(const Prototype &); |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 118 | void operator=(const ::FLAC__StreamMetadata &); |
| 119 | void operator=(const ::FLAC__StreamMetadata *); |
| 120 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 121 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 122 | /** Deletes the underlying ::FLAC__StreamMetadata object. |
| 123 | */ |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 124 | virtual void clear(); |
| 125 | |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 126 | ::FLAC__StreamMetadata *object_; |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 127 | public: |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 128 | /** Deletes the underlying ::FLAC__StreamMetadata object. |
| 129 | */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 130 | virtual ~Prototype(); |
| 131 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 132 | //@{ |
| 133 | /** Check for equality, performing a deep compare by following pointers. */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 134 | inline bool operator==(const Prototype &) const; |
| 135 | inline bool operator==(const ::FLAC__StreamMetadata &) const; |
| 136 | inline bool operator==(const ::FLAC__StreamMetadata *) const; |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 137 | //@} |
| 138 | |
| 139 | //@{ |
| 140 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 141 | inline bool operator!=(const Prototype &) const; |
| 142 | inline bool operator!=(const ::FLAC__StreamMetadata &) const; |
| 143 | inline bool operator!=(const ::FLAC__StreamMetadata *) const; |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 144 | //@} |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 145 | |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 146 | friend class SimpleIterator; |
| 147 | friend class Iterator; |
| 148 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 149 | /** Returns \c true if the object was correctly constructed |
| 150 | * (i.e. the underlying ::FLAC__StreamMetadata object was |
| 151 | * properly allocated), else \c false. |
| 152 | */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 153 | inline bool is_valid() const; |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 154 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 155 | /** Returns \c true if this block is the last block in a |
| 156 | * stream, else \c false. |
| 157 | * |
| 158 | * \assert |
| 159 | * \code is_valid() \endcode |
| 160 | */ |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 161 | bool get_is_last() const; |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 162 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 163 | /** Returns the type of the block. |
| 164 | * |
| 165 | * \assert |
| 166 | * \code is_valid() \endcode |
| 167 | */ |
| 168 | ::FLAC__MetadataType get_type() const; |
| 169 | |
| 170 | /** Returns the stream length of the metadata block. |
| 171 | * |
| 172 | * \note |
| 173 | * The length does not include the metadata block header, |
| 174 | * per spec. |
| 175 | * |
| 176 | * \assert |
| 177 | * \code is_valid() \endcode |
| 178 | */ |
| 179 | unsigned get_length() const; |
| 180 | |
| 181 | /** Sets the "is_last" flag for the block. When using the iterators |
| 182 | * it is not necessary to set this flag; they will do it for you. |
| 183 | * |
| 184 | * \assert |
| 185 | * \code is_valid() \endcode |
| 186 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 187 | void set_is_last(bool); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 188 | private: |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 189 | /** Private and undefined so you can't use it. */ |
| 190 | Prototype(); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 191 | |
| 192 | // These are used only by Iterator |
| 193 | bool is_reference_; |
| 194 | inline void set_reference(bool x) { is_reference_ = x; } |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 195 | }; |
| 196 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 197 | inline bool Prototype::operator==(const Prototype &object) const |
Josh Coalson | d57c8d3 | 2002-06-11 06:15:28 +0000 | [diff] [blame] | 198 | { return (bool)::FLAC__metadata_object_is_equal(object_, object.object_); } |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 199 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 200 | inline bool Prototype::operator==(const ::FLAC__StreamMetadata &object) const |
Josh Coalson | d57c8d3 | 2002-06-11 06:15:28 +0000 | [diff] [blame] | 201 | { return (bool)::FLAC__metadata_object_is_equal(object_, &object); } |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 202 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 203 | inline bool Prototype::operator==(const ::FLAC__StreamMetadata *object) const |
Josh Coalson | d57c8d3 | 2002-06-11 06:15:28 +0000 | [diff] [blame] | 204 | { return (bool)::FLAC__metadata_object_is_equal(object_, object); } |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 205 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 206 | inline bool Prototype::operator!=(const Prototype &object) const |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 207 | { return !operator==(object); } |
| 208 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 209 | inline bool Prototype::operator!=(const ::FLAC__StreamMetadata &object) const |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 210 | { return !operator==(object); } |
| 211 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 212 | inline bool Prototype::operator!=(const ::FLAC__StreamMetadata *object) const |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 213 | { return !operator==(object); } |
| 214 | |
| 215 | inline bool Prototype::is_valid() const |
| 216 | { return 0 != object_; } |
| 217 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 218 | /** Create a deep copy of an object and return it. */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 219 | FLACPP_API Prototype *clone(const Prototype *); |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 220 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 221 | |
| 222 | /** STREAMINFO metadata block. |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 223 | * See <A HREF="../format.html#metadata_block_streaminfo">format specification</A>. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 224 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 225 | class FLACPP_API StreamInfo : public Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 226 | public: |
| 227 | StreamInfo(); |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 228 | |
| 229 | //@{ |
| 230 | /** Constructs a copy of the given object. This form |
| 231 | * always performs a deep copy. |
| 232 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 233 | inline StreamInfo(const StreamInfo &object): Prototype(object) { } |
| 234 | inline StreamInfo(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 235 | inline StreamInfo(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 236 | //@} |
| 237 | |
| 238 | /** Constructs an object with copy control. See |
| 239 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 240 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 241 | inline StreamInfo(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 242 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 243 | ~StreamInfo(); |
| 244 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 245 | //@{ |
| 246 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 247 | inline void operator=(const StreamInfo &object) { Prototype::operator=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 248 | inline void operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); } |
| 249 | inline void operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); } |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 250 | //@} |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 251 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 252 | //@{ |
| 253 | /** Check for equality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 254 | inline bool operator==(const StreamInfo &object) const { return Prototype::operator==(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 255 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 256 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 257 | //@} |
| 258 | |
| 259 | //@{ |
| 260 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 261 | inline bool operator!=(const StreamInfo &object) const { return Prototype::operator!=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 262 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 263 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 264 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 265 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 266 | //@{ |
| 267 | /** See <A HREF="../format.html#metadata_block_streaminfo">format specification</A>. */ |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 268 | unsigned get_min_blocksize() const; |
| 269 | unsigned get_max_blocksize() const; |
| 270 | unsigned get_min_framesize() const; |
| 271 | unsigned get_max_framesize() const; |
| 272 | unsigned get_sample_rate() const; |
| 273 | unsigned get_channels() const; |
| 274 | unsigned get_bits_per_sample() const; |
| 275 | FLAC__uint64 get_total_samples() const; |
| 276 | const FLAC__byte *get_md5sum() const; |
| 277 | |
| 278 | void set_min_blocksize(unsigned value); |
| 279 | void set_max_blocksize(unsigned value); |
| 280 | void set_min_framesize(unsigned value); |
| 281 | void set_max_framesize(unsigned value); |
| 282 | void set_sample_rate(unsigned value); |
| 283 | void set_channels(unsigned value); |
| 284 | void set_bits_per_sample(unsigned value); |
| 285 | void set_total_samples(FLAC__uint64 value); |
| 286 | void set_md5sum(const FLAC__byte value[16]); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 287 | //@} |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 288 | }; |
| 289 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 290 | /** PADDING metadata block. |
| 291 | * See <A HREF="../format.html#metadata_block_padding">format specification</A>. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 292 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 293 | class FLACPP_API Padding : public Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 294 | public: |
| 295 | Padding(); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 296 | |
| 297 | //@{ |
| 298 | /** Constructs a copy of the given object. This form |
| 299 | * always performs a deep copy. |
| 300 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 301 | inline Padding(const Padding &object): Prototype(object) { } |
| 302 | inline Padding(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 303 | inline Padding(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 304 | //@} |
| 305 | |
| 306 | /** Constructs an object with copy control. See |
| 307 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 308 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 309 | inline Padding(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 310 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 311 | ~Padding(); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 312 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 313 | //@{ |
| 314 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 315 | inline void operator=(const Padding &object) { Prototype::operator=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 316 | inline void operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); } |
| 317 | inline void operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 318 | //@} |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 319 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 320 | //@{ |
| 321 | /** Check for equality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 322 | inline bool operator==(const Padding &object) const { return Prototype::operator==(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 323 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 324 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 325 | //@} |
| 326 | |
| 327 | //@{ |
| 328 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 329 | inline bool operator!=(const Padding &object) const { return Prototype::operator!=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 330 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 331 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 332 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 333 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 334 | void set_length(unsigned length); |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 335 | }; |
| 336 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 337 | /** APPLICATION metadata block. |
| 338 | * See <A HREF="../format.html#metadata_block_application">format specification</A>. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 339 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 340 | class FLACPP_API Application : public Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 341 | public: |
| 342 | Application(); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 343 | // |
| 344 | //@{ |
| 345 | /** Constructs a copy of the given object. This form |
| 346 | * always performs a deep copy. |
| 347 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 348 | inline Application(const Application &object): Prototype(object) { } |
| 349 | inline Application(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 350 | inline Application(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 351 | //@} |
| 352 | |
| 353 | /** Constructs an object with copy control. See |
| 354 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 355 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 356 | inline Application(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 357 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 358 | ~Application(); |
| 359 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 360 | //@{ |
| 361 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 362 | inline void operator=(const Application &object) { Prototype::operator=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 363 | inline void operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); } |
| 364 | inline void operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 365 | //@} |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 366 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 367 | //@{ |
| 368 | /** Check for equality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 369 | inline bool operator==(const Application &object) const { return Prototype::operator==(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 370 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 371 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 372 | //@} |
| 373 | |
| 374 | //@{ |
| 375 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 376 | inline bool operator!=(const Application &object) const { return Prototype::operator!=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 377 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 378 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 379 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 380 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 381 | const FLAC__byte *get_id() const; |
| 382 | const FLAC__byte *get_data() const; |
| 383 | |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 384 | void set_id(const FLAC__byte value[4]); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 385 | //! This form always copies \a data |
| 386 | bool set_data(const FLAC__byte *data, unsigned length); |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 387 | bool set_data(FLAC__byte *data, unsigned length, bool copy); |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 388 | }; |
| 389 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 390 | /** SEEKTABLE metadata block. |
| 391 | * See <A HREF="../format.html#metadata_block_seektable">format specification</A>. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 392 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 393 | class FLACPP_API SeekTable : public Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 394 | public: |
| 395 | SeekTable(); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 396 | |
| 397 | //@{ |
| 398 | /** Constructs a copy of the given object. This form |
| 399 | * always performs a deep copy. |
| 400 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 401 | inline SeekTable(const SeekTable &object): Prototype(object) { } |
| 402 | inline SeekTable(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 403 | inline SeekTable(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 404 | //@} |
| 405 | |
| 406 | /** Constructs an object with copy control. See |
| 407 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 408 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 409 | inline SeekTable(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 410 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 411 | ~SeekTable(); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 412 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 413 | //@{ |
| 414 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 415 | inline void operator=(const SeekTable &object) { Prototype::operator=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 416 | inline void operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); } |
| 417 | inline void operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 418 | //@} |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 419 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 420 | //@{ |
| 421 | /** Check for equality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 422 | inline bool operator==(const SeekTable &object) const { return Prototype::operator==(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 423 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 424 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 425 | //@} |
| 426 | |
| 427 | //@{ |
| 428 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 429 | inline bool operator!=(const SeekTable &object) const { return Prototype::operator!=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 430 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 431 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 432 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 433 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 434 | unsigned get_num_points() const; |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 435 | ::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const; |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 436 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 437 | //! See FLAC__metadata_object_seektable_set_point() |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 438 | void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 439 | |
| 440 | //! See FLAC__metadata_object_seektable_insert_point() |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 441 | bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 442 | |
| 443 | //! See FLAC__metadata_object_seektable_delete_point() |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 444 | bool delete_point(unsigned index); |
Josh Coalson | 28e08d8 | 2002-06-05 05:56:41 +0000 | [diff] [blame] | 445 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 446 | //! See FLAC__metadata_object_seektable_is_legal() |
Josh Coalson | 28e08d8 | 2002-06-05 05:56:41 +0000 | [diff] [blame] | 447 | bool is_legal() const; |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 448 | }; |
| 449 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 450 | /** VORBIS_COMMENT metadata block. |
| 451 | * See <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 452 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 453 | class FLACPP_API VorbisComment : public Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 454 | public: |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 455 | /** Convenience class for encapsulating Vorbis comment |
| 456 | * entries. An entry is a vendor string or a comment |
| 457 | * field. In the case of a vendor string, the field |
| 458 | * name is undefined; only the field value is relevant. |
| 459 | * |
| 460 | * A \a field as used in the methods refers to an |
| 461 | * entire 'NAME=VALUE' string; the string is not null- |
| 462 | * terminated and a length field is required since the |
| 463 | * string may contain embedded nulls. |
| 464 | * |
| 465 | * A \a field_name is what is on the left side of the |
| 466 | * first '=' in the \a field. By definition it is ASCII |
| 467 | * and so is null-terminated and does not require a |
| 468 | * length to describe it. \a field_name is undefined |
| 469 | * for a vendor string entry. |
| 470 | * |
| 471 | * A \a field_value is what is on the right side of the |
| 472 | * first '=' in the \a field. By definition, this may |
| 473 | * contain embedded nulls and so a \a field_value_length |
| 474 | * is requires to describe it. |
| 475 | * |
| 476 | * Always check is_valid() after the constructor or operator= |
| 477 | * to make sure memory was properly allocated. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 478 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 479 | class FLACPP_API Entry { |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 480 | public: |
| 481 | Entry(); |
| 482 | Entry(const char *field, unsigned field_length); |
| 483 | Entry(const char *field_name, const char *field_value, unsigned field_value_length); |
| 484 | Entry(const Entry &entry); |
| 485 | void operator=(const Entry &entry); |
| 486 | |
| 487 | virtual ~Entry(); |
| 488 | |
| 489 | virtual bool is_valid() const; |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 490 | |
| 491 | unsigned get_field_length() const; |
| 492 | unsigned get_field_name_length() const; |
| 493 | unsigned get_field_value_length() const; |
| 494 | |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 495 | ::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const; |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 496 | const char *get_field() const; |
| 497 | const char *get_field_name() const; |
| 498 | const char *get_field_value() const; |
| 499 | |
| 500 | bool set_field(const char *field, unsigned field_length); |
| 501 | bool set_field_name(const char *field_name); |
| 502 | bool set_field_value(const char *field_value, unsigned field_value_length); |
| 503 | protected: |
| 504 | bool is_valid_; |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 505 | ::FLAC__StreamMetadata_VorbisComment_Entry entry_; |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 506 | char *field_name_; |
| 507 | unsigned field_name_length_; |
| 508 | char *field_value_; |
| 509 | unsigned field_value_length_; |
| 510 | private: |
| 511 | void zero(); |
| 512 | void clear(); |
| 513 | void clear_entry(); |
| 514 | void clear_field_name(); |
| 515 | void clear_field_value(); |
| 516 | void construct(const char *field, unsigned field_length); |
| 517 | void construct(const char *field_name, const char *field_value, unsigned field_value_length); |
| 518 | void compose_field(); |
| 519 | void parse_field(); |
| 520 | }; |
| 521 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 522 | VorbisComment(); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 523 | |
| 524 | //@{ |
| 525 | /** Constructs a copy of the given object. This form |
| 526 | * always performs a deep copy. |
| 527 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 528 | inline VorbisComment(const VorbisComment &object): Prototype(object) { } |
| 529 | inline VorbisComment(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 530 | inline VorbisComment(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 531 | //@} |
| 532 | |
| 533 | /** Constructs an object with copy control. See |
| 534 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 535 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 536 | inline VorbisComment(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 537 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 538 | ~VorbisComment(); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 539 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 540 | //@{ |
| 541 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 542 | inline void operator=(const VorbisComment &object) { Prototype::operator=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 543 | inline void operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); } |
| 544 | inline void operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 545 | //@} |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 546 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 547 | //@{ |
| 548 | /** Check for equality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 549 | inline bool operator==(const VorbisComment &object) const { return Prototype::operator==(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 550 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 551 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 552 | //@} |
| 553 | |
| 554 | //@{ |
| 555 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 556 | inline bool operator!=(const VorbisComment &object) const { return Prototype::operator!=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 557 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 558 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 559 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 560 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 561 | unsigned get_num_comments() const; |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 562 | Entry get_vendor_string() const; // only the Entry's field name should be used |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 563 | Entry get_comment(unsigned index) const; |
| 564 | |
Josh Coalson | 87977ba | 2002-08-20 07:09:33 +0000 | [diff] [blame] | 565 | //! See FLAC__metadata_object_vorbiscomment_set_vendor_string() |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 566 | //! \note Only the Entry's field name will be used. |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 567 | bool set_vendor_string(const Entry &entry); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 568 | |
Josh Coalson | 87977ba | 2002-08-20 07:09:33 +0000 | [diff] [blame] | 569 | //! See FLAC__metadata_object_vorbiscomment_set_comment() |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 570 | bool set_comment(unsigned index, const Entry &entry); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 571 | |
Josh Coalson | 87977ba | 2002-08-20 07:09:33 +0000 | [diff] [blame] | 572 | //! See FLAC__metadata_object_vorbiscomment_insert_comment() |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 573 | bool insert_comment(unsigned index, const Entry &entry); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 574 | |
Josh Coalson | 87977ba | 2002-08-20 07:09:33 +0000 | [diff] [blame] | 575 | //! See FLAC__metadata_object_vorbiscomment_delete_comment() |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 576 | bool delete_comment(unsigned index); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 577 | }; |
| 578 | |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 579 | /** CUESHEET metadata block. |
| 580 | * See <A HREF="../format.html#metadata_block_cuesheet">format specification</A>. |
| 581 | */ |
| 582 | class FLACPP_API CueSheet : public Prototype { |
| 583 | public: |
| 584 | /** Convenience class for encapsulating a cue sheet |
| 585 | * track. |
| 586 | * |
| 587 | * Always check is_valid() after the constructor or operator= |
| 588 | * to make sure memory was properly allocated. |
| 589 | */ |
| 590 | class FLACPP_API Track { |
| 591 | protected: |
| 592 | ::FLAC__StreamMetadata_CueSheet_Track *object_; |
| 593 | public: |
| 594 | Track(); |
| 595 | Track(const ::FLAC__StreamMetadata_CueSheet_Track *track); |
| 596 | Track(const Track &track); |
| 597 | void operator=(const Track &track); |
| 598 | |
| 599 | virtual ~Track(); |
| 600 | |
| 601 | virtual bool is_valid() const; |
| 602 | |
| 603 | inline FLAC__uint64 get_offset() const { return object_->offset; } |
| 604 | inline FLAC__byte get_number() const { return object_->number; } |
| 605 | inline const char *get_isrc() const { return object_->isrc; } |
| 606 | inline unsigned get_type() const { return object_->type; } |
| 607 | inline bool get_pre_emphasis() const { return object_->pre_emphasis; } |
| 608 | |
| 609 | inline bool get_num_indices() const { return object_->num_indices; } |
| 610 | ::FLAC__StreamMetadata_CueSheet_Index get_index(unsigned i) const; |
| 611 | |
| 612 | inline const ::FLAC__StreamMetadata_CueSheet_Track *get_track() const { return object_; } |
| 613 | |
| 614 | inline void set_offset(FLAC__uint64 value) { object_->offset = value; } |
| 615 | inline void set_number(FLAC__byte value) { object_->number = value; } |
Josh Coalson | 1621979 | 2002-11-19 06:19:29 +0000 | [diff] [blame] | 616 | void set_isrc(const char value[12]); |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 617 | void set_type(unsigned value); |
| 618 | inline void set_pre_emphasis(bool value) { object_->pre_emphasis = value? 1 : 0; } |
| 619 | |
Josh Coalson | 1621979 | 2002-11-19 06:19:29 +0000 | [diff] [blame] | 620 | void set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index); |
| 621 | //@@@@ It's awkward but to insert/delete index points |
| 622 | //@@@@ you must use the routines in the CueSheet class. |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 623 | }; |
| 624 | |
| 625 | CueSheet(); |
| 626 | |
| 627 | //@{ |
| 628 | /** Constructs a copy of the given object. This form |
| 629 | * always performs a deep copy. |
| 630 | */ |
| 631 | inline CueSheet(const CueSheet &object): Prototype(object) { } |
| 632 | inline CueSheet(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 633 | inline CueSheet(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
| 634 | //@} |
| 635 | |
| 636 | /** Constructs an object with copy control. See |
| 637 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 638 | */ |
| 639 | inline CueSheet(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
| 640 | |
| 641 | ~CueSheet(); |
| 642 | |
| 643 | //@{ |
| 644 | /** Assign from another object. Always performs a deep copy. */ |
| 645 | inline void operator=(const CueSheet &object) { Prototype::operator=(object); } |
| 646 | inline void operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); } |
| 647 | inline void operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); } |
| 648 | //@} |
| 649 | |
| 650 | //@{ |
| 651 | /** Check for equality, performing a deep compare by following pointers. */ |
| 652 | inline bool operator==(const CueSheet &object) const { return Prototype::operator==(object); } |
| 653 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 654 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
| 655 | //@} |
| 656 | |
| 657 | //@{ |
| 658 | /** Check for inequality, performing a deep compare by following pointers. */ |
| 659 | inline bool operator!=(const CueSheet &object) const { return Prototype::operator!=(object); } |
| 660 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 661 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
| 662 | //@} |
| 663 | |
| 664 | const char *get_media_catalog_number() const; |
| 665 | FLAC__uint64 get_lead_in() const; |
Josh Coalson | 8f0c71b | 2002-12-05 06:37:46 +0000 | [diff] [blame] | 666 | bool get_is_cd() const; |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 667 | |
| 668 | unsigned get_num_tracks() const; |
| 669 | Track get_track(unsigned i) const; |
| 670 | |
Josh Coalson | 1621979 | 2002-11-19 06:19:29 +0000 | [diff] [blame] | 671 | void set_media_catalog_number(const char value[128]); |
| 672 | void set_lead_in(FLAC__uint64 value); |
Josh Coalson | 8f0c71b | 2002-12-05 06:37:46 +0000 | [diff] [blame] | 673 | void set_is_cd(bool value); |
Josh Coalson | 1621979 | 2002-11-19 06:19:29 +0000 | [diff] [blame] | 674 | |
| 675 | void set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index); |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 676 | |
| 677 | //! See FLAC__metadata_object_cuesheet_track_insert_index() |
| 678 | bool insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index); |
| 679 | |
| 680 | //! See FLAC__metadata_object_cuesheet_track_delete_index() |
| 681 | bool delete_index(unsigned track_num, unsigned index_num); |
| 682 | |
| 683 | //! See FLAC__metadata_object_cuesheet_set_track() |
| 684 | bool set_track(unsigned i, const Track &track); |
| 685 | |
| 686 | //! See FLAC__metadata_object_cuesheet_insert_track() |
| 687 | bool insert_track(unsigned i, const Track &track); |
| 688 | |
| 689 | //! See FLAC__metadata_object_cuesheet_delete_track() |
| 690 | bool delete_track(unsigned i); |
| 691 | |
| 692 | //! See FLAC__metadata_object_cuesheet_is_legal() |
| 693 | bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const; |
| 694 | }; |
| 695 | |
Josh Coalson | 0eea34a | 2003-01-10 05:29:17 +0000 | [diff] [blame^] | 696 | /** Opaque metadata block for storing unknown types. |
| 697 | * This should not be used unless you know what you are doing; |
| 698 | * it is currently used only internally to support forward |
| 699 | * compatibility of metadata blocks. |
| 700 | */ |
| 701 | class FLACPP_API Unknown : public Prototype { |
| 702 | public: |
| 703 | Unknown(); |
| 704 | // |
| 705 | //@{ |
| 706 | /** Constructs a copy of the given object. This form |
| 707 | * always performs a deep copy. |
| 708 | */ |
| 709 | inline Unknown(const Unknown &object): Prototype(object) { } |
| 710 | inline Unknown(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 711 | inline Unknown(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
| 712 | //@} |
| 713 | |
| 714 | /** Constructs an object with copy control. See |
| 715 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 716 | */ |
| 717 | inline Unknown(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
| 718 | |
| 719 | ~Unknown(); |
| 720 | |
| 721 | //@{ |
| 722 | /** Assign from another object. Always performs a deep copy. */ |
| 723 | inline void operator=(const Unknown &object) { Prototype::operator=(object); } |
| 724 | inline void operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); } |
| 725 | inline void operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); } |
| 726 | //@} |
| 727 | |
| 728 | //@{ |
| 729 | /** Check for equality, performing a deep compare by following pointers. */ |
| 730 | inline bool operator==(const Unknown &object) const { return Prototype::operator==(object); } |
| 731 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 732 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
| 733 | //@} |
| 734 | |
| 735 | //@{ |
| 736 | /** Check for inequality, performing a deep compare by following pointers. */ |
| 737 | inline bool operator!=(const Unknown &object) const { return Prototype::operator!=(object); } |
| 738 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 739 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
| 740 | //@} |
| 741 | |
| 742 | const FLAC__byte *get_data() const; |
| 743 | |
| 744 | //! This form always copies \a data |
| 745 | bool set_data(const FLAC__byte *data, unsigned length); |
| 746 | bool set_data(FLAC__byte *data, unsigned length, bool copy); |
| 747 | }; |
| 748 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 749 | /* \} */ |
| 750 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 751 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 752 | /** \defgroup flacpp_metadata_level0 FLAC++/metadata.h: metadata level 0 interface |
| 753 | * \ingroup flacpp_metadata |
| 754 | * |
| 755 | * \brief |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 756 | * Level 0 metadata iterator. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 757 | * |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 758 | * See the \link flac_metadata_level0 C layer equivalent \endlink |
| 759 | * for more. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 760 | * |
| 761 | * \{ |
| 762 | */ |
| 763 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 764 | //! See FLAC__metadata_get_streaminfo(). |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 765 | FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 766 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 767 | /* \} */ |
| 768 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 769 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 770 | /** \defgroup flacpp_metadata_level1 FLAC++/metadata.h: metadata level 1 interface |
| 771 | * \ingroup flacpp_metadata |
| 772 | * |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 773 | * \brief |
| 774 | * Level 1 metadata iterator. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 775 | * |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 776 | * The flow through the iterator in the C++ layer is similar |
| 777 | * to the C layer: |
| 778 | * - Create a SimpleIterator instance |
| 779 | * - Check SimpleIterator::is_valid() |
| 780 | * - Call SimpleIterator::init() and check the return |
| 781 | * - Traverse and/or edit. Edits are written to file |
| 782 | * immediately. |
| 783 | * - Destroy the SimpleIterator instance |
| 784 | * |
| 785 | * The ownership of pointers in the C++ layer follows that in |
| 786 | * the C layer, i.e. |
| 787 | * - The objects returned by get_block() are yours to |
| 788 | * modify, but changes are not reflected in the FLAC file |
| 789 | * until you call set_block(). The objects are also |
| 790 | * yours to delete; they are not automatically deleted |
| 791 | * when passed to set_block() or insert_block_after(). |
| 792 | * |
| 793 | * See the \link flac_metadata_level1 C layer equivalent \endlink |
| 794 | * for more. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 795 | * |
| 796 | * \{ |
| 797 | */ |
| 798 | |
Josh Coalson | 402da70 | 2002-08-21 03:40:11 +0000 | [diff] [blame] | 799 | /** This class is a wrapper around the FLAC__metadata_simple_iterator |
| 800 | * structures and methods; see ::FLAC__Metadata_SimpleIterator. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 801 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 802 | class FLACPP_API SimpleIterator { |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 803 | public: |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 804 | class FLACPP_API Status { |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 805 | public: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 806 | inline Status(::FLAC__Metadata_SimpleIteratorStatus status): status_(status) { } |
| 807 | inline operator ::FLAC__Metadata_SimpleIteratorStatus() const { return status_; } |
| 808 | inline const char *as_cstring() const { return ::FLAC__Metadata_SimpleIteratorStatusString[status_]; } |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 809 | protected: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 810 | ::FLAC__Metadata_SimpleIteratorStatus status_; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 811 | }; |
| 812 | |
| 813 | SimpleIterator(); |
| 814 | virtual ~SimpleIterator(); |
| 815 | |
Josh Coalson | 3ac6693 | 2002-08-30 05:41:31 +0000 | [diff] [blame] | 816 | bool init(const char *filename, bool read_only, bool preserve_file_stats); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 817 | |
| 818 | bool is_valid() const; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 819 | Status status(); |
| 820 | bool is_writable() const; |
| 821 | |
| 822 | bool next(); |
| 823 | bool prev(); |
| 824 | |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 825 | ::FLAC__MetadataType get_block_type() const; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 826 | Prototype *get_block(); |
| 827 | bool set_block(Prototype *block, bool use_padding = true); |
| 828 | bool insert_block_after(Prototype *block, bool use_padding = true); |
| 829 | bool delete_block(bool use_padding = true); |
| 830 | |
| 831 | protected: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 832 | ::FLAC__Metadata_SimpleIterator *iterator_; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 833 | void clear(); |
| 834 | }; |
| 835 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 836 | /* \} */ |
| 837 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 838 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 839 | /** \defgroup flacpp_metadata_level2 FLAC++/metadata.h: metadata level 2 interface |
| 840 | * \ingroup flacpp_metadata |
| 841 | * |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 842 | * \brief |
| 843 | * Level 2 metadata iterator. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 844 | * |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 845 | * The flow through the iterator in the C++ layer is similar |
| 846 | * to the C layer: |
| 847 | * - Create a Chain instance |
| 848 | * - Check Chain::is_valid() |
| 849 | * - Call Chain::read() and check the return |
| 850 | * - Traverse and/or edit with an Iterator or with |
| 851 | * Chain::merge_padding() or Chain::sort_padding() |
| 852 | * - Write changes back to FLAC file with Chain::write() |
| 853 | * - Destroy the Chain instance |
| 854 | * |
Josh Coalson | 8b9a477 | 2002-12-28 07:03:26 +0000 | [diff] [blame] | 855 | * The ownership of pointers in the C++ layer is slightly |
| 856 | * different than in the C layer, i.e. |
| 857 | * - The objects returned by Iterator::get_block() are NOT |
| 858 | * owned by the iterator and should be deleted by the |
| 859 | * caller when finished, BUT, when you modify the block, |
| 860 | * it will directly edit what's in the chain and you do |
| 861 | * not need to call Iterator::set_block(). However the |
| 862 | * changes will not be reflected in the FLAC file until |
| 863 | * the chain is written with Chain::write(). |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 864 | * - When you pass an object to Iterator::set_block(), |
| 865 | * Iterator::insert_block_before(), or |
| 866 | * Iterator::insert_block_after(), the iterator takes |
Josh Coalson | 8b9a477 | 2002-12-28 07:03:26 +0000 | [diff] [blame] | 867 | * ownership of the block and it will be deleted by the |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 868 | * chain. |
| 869 | * |
| 870 | * See the \link flac_metadata_level2 C layer equivalent \endlink |
| 871 | * for more. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 872 | * |
| 873 | * \{ |
| 874 | */ |
| 875 | |
Josh Coalson | 402da70 | 2002-08-21 03:40:11 +0000 | [diff] [blame] | 876 | /** This class is a wrapper around the FLAC__metadata_chain |
| 877 | * structures and methods; see ::FLAC__Metadata_Chain. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 878 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 879 | class FLACPP_API Chain { |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 880 | public: |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 881 | class FLACPP_API Status { |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 882 | public: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 883 | inline Status(::FLAC__Metadata_ChainStatus status): status_(status) { } |
| 884 | inline operator ::FLAC__Metadata_ChainStatus() const { return status_; } |
| 885 | inline const char *as_cstring() const { return ::FLAC__Metadata_ChainStatusString[status_]; } |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 886 | protected: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 887 | ::FLAC__Metadata_ChainStatus status_; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 888 | }; |
| 889 | |
| 890 | Chain(); |
| 891 | virtual ~Chain(); |
| 892 | |
| 893 | friend class Iterator; |
| 894 | |
| 895 | bool is_valid() const; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 896 | Status status(); |
| 897 | |
| 898 | bool read(const char *filename); |
| 899 | bool write(bool use_padding = true, bool preserve_file_stats = false); |
| 900 | |
| 901 | void merge_padding(); |
| 902 | void sort_padding(); |
| 903 | |
| 904 | protected: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 905 | ::FLAC__Metadata_Chain *chain_; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 906 | virtual void clear(); |
| 907 | }; |
| 908 | |
Josh Coalson | 402da70 | 2002-08-21 03:40:11 +0000 | [diff] [blame] | 909 | /** This class is a wrapper around the FLAC__metadata_iterator |
| 910 | * structures and methods; see ::FLAC__Metadata_Iterator. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 911 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 912 | class FLACPP_API Iterator { |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 913 | public: |
| 914 | Iterator(); |
| 915 | virtual ~Iterator(); |
| 916 | |
| 917 | bool is_valid() const; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 918 | |
Josh Coalson | 999be3b | 2002-06-10 04:42:35 +0000 | [diff] [blame] | 919 | void init(Chain &chain); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 920 | |
| 921 | bool next(); |
| 922 | bool prev(); |
| 923 | |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 924 | ::FLAC__MetadataType get_block_type() const; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 925 | Prototype *get_block(); |
| 926 | bool set_block(Prototype *block); |
| 927 | bool delete_block(bool replace_with_padding); |
| 928 | bool insert_block_before(Prototype *block); |
| 929 | bool insert_block_after(Prototype *block); |
| 930 | |
| 931 | protected: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 932 | ::FLAC__Metadata_Iterator *iterator_; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 933 | virtual void clear(); |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 934 | }; |
| 935 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 936 | /* \} */ |
| 937 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 938 | }; |
| 939 | }; |
| 940 | |
| 941 | #endif |