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