annotate osx/include/FLAC++/metadata.h @ 83:ae30d91d2ffe

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