annotate win64-mingw/include/FLAC++/metadata.h @ 34:05254799ed10

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