Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 1 | /* libFLAC++ - Free Lossless Audio Codec library |
Josh Coalson | 0395dac | 2006-04-25 06:59:33 +0000 | [diff] [blame] | 2 | * Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 3 | * |
Josh Coalson | afd8107 | 2003-01-31 23:34:56 +0000 | [diff] [blame] | 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 7 | * |
Josh Coalson | afd8107 | 2003-01-31 23:34:56 +0000 | [diff] [blame] | 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 10 | * |
Josh Coalson | afd8107 | 2003-01-31 23:34:56 +0000 | [diff] [blame] | 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 30 | */ |
| 31 | |
| 32 | #ifndef FLACPP__METADATA_H |
| 33 | #define FLACPP__METADATA_H |
| 34 | |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 35 | #include "export.h" |
| 36 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 37 | #include "FLAC/metadata.h" |
| 38 | |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 39 | // =============================================================== |
| 40 | // |
| 41 | // Full documentation for the metadata interface can be found |
| 42 | // in the C layer in include/FLAC/metadata.h |
| 43 | // |
| 44 | // =============================================================== |
| 45 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 46 | /** \file include/FLAC++/metadata.h |
| 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 | * See the detailed documentation for each interface in the |
| 54 | * \link flacpp_metadata metadata \endlink module. |
| 55 | */ |
| 56 | |
| 57 | /** \defgroup flacpp_metadata FLAC++/metadata.h: metadata interfaces |
| 58 | * \ingroup flacpp |
| 59 | * |
| 60 | * \brief |
| 61 | * This module provides classes for creating and manipulating FLAC |
| 62 | * metadata blocks in memory, and three progressively more powerful |
| 63 | * interfaces for traversing and editing metadata in FLAC files. |
| 64 | * |
| 65 | * The behavior closely mimics the C layer interface; be sure to read |
| 66 | * the detailed description of the |
Josh Coalson | 3c91754 | 2006-10-15 07:50:44 +0000 | [diff] [blame^] | 67 | * \link flac_metadata C metadata module \endlink. Note that the |
| 68 | * metadata API currently does not support Ogg FLAC files. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 69 | */ |
| 70 | |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 71 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 72 | namespace FLAC { |
| 73 | namespace Metadata { |
| 74 | |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 75 | // ============================================================ |
| 76 | // |
| 77 | // Metadata objects |
| 78 | // |
| 79 | // ============================================================ |
| 80 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 81 | /** \defgroup flacpp_metadata_object FLAC++/metadata.h: metadata object classes |
| 82 | * \ingroup flacpp_metadata |
| 83 | * |
| 84 | * This module contains classes representing FLAC metadata |
| 85 | * blocks in memory. |
| 86 | * |
| 87 | * The behavior closely mimics the C layer interface; be |
| 88 | * sure to read the detailed description of the |
| 89 | * \link flac_metadata_object C metadata object module \endlink. |
| 90 | * |
| 91 | * Any time a metadata object is constructed or assigned, you |
| 92 | * should check is_valid() to make sure the underlying |
| 93 | * ::FLAC__StreamMetadata object was able to be created. |
| 94 | * |
| 95 | * \warning |
| 96 | * When the get_*() methods of any metadata object method |
| 97 | * return you a const pointer, DO NOT disobey and write into it. |
| 98 | * Always use the set_*() methods. |
| 99 | * |
| 100 | * \{ |
| 101 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 102 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 103 | /** Base class for all metadata block types. |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 104 | * See the \link flacpp_metadata_object overview \endlink for more. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 105 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 106 | class FLACPP_API Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 107 | protected: |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 108 | //@{ |
| 109 | /** Constructs a copy of the given object. This form |
| 110 | * always performs a deep copy. |
| 111 | */ |
| 112 | Prototype(const Prototype &); |
| 113 | Prototype(const ::FLAC__StreamMetadata &); |
| 114 | Prototype(const ::FLAC__StreamMetadata *); |
| 115 | //@} |
Josh Coalson | 8396175 | 2002-07-09 06:12:59 +0000 | [diff] [blame] | 116 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 117 | /** Constructs an object with copy control. When \a copy |
| 118 | * is \c true, behaves identically to |
| 119 | * FLAC::Metadata::Prototype::Prototype(const ::FLAC__StreamMetadata *object). |
| 120 | * When \a copy is \c false, the instance takes ownership of |
| 121 | * the pointer and the ::FLAC__StreamMetadata object will |
| 122 | * be freed by the destructor. |
| 123 | * |
| 124 | * \assert |
| 125 | * \code object != NULL \endcode |
| 126 | */ |
Josh Coalson | 8396175 | 2002-07-09 06:12:59 +0000 | [diff] [blame] | 127 | Prototype(::FLAC__StreamMetadata *object, bool copy); |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 128 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 129 | //@{ |
| 130 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 131 | Prototype &operator=(const Prototype &); |
| 132 | Prototype &operator=(const ::FLAC__StreamMetadata &); |
| 133 | Prototype &operator=(const ::FLAC__StreamMetadata *); |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 134 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 135 | |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 136 | /** Assigns an object with copy control. See |
| 137 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 138 | */ |
| 139 | Prototype &assign_object(::FLAC__StreamMetadata *object, bool copy); |
| 140 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 141 | /** Deletes the underlying ::FLAC__StreamMetadata object. |
| 142 | */ |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 143 | virtual void clear(); |
| 144 | |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 145 | ::FLAC__StreamMetadata *object_; |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 146 | public: |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 147 | /** Deletes the underlying ::FLAC__StreamMetadata object. |
| 148 | */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 149 | virtual ~Prototype(); |
| 150 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 151 | //@{ |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 152 | /** Check for equality, performing a deep compare by following pointers. |
| 153 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 154 | inline bool operator==(const Prototype &) const; |
| 155 | inline bool operator==(const ::FLAC__StreamMetadata &) const; |
| 156 | inline bool operator==(const ::FLAC__StreamMetadata *) const; |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 157 | //@} |
| 158 | |
| 159 | //@{ |
| 160 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 161 | inline bool operator!=(const Prototype &) const; |
| 162 | inline bool operator!=(const ::FLAC__StreamMetadata &) const; |
| 163 | inline bool operator!=(const ::FLAC__StreamMetadata *) const; |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 164 | //@} |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 165 | |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 166 | friend class SimpleIterator; |
| 167 | friend class Iterator; |
| 168 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 169 | /** Returns \c true if the object was correctly constructed |
| 170 | * (i.e. the underlying ::FLAC__StreamMetadata object was |
| 171 | * properly allocated), else \c false. |
| 172 | */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 173 | inline bool is_valid() const; |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 174 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 175 | /** Returns \c true if this block is the last block in a |
| 176 | * stream, else \c false. |
| 177 | * |
| 178 | * \assert |
| 179 | * \code is_valid() \endcode |
| 180 | */ |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 181 | bool get_is_last() const; |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 182 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 183 | /** Returns the type of the block. |
| 184 | * |
| 185 | * \assert |
| 186 | * \code is_valid() \endcode |
| 187 | */ |
| 188 | ::FLAC__MetadataType get_type() const; |
| 189 | |
| 190 | /** Returns the stream length of the metadata block. |
| 191 | * |
| 192 | * \note |
| 193 | * The length does not include the metadata block header, |
| 194 | * per spec. |
| 195 | * |
| 196 | * \assert |
| 197 | * \code is_valid() \endcode |
| 198 | */ |
| 199 | unsigned get_length() const; |
| 200 | |
| 201 | /** Sets the "is_last" flag for the block. When using the iterators |
| 202 | * it is not necessary to set this flag; they will do it for you. |
| 203 | * |
| 204 | * \assert |
| 205 | * \code is_valid() \endcode |
| 206 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 207 | void set_is_last(bool); |
Josh Coalson | d113ca3 | 2004-07-22 01:03:43 +0000 | [diff] [blame] | 208 | |
| 209 | /** Returns a pointer to the underlying ::FLAC__StreamMetadata |
| 210 | * object. This can be useful for plugging any holes between |
| 211 | * the C++ and C interfaces. |
| 212 | * |
| 213 | * \assert |
| 214 | * \code is_valid() \endcode |
| 215 | */ |
| 216 | inline operator const ::FLAC__StreamMetadata *() const; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 217 | private: |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 218 | /** Private and undefined so you can't use it. */ |
| 219 | Prototype(); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 220 | |
| 221 | // These are used only by Iterator |
| 222 | bool is_reference_; |
| 223 | inline void set_reference(bool x) { is_reference_ = x; } |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 224 | }; |
| 225 | |
Josh Coalson | 3cb8341 | 2004-07-23 05:11:06 +0000 | [diff] [blame] | 226 | #ifdef _MSC_VER |
| 227 | // warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning) |
| 228 | #pragma warning ( disable : 4800 ) |
| 229 | #endif |
| 230 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 231 | inline bool Prototype::operator==(const Prototype &object) const |
Josh Coalson | d57c8d3 | 2002-06-11 06:15:28 +0000 | [diff] [blame] | 232 | { return (bool)::FLAC__metadata_object_is_equal(object_, object.object_); } |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 233 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 234 | inline bool Prototype::operator==(const ::FLAC__StreamMetadata &object) const |
Josh Coalson | d57c8d3 | 2002-06-11 06:15:28 +0000 | [diff] [blame] | 235 | { return (bool)::FLAC__metadata_object_is_equal(object_, &object); } |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 236 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 237 | inline bool Prototype::operator==(const ::FLAC__StreamMetadata *object) const |
Josh Coalson | d57c8d3 | 2002-06-11 06:15:28 +0000 | [diff] [blame] | 238 | { return (bool)::FLAC__metadata_object_is_equal(object_, object); } |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 239 | |
Josh Coalson | 3cb8341 | 2004-07-23 05:11:06 +0000 | [diff] [blame] | 240 | #ifdef _MSC_VER |
| 241 | // @@@ how to re-enable? the following doesn't work |
| 242 | // #pragma warning ( enable : 4800 ) |
| 243 | #endif |
| 244 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 245 | inline bool Prototype::operator!=(const Prototype &object) const |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 246 | { return !operator==(object); } |
| 247 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 248 | inline bool Prototype::operator!=(const ::FLAC__StreamMetadata &object) const |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 249 | { return !operator==(object); } |
| 250 | |
Josh Coalson | 765ff50 | 2002-08-27 05:46:11 +0000 | [diff] [blame] | 251 | inline bool Prototype::operator!=(const ::FLAC__StreamMetadata *object) const |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 252 | { return !operator==(object); } |
| 253 | |
| 254 | inline bool Prototype::is_valid() const |
| 255 | { return 0 != object_; } |
| 256 | |
Josh Coalson | d113ca3 | 2004-07-22 01:03:43 +0000 | [diff] [blame] | 257 | inline Prototype::operator const ::FLAC__StreamMetadata *() const |
| 258 | { return object_; } |
| 259 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 260 | /** Create a deep copy of an object and return it. */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 261 | FLACPP_API Prototype *clone(const Prototype *); |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 262 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 263 | |
| 264 | /** STREAMINFO metadata block. |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 265 | * See the \link flacpp_metadata_object overview \endlink for more, |
| 266 | * and the <A HREF="../format.html#metadata_block_streaminfo">format specification</A>. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 267 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 268 | class FLACPP_API StreamInfo : public Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 269 | public: |
| 270 | StreamInfo(); |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 271 | |
| 272 | //@{ |
| 273 | /** Constructs a copy of the given object. This form |
| 274 | * always performs a deep copy. |
| 275 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 276 | inline StreamInfo(const StreamInfo &object): Prototype(object) { } |
| 277 | inline StreamInfo(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 278 | inline StreamInfo(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 279 | //@} |
| 280 | |
| 281 | /** Constructs an object with copy control. See |
| 282 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 283 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 284 | inline StreamInfo(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 285 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 286 | ~StreamInfo(); |
| 287 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 288 | //@{ |
| 289 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 290 | inline StreamInfo &operator=(const StreamInfo &object) { Prototype::operator=(object); return *this; } |
| 291 | inline StreamInfo &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; } |
| 292 | inline StreamInfo &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; } |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 293 | //@} |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 294 | |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 295 | /** Assigns an object with copy control. See |
| 296 | * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy). |
| 297 | */ |
| 298 | inline StreamInfo &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; } |
| 299 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 300 | //@{ |
| 301 | /** Check for equality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 302 | inline bool operator==(const StreamInfo &object) const { return Prototype::operator==(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 303 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 304 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 305 | //@} |
| 306 | |
| 307 | //@{ |
| 308 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 309 | inline bool operator!=(const StreamInfo &object) const { return Prototype::operator!=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 310 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 311 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 312 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 313 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 314 | //@{ |
| 315 | /** See <A HREF="../format.html#metadata_block_streaminfo">format specification</A>. */ |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 316 | unsigned get_min_blocksize() const; |
| 317 | unsigned get_max_blocksize() const; |
| 318 | unsigned get_min_framesize() const; |
| 319 | unsigned get_max_framesize() const; |
| 320 | unsigned get_sample_rate() const; |
| 321 | unsigned get_channels() const; |
| 322 | unsigned get_bits_per_sample() const; |
| 323 | FLAC__uint64 get_total_samples() const; |
| 324 | const FLAC__byte *get_md5sum() const; |
| 325 | |
| 326 | void set_min_blocksize(unsigned value); |
| 327 | void set_max_blocksize(unsigned value); |
| 328 | void set_min_framesize(unsigned value); |
| 329 | void set_max_framesize(unsigned value); |
| 330 | void set_sample_rate(unsigned value); |
| 331 | void set_channels(unsigned value); |
| 332 | void set_bits_per_sample(unsigned value); |
| 333 | void set_total_samples(FLAC__uint64 value); |
| 334 | void set_md5sum(const FLAC__byte value[16]); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 335 | //@} |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 336 | }; |
| 337 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 338 | /** PADDING metadata block. |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 339 | * See the \link flacpp_metadata_object overview \endlink for more, |
| 340 | * and the <A HREF="../format.html#metadata_block_padding">format specification</A>. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 341 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 342 | class FLACPP_API Padding : public Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 343 | public: |
| 344 | Padding(); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 345 | |
| 346 | //@{ |
| 347 | /** Constructs a copy of the given object. This form |
| 348 | * always performs a deep copy. |
| 349 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 350 | inline Padding(const Padding &object): Prototype(object) { } |
| 351 | inline Padding(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 352 | inline Padding(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 353 | //@} |
| 354 | |
| 355 | /** Constructs an object with copy control. See |
| 356 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 357 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 358 | inline Padding(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 359 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 360 | ~Padding(); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 361 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 362 | //@{ |
| 363 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 364 | inline Padding &operator=(const Padding &object) { Prototype::operator=(object); return *this; } |
| 365 | inline Padding &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; } |
| 366 | inline Padding &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 367 | //@} |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 368 | |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 369 | /** Assigns an object with copy control. See |
| 370 | * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy). |
| 371 | */ |
| 372 | inline Padding &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; } |
| 373 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 374 | //@{ |
| 375 | /** Check for equality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 376 | inline bool operator==(const Padding &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 | //@} |
| 380 | |
| 381 | //@{ |
| 382 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 383 | inline bool operator!=(const Padding &object) const { return Prototype::operator!=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 384 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 385 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 386 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 387 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 388 | void set_length(unsigned length); |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 389 | }; |
| 390 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 391 | /** APPLICATION metadata block. |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 392 | * See the \link flacpp_metadata_object overview \endlink for more, |
| 393 | * and the <A HREF="../format.html#metadata_block_application">format specification</A>. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 394 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 395 | class FLACPP_API Application : public Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 396 | public: |
| 397 | Application(); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 398 | // |
| 399 | //@{ |
| 400 | /** Constructs a copy of the given object. This form |
| 401 | * always performs a deep copy. |
| 402 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 403 | inline Application(const Application &object): Prototype(object) { } |
| 404 | inline Application(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 405 | inline Application(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 406 | //@} |
| 407 | |
| 408 | /** Constructs an object with copy control. See |
| 409 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 410 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 411 | inline Application(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 412 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 413 | ~Application(); |
| 414 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 415 | //@{ |
| 416 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 417 | inline Application &operator=(const Application &object) { Prototype::operator=(object); return *this; } |
| 418 | inline Application &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; } |
| 419 | inline Application &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 420 | //@} |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 421 | |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 422 | /** Assigns an object with copy control. See |
| 423 | * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy). |
| 424 | */ |
| 425 | inline Application &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; } |
| 426 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 427 | //@{ |
| 428 | /** Check for equality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 429 | inline bool operator==(const Application &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 | //@} |
| 433 | |
| 434 | //@{ |
| 435 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 436 | inline bool operator!=(const Application &object) const { return Prototype::operator!=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 437 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 438 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 439 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 440 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 441 | const FLAC__byte *get_id() const; |
| 442 | const FLAC__byte *get_data() const; |
| 443 | |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 444 | void set_id(const FLAC__byte value[4]); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 445 | //! This form always copies \a data |
| 446 | bool set_data(const FLAC__byte *data, unsigned length); |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 447 | bool set_data(FLAC__byte *data, unsigned length, bool copy); |
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 | /** SEEKTABLE metadata block. |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 451 | * See the \link flacpp_metadata_object overview \endlink for more, |
| 452 | * and the <A HREF="../format.html#metadata_block_seektable">format specification</A>. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 453 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 454 | class FLACPP_API SeekTable : public Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 455 | public: |
| 456 | SeekTable(); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 457 | |
| 458 | //@{ |
| 459 | /** Constructs a copy of the given object. This form |
| 460 | * always performs a deep copy. |
| 461 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 462 | inline SeekTable(const SeekTable &object): Prototype(object) { } |
| 463 | inline SeekTable(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 464 | inline SeekTable(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 465 | //@} |
| 466 | |
| 467 | /** Constructs an object with copy control. See |
| 468 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 469 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 470 | inline SeekTable(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 471 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 472 | ~SeekTable(); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 473 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 474 | //@{ |
| 475 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 476 | inline SeekTable &operator=(const SeekTable &object) { Prototype::operator=(object); return *this; } |
| 477 | inline SeekTable &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; } |
| 478 | inline SeekTable &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 479 | //@} |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 480 | |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 481 | /** Assigns an object with copy control. See |
| 482 | * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy). |
| 483 | */ |
| 484 | inline SeekTable &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; } |
| 485 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 486 | //@{ |
| 487 | /** Check for equality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 488 | inline bool operator==(const SeekTable &object) const { return Prototype::operator==(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 489 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 490 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 491 | //@} |
| 492 | |
| 493 | //@{ |
| 494 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 495 | inline bool operator!=(const SeekTable &object) const { return Prototype::operator!=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 496 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 497 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 498 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 499 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 500 | unsigned get_num_points() const; |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 501 | ::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const; |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 502 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 503 | //! See FLAC__metadata_object_seektable_set_point() |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 504 | void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 505 | |
| 506 | //! See FLAC__metadata_object_seektable_insert_point() |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 507 | bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 508 | |
| 509 | //! See FLAC__metadata_object_seektable_delete_point() |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 510 | bool delete_point(unsigned index); |
Josh Coalson | 28e08d8 | 2002-06-05 05:56:41 +0000 | [diff] [blame] | 511 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 512 | //! See FLAC__metadata_object_seektable_is_legal() |
Josh Coalson | 28e08d8 | 2002-06-05 05:56:41 +0000 | [diff] [blame] | 513 | bool is_legal() const; |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 514 | }; |
| 515 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 516 | /** VORBIS_COMMENT metadata block. |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 517 | * See the \link flacpp_metadata_object overview \endlink for more, |
| 518 | * and the <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 519 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 520 | class FLACPP_API VorbisComment : public Prototype { |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 521 | public: |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 522 | /** Convenience class for encapsulating Vorbis comment |
| 523 | * entries. An entry is a vendor string or a comment |
| 524 | * field. In the case of a vendor string, the field |
| 525 | * name is undefined; only the field value is relevant. |
| 526 | * |
| 527 | * A \a field as used in the methods refers to an |
Josh Coalson | def597e | 2004-12-30 00:59:30 +0000 | [diff] [blame] | 528 | * entire 'NAME=VALUE' string; for convenience the |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 529 | * string is NUL-terminated. A length field is |
Josh Coalson | def597e | 2004-12-30 00:59:30 +0000 | [diff] [blame] | 530 | * required in the unlikely event that the value |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 531 | * contains contain embedded NULs. |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 532 | * |
| 533 | * A \a field_name is what is on the left side of the |
| 534 | * first '=' in the \a field. By definition it is ASCII |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 535 | * and so is NUL-terminated and does not require a |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 536 | * length to describe it. \a field_name is undefined |
| 537 | * for a vendor string entry. |
| 538 | * |
| 539 | * A \a field_value is what is on the right side of the |
| 540 | * first '=' in the \a field. By definition, this may |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 541 | * contain embedded NULs and so a \a field_value_length |
Josh Coalson | def597e | 2004-12-30 00:59:30 +0000 | [diff] [blame] | 542 | * is required to describe it. However in practice, |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 543 | * embedded NULs are not known to be used, so it is |
| 544 | * generally safe to treat field values as NUL- |
Josh Coalson | def597e | 2004-12-30 00:59:30 +0000 | [diff] [blame] | 545 | * terminated UTF-8 strings. |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 546 | * |
| 547 | * Always check is_valid() after the constructor or operator= |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 548 | * to make sure memory was properly allocated and that the |
| 549 | * Entry conforms to the Vorbis comment specification. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 550 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 551 | class FLACPP_API Entry { |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 552 | public: |
| 553 | Entry(); |
Josh Coalson | def597e | 2004-12-30 00:59:30 +0000 | [diff] [blame] | 554 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 555 | Entry(const char *field, unsigned field_length); |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 556 | Entry(const char *field); // assumes \a field is NUL-terminated |
Josh Coalson | def597e | 2004-12-30 00:59:30 +0000 | [diff] [blame] | 557 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 558 | Entry(const char *field_name, const char *field_value, unsigned field_value_length); |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 559 | Entry(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated |
Josh Coalson | def597e | 2004-12-30 00:59:30 +0000 | [diff] [blame] | 560 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 561 | Entry(const Entry &entry); |
Josh Coalson | def597e | 2004-12-30 00:59:30 +0000 | [diff] [blame] | 562 | |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 563 | Entry &operator=(const Entry &entry); |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 564 | |
| 565 | virtual ~Entry(); |
| 566 | |
Josh Coalson | 3c91754 | 2006-10-15 07:50:44 +0000 | [diff] [blame^] | 567 | virtual bool is_valid() const; ///< Returns \c true iff object was properly constructed. |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 568 | |
| 569 | unsigned get_field_length() const; |
| 570 | unsigned get_field_name_length() const; |
| 571 | unsigned get_field_value_length() const; |
| 572 | |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 573 | ::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const; |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 574 | const char *get_field() const; |
| 575 | const char *get_field_name() const; |
| 576 | const char *get_field_value() const; |
| 577 | |
| 578 | bool set_field(const char *field, unsigned field_length); |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 579 | bool set_field(const char *field); // assumes \a field is NUL-terminated |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 580 | bool set_field_name(const char *field_name); |
| 581 | bool set_field_value(const char *field_value, unsigned field_value_length); |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 582 | bool set_field_value(const char *field_value); // assumes \a field_value is NUL-terminated |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 583 | protected: |
| 584 | bool is_valid_; |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 585 | ::FLAC__StreamMetadata_VorbisComment_Entry entry_; |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 586 | char *field_name_; |
| 587 | unsigned field_name_length_; |
| 588 | char *field_value_; |
| 589 | unsigned field_value_length_; |
| 590 | private: |
| 591 | void zero(); |
| 592 | void clear(); |
| 593 | void clear_entry(); |
| 594 | void clear_field_name(); |
| 595 | void clear_field_value(); |
| 596 | void construct(const char *field, unsigned field_length); |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 597 | void construct(const char *field); // assumes \a field is NUL-terminated |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 598 | void construct(const char *field_name, const char *field_value, unsigned field_value_length); |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 599 | void construct(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 600 | void compose_field(); |
| 601 | void parse_field(); |
| 602 | }; |
| 603 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 604 | VorbisComment(); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 605 | |
| 606 | //@{ |
| 607 | /** Constructs a copy of the given object. This form |
| 608 | * always performs a deep copy. |
| 609 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 610 | inline VorbisComment(const VorbisComment &object): Prototype(object) { } |
| 611 | inline VorbisComment(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 612 | inline VorbisComment(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 613 | //@} |
| 614 | |
| 615 | /** Constructs an object with copy control. See |
| 616 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 617 | */ |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 618 | inline VorbisComment(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 619 | |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 620 | ~VorbisComment(); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 621 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 622 | //@{ |
| 623 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 624 | inline VorbisComment &operator=(const VorbisComment &object) { Prototype::operator=(object); return *this; } |
| 625 | inline VorbisComment &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; } |
| 626 | inline VorbisComment &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 627 | //@} |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 628 | |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 629 | /** Assigns an object with copy control. See |
| 630 | * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy). |
| 631 | */ |
| 632 | inline VorbisComment &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; } |
| 633 | |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 634 | //@{ |
| 635 | /** Check for equality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 636 | inline bool operator==(const VorbisComment &object) const { return Prototype::operator==(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 637 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 638 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 639 | //@} |
| 640 | |
| 641 | //@{ |
| 642 | /** Check for inequality, performing a deep compare by following pointers. */ |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 643 | inline bool operator!=(const VorbisComment &object) const { return Prototype::operator!=(object); } |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 644 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 645 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 646 | //@} |
Josh Coalson | 57ba6f4 | 2002-06-07 05:27:37 +0000 | [diff] [blame] | 647 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 648 | unsigned get_num_comments() const; |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 649 | const FLAC__byte *get_vendor_string() const; // NUL-terminated UTF-8 string |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 650 | Entry get_comment(unsigned index) const; |
| 651 | |
Josh Coalson | 87977ba | 2002-08-20 07:09:33 +0000 | [diff] [blame] | 652 | //! See FLAC__metadata_object_vorbiscomment_set_vendor_string() |
Josh Coalson | 2de1124 | 2004-12-30 03:41:19 +0000 | [diff] [blame] | 653 | bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 654 | |
Josh Coalson | 87977ba | 2002-08-20 07:09:33 +0000 | [diff] [blame] | 655 | //! See FLAC__metadata_object_vorbiscomment_set_comment() |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 656 | bool set_comment(unsigned index, const Entry &entry); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 657 | |
Josh Coalson | 87977ba | 2002-08-20 07:09:33 +0000 | [diff] [blame] | 658 | //! See FLAC__metadata_object_vorbiscomment_insert_comment() |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 659 | bool insert_comment(unsigned index, const Entry &entry); |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 660 | |
Josh Coalson | def597e | 2004-12-30 00:59:30 +0000 | [diff] [blame] | 661 | //! See FLAC__metadata_object_vorbiscomment_append_comment() |
| 662 | bool append_comment(const Entry &entry); |
| 663 | |
Josh Coalson | 87977ba | 2002-08-20 07:09:33 +0000 | [diff] [blame] | 664 | //! See FLAC__metadata_object_vorbiscomment_delete_comment() |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 665 | bool delete_comment(unsigned index); |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 666 | }; |
| 667 | |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 668 | /** CUESHEET metadata block. |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 669 | * See the \link flacpp_metadata_object overview \endlink for more, |
| 670 | * and the <A HREF="../format.html#metadata_block_cuesheet">format specification</A>. |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 671 | */ |
| 672 | class FLACPP_API CueSheet : public Prototype { |
| 673 | public: |
| 674 | /** Convenience class for encapsulating a cue sheet |
| 675 | * track. |
| 676 | * |
| 677 | * Always check is_valid() after the constructor or operator= |
| 678 | * to make sure memory was properly allocated. |
| 679 | */ |
| 680 | class FLACPP_API Track { |
| 681 | protected: |
| 682 | ::FLAC__StreamMetadata_CueSheet_Track *object_; |
| 683 | public: |
| 684 | Track(); |
| 685 | Track(const ::FLAC__StreamMetadata_CueSheet_Track *track); |
| 686 | Track(const Track &track); |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 687 | Track &operator=(const Track &track); |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 688 | |
| 689 | virtual ~Track(); |
| 690 | |
Josh Coalson | 3c91754 | 2006-10-15 07:50:44 +0000 | [diff] [blame^] | 691 | virtual bool is_valid() const; ///< Returns \c true iff object was properly constructed. |
| 692 | |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 693 | |
| 694 | inline FLAC__uint64 get_offset() const { return object_->offset; } |
| 695 | inline FLAC__byte get_number() const { return object_->number; } |
| 696 | inline const char *get_isrc() const { return object_->isrc; } |
| 697 | inline unsigned get_type() const { return object_->type; } |
| 698 | inline bool get_pre_emphasis() const { return object_->pre_emphasis; } |
| 699 | |
Josh Coalson | a7038a9 | 2003-01-22 20:16:20 +0000 | [diff] [blame] | 700 | inline FLAC__byte get_num_indices() const { return object_->num_indices; } |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 701 | ::FLAC__StreamMetadata_CueSheet_Index get_index(unsigned i) const; |
| 702 | |
| 703 | inline const ::FLAC__StreamMetadata_CueSheet_Track *get_track() const { return object_; } |
| 704 | |
| 705 | inline void set_offset(FLAC__uint64 value) { object_->offset = value; } |
| 706 | inline void set_number(FLAC__byte value) { object_->number = value; } |
Josh Coalson | 1621979 | 2002-11-19 06:19:29 +0000 | [diff] [blame] | 707 | void set_isrc(const char value[12]); |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 708 | void set_type(unsigned value); |
| 709 | inline void set_pre_emphasis(bool value) { object_->pre_emphasis = value? 1 : 0; } |
| 710 | |
Josh Coalson | 1621979 | 2002-11-19 06:19:29 +0000 | [diff] [blame] | 711 | void set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index); |
Josh Coalson | b3538c8 | 2003-01-12 08:42:23 +0000 | [diff] [blame] | 712 | //@@@ It's awkward but to insert/delete index points |
| 713 | //@@@ you must use the routines in the CueSheet class. |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 714 | }; |
| 715 | |
| 716 | CueSheet(); |
| 717 | |
| 718 | //@{ |
| 719 | /** Constructs a copy of the given object. This form |
| 720 | * always performs a deep copy. |
| 721 | */ |
| 722 | inline CueSheet(const CueSheet &object): Prototype(object) { } |
| 723 | inline CueSheet(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 724 | inline CueSheet(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
| 725 | //@} |
| 726 | |
| 727 | /** Constructs an object with copy control. See |
| 728 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 729 | */ |
| 730 | inline CueSheet(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
| 731 | |
| 732 | ~CueSheet(); |
| 733 | |
| 734 | //@{ |
| 735 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 736 | inline CueSheet &operator=(const CueSheet &object) { Prototype::operator=(object); return *this; } |
| 737 | inline CueSheet &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; } |
| 738 | inline CueSheet &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; } |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 739 | //@} |
| 740 | |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 741 | /** Assigns an object with copy control. See |
| 742 | * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy). |
| 743 | */ |
| 744 | inline CueSheet &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; } |
| 745 | |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 746 | //@{ |
| 747 | /** Check for equality, performing a deep compare by following pointers. */ |
| 748 | inline bool operator==(const CueSheet &object) const { return Prototype::operator==(object); } |
| 749 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 750 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
| 751 | //@} |
| 752 | |
| 753 | //@{ |
| 754 | /** Check for inequality, performing a deep compare by following pointers. */ |
| 755 | inline bool operator!=(const CueSheet &object) const { return Prototype::operator!=(object); } |
| 756 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 757 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
| 758 | //@} |
| 759 | |
| 760 | const char *get_media_catalog_number() const; |
| 761 | FLAC__uint64 get_lead_in() const; |
Josh Coalson | 8f0c71b | 2002-12-05 06:37:46 +0000 | [diff] [blame] | 762 | bool get_is_cd() const; |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 763 | |
| 764 | unsigned get_num_tracks() const; |
| 765 | Track get_track(unsigned i) const; |
| 766 | |
Josh Coalson | 1621979 | 2002-11-19 06:19:29 +0000 | [diff] [blame] | 767 | void set_media_catalog_number(const char value[128]); |
| 768 | void set_lead_in(FLAC__uint64 value); |
Josh Coalson | 8f0c71b | 2002-12-05 06:37:46 +0000 | [diff] [blame] | 769 | void set_is_cd(bool value); |
Josh Coalson | 1621979 | 2002-11-19 06:19:29 +0000 | [diff] [blame] | 770 | |
| 771 | 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] | 772 | |
| 773 | //! See FLAC__metadata_object_cuesheet_track_insert_index() |
| 774 | bool insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index); |
| 775 | |
| 776 | //! See FLAC__metadata_object_cuesheet_track_delete_index() |
| 777 | bool delete_index(unsigned track_num, unsigned index_num); |
| 778 | |
| 779 | //! See FLAC__metadata_object_cuesheet_set_track() |
| 780 | bool set_track(unsigned i, const Track &track); |
| 781 | |
| 782 | //! See FLAC__metadata_object_cuesheet_insert_track() |
| 783 | bool insert_track(unsigned i, const Track &track); |
| 784 | |
| 785 | //! See FLAC__metadata_object_cuesheet_delete_track() |
| 786 | bool delete_track(unsigned i); |
| 787 | |
| 788 | //! See FLAC__metadata_object_cuesheet_is_legal() |
| 789 | bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const; |
Josh Coalson | 7cfac0b | 2006-04-10 05:37:34 +0000 | [diff] [blame] | 790 | |
| 791 | //! See FLAC__metadata_object_cuesheet_calculate_cddb_id() |
| 792 | FLAC__uint32 calculate_cddb_id() const; |
Josh Coalson | 863dbf3 | 2002-11-16 06:30:30 +0000 | [diff] [blame] | 793 | }; |
| 794 | |
Josh Coalson | e343ab2 | 2006-09-23 19:21:19 +0000 | [diff] [blame] | 795 | /** PICTURE metadata block. |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 796 | * See the \link flacpp_metadata_object overview \endlink for more, |
| 797 | * and the <A HREF="../format.html#metadata_block_picture">format specification</A>. |
Josh Coalson | e343ab2 | 2006-09-23 19:21:19 +0000 | [diff] [blame] | 798 | */ |
| 799 | class FLACPP_API Picture : public Prototype { |
| 800 | public: |
| 801 | Picture(); |
| 802 | |
| 803 | //@{ |
| 804 | /** Constructs a copy of the given object. This form |
| 805 | * always performs a deep copy. |
| 806 | */ |
| 807 | inline Picture(const Picture &object): Prototype(object) { } |
| 808 | inline Picture(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 809 | inline Picture(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
| 810 | //@} |
| 811 | |
| 812 | /** Constructs an object with copy control. See |
| 813 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 814 | */ |
| 815 | inline Picture(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
| 816 | |
| 817 | ~Picture(); |
| 818 | |
| 819 | //@{ |
| 820 | /** Assign from another object. Always performs a deep copy. */ |
| 821 | inline Picture &operator=(const Picture &object) { Prototype::operator=(object); return *this; } |
| 822 | inline Picture &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; } |
| 823 | inline Picture &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; } |
| 824 | //@} |
| 825 | |
| 826 | /** Assigns an object with copy control. See |
| 827 | * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy). |
| 828 | */ |
| 829 | inline Picture &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; } |
| 830 | |
| 831 | //@{ |
| 832 | /** Check for equality, performing a deep compare by following pointers. */ |
| 833 | inline bool operator==(const Picture &object) const { return Prototype::operator==(object); } |
| 834 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 835 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
| 836 | //@} |
| 837 | |
| 838 | //@{ |
| 839 | /** Check for inequality, performing a deep compare by following pointers. */ |
| 840 | inline bool operator!=(const Picture &object) const { return Prototype::operator!=(object); } |
| 841 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 842 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
| 843 | //@} |
| 844 | |
| 845 | ::FLAC__StreamMetadata_Picture_Type get_type() const; |
| 846 | const char *get_mime_type() const; // NUL-terminated printable ASCII string |
| 847 | const FLAC__byte *get_description() const; // NUL-terminated UTF-8 string |
| 848 | FLAC__uint32 get_width() const; |
| 849 | FLAC__uint32 get_height() const; |
| 850 | FLAC__uint32 get_depth() const; |
Josh Coalson | 74ed294 | 2006-09-23 23:15:05 +0000 | [diff] [blame] | 851 | FLAC__uint32 get_colors() const; ///< a return value of \c 0 means true-color, i.e. 2^depth colors |
Josh Coalson | e343ab2 | 2006-09-23 19:21:19 +0000 | [diff] [blame] | 852 | FLAC__uint32 get_data_length() const; |
| 853 | const FLAC__byte *get_data() const; |
| 854 | |
| 855 | void set_type(::FLAC__StreamMetadata_Picture_Type type); |
| 856 | |
| 857 | //! See FLAC__metadata_object_picture_set_mime_type() |
| 858 | bool set_mime_type(const char *string); // NUL-terminated printable ASCII string |
| 859 | |
| 860 | //! See FLAC__metadata_object_picture_set_description() |
| 861 | bool set_description(const FLAC__byte *string); // NUL-terminated UTF-8 string |
| 862 | |
| 863 | void set_width(FLAC__uint32 value) const; |
| 864 | void set_height(FLAC__uint32 value) const; |
| 865 | void set_depth(FLAC__uint32 value) const; |
Josh Coalson | 74ed294 | 2006-09-23 23:15:05 +0000 | [diff] [blame] | 866 | void set_colors(FLAC__uint32 value) const; ///< a value of \c 0 means true-color, i.e. 2^depth colors |
Josh Coalson | e343ab2 | 2006-09-23 19:21:19 +0000 | [diff] [blame] | 867 | |
| 868 | //! See FLAC__metadata_object_picture_set_data() |
| 869 | bool set_data(const FLAC__byte *data, FLAC__uint32 data_length); |
| 870 | }; |
| 871 | |
Josh Coalson | 0eea34a | 2003-01-10 05:29:17 +0000 | [diff] [blame] | 872 | /** Opaque metadata block for storing unknown types. |
| 873 | * This should not be used unless you know what you are doing; |
| 874 | * it is currently used only internally to support forward |
| 875 | * compatibility of metadata blocks. |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 876 | * See the \link flacpp_metadata_object overview \endlink for more, |
Josh Coalson | 0eea34a | 2003-01-10 05:29:17 +0000 | [diff] [blame] | 877 | */ |
| 878 | class FLACPP_API Unknown : public Prototype { |
| 879 | public: |
| 880 | Unknown(); |
| 881 | // |
| 882 | //@{ |
| 883 | /** Constructs a copy of the given object. This form |
| 884 | * always performs a deep copy. |
| 885 | */ |
| 886 | inline Unknown(const Unknown &object): Prototype(object) { } |
| 887 | inline Unknown(const ::FLAC__StreamMetadata &object): Prototype(object) { } |
| 888 | inline Unknown(const ::FLAC__StreamMetadata *object): Prototype(object) { } |
| 889 | //@} |
| 890 | |
| 891 | /** Constructs an object with copy control. See |
| 892 | * Prototype(::FLAC__StreamMetadata *object, bool copy). |
| 893 | */ |
| 894 | inline Unknown(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } |
| 895 | |
| 896 | ~Unknown(); |
| 897 | |
| 898 | //@{ |
| 899 | /** Assign from another object. Always performs a deep copy. */ |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 900 | inline Unknown &operator=(const Unknown &object) { Prototype::operator=(object); return *this; } |
| 901 | inline Unknown &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; } |
| 902 | inline Unknown &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; } |
Josh Coalson | 0eea34a | 2003-01-10 05:29:17 +0000 | [diff] [blame] | 903 | //@} |
| 904 | |
Josh Coalson | 42372b9 | 2005-01-07 01:09:07 +0000 | [diff] [blame] | 905 | /** Assigns an object with copy control. See |
| 906 | * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy). |
| 907 | */ |
| 908 | inline Unknown &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; } |
| 909 | |
Josh Coalson | 0eea34a | 2003-01-10 05:29:17 +0000 | [diff] [blame] | 910 | //@{ |
| 911 | /** Check for equality, performing a deep compare by following pointers. */ |
| 912 | inline bool operator==(const Unknown &object) const { return Prototype::operator==(object); } |
| 913 | inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); } |
| 914 | inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); } |
| 915 | //@} |
| 916 | |
| 917 | //@{ |
| 918 | /** Check for inequality, performing a deep compare by following pointers. */ |
| 919 | inline bool operator!=(const Unknown &object) const { return Prototype::operator!=(object); } |
| 920 | inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); } |
| 921 | inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); } |
| 922 | //@} |
| 923 | |
| 924 | const FLAC__byte *get_data() const; |
| 925 | |
| 926 | //! This form always copies \a data |
| 927 | bool set_data(const FLAC__byte *data, unsigned length); |
| 928 | bool set_data(FLAC__byte *data, unsigned length, bool copy); |
| 929 | }; |
| 930 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 931 | /* \} */ |
| 932 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 933 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 934 | /** \defgroup flacpp_metadata_level0 FLAC++/metadata.h: metadata level 0 interface |
| 935 | * \ingroup flacpp_metadata |
| 936 | * |
| 937 | * \brief |
Josh Coalson | 1aca6b1 | 2004-07-30 01:54:29 +0000 | [diff] [blame] | 938 | * Level 0 metadata iterators. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 939 | * |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 940 | * See the \link flac_metadata_level0 C layer equivalent \endlink |
| 941 | * for more. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 942 | * |
| 943 | * \{ |
| 944 | */ |
| 945 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 946 | FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo); ///< See FLAC__metadata_get_streaminfo(). |
Josh Coalson | 2c75bd8 | 2004-12-30 03:55:00 +0000 | [diff] [blame] | 947 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 948 | FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags); ///< See FLAC__metadata_get_tags(). |
| 949 | FLACPP_API bool get_tags(const char *filename, VorbisComment &tags); ///< See FLAC__metadata_get_tags(). |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 950 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 951 | FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet); ///< See FLAC__metadata_get_cuesheet(). |
| 952 | FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet); ///< See FLAC__metadata_get_cuesheet(). |
Josh Coalson | e343ab2 | 2006-09-23 19:21:19 +0000 | [diff] [blame] | 953 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 954 | 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); ///< See FLAC__metadata_get_picture(). |
| 955 | 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); ///< See FLAC__metadata_get_picture(). |
Josh Coalson | 7cfac0b | 2006-04-10 05:37:34 +0000 | [diff] [blame] | 956 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 957 | /* \} */ |
| 958 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 959 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 960 | /** \defgroup flacpp_metadata_level1 FLAC++/metadata.h: metadata level 1 interface |
| 961 | * \ingroup flacpp_metadata |
| 962 | * |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 963 | * \brief |
| 964 | * Level 1 metadata iterator. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 965 | * |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 966 | * The flow through the iterator in the C++ layer is similar |
| 967 | * to the C layer: |
| 968 | * - Create a SimpleIterator instance |
| 969 | * - Check SimpleIterator::is_valid() |
| 970 | * - Call SimpleIterator::init() and check the return |
| 971 | * - Traverse and/or edit. Edits are written to file |
| 972 | * immediately. |
| 973 | * - Destroy the SimpleIterator instance |
| 974 | * |
| 975 | * The ownership of pointers in the C++ layer follows that in |
| 976 | * the C layer, i.e. |
| 977 | * - The objects returned by get_block() are yours to |
| 978 | * modify, but changes are not reflected in the FLAC file |
| 979 | * until you call set_block(). The objects are also |
| 980 | * yours to delete; they are not automatically deleted |
| 981 | * when passed to set_block() or insert_block_after(). |
| 982 | * |
| 983 | * See the \link flac_metadata_level1 C layer equivalent \endlink |
| 984 | * for more. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 985 | * |
| 986 | * \{ |
| 987 | */ |
| 988 | |
Josh Coalson | 402da70 | 2002-08-21 03:40:11 +0000 | [diff] [blame] | 989 | /** This class is a wrapper around the FLAC__metadata_simple_iterator |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 990 | * structures and methods; see the |
| 991 | * \link flacpp_metadata_level1 usage guide \endlink and |
| 992 | * ::FLAC__Metadata_SimpleIterator. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 993 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 994 | class FLACPP_API SimpleIterator { |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 995 | public: |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 996 | /** This class is a wrapper around FLAC__Metadata_SimpleIteratorStatus. |
| 997 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 998 | class FLACPP_API Status { |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 999 | public: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 1000 | inline Status(::FLAC__Metadata_SimpleIteratorStatus status): status_(status) { } |
| 1001 | inline operator ::FLAC__Metadata_SimpleIteratorStatus() const { return status_; } |
| 1002 | inline const char *as_cstring() const { return ::FLAC__Metadata_SimpleIteratorStatusString[status_]; } |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1003 | protected: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 1004 | ::FLAC__Metadata_SimpleIteratorStatus status_; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1005 | }; |
| 1006 | |
| 1007 | SimpleIterator(); |
| 1008 | virtual ~SimpleIterator(); |
| 1009 | |
Josh Coalson | 3c91754 | 2006-10-15 07:50:44 +0000 | [diff] [blame^] | 1010 | bool is_valid() const; ///< Returns \c true iff object was properly constructed. |
| 1011 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1012 | bool init(const char *filename, bool read_only, bool preserve_file_stats); ///< See FLAC__metadata_simple_iterator_init(). |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1013 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1014 | Status status(); ///< See FLAC__metadata_simple_iterator_status(). |
| 1015 | bool is_writable() const; ///< See FLAC__metadata_simple_iterator_is_writable(). |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1016 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1017 | bool next(); ///< See FLAC__metadata_simple_iterator_next(). |
| 1018 | bool prev(); ///< See FLAC__metadata_simple_iterator_prev(). |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1019 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1020 | ::FLAC__MetadataType get_block_type() const; ///< See FLAC__metadata_simple_iterator_get_block_type(). |
| 1021 | Prototype *get_block(); ///< See FLAC__metadata_simple_iterator_get_block(). |
| 1022 | bool set_block(Prototype *block, bool use_padding = true); ///< See FLAC__metadata_simple_iterator_set_block(). |
| 1023 | bool insert_block_after(Prototype *block, bool use_padding = true); ///< See FLAC__metadata_simple_iterator_insert_block_after(). |
| 1024 | bool delete_block(bool use_padding = true); ///< See FLAC__metadata_simple_iterator_delete_block(). |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1025 | |
| 1026 | protected: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 1027 | ::FLAC__Metadata_SimpleIterator *iterator_; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1028 | void clear(); |
| 1029 | }; |
| 1030 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 1031 | /* \} */ |
| 1032 | |
Josh Coalson | b2b5358 | 2002-05-31 06:20:50 +0000 | [diff] [blame] | 1033 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 1034 | /** \defgroup flacpp_metadata_level2 FLAC++/metadata.h: metadata level 2 interface |
| 1035 | * \ingroup flacpp_metadata |
| 1036 | * |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 1037 | * \brief |
| 1038 | * Level 2 metadata iterator. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 1039 | * |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 1040 | * The flow through the iterator in the C++ layer is similar |
| 1041 | * to the C layer: |
| 1042 | * - Create a Chain instance |
| 1043 | * - Check Chain::is_valid() |
| 1044 | * - Call Chain::read() and check the return |
| 1045 | * - Traverse and/or edit with an Iterator or with |
| 1046 | * Chain::merge_padding() or Chain::sort_padding() |
| 1047 | * - Write changes back to FLAC file with Chain::write() |
| 1048 | * - Destroy the Chain instance |
| 1049 | * |
Josh Coalson | 8b9a477 | 2002-12-28 07:03:26 +0000 | [diff] [blame] | 1050 | * The ownership of pointers in the C++ layer is slightly |
| 1051 | * different than in the C layer, i.e. |
| 1052 | * - The objects returned by Iterator::get_block() are NOT |
| 1053 | * owned by the iterator and should be deleted by the |
| 1054 | * caller when finished, BUT, when you modify the block, |
| 1055 | * it will directly edit what's in the chain and you do |
| 1056 | * not need to call Iterator::set_block(). However the |
| 1057 | * changes will not be reflected in the FLAC file until |
| 1058 | * the chain is written with Chain::write(). |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 1059 | * - When you pass an object to Iterator::set_block(), |
| 1060 | * Iterator::insert_block_before(), or |
| 1061 | * Iterator::insert_block_after(), the iterator takes |
Josh Coalson | 8b9a477 | 2002-12-28 07:03:26 +0000 | [diff] [blame] | 1062 | * ownership of the block and it will be deleted by the |
Josh Coalson | 4dc3507 | 2002-08-20 03:56:52 +0000 | [diff] [blame] | 1063 | * chain. |
| 1064 | * |
| 1065 | * See the \link flac_metadata_level2 C layer equivalent \endlink |
| 1066 | * for more. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 1067 | * |
| 1068 | * \{ |
| 1069 | */ |
| 1070 | |
Josh Coalson | 402da70 | 2002-08-21 03:40:11 +0000 | [diff] [blame] | 1071 | /** This class is a wrapper around the FLAC__metadata_chain |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1072 | * structures and methods; see the |
| 1073 | * \link flacpp_metadata_level2 usage guide \endlink and |
| 1074 | * ::FLAC__Metadata_Chain. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 1075 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 1076 | class FLACPP_API Chain { |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1077 | public: |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1078 | /** This class is a wrapper around FLAC__Metadata_ChainStatus. |
| 1079 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 1080 | class FLACPP_API Status { |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1081 | public: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 1082 | inline Status(::FLAC__Metadata_ChainStatus status): status_(status) { } |
| 1083 | inline operator ::FLAC__Metadata_ChainStatus() const { return status_; } |
| 1084 | inline const char *as_cstring() const { return ::FLAC__Metadata_ChainStatusString[status_]; } |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1085 | protected: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 1086 | ::FLAC__Metadata_ChainStatus status_; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1087 | }; |
| 1088 | |
| 1089 | Chain(); |
| 1090 | virtual ~Chain(); |
| 1091 | |
| 1092 | friend class Iterator; |
| 1093 | |
Josh Coalson | 3c91754 | 2006-10-15 07:50:44 +0000 | [diff] [blame^] | 1094 | bool is_valid() const; ///< Returns \c true iff object was properly constructed. |
| 1095 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1096 | Status status(); ///< See FLAC__metadata_chain_status(). |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1097 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1098 | bool read(const char *filename); ///< See FLAC__metadata_chain_read(). |
| 1099 | bool read(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks); ///< See FLAC__metadata_chain_read_with_callbacks(). |
Josh Coalson | deab462 | 2004-07-15 16:22:43 +0000 | [diff] [blame] | 1100 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1101 | bool check_if_tempfile_needed(bool use_padding); ///< See FLAC__metadata_chain_check_if_tempfile_needed(). |
Josh Coalson | deab462 | 2004-07-15 16:22:43 +0000 | [diff] [blame] | 1102 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1103 | bool write(bool use_padding = true, bool preserve_file_stats = false); ///< See FLAC__metadata_chain_write(). |
| 1104 | bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks); ///< See FLAC__metadata_chain_write_with_callbacks(). |
| 1105 | bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks, ::FLAC__IOHandle temp_handle, ::FLAC__IOCallbacks temp_callbacks); ///< See FLAC__metadata_chain_write_with_callbacks_and_tempfile(). |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1106 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1107 | void merge_padding(); ///< See FLAC__metadata_chain_merge_padding(). |
| 1108 | void sort_padding(); ///< See FLAC__metadata_chain_sort_padding(). |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1109 | |
| 1110 | protected: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 1111 | ::FLAC__Metadata_Chain *chain_; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1112 | virtual void clear(); |
| 1113 | }; |
| 1114 | |
Josh Coalson | 402da70 | 2002-08-21 03:40:11 +0000 | [diff] [blame] | 1115 | /** This class is a wrapper around the FLAC__metadata_iterator |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1116 | * structures and methods; see the |
| 1117 | * \link flacpp_metadata_level2 usage guide \endlink and |
| 1118 | * ::FLAC__Metadata_Iterator. |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 1119 | */ |
Josh Coalson | 55bc587 | 2002-10-16 22:18:32 +0000 | [diff] [blame] | 1120 | class FLACPP_API Iterator { |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1121 | public: |
| 1122 | Iterator(); |
| 1123 | virtual ~Iterator(); |
| 1124 | |
Josh Coalson | 3c91754 | 2006-10-15 07:50:44 +0000 | [diff] [blame^] | 1125 | bool is_valid() const; ///< Returns \c true iff object was properly constructed. |
| 1126 | |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1127 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1128 | void init(Chain &chain); ///< See FLAC__metadata_iterator_init(). |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1129 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1130 | bool next(); ///< See FLAC__metadata_iterator_next(). |
| 1131 | bool prev(); ///< See FLAC__metadata_iterator_prev(). |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1132 | |
Josh Coalson | 20ad84a | 2006-10-07 05:43:01 +0000 | [diff] [blame] | 1133 | ::FLAC__MetadataType get_block_type() const; ///< See FLAC__metadata_iterator_get_block_type(). |
| 1134 | Prototype *get_block(); ///< See FLAC__metadata_iterator_get_block(). |
| 1135 | bool set_block(Prototype *block); ///< See FLAC__metadata_iterator_set_block(). |
| 1136 | bool delete_block(bool replace_with_padding); ///< See FLAC__metadata_iterator_delete_block(). |
| 1137 | bool insert_block_before(Prototype *block); ///< See FLAC__metadata_iterator_insert_block_before(). |
| 1138 | bool insert_block_after(Prototype *block); ///< See FLAC__metadata_iterator_insert_block_after(). |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1139 | |
| 1140 | protected: |
Josh Coalson | cc68251 | 2002-06-08 04:53:42 +0000 | [diff] [blame] | 1141 | ::FLAC__Metadata_Iterator *iterator_; |
Josh Coalson | fb74f10 | 2002-05-22 05:33:29 +0000 | [diff] [blame] | 1142 | virtual void clear(); |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 1143 | }; |
| 1144 | |
Josh Coalson | f6efd9c | 2002-07-27 04:59:54 +0000 | [diff] [blame] | 1145 | /* \} */ |
| 1146 | |
Josh Coalson | c71bfe9 | 2005-01-25 02:27:20 +0000 | [diff] [blame] | 1147 | } |
| 1148 | } |
Josh Coalson | fda98fb | 2002-05-17 06:33:39 +0000 | [diff] [blame] | 1149 | |
| 1150 | #endif |