blob: d26a92f07358f85d16d5f142edbf8f86d7108c27 [file] [log] [blame]
Josh Coalsonfda98fb2002-05-17 06:33:39 +00001/* libFLAC++ - Free Lossless Audio Codec library
Josh Coalson0395dac2006-04-25 06:59:33 +00002 * Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
Josh Coalsonfda98fb2002-05-17 06:33:39 +00003 *
Josh Coalsonafd81072003-01-31 23:34:56 +00004 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
Josh Coalsonfda98fb2002-05-17 06:33:39 +00007 *
Josh Coalsonafd81072003-01-31 23:34:56 +00008 * - Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
Josh Coalsonfda98fb2002-05-17 06:33:39 +000010 *
Josh Coalsonafd81072003-01-31 23:34:56 +000011 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * - Neither the name of the Xiph.org Foundation nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Josh Coalsonfda98fb2002-05-17 06:33:39 +000030 */
31
32#ifndef FLACPP__METADATA_H
33#define FLACPP__METADATA_H
34
Josh Coalson55bc5872002-10-16 22:18:32 +000035#include "export.h"
36
Josh Coalsonfda98fb2002-05-17 06:33:39 +000037#include "FLAC/metadata.h"
38
Josh Coalsonfb74f102002-05-22 05:33:29 +000039// ===============================================================
40//
41// Full documentation for the metadata interface can be found
42// in the C layer in include/FLAC/metadata.h
43//
44// ===============================================================
45
Josh Coalsonf6efd9c2002-07-27 04:59:54 +000046/** \file include/FLAC++/metadata.h
47 *
48 * \brief
49 * This module provides classes for creating and manipulating FLAC
50 * metadata blocks in memory, and three progressively more powerful
51 * interfaces for traversing and editing metadata in FLAC files.
52 *
53 * See the detailed documentation for each interface in the
54 * \link flacpp_metadata metadata \endlink module.
55 */
56
57/** \defgroup flacpp_metadata FLAC++/metadata.h: metadata interfaces
58 * \ingroup flacpp
59 *
60 * \brief
61 * This module provides classes for creating and manipulating FLAC
62 * metadata blocks in memory, and three progressively more powerful
63 * interfaces for traversing and editing metadata in FLAC files.
64 *
65 * The behavior closely mimics the C layer interface; be sure to read
66 * the detailed description of the
Josh Coalson3c917542006-10-15 07:50:44 +000067 * \link flac_metadata C metadata module \endlink. Note that the
68 * metadata API currently does not support Ogg FLAC files.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +000069 */
70
Josh Coalsonfb74f102002-05-22 05:33:29 +000071
Josh Coalsonfda98fb2002-05-17 06:33:39 +000072namespace FLAC {
73 namespace Metadata {
74
Josh Coalsonfb74f102002-05-22 05:33:29 +000075 // ============================================================
76 //
77 // Metadata objects
78 //
79 // ============================================================
80
Josh Coalsonf6efd9c2002-07-27 04:59:54 +000081 /** \defgroup flacpp_metadata_object FLAC++/metadata.h: metadata object classes
82 * \ingroup flacpp_metadata
83 *
84 * This module contains classes representing FLAC metadata
85 * blocks in memory.
86 *
87 * The behavior closely mimics the C layer interface; be
88 * sure to read the detailed description of the
89 * \link flac_metadata_object C metadata object module \endlink.
90 *
91 * Any time a metadata object is constructed or assigned, you
92 * should check is_valid() to make sure the underlying
93 * ::FLAC__StreamMetadata object was able to be created.
94 *
95 * \warning
96 * When the get_*() methods of any metadata object method
97 * return you a const pointer, DO NOT disobey and write into it.
98 * Always use the set_*() methods.
99 *
100 * \{
101 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000102
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000103 /** Base class for all metadata block types.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000104 * See the \link flacpp_metadata_object overview \endlink for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000105 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000106 class FLACPP_API Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000107 protected:
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000108 //@{
109 /** Constructs a copy of the given object. This form
110 * always performs a deep copy.
111 */
112 Prototype(const Prototype &);
113 Prototype(const ::FLAC__StreamMetadata &);
114 Prototype(const ::FLAC__StreamMetadata *);
115 //@}
Josh Coalson83961752002-07-09 06:12:59 +0000116
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000117 /** Constructs an object with copy control. When \a copy
118 * is \c true, behaves identically to
119 * FLAC::Metadata::Prototype::Prototype(const ::FLAC__StreamMetadata *object).
120 * When \a copy is \c false, the instance takes ownership of
121 * the pointer and the ::FLAC__StreamMetadata object will
122 * be freed by the destructor.
123 *
124 * \assert
125 * \code object != NULL \endcode
126 */
Josh Coalson83961752002-07-09 06:12:59 +0000127 Prototype(::FLAC__StreamMetadata *object, bool copy);
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000128
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000129 //@{
130 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000131 Prototype &operator=(const Prototype &);
132 Prototype &operator=(const ::FLAC__StreamMetadata &);
133 Prototype &operator=(const ::FLAC__StreamMetadata *);
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000134 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000135
Josh Coalson42372b92005-01-07 01:09:07 +0000136 /** Assigns an object with copy control. See
137 * Prototype(::FLAC__StreamMetadata *object, bool copy).
138 */
139 Prototype &assign_object(::FLAC__StreamMetadata *object, bool copy);
140
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000141 /** Deletes the underlying ::FLAC__StreamMetadata object.
142 */
Josh Coalsonfb74f102002-05-22 05:33:29 +0000143 virtual void clear();
144
Josh Coalsoncc682512002-06-08 04:53:42 +0000145 ::FLAC__StreamMetadata *object_;
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000146 public:
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000147 /** Deletes the underlying ::FLAC__StreamMetadata object.
148 */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000149 virtual ~Prototype();
150
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000151 //@{
Josh Coalson20ad84a2006-10-07 05:43:01 +0000152 /** Check for equality, performing a deep compare by following pointers.
153 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000154 inline bool operator==(const Prototype &) const;
155 inline bool operator==(const ::FLAC__StreamMetadata &) const;
156 inline bool operator==(const ::FLAC__StreamMetadata *) const;
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000157 //@}
158
159 //@{
160 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalsoncc682512002-06-08 04:53:42 +0000161 inline bool operator!=(const Prototype &) const;
162 inline bool operator!=(const ::FLAC__StreamMetadata &) const;
163 inline bool operator!=(const ::FLAC__StreamMetadata *) const;
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000164 //@}
Josh Coalsoncc682512002-06-08 04:53:42 +0000165
Josh Coalsonfb74f102002-05-22 05:33:29 +0000166 friend class SimpleIterator;
167 friend class Iterator;
168
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000169 /** Returns \c true if the object was correctly constructed
170 * (i.e. the underlying ::FLAC__StreamMetadata object was
171 * properly allocated), else \c false.
172 */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000173 inline bool is_valid() const;
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000174
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000175 /** Returns \c true if this block is the last block in a
176 * stream, else \c false.
177 *
178 * \assert
179 * \code is_valid() \endcode
180 */
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000181 bool get_is_last() const;
Josh Coalsoncc682512002-06-08 04:53:42 +0000182
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000183 /** Returns the type of the block.
184 *
185 * \assert
186 * \code is_valid() \endcode
187 */
188 ::FLAC__MetadataType get_type() const;
189
190 /** Returns the stream length of the metadata block.
191 *
192 * \note
193 * The length does not include the metadata block header,
194 * per spec.
195 *
196 * \assert
197 * \code is_valid() \endcode
198 */
199 unsigned get_length() const;
200
201 /** Sets the "is_last" flag for the block. When using the iterators
202 * it is not necessary to set this flag; they will do it for you.
203 *
204 * \assert
205 * \code is_valid() \endcode
206 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000207 void set_is_last(bool);
Josh Coalsond113ca32004-07-22 01:03:43 +0000208
209 /** Returns a pointer to the underlying ::FLAC__StreamMetadata
210 * object. This can be useful for plugging any holes between
211 * the C++ and C interfaces.
212 *
213 * \assert
214 * \code is_valid() \endcode
215 */
216 inline operator const ::FLAC__StreamMetadata *() const;
Josh Coalsonfb74f102002-05-22 05:33:29 +0000217 private:
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000218 /** Private and undefined so you can't use it. */
219 Prototype();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000220
221 // These are used only by Iterator
222 bool is_reference_;
223 inline void set_reference(bool x) { is_reference_ = x; }
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000224 };
225
Josh Coalson3cb83412004-07-23 05:11:06 +0000226#ifdef _MSC_VER
227// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
228#pragma warning ( disable : 4800 )
229#endif
230
Josh Coalson765ff502002-08-27 05:46:11 +0000231 inline bool Prototype::operator==(const Prototype &object) const
Josh Coalsond57c8d32002-06-11 06:15:28 +0000232 { return (bool)::FLAC__metadata_object_is_equal(object_, object.object_); }
Josh Coalson57ba6f42002-06-07 05:27:37 +0000233
Josh Coalson765ff502002-08-27 05:46:11 +0000234 inline bool Prototype::operator==(const ::FLAC__StreamMetadata &object) const
Josh Coalsond57c8d32002-06-11 06:15:28 +0000235 { return (bool)::FLAC__metadata_object_is_equal(object_, &object); }
Josh Coalson57ba6f42002-06-07 05:27:37 +0000236
Josh Coalson765ff502002-08-27 05:46:11 +0000237 inline bool Prototype::operator==(const ::FLAC__StreamMetadata *object) const
Josh Coalsond57c8d32002-06-11 06:15:28 +0000238 { return (bool)::FLAC__metadata_object_is_equal(object_, object); }
Josh Coalson57ba6f42002-06-07 05:27:37 +0000239
Josh Coalson3cb83412004-07-23 05:11:06 +0000240#ifdef _MSC_VER
241// @@@ how to re-enable? the following doesn't work
242// #pragma warning ( enable : 4800 )
243#endif
244
Josh Coalson765ff502002-08-27 05:46:11 +0000245 inline bool Prototype::operator!=(const Prototype &object) const
Josh Coalson57ba6f42002-06-07 05:27:37 +0000246 { return !operator==(object); }
247
Josh Coalson765ff502002-08-27 05:46:11 +0000248 inline bool Prototype::operator!=(const ::FLAC__StreamMetadata &object) const
Josh Coalson57ba6f42002-06-07 05:27:37 +0000249 { return !operator==(object); }
250
Josh Coalson765ff502002-08-27 05:46:11 +0000251 inline bool Prototype::operator!=(const ::FLAC__StreamMetadata *object) const
Josh Coalson57ba6f42002-06-07 05:27:37 +0000252 { return !operator==(object); }
253
254 inline bool Prototype::is_valid() const
255 { return 0 != object_; }
256
Josh Coalsond113ca32004-07-22 01:03:43 +0000257 inline Prototype::operator const ::FLAC__StreamMetadata *() const
258 { return object_; }
259
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000260 /** Create a deep copy of an object and return it. */
Josh Coalson55bc5872002-10-16 22:18:32 +0000261 FLACPP_API Prototype *clone(const Prototype *);
Josh Coalson57ba6f42002-06-07 05:27:37 +0000262
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000263
264 /** STREAMINFO metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000265 * See the \link flacpp_metadata_object overview \endlink for more,
266 * and the <A HREF="../format.html#metadata_block_streaminfo">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000267 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000268 class FLACPP_API StreamInfo : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000269 public:
270 StreamInfo();
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000271
272 //@{
273 /** Constructs a copy of the given object. This form
274 * always performs a deep copy.
275 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000276 inline StreamInfo(const StreamInfo &object): Prototype(object) { }
277 inline StreamInfo(const ::FLAC__StreamMetadata &object): Prototype(object) { }
278 inline StreamInfo(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000279 //@}
280
281 /** Constructs an object with copy control. See
282 * Prototype(::FLAC__StreamMetadata *object, bool copy).
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000283 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000284 inline StreamInfo(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000285
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000286 ~StreamInfo();
287
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000288 //@{
289 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000290 inline StreamInfo &operator=(const StreamInfo &object) { Prototype::operator=(object); return *this; }
291 inline StreamInfo &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
292 inline StreamInfo &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000293 //@}
Josh Coalsonfb74f102002-05-22 05:33:29 +0000294
Josh Coalson42372b92005-01-07 01:09:07 +0000295 /** Assigns an object with copy control. See
296 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
297 */
298 inline StreamInfo &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
299
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000300 //@{
301 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000302 inline bool operator==(const StreamInfo &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000303 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
304 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000305 //@}
306
307 //@{
308 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000309 inline bool operator!=(const StreamInfo &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000310 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
311 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000312 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000313
Josh Coalson4dc35072002-08-20 03:56:52 +0000314 //@{
315 /** See <A HREF="../format.html#metadata_block_streaminfo">format specification</A>. */
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000316 unsigned get_min_blocksize() const;
317 unsigned get_max_blocksize() const;
318 unsigned get_min_framesize() const;
319 unsigned get_max_framesize() const;
320 unsigned get_sample_rate() const;
321 unsigned get_channels() const;
322 unsigned get_bits_per_sample() const;
323 FLAC__uint64 get_total_samples() const;
324 const FLAC__byte *get_md5sum() const;
325
326 void set_min_blocksize(unsigned value);
327 void set_max_blocksize(unsigned value);
328 void set_min_framesize(unsigned value);
329 void set_max_framesize(unsigned value);
330 void set_sample_rate(unsigned value);
331 void set_channels(unsigned value);
332 void set_bits_per_sample(unsigned value);
333 void set_total_samples(FLAC__uint64 value);
334 void set_md5sum(const FLAC__byte value[16]);
Josh Coalson4dc35072002-08-20 03:56:52 +0000335 //@}
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000336 };
337
Josh Coalson4dc35072002-08-20 03:56:52 +0000338 /** PADDING metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000339 * See the \link flacpp_metadata_object overview \endlink for more,
340 * and the <A HREF="../format.html#metadata_block_padding">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000341 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000342 class FLACPP_API Padding : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000343 public:
344 Padding();
Josh Coalson4dc35072002-08-20 03:56:52 +0000345
346 //@{
347 /** Constructs a copy of the given object. This form
348 * always performs a deep copy.
349 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000350 inline Padding(const Padding &object): Prototype(object) { }
351 inline Padding(const ::FLAC__StreamMetadata &object): Prototype(object) { }
352 inline Padding(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000353 //@}
354
355 /** Constructs an object with copy control. See
356 * Prototype(::FLAC__StreamMetadata *object, bool copy).
357 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000358 inline Padding(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000359
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000360 ~Padding();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000361
Josh Coalson4dc35072002-08-20 03:56:52 +0000362 //@{
363 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000364 inline Padding &operator=(const Padding &object) { Prototype::operator=(object); return *this; }
365 inline Padding &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
366 inline Padding &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000367 //@}
Josh Coalsonb2b53582002-05-31 06:20:50 +0000368
Josh Coalson42372b92005-01-07 01:09:07 +0000369 /** Assigns an object with copy control. See
370 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
371 */
372 inline Padding &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
373
Josh Coalson4dc35072002-08-20 03:56:52 +0000374 //@{
375 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000376 inline bool operator==(const Padding &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000377 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
378 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000379 //@}
380
381 //@{
382 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000383 inline bool operator!=(const Padding &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000384 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
385 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000386 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000387
Josh Coalsonb2b53582002-05-31 06:20:50 +0000388 void set_length(unsigned length);
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000389 };
390
Josh Coalson4dc35072002-08-20 03:56:52 +0000391 /** APPLICATION metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000392 * See the \link flacpp_metadata_object overview \endlink for more,
393 * and the <A HREF="../format.html#metadata_block_application">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000394 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000395 class FLACPP_API Application : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000396 public:
397 Application();
Josh Coalson4dc35072002-08-20 03:56:52 +0000398 //
399 //@{
400 /** Constructs a copy of the given object. This form
401 * always performs a deep copy.
402 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000403 inline Application(const Application &object): Prototype(object) { }
404 inline Application(const ::FLAC__StreamMetadata &object): Prototype(object) { }
405 inline Application(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000406 //@}
407
408 /** Constructs an object with copy control. See
409 * Prototype(::FLAC__StreamMetadata *object, bool copy).
410 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000411 inline Application(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000412
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000413 ~Application();
414
Josh Coalson4dc35072002-08-20 03:56:52 +0000415 //@{
416 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000417 inline Application &operator=(const Application &object) { Prototype::operator=(object); return *this; }
418 inline Application &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
419 inline Application &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000420 //@}
Josh Coalsonfb74f102002-05-22 05:33:29 +0000421
Josh Coalson42372b92005-01-07 01:09:07 +0000422 /** Assigns an object with copy control. See
423 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
424 */
425 inline Application &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
426
Josh Coalson4dc35072002-08-20 03:56:52 +0000427 //@{
428 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000429 inline bool operator==(const Application &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000430 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
431 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000432 //@}
433
434 //@{
435 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000436 inline bool operator!=(const Application &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000437 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
438 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000439 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000440
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000441 const FLAC__byte *get_id() const;
442 const FLAC__byte *get_data() const;
443
Josh Coalsoncc682512002-06-08 04:53:42 +0000444 void set_id(const FLAC__byte value[4]);
Josh Coalson4dc35072002-08-20 03:56:52 +0000445 //! This form always copies \a data
446 bool set_data(const FLAC__byte *data, unsigned length);
Josh Coalsoncc682512002-06-08 04:53:42 +0000447 bool set_data(FLAC__byte *data, unsigned length, bool copy);
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000448 };
449
Josh Coalson4dc35072002-08-20 03:56:52 +0000450 /** SEEKTABLE metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000451 * See the \link flacpp_metadata_object overview \endlink for more,
452 * and the <A HREF="../format.html#metadata_block_seektable">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000453 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000454 class FLACPP_API SeekTable : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000455 public:
456 SeekTable();
Josh Coalson4dc35072002-08-20 03:56:52 +0000457
458 //@{
459 /** Constructs a copy of the given object. This form
460 * always performs a deep copy.
461 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000462 inline SeekTable(const SeekTable &object): Prototype(object) { }
463 inline SeekTable(const ::FLAC__StreamMetadata &object): Prototype(object) { }
464 inline SeekTable(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000465 //@}
466
467 /** Constructs an object with copy control. See
468 * Prototype(::FLAC__StreamMetadata *object, bool copy).
469 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000470 inline SeekTable(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000471
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000472 ~SeekTable();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000473
Josh Coalson4dc35072002-08-20 03:56:52 +0000474 //@{
475 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000476 inline SeekTable &operator=(const SeekTable &object) { Prototype::operator=(object); return *this; }
477 inline SeekTable &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
478 inline SeekTable &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000479 //@}
Josh Coalsonb2b53582002-05-31 06:20:50 +0000480
Josh Coalson42372b92005-01-07 01:09:07 +0000481 /** Assigns an object with copy control. See
482 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
483 */
484 inline SeekTable &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
485
Josh Coalson4dc35072002-08-20 03:56:52 +0000486 //@{
487 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000488 inline bool operator==(const SeekTable &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000489 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
490 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000491 //@}
492
493 //@{
494 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000495 inline bool operator!=(const SeekTable &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000496 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
497 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000498 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000499
Josh Coalsonb2b53582002-05-31 06:20:50 +0000500 unsigned get_num_points() const;
Josh Coalsoncc682512002-06-08 04:53:42 +0000501 ::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const;
Josh Coalsonb2b53582002-05-31 06:20:50 +0000502
Josh Coalson4dc35072002-08-20 03:56:52 +0000503 //! See FLAC__metadata_object_seektable_set_point()
Josh Coalsoncc682512002-06-08 04:53:42 +0000504 void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
Josh Coalson4dc35072002-08-20 03:56:52 +0000505
506 //! See FLAC__metadata_object_seektable_insert_point()
Josh Coalsoncc682512002-06-08 04:53:42 +0000507 bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
Josh Coalson4dc35072002-08-20 03:56:52 +0000508
509 //! See FLAC__metadata_object_seektable_delete_point()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000510 bool delete_point(unsigned index);
Josh Coalson28e08d82002-06-05 05:56:41 +0000511
Josh Coalson4dc35072002-08-20 03:56:52 +0000512 //! See FLAC__metadata_object_seektable_is_legal()
Josh Coalson28e08d82002-06-05 05:56:41 +0000513 bool is_legal() const;
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000514 };
515
Josh Coalson4dc35072002-08-20 03:56:52 +0000516 /** VORBIS_COMMENT metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000517 * See the \link flacpp_metadata_object overview \endlink for more,
518 * and the <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000519 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000520 class FLACPP_API VorbisComment : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000521 public:
Josh Coalson4dc35072002-08-20 03:56:52 +0000522 /** Convenience class for encapsulating Vorbis comment
523 * entries. An entry is a vendor string or a comment
524 * field. In the case of a vendor string, the field
525 * name is undefined; only the field value is relevant.
526 *
527 * A \a field as used in the methods refers to an
Josh Coalsondef597e2004-12-30 00:59:30 +0000528 * entire 'NAME=VALUE' string; for convenience the
Josh Coalson2de11242004-12-30 03:41:19 +0000529 * string is NUL-terminated. A length field is
Josh Coalsondef597e2004-12-30 00:59:30 +0000530 * required in the unlikely event that the value
Josh Coalson2de11242004-12-30 03:41:19 +0000531 * contains contain embedded NULs.
Josh Coalson4dc35072002-08-20 03:56:52 +0000532 *
533 * A \a field_name is what is on the left side of the
534 * first '=' in the \a field. By definition it is ASCII
Josh Coalson2de11242004-12-30 03:41:19 +0000535 * and so is NUL-terminated and does not require a
Josh Coalson4dc35072002-08-20 03:56:52 +0000536 * length to describe it. \a field_name is undefined
537 * for a vendor string entry.
538 *
539 * A \a field_value is what is on the right side of the
540 * first '=' in the \a field. By definition, this may
Josh Coalson2de11242004-12-30 03:41:19 +0000541 * contain embedded NULs and so a \a field_value_length
Josh Coalsondef597e2004-12-30 00:59:30 +0000542 * is required to describe it. However in practice,
Josh Coalson2de11242004-12-30 03:41:19 +0000543 * embedded NULs are not known to be used, so it is
544 * generally safe to treat field values as NUL-
Josh Coalsondef597e2004-12-30 00:59:30 +0000545 * terminated UTF-8 strings.
Josh Coalson4dc35072002-08-20 03:56:52 +0000546 *
547 * Always check is_valid() after the constructor or operator=
Josh Coalson2de11242004-12-30 03:41:19 +0000548 * to make sure memory was properly allocated and that the
549 * Entry conforms to the Vorbis comment specification.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000550 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000551 class FLACPP_API Entry {
Josh Coalsonb2b53582002-05-31 06:20:50 +0000552 public:
553 Entry();
Josh Coalsondef597e2004-12-30 00:59:30 +0000554
Josh Coalsonb2b53582002-05-31 06:20:50 +0000555 Entry(const char *field, unsigned field_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000556 Entry(const char *field); // assumes \a field is NUL-terminated
Josh Coalsondef597e2004-12-30 00:59:30 +0000557
Josh Coalsonb2b53582002-05-31 06:20:50 +0000558 Entry(const char *field_name, const char *field_value, unsigned field_value_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000559 Entry(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
Josh Coalsondef597e2004-12-30 00:59:30 +0000560
Josh Coalsonb2b53582002-05-31 06:20:50 +0000561 Entry(const Entry &entry);
Josh Coalsondef597e2004-12-30 00:59:30 +0000562
Josh Coalson42372b92005-01-07 01:09:07 +0000563 Entry &operator=(const Entry &entry);
Josh Coalsonb2b53582002-05-31 06:20:50 +0000564
565 virtual ~Entry();
566
Josh Coalson3c917542006-10-15 07:50:44 +0000567 virtual bool is_valid() const; ///< Returns \c true iff object was properly constructed.
Josh Coalsonb2b53582002-05-31 06:20:50 +0000568
569 unsigned get_field_length() const;
570 unsigned get_field_name_length() const;
571 unsigned get_field_value_length() const;
572
Josh Coalsoncc682512002-06-08 04:53:42 +0000573 ::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const;
Josh Coalsonb2b53582002-05-31 06:20:50 +0000574 const char *get_field() const;
575 const char *get_field_name() const;
576 const char *get_field_value() const;
577
578 bool set_field(const char *field, unsigned field_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000579 bool set_field(const char *field); // assumes \a field is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000580 bool set_field_name(const char *field_name);
581 bool set_field_value(const char *field_value, unsigned field_value_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000582 bool set_field_value(const char *field_value); // assumes \a field_value is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000583 protected:
584 bool is_valid_;
Josh Coalsoncc682512002-06-08 04:53:42 +0000585 ::FLAC__StreamMetadata_VorbisComment_Entry entry_;
Josh Coalsonb2b53582002-05-31 06:20:50 +0000586 char *field_name_;
587 unsigned field_name_length_;
588 char *field_value_;
589 unsigned field_value_length_;
590 private:
591 void zero();
592 void clear();
593 void clear_entry();
594 void clear_field_name();
595 void clear_field_value();
596 void construct(const char *field, unsigned field_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000597 void construct(const char *field); // assumes \a field is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000598 void construct(const char *field_name, const char *field_value, unsigned field_value_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000599 void construct(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000600 void compose_field();
601 void parse_field();
602 };
603
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000604 VorbisComment();
Josh Coalson4dc35072002-08-20 03:56:52 +0000605
606 //@{
607 /** Constructs a copy of the given object. This form
608 * always performs a deep copy.
609 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000610 inline VorbisComment(const VorbisComment &object): Prototype(object) { }
611 inline VorbisComment(const ::FLAC__StreamMetadata &object): Prototype(object) { }
612 inline VorbisComment(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000613 //@}
614
615 /** Constructs an object with copy control. See
616 * Prototype(::FLAC__StreamMetadata *object, bool copy).
617 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000618 inline VorbisComment(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000619
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000620 ~VorbisComment();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000621
Josh Coalson4dc35072002-08-20 03:56:52 +0000622 //@{
623 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000624 inline VorbisComment &operator=(const VorbisComment &object) { Prototype::operator=(object); return *this; }
625 inline VorbisComment &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
626 inline VorbisComment &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000627 //@}
Josh Coalsonb2b53582002-05-31 06:20:50 +0000628
Josh Coalson42372b92005-01-07 01:09:07 +0000629 /** Assigns an object with copy control. See
630 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
631 */
632 inline VorbisComment &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
633
Josh Coalson4dc35072002-08-20 03:56:52 +0000634 //@{
635 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000636 inline bool operator==(const VorbisComment &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000637 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
638 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000639 //@}
640
641 //@{
642 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000643 inline bool operator!=(const VorbisComment &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000644 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
645 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000646 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000647
Josh Coalsonb2b53582002-05-31 06:20:50 +0000648 unsigned get_num_comments() const;
Josh Coalson2de11242004-12-30 03:41:19 +0000649 const FLAC__byte *get_vendor_string() const; // NUL-terminated UTF-8 string
Josh Coalsonb2b53582002-05-31 06:20:50 +0000650 Entry get_comment(unsigned index) const;
651
Josh Coalson87977ba2002-08-20 07:09:33 +0000652 //! See FLAC__metadata_object_vorbiscomment_set_vendor_string()
Josh Coalson2de11242004-12-30 03:41:19 +0000653 bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string
Josh Coalson4dc35072002-08-20 03:56:52 +0000654
Josh Coalson87977ba2002-08-20 07:09:33 +0000655 //! See FLAC__metadata_object_vorbiscomment_set_comment()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000656 bool set_comment(unsigned index, const Entry &entry);
Josh Coalson4dc35072002-08-20 03:56:52 +0000657
Josh Coalson87977ba2002-08-20 07:09:33 +0000658 //! See FLAC__metadata_object_vorbiscomment_insert_comment()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000659 bool insert_comment(unsigned index, const Entry &entry);
Josh Coalson4dc35072002-08-20 03:56:52 +0000660
Josh Coalsondef597e2004-12-30 00:59:30 +0000661 //! See FLAC__metadata_object_vorbiscomment_append_comment()
662 bool append_comment(const Entry &entry);
663
Josh Coalson87977ba2002-08-20 07:09:33 +0000664 //! See FLAC__metadata_object_vorbiscomment_delete_comment()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000665 bool delete_comment(unsigned index);
Josh Coalsonfb74f102002-05-22 05:33:29 +0000666 };
667
Josh Coalson863dbf32002-11-16 06:30:30 +0000668 /** CUESHEET metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000669 * See the \link flacpp_metadata_object overview \endlink for more,
670 * and the <A HREF="../format.html#metadata_block_cuesheet">format specification</A>.
Josh Coalson863dbf32002-11-16 06:30:30 +0000671 */
672 class FLACPP_API CueSheet : public Prototype {
673 public:
674 /** Convenience class for encapsulating a cue sheet
675 * track.
676 *
677 * Always check is_valid() after the constructor or operator=
678 * to make sure memory was properly allocated.
679 */
680 class FLACPP_API Track {
681 protected:
682 ::FLAC__StreamMetadata_CueSheet_Track *object_;
683 public:
684 Track();
685 Track(const ::FLAC__StreamMetadata_CueSheet_Track *track);
686 Track(const Track &track);
Josh Coalson42372b92005-01-07 01:09:07 +0000687 Track &operator=(const Track &track);
Josh Coalson863dbf32002-11-16 06:30:30 +0000688
689 virtual ~Track();
690
Josh Coalson3c917542006-10-15 07:50:44 +0000691 virtual bool is_valid() const; ///< Returns \c true iff object was properly constructed.
692
Josh Coalson863dbf32002-11-16 06:30:30 +0000693
694 inline FLAC__uint64 get_offset() const { return object_->offset; }
695 inline FLAC__byte get_number() const { return object_->number; }
696 inline const char *get_isrc() const { return object_->isrc; }
697 inline unsigned get_type() const { return object_->type; }
698 inline bool get_pre_emphasis() const { return object_->pre_emphasis; }
699
Josh Coalsona7038a92003-01-22 20:16:20 +0000700 inline FLAC__byte get_num_indices() const { return object_->num_indices; }
Josh Coalson863dbf32002-11-16 06:30:30 +0000701 ::FLAC__StreamMetadata_CueSheet_Index get_index(unsigned i) const;
702
703 inline const ::FLAC__StreamMetadata_CueSheet_Track *get_track() const { return object_; }
704
705 inline void set_offset(FLAC__uint64 value) { object_->offset = value; }
706 inline void set_number(FLAC__byte value) { object_->number = value; }
Josh Coalson16219792002-11-19 06:19:29 +0000707 void set_isrc(const char value[12]);
Josh Coalson863dbf32002-11-16 06:30:30 +0000708 void set_type(unsigned value);
709 inline void set_pre_emphasis(bool value) { object_->pre_emphasis = value? 1 : 0; }
710
Josh Coalson16219792002-11-19 06:19:29 +0000711 void set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index);
Josh Coalsonb3538c82003-01-12 08:42:23 +0000712 //@@@ It's awkward but to insert/delete index points
713 //@@@ you must use the routines in the CueSheet class.
Josh Coalson863dbf32002-11-16 06:30:30 +0000714 };
715
716 CueSheet();
717
718 //@{
719 /** Constructs a copy of the given object. This form
720 * always performs a deep copy.
721 */
722 inline CueSheet(const CueSheet &object): Prototype(object) { }
723 inline CueSheet(const ::FLAC__StreamMetadata &object): Prototype(object) { }
724 inline CueSheet(const ::FLAC__StreamMetadata *object): Prototype(object) { }
725 //@}
726
727 /** Constructs an object with copy control. See
728 * Prototype(::FLAC__StreamMetadata *object, bool copy).
729 */
730 inline CueSheet(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
731
732 ~CueSheet();
733
734 //@{
735 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000736 inline CueSheet &operator=(const CueSheet &object) { Prototype::operator=(object); return *this; }
737 inline CueSheet &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
738 inline CueSheet &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson863dbf32002-11-16 06:30:30 +0000739 //@}
740
Josh Coalson42372b92005-01-07 01:09:07 +0000741 /** Assigns an object with copy control. See
742 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
743 */
744 inline CueSheet &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
745
Josh Coalson863dbf32002-11-16 06:30:30 +0000746 //@{
747 /** Check for equality, performing a deep compare by following pointers. */
748 inline bool operator==(const CueSheet &object) const { return Prototype::operator==(object); }
749 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
750 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
751 //@}
752
753 //@{
754 /** Check for inequality, performing a deep compare by following pointers. */
755 inline bool operator!=(const CueSheet &object) const { return Prototype::operator!=(object); }
756 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
757 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
758 //@}
759
760 const char *get_media_catalog_number() const;
761 FLAC__uint64 get_lead_in() const;
Josh Coalson8f0c71b2002-12-05 06:37:46 +0000762 bool get_is_cd() const;
Josh Coalson863dbf32002-11-16 06:30:30 +0000763
764 unsigned get_num_tracks() const;
765 Track get_track(unsigned i) const;
766
Josh Coalson16219792002-11-19 06:19:29 +0000767 void set_media_catalog_number(const char value[128]);
768 void set_lead_in(FLAC__uint64 value);
Josh Coalson8f0c71b2002-12-05 06:37:46 +0000769 void set_is_cd(bool value);
Josh Coalson16219792002-11-19 06:19:29 +0000770
771 void set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
Josh Coalson863dbf32002-11-16 06:30:30 +0000772
773 //! See FLAC__metadata_object_cuesheet_track_insert_index()
774 bool insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
775
776 //! See FLAC__metadata_object_cuesheet_track_delete_index()
777 bool delete_index(unsigned track_num, unsigned index_num);
778
779 //! See FLAC__metadata_object_cuesheet_set_track()
780 bool set_track(unsigned i, const Track &track);
781
782 //! See FLAC__metadata_object_cuesheet_insert_track()
783 bool insert_track(unsigned i, const Track &track);
784
785 //! See FLAC__metadata_object_cuesheet_delete_track()
786 bool delete_track(unsigned i);
787
788 //! See FLAC__metadata_object_cuesheet_is_legal()
789 bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const;
Josh Coalson7cfac0b2006-04-10 05:37:34 +0000790
791 //! See FLAC__metadata_object_cuesheet_calculate_cddb_id()
792 FLAC__uint32 calculate_cddb_id() const;
Josh Coalson863dbf32002-11-16 06:30:30 +0000793 };
794
Josh Coalsone343ab22006-09-23 19:21:19 +0000795 /** PICTURE metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000796 * See the \link flacpp_metadata_object overview \endlink for more,
797 * and the <A HREF="../format.html#metadata_block_picture">format specification</A>.
Josh Coalsone343ab22006-09-23 19:21:19 +0000798 */
799 class FLACPP_API Picture : public Prototype {
800 public:
801 Picture();
802
803 //@{
804 /** Constructs a copy of the given object. This form
805 * always performs a deep copy.
806 */
807 inline Picture(const Picture &object): Prototype(object) { }
808 inline Picture(const ::FLAC__StreamMetadata &object): Prototype(object) { }
809 inline Picture(const ::FLAC__StreamMetadata *object): Prototype(object) { }
810 //@}
811
812 /** Constructs an object with copy control. See
813 * Prototype(::FLAC__StreamMetadata *object, bool copy).
814 */
815 inline Picture(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
816
817 ~Picture();
818
819 //@{
820 /** Assign from another object. Always performs a deep copy. */
821 inline Picture &operator=(const Picture &object) { Prototype::operator=(object); return *this; }
822 inline Picture &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
823 inline Picture &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
824 //@}
825
826 /** Assigns an object with copy control. See
827 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
828 */
829 inline Picture &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
830
831 //@{
832 /** Check for equality, performing a deep compare by following pointers. */
833 inline bool operator==(const Picture &object) const { return Prototype::operator==(object); }
834 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
835 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
836 //@}
837
838 //@{
839 /** Check for inequality, performing a deep compare by following pointers. */
840 inline bool operator!=(const Picture &object) const { return Prototype::operator!=(object); }
841 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
842 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
843 //@}
844
845 ::FLAC__StreamMetadata_Picture_Type get_type() const;
846 const char *get_mime_type() const; // NUL-terminated printable ASCII string
847 const FLAC__byte *get_description() const; // NUL-terminated UTF-8 string
848 FLAC__uint32 get_width() const;
849 FLAC__uint32 get_height() const;
850 FLAC__uint32 get_depth() const;
Josh Coalson74ed2942006-09-23 23:15:05 +0000851 FLAC__uint32 get_colors() const; ///< a return value of \c 0 means true-color, i.e. 2^depth colors
Josh Coalsone343ab22006-09-23 19:21:19 +0000852 FLAC__uint32 get_data_length() const;
853 const FLAC__byte *get_data() const;
854
855 void set_type(::FLAC__StreamMetadata_Picture_Type type);
856
857 //! See FLAC__metadata_object_picture_set_mime_type()
858 bool set_mime_type(const char *string); // NUL-terminated printable ASCII string
859
860 //! See FLAC__metadata_object_picture_set_description()
861 bool set_description(const FLAC__byte *string); // NUL-terminated UTF-8 string
862
863 void set_width(FLAC__uint32 value) const;
864 void set_height(FLAC__uint32 value) const;
865 void set_depth(FLAC__uint32 value) const;
Josh Coalson74ed2942006-09-23 23:15:05 +0000866 void set_colors(FLAC__uint32 value) const; ///< a value of \c 0 means true-color, i.e. 2^depth colors
Josh Coalsone343ab22006-09-23 19:21:19 +0000867
868 //! See FLAC__metadata_object_picture_set_data()
869 bool set_data(const FLAC__byte *data, FLAC__uint32 data_length);
870 };
871
Josh Coalson0eea34a2003-01-10 05:29:17 +0000872 /** Opaque metadata block for storing unknown types.
873 * This should not be used unless you know what you are doing;
874 * it is currently used only internally to support forward
875 * compatibility of metadata blocks.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000876 * See the \link flacpp_metadata_object overview \endlink for more,
Josh Coalson0eea34a2003-01-10 05:29:17 +0000877 */
878 class FLACPP_API Unknown : public Prototype {
879 public:
880 Unknown();
881 //
882 //@{
883 /** Constructs a copy of the given object. This form
884 * always performs a deep copy.
885 */
886 inline Unknown(const Unknown &object): Prototype(object) { }
887 inline Unknown(const ::FLAC__StreamMetadata &object): Prototype(object) { }
888 inline Unknown(const ::FLAC__StreamMetadata *object): Prototype(object) { }
889 //@}
890
891 /** Constructs an object with copy control. See
892 * Prototype(::FLAC__StreamMetadata *object, bool copy).
893 */
894 inline Unknown(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
895
896 ~Unknown();
897
898 //@{
899 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000900 inline Unknown &operator=(const Unknown &object) { Prototype::operator=(object); return *this; }
901 inline Unknown &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
902 inline Unknown &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson0eea34a2003-01-10 05:29:17 +0000903 //@}
904
Josh Coalson42372b92005-01-07 01:09:07 +0000905 /** Assigns an object with copy control. See
906 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
907 */
908 inline Unknown &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
909
Josh Coalson0eea34a2003-01-10 05:29:17 +0000910 //@{
911 /** Check for equality, performing a deep compare by following pointers. */
912 inline bool operator==(const Unknown &object) const { return Prototype::operator==(object); }
913 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
914 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
915 //@}
916
917 //@{
918 /** Check for inequality, performing a deep compare by following pointers. */
919 inline bool operator!=(const Unknown &object) const { return Prototype::operator!=(object); }
920 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
921 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
922 //@}
923
924 const FLAC__byte *get_data() const;
925
926 //! This form always copies \a data
927 bool set_data(const FLAC__byte *data, unsigned length);
928 bool set_data(FLAC__byte *data, unsigned length, bool copy);
929 };
930
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000931 /* \} */
932
Josh Coalsonb2b53582002-05-31 06:20:50 +0000933
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000934 /** \defgroup flacpp_metadata_level0 FLAC++/metadata.h: metadata level 0 interface
935 * \ingroup flacpp_metadata
936 *
937 * \brief
Josh Coalson1aca6b12004-07-30 01:54:29 +0000938 * Level 0 metadata iterators.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000939 *
Josh Coalson4dc35072002-08-20 03:56:52 +0000940 * See the \link flac_metadata_level0 C layer equivalent \endlink
941 * for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000942 *
943 * \{
944 */
945
Josh Coalson20ad84a2006-10-07 05:43:01 +0000946 FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo); ///< See FLAC__metadata_get_streaminfo().
Josh Coalson2c75bd82004-12-30 03:55:00 +0000947
Josh Coalson20ad84a2006-10-07 05:43:01 +0000948 FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags); ///< See FLAC__metadata_get_tags().
949 FLACPP_API bool get_tags(const char *filename, VorbisComment &tags); ///< See FLAC__metadata_get_tags().
Josh Coalsonfb74f102002-05-22 05:33:29 +0000950
Josh Coalson20ad84a2006-10-07 05:43:01 +0000951 FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet); ///< See FLAC__metadata_get_cuesheet().
952 FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet); ///< See FLAC__metadata_get_cuesheet().
Josh Coalsone343ab22006-09-23 19:21:19 +0000953
Josh Coalson20ad84a2006-10-07 05:43:01 +0000954 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().
955 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().
Josh Coalson7cfac0b2006-04-10 05:37:34 +0000956
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000957 /* \} */
958
Josh Coalsonb2b53582002-05-31 06:20:50 +0000959
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000960 /** \defgroup flacpp_metadata_level1 FLAC++/metadata.h: metadata level 1 interface
961 * \ingroup flacpp_metadata
962 *
Josh Coalson4dc35072002-08-20 03:56:52 +0000963 * \brief
964 * Level 1 metadata iterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000965 *
Josh Coalson4dc35072002-08-20 03:56:52 +0000966 * The flow through the iterator in the C++ layer is similar
967 * to the C layer:
968 * - Create a SimpleIterator instance
969 * - Check SimpleIterator::is_valid()
970 * - Call SimpleIterator::init() and check the return
971 * - Traverse and/or edit. Edits are written to file
972 * immediately.
973 * - Destroy the SimpleIterator instance
974 *
975 * The ownership of pointers in the C++ layer follows that in
976 * the C layer, i.e.
977 * - The objects returned by get_block() are yours to
978 * modify, but changes are not reflected in the FLAC file
979 * until you call set_block(). The objects are also
980 * yours to delete; they are not automatically deleted
981 * when passed to set_block() or insert_block_after().
982 *
983 * See the \link flac_metadata_level1 C layer equivalent \endlink
984 * for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000985 *
986 * \{
987 */
988
Josh Coalson402da702002-08-21 03:40:11 +0000989 /** This class is a wrapper around the FLAC__metadata_simple_iterator
Josh Coalson20ad84a2006-10-07 05:43:01 +0000990 * structures and methods; see the
991 * \link flacpp_metadata_level1 usage guide \endlink and
992 * ::FLAC__Metadata_SimpleIterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000993 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000994 class FLACPP_API SimpleIterator {
Josh Coalsonfb74f102002-05-22 05:33:29 +0000995 public:
Josh Coalson20ad84a2006-10-07 05:43:01 +0000996 /** This class is a wrapper around FLAC__Metadata_SimpleIteratorStatus.
997 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000998 class FLACPP_API Status {
Josh Coalsonfb74f102002-05-22 05:33:29 +0000999 public:
Josh Coalsoncc682512002-06-08 04:53:42 +00001000 inline Status(::FLAC__Metadata_SimpleIteratorStatus status): status_(status) { }
1001 inline operator ::FLAC__Metadata_SimpleIteratorStatus() const { return status_; }
1002 inline const char *as_cstring() const { return ::FLAC__Metadata_SimpleIteratorStatusString[status_]; }
Josh Coalsonfb74f102002-05-22 05:33:29 +00001003 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001004 ::FLAC__Metadata_SimpleIteratorStatus status_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001005 };
1006
1007 SimpleIterator();
1008 virtual ~SimpleIterator();
1009
Josh Coalson3c917542006-10-15 07:50:44 +00001010 bool is_valid() const; ///< Returns \c true iff object was properly constructed.
1011
Josh Coalson20ad84a2006-10-07 05:43:01 +00001012 bool init(const char *filename, bool read_only, bool preserve_file_stats); ///< See FLAC__metadata_simple_iterator_init().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001013
Josh Coalson20ad84a2006-10-07 05:43:01 +00001014 Status status(); ///< See FLAC__metadata_simple_iterator_status().
1015 bool is_writable() const; ///< See FLAC__metadata_simple_iterator_is_writable().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001016
Josh Coalson20ad84a2006-10-07 05:43:01 +00001017 bool next(); ///< See FLAC__metadata_simple_iterator_next().
1018 bool prev(); ///< See FLAC__metadata_simple_iterator_prev().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001019
Josh Coalson20ad84a2006-10-07 05:43:01 +00001020 ::FLAC__MetadataType get_block_type() const; ///< See FLAC__metadata_simple_iterator_get_block_type().
1021 Prototype *get_block(); ///< See FLAC__metadata_simple_iterator_get_block().
1022 bool set_block(Prototype *block, bool use_padding = true); ///< See FLAC__metadata_simple_iterator_set_block().
1023 bool insert_block_after(Prototype *block, bool use_padding = true); ///< See FLAC__metadata_simple_iterator_insert_block_after().
1024 bool delete_block(bool use_padding = true); ///< See FLAC__metadata_simple_iterator_delete_block().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001025
1026 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001027 ::FLAC__Metadata_SimpleIterator *iterator_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001028 void clear();
1029 };
1030
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001031 /* \} */
1032
Josh Coalsonb2b53582002-05-31 06:20:50 +00001033
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001034 /** \defgroup flacpp_metadata_level2 FLAC++/metadata.h: metadata level 2 interface
1035 * \ingroup flacpp_metadata
1036 *
Josh Coalson4dc35072002-08-20 03:56:52 +00001037 * \brief
1038 * Level 2 metadata iterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001039 *
Josh Coalson4dc35072002-08-20 03:56:52 +00001040 * The flow through the iterator in the C++ layer is similar
1041 * to the C layer:
1042 * - Create a Chain instance
1043 * - Check Chain::is_valid()
1044 * - Call Chain::read() and check the return
1045 * - Traverse and/or edit with an Iterator or with
1046 * Chain::merge_padding() or Chain::sort_padding()
1047 * - Write changes back to FLAC file with Chain::write()
1048 * - Destroy the Chain instance
1049 *
Josh Coalson8b9a4772002-12-28 07:03:26 +00001050 * The ownership of pointers in the C++ layer is slightly
1051 * different than in the C layer, i.e.
1052 * - The objects returned by Iterator::get_block() are NOT
1053 * owned by the iterator and should be deleted by the
1054 * caller when finished, BUT, when you modify the block,
1055 * it will directly edit what's in the chain and you do
1056 * not need to call Iterator::set_block(). However the
1057 * changes will not be reflected in the FLAC file until
1058 * the chain is written with Chain::write().
Josh Coalson4dc35072002-08-20 03:56:52 +00001059 * - When you pass an object to Iterator::set_block(),
1060 * Iterator::insert_block_before(), or
1061 * Iterator::insert_block_after(), the iterator takes
Josh Coalson8b9a4772002-12-28 07:03:26 +00001062 * ownership of the block and it will be deleted by the
Josh Coalson4dc35072002-08-20 03:56:52 +00001063 * chain.
1064 *
1065 * See the \link flac_metadata_level2 C layer equivalent \endlink
1066 * for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001067 *
1068 * \{
1069 */
1070
Josh Coalson402da702002-08-21 03:40:11 +00001071 /** This class is a wrapper around the FLAC__metadata_chain
Josh Coalson20ad84a2006-10-07 05:43:01 +00001072 * structures and methods; see the
1073 * \link flacpp_metadata_level2 usage guide \endlink and
1074 * ::FLAC__Metadata_Chain.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001075 */
Josh Coalson55bc5872002-10-16 22:18:32 +00001076 class FLACPP_API Chain {
Josh Coalsonfb74f102002-05-22 05:33:29 +00001077 public:
Josh Coalson20ad84a2006-10-07 05:43:01 +00001078 /** This class is a wrapper around FLAC__Metadata_ChainStatus.
1079 */
Josh Coalson55bc5872002-10-16 22:18:32 +00001080 class FLACPP_API Status {
Josh Coalsonfb74f102002-05-22 05:33:29 +00001081 public:
Josh Coalsoncc682512002-06-08 04:53:42 +00001082 inline Status(::FLAC__Metadata_ChainStatus status): status_(status) { }
1083 inline operator ::FLAC__Metadata_ChainStatus() const { return status_; }
1084 inline const char *as_cstring() const { return ::FLAC__Metadata_ChainStatusString[status_]; }
Josh Coalsonfb74f102002-05-22 05:33:29 +00001085 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001086 ::FLAC__Metadata_ChainStatus status_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001087 };
1088
1089 Chain();
1090 virtual ~Chain();
1091
1092 friend class Iterator;
1093
Josh Coalson3c917542006-10-15 07:50:44 +00001094 bool is_valid() const; ///< Returns \c true iff object was properly constructed.
1095
Josh Coalson20ad84a2006-10-07 05:43:01 +00001096 Status status(); ///< See FLAC__metadata_chain_status().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001097
Josh Coalson7d273b42006-11-15 06:12:30 +00001098 bool read(const char *filename, bool is_ogg = false); ///< See FLAC__metadata_chain_read(), FLAC__metadata_chain_read_ogg().
1099 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().
Josh Coalsondeab4622004-07-15 16:22:43 +00001100
Josh Coalson20ad84a2006-10-07 05:43:01 +00001101 bool check_if_tempfile_needed(bool use_padding); ///< See FLAC__metadata_chain_check_if_tempfile_needed().
Josh Coalsondeab4622004-07-15 16:22:43 +00001102
Josh Coalson20ad84a2006-10-07 05:43:01 +00001103 bool write(bool use_padding = true, bool preserve_file_stats = false); ///< See FLAC__metadata_chain_write().
1104 bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks); ///< See FLAC__metadata_chain_write_with_callbacks().
1105 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().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001106
Josh Coalson20ad84a2006-10-07 05:43:01 +00001107 void merge_padding(); ///< See FLAC__metadata_chain_merge_padding().
1108 void sort_padding(); ///< See FLAC__metadata_chain_sort_padding().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001109
1110 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001111 ::FLAC__Metadata_Chain *chain_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001112 virtual void clear();
1113 };
1114
Josh Coalson402da702002-08-21 03:40:11 +00001115 /** This class is a wrapper around the FLAC__metadata_iterator
Josh Coalson20ad84a2006-10-07 05:43:01 +00001116 * structures and methods; see the
1117 * \link flacpp_metadata_level2 usage guide \endlink and
1118 * ::FLAC__Metadata_Iterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001119 */
Josh Coalson55bc5872002-10-16 22:18:32 +00001120 class FLACPP_API Iterator {
Josh Coalsonfb74f102002-05-22 05:33:29 +00001121 public:
1122 Iterator();
1123 virtual ~Iterator();
1124
Josh Coalson3c917542006-10-15 07:50:44 +00001125 bool is_valid() const; ///< Returns \c true iff object was properly constructed.
1126
Josh Coalsonfb74f102002-05-22 05:33:29 +00001127
Josh Coalson20ad84a2006-10-07 05:43:01 +00001128 void init(Chain &chain); ///< See FLAC__metadata_iterator_init().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001129
Josh Coalson20ad84a2006-10-07 05:43:01 +00001130 bool next(); ///< See FLAC__metadata_iterator_next().
1131 bool prev(); ///< See FLAC__metadata_iterator_prev().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001132
Josh Coalson20ad84a2006-10-07 05:43:01 +00001133 ::FLAC__MetadataType get_block_type() const; ///< See FLAC__metadata_iterator_get_block_type().
1134 Prototype *get_block(); ///< See FLAC__metadata_iterator_get_block().
1135 bool set_block(Prototype *block); ///< See FLAC__metadata_iterator_set_block().
1136 bool delete_block(bool replace_with_padding); ///< See FLAC__metadata_iterator_delete_block().
1137 bool insert_block_before(Prototype *block); ///< See FLAC__metadata_iterator_insert_block_before().
1138 bool insert_block_after(Prototype *block); ///< See FLAC__metadata_iterator_insert_block_after().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001139
1140 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001141 ::FLAC__Metadata_Iterator *iterator_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001142 virtual void clear();
Josh Coalsonfda98fb2002-05-17 06:33:39 +00001143 };
1144
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001145 /* \} */
1146
Josh Coalsonc71bfe92005-01-25 02:27:20 +00001147 }
1148}
Josh Coalsonfda98fb2002-05-17 06:33:39 +00001149
1150#endif