annotate osx/include/FLAC++/metadata.h @ 94:d278df1123f9

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