annotate win32-mingw/include/FLAC++/metadata.h @ 127:7867fa7e1b6b

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