blob: 1f8b7babd5de5a9020a0975df500f90f55cf226e [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
67 * \link flac_metadata C metadata module \endlink.
68 */
69
Josh Coalsonfb74f102002-05-22 05:33:29 +000070
Josh Coalsonfda98fb2002-05-17 06:33:39 +000071namespace FLAC {
72 namespace Metadata {
73
Josh Coalsonfb74f102002-05-22 05:33:29 +000074 // ============================================================
75 //
76 // Metadata objects
77 //
78 // ============================================================
79
Josh Coalsonf6efd9c2002-07-27 04:59:54 +000080 /** \defgroup flacpp_metadata_object FLAC++/metadata.h: metadata object classes
81 * \ingroup flacpp_metadata
82 *
83 * This module contains classes representing FLAC metadata
84 * blocks in memory.
85 *
86 * The behavior closely mimics the C layer interface; be
87 * sure to read the detailed description of the
88 * \link flac_metadata_object C metadata object module \endlink.
89 *
90 * Any time a metadata object is constructed or assigned, you
91 * should check is_valid() to make sure the underlying
92 * ::FLAC__StreamMetadata object was able to be created.
93 *
94 * \warning
95 * When the get_*() methods of any metadata object method
96 * return you a const pointer, DO NOT disobey and write into it.
97 * Always use the set_*() methods.
98 *
99 * \{
100 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000101
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000102 /** Base class for all metadata block types.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000103 * See the \link flacpp_metadata_object overview \endlink for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000104 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000105 class FLACPP_API Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000106 protected:
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000107 //@{
108 /** Constructs a copy of the given object. This form
109 * always performs a deep copy.
110 */
111 Prototype(const Prototype &);
112 Prototype(const ::FLAC__StreamMetadata &);
113 Prototype(const ::FLAC__StreamMetadata *);
114 //@}
Josh Coalson83961752002-07-09 06:12:59 +0000115
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000116 /** Constructs an object with copy control. When \a copy
117 * is \c true, behaves identically to
118 * FLAC::Metadata::Prototype::Prototype(const ::FLAC__StreamMetadata *object).
119 * When \a copy is \c false, the instance takes ownership of
120 * the pointer and the ::FLAC__StreamMetadata object will
121 * be freed by the destructor.
122 *
123 * \assert
124 * \code object != NULL \endcode
125 */
Josh Coalson83961752002-07-09 06:12:59 +0000126 Prototype(::FLAC__StreamMetadata *object, bool copy);
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000127
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000128 //@{
129 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000130 Prototype &operator=(const Prototype &);
131 Prototype &operator=(const ::FLAC__StreamMetadata &);
132 Prototype &operator=(const ::FLAC__StreamMetadata *);
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000133 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000134
Josh Coalson42372b92005-01-07 01:09:07 +0000135 /** Assigns an object with copy control. See
136 * Prototype(::FLAC__StreamMetadata *object, bool copy).
137 */
138 Prototype &assign_object(::FLAC__StreamMetadata *object, bool copy);
139
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000140 /** Deletes the underlying ::FLAC__StreamMetadata object.
141 */
Josh Coalsonfb74f102002-05-22 05:33:29 +0000142 virtual void clear();
143
Josh Coalsoncc682512002-06-08 04:53:42 +0000144 ::FLAC__StreamMetadata *object_;
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000145 public:
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000146 /** Deletes the underlying ::FLAC__StreamMetadata object.
147 */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000148 virtual ~Prototype();
149
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000150 //@{
Josh Coalson20ad84a2006-10-07 05:43:01 +0000151 /** Check for equality, performing a deep compare by following pointers.
152 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000153 inline bool operator==(const Prototype &) const;
154 inline bool operator==(const ::FLAC__StreamMetadata &) const;
155 inline bool operator==(const ::FLAC__StreamMetadata *) const;
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000156 //@}
157
158 //@{
159 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalsoncc682512002-06-08 04:53:42 +0000160 inline bool operator!=(const Prototype &) const;
161 inline bool operator!=(const ::FLAC__StreamMetadata &) const;
162 inline bool operator!=(const ::FLAC__StreamMetadata *) const;
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000163 //@}
Josh Coalsoncc682512002-06-08 04:53:42 +0000164
Josh Coalsonfb74f102002-05-22 05:33:29 +0000165 friend class SimpleIterator;
166 friend class Iterator;
167
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000168 /** Returns \c true if the object was correctly constructed
169 * (i.e. the underlying ::FLAC__StreamMetadata object was
170 * properly allocated), else \c false.
171 */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000172 inline bool is_valid() const;
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000173
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000174 /** Returns \c true if this block is the last block in a
175 * stream, else \c false.
176 *
177 * \assert
178 * \code is_valid() \endcode
179 */
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000180 bool get_is_last() const;
Josh Coalsoncc682512002-06-08 04:53:42 +0000181
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000182 /** Returns the type of the block.
183 *
184 * \assert
185 * \code is_valid() \endcode
186 */
187 ::FLAC__MetadataType get_type() const;
188
189 /** Returns the stream length of the metadata block.
190 *
191 * \note
192 * The length does not include the metadata block header,
193 * per spec.
194 *
195 * \assert
196 * \code is_valid() \endcode
197 */
198 unsigned get_length() const;
199
200 /** Sets the "is_last" flag for the block. When using the iterators
201 * it is not necessary to set this flag; they will do it for you.
202 *
203 * \assert
204 * \code is_valid() \endcode
205 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000206 void set_is_last(bool);
Josh Coalsond113ca32004-07-22 01:03:43 +0000207
208 /** Returns a pointer to the underlying ::FLAC__StreamMetadata
209 * object. This can be useful for plugging any holes between
210 * the C++ and C interfaces.
211 *
212 * \assert
213 * \code is_valid() \endcode
214 */
215 inline operator const ::FLAC__StreamMetadata *() const;
Josh Coalsonfb74f102002-05-22 05:33:29 +0000216 private:
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000217 /** Private and undefined so you can't use it. */
218 Prototype();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000219
220 // These are used only by Iterator
221 bool is_reference_;
222 inline void set_reference(bool x) { is_reference_ = x; }
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000223 };
224
Josh Coalson3cb83412004-07-23 05:11:06 +0000225#ifdef _MSC_VER
226// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
227#pragma warning ( disable : 4800 )
228#endif
229
Josh Coalson765ff502002-08-27 05:46:11 +0000230 inline bool Prototype::operator==(const Prototype &object) const
Josh Coalsond57c8d32002-06-11 06:15:28 +0000231 { return (bool)::FLAC__metadata_object_is_equal(object_, object.object_); }
Josh Coalson57ba6f42002-06-07 05:27:37 +0000232
Josh Coalson765ff502002-08-27 05:46:11 +0000233 inline bool Prototype::operator==(const ::FLAC__StreamMetadata &object) const
Josh Coalsond57c8d32002-06-11 06:15:28 +0000234 { return (bool)::FLAC__metadata_object_is_equal(object_, &object); }
Josh Coalson57ba6f42002-06-07 05:27:37 +0000235
Josh Coalson765ff502002-08-27 05:46:11 +0000236 inline bool Prototype::operator==(const ::FLAC__StreamMetadata *object) const
Josh Coalsond57c8d32002-06-11 06:15:28 +0000237 { return (bool)::FLAC__metadata_object_is_equal(object_, object); }
Josh Coalson57ba6f42002-06-07 05:27:37 +0000238
Josh Coalson3cb83412004-07-23 05:11:06 +0000239#ifdef _MSC_VER
240// @@@ how to re-enable? the following doesn't work
241// #pragma warning ( enable : 4800 )
242#endif
243
Josh Coalson765ff502002-08-27 05:46:11 +0000244 inline bool Prototype::operator!=(const Prototype &object) const
Josh Coalson57ba6f42002-06-07 05:27:37 +0000245 { return !operator==(object); }
246
Josh Coalson765ff502002-08-27 05:46:11 +0000247 inline bool Prototype::operator!=(const ::FLAC__StreamMetadata &object) const
Josh Coalson57ba6f42002-06-07 05:27:37 +0000248 { return !operator==(object); }
249
Josh Coalson765ff502002-08-27 05:46:11 +0000250 inline bool Prototype::operator!=(const ::FLAC__StreamMetadata *object) const
Josh Coalson57ba6f42002-06-07 05:27:37 +0000251 { return !operator==(object); }
252
253 inline bool Prototype::is_valid() const
254 { return 0 != object_; }
255
Josh Coalsond113ca32004-07-22 01:03:43 +0000256 inline Prototype::operator const ::FLAC__StreamMetadata *() const
257 { return object_; }
258
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000259 /** Create a deep copy of an object and return it. */
Josh Coalson55bc5872002-10-16 22:18:32 +0000260 FLACPP_API Prototype *clone(const Prototype *);
Josh Coalson57ba6f42002-06-07 05:27:37 +0000261
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000262
263 /** STREAMINFO metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000264 * See the \link flacpp_metadata_object overview \endlink for more,
265 * and the <A HREF="../format.html#metadata_block_streaminfo">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000266 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000267 class FLACPP_API StreamInfo : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000268 public:
269 StreamInfo();
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000270
271 //@{
272 /** Constructs a copy of the given object. This form
273 * always performs a deep copy.
274 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000275 inline StreamInfo(const StreamInfo &object): Prototype(object) { }
276 inline StreamInfo(const ::FLAC__StreamMetadata &object): Prototype(object) { }
277 inline StreamInfo(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000278 //@}
279
280 /** Constructs an object with copy control. See
281 * Prototype(::FLAC__StreamMetadata *object, bool copy).
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000282 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000283 inline StreamInfo(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000284
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000285 ~StreamInfo();
286
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000287 //@{
288 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000289 inline StreamInfo &operator=(const StreamInfo &object) { Prototype::operator=(object); return *this; }
290 inline StreamInfo &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
291 inline StreamInfo &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000292 //@}
Josh Coalsonfb74f102002-05-22 05:33:29 +0000293
Josh Coalson42372b92005-01-07 01:09:07 +0000294 /** Assigns an object with copy control. See
295 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
296 */
297 inline StreamInfo &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
298
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000299 //@{
300 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000301 inline bool operator==(const StreamInfo &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000302 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
303 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000304 //@}
305
306 //@{
307 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000308 inline bool operator!=(const StreamInfo &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000309 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
310 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000311 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000312
Josh Coalson4dc35072002-08-20 03:56:52 +0000313 //@{
314 /** See <A HREF="../format.html#metadata_block_streaminfo">format specification</A>. */
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000315 unsigned get_min_blocksize() const;
316 unsigned get_max_blocksize() const;
317 unsigned get_min_framesize() const;
318 unsigned get_max_framesize() const;
319 unsigned get_sample_rate() const;
320 unsigned get_channels() const;
321 unsigned get_bits_per_sample() const;
322 FLAC__uint64 get_total_samples() const;
323 const FLAC__byte *get_md5sum() const;
324
325 void set_min_blocksize(unsigned value);
326 void set_max_blocksize(unsigned value);
327 void set_min_framesize(unsigned value);
328 void set_max_framesize(unsigned value);
329 void set_sample_rate(unsigned value);
330 void set_channels(unsigned value);
331 void set_bits_per_sample(unsigned value);
332 void set_total_samples(FLAC__uint64 value);
333 void set_md5sum(const FLAC__byte value[16]);
Josh Coalson4dc35072002-08-20 03:56:52 +0000334 //@}
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000335 };
336
Josh Coalson4dc35072002-08-20 03:56:52 +0000337 /** PADDING metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000338 * See the \link flacpp_metadata_object overview \endlink for more,
339 * and the <A HREF="../format.html#metadata_block_padding">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000340 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000341 class FLACPP_API Padding : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000342 public:
343 Padding();
Josh Coalson4dc35072002-08-20 03:56:52 +0000344
345 //@{
346 /** Constructs a copy of the given object. This form
347 * always performs a deep copy.
348 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000349 inline Padding(const Padding &object): Prototype(object) { }
350 inline Padding(const ::FLAC__StreamMetadata &object): Prototype(object) { }
351 inline Padding(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000352 //@}
353
354 /** Constructs an object with copy control. See
355 * Prototype(::FLAC__StreamMetadata *object, bool copy).
356 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000357 inline Padding(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000358
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000359 ~Padding();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000360
Josh Coalson4dc35072002-08-20 03:56:52 +0000361 //@{
362 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000363 inline Padding &operator=(const Padding &object) { Prototype::operator=(object); return *this; }
364 inline Padding &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
365 inline Padding &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000366 //@}
Josh Coalsonb2b53582002-05-31 06:20:50 +0000367
Josh Coalson42372b92005-01-07 01:09:07 +0000368 /** Assigns an object with copy control. See
369 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
370 */
371 inline Padding &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
372
Josh Coalson4dc35072002-08-20 03:56:52 +0000373 //@{
374 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000375 inline bool operator==(const Padding &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000376 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
377 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000378 //@}
379
380 //@{
381 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000382 inline bool operator!=(const Padding &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000383 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
384 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000385 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000386
Josh Coalsonb2b53582002-05-31 06:20:50 +0000387 void set_length(unsigned length);
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000388 };
389
Josh Coalson4dc35072002-08-20 03:56:52 +0000390 /** APPLICATION metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000391 * See the \link flacpp_metadata_object overview \endlink for more,
392 * and the <A HREF="../format.html#metadata_block_application">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000393 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000394 class FLACPP_API Application : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000395 public:
396 Application();
Josh Coalson4dc35072002-08-20 03:56:52 +0000397 //
398 //@{
399 /** Constructs a copy of the given object. This form
400 * always performs a deep copy.
401 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000402 inline Application(const Application &object): Prototype(object) { }
403 inline Application(const ::FLAC__StreamMetadata &object): Prototype(object) { }
404 inline Application(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000405 //@}
406
407 /** Constructs an object with copy control. See
408 * Prototype(::FLAC__StreamMetadata *object, bool copy).
409 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000410 inline Application(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000411
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000412 ~Application();
413
Josh Coalson4dc35072002-08-20 03:56:52 +0000414 //@{
415 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000416 inline Application &operator=(const Application &object) { Prototype::operator=(object); return *this; }
417 inline Application &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
418 inline Application &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000419 //@}
Josh Coalsonfb74f102002-05-22 05:33:29 +0000420
Josh Coalson42372b92005-01-07 01:09:07 +0000421 /** Assigns an object with copy control. See
422 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
423 */
424 inline Application &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
425
Josh Coalson4dc35072002-08-20 03:56:52 +0000426 //@{
427 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000428 inline bool operator==(const Application &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000429 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
430 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000431 //@}
432
433 //@{
434 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000435 inline bool operator!=(const Application &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000436 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
437 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000438 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000439
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000440 const FLAC__byte *get_id() const;
441 const FLAC__byte *get_data() const;
442
Josh Coalsoncc682512002-06-08 04:53:42 +0000443 void set_id(const FLAC__byte value[4]);
Josh Coalson4dc35072002-08-20 03:56:52 +0000444 //! This form always copies \a data
445 bool set_data(const FLAC__byte *data, unsigned length);
Josh Coalsoncc682512002-06-08 04:53:42 +0000446 bool set_data(FLAC__byte *data, unsigned length, bool copy);
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000447 };
448
Josh Coalson4dc35072002-08-20 03:56:52 +0000449 /** SEEKTABLE metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000450 * See the \link flacpp_metadata_object overview \endlink for more,
451 * and the <A HREF="../format.html#metadata_block_seektable">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000452 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000453 class FLACPP_API SeekTable : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000454 public:
455 SeekTable();
Josh Coalson4dc35072002-08-20 03:56:52 +0000456
457 //@{
458 /** Constructs a copy of the given object. This form
459 * always performs a deep copy.
460 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000461 inline SeekTable(const SeekTable &object): Prototype(object) { }
462 inline SeekTable(const ::FLAC__StreamMetadata &object): Prototype(object) { }
463 inline SeekTable(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000464 //@}
465
466 /** Constructs an object with copy control. See
467 * Prototype(::FLAC__StreamMetadata *object, bool copy).
468 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000469 inline SeekTable(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000470
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000471 ~SeekTable();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000472
Josh Coalson4dc35072002-08-20 03:56:52 +0000473 //@{
474 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000475 inline SeekTable &operator=(const SeekTable &object) { Prototype::operator=(object); return *this; }
476 inline SeekTable &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
477 inline SeekTable &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000478 //@}
Josh Coalsonb2b53582002-05-31 06:20:50 +0000479
Josh Coalson42372b92005-01-07 01:09:07 +0000480 /** Assigns an object with copy control. See
481 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
482 */
483 inline SeekTable &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
484
Josh Coalson4dc35072002-08-20 03:56:52 +0000485 //@{
486 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000487 inline bool operator==(const SeekTable &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000488 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
489 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000490 //@}
491
492 //@{
493 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000494 inline bool operator!=(const SeekTable &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000495 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
496 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000497 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000498
Josh Coalsonb2b53582002-05-31 06:20:50 +0000499 unsigned get_num_points() const;
Josh Coalsoncc682512002-06-08 04:53:42 +0000500 ::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const;
Josh Coalsonb2b53582002-05-31 06:20:50 +0000501
Josh Coalson4dc35072002-08-20 03:56:52 +0000502 //! See FLAC__metadata_object_seektable_set_point()
Josh Coalsoncc682512002-06-08 04:53:42 +0000503 void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
Josh Coalson4dc35072002-08-20 03:56:52 +0000504
505 //! See FLAC__metadata_object_seektable_insert_point()
Josh Coalsoncc682512002-06-08 04:53:42 +0000506 bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
Josh Coalson4dc35072002-08-20 03:56:52 +0000507
508 //! See FLAC__metadata_object_seektable_delete_point()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000509 bool delete_point(unsigned index);
Josh Coalson28e08d82002-06-05 05:56:41 +0000510
Josh Coalson4dc35072002-08-20 03:56:52 +0000511 //! See FLAC__metadata_object_seektable_is_legal()
Josh Coalson28e08d82002-06-05 05:56:41 +0000512 bool is_legal() const;
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000513 };
514
Josh Coalson4dc35072002-08-20 03:56:52 +0000515 /** VORBIS_COMMENT metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000516 * See the \link flacpp_metadata_object overview \endlink for more,
517 * and the <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000518 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000519 class FLACPP_API VorbisComment : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000520 public:
Josh Coalson4dc35072002-08-20 03:56:52 +0000521 /** Convenience class for encapsulating Vorbis comment
522 * entries. An entry is a vendor string or a comment
523 * field. In the case of a vendor string, the field
524 * name is undefined; only the field value is relevant.
525 *
526 * A \a field as used in the methods refers to an
Josh Coalsondef597e2004-12-30 00:59:30 +0000527 * entire 'NAME=VALUE' string; for convenience the
Josh Coalson2de11242004-12-30 03:41:19 +0000528 * string is NUL-terminated. A length field is
Josh Coalsondef597e2004-12-30 00:59:30 +0000529 * required in the unlikely event that the value
Josh Coalson2de11242004-12-30 03:41:19 +0000530 * contains contain embedded NULs.
Josh Coalson4dc35072002-08-20 03:56:52 +0000531 *
532 * A \a field_name is what is on the left side of the
533 * first '=' in the \a field. By definition it is ASCII
Josh Coalson2de11242004-12-30 03:41:19 +0000534 * and so is NUL-terminated and does not require a
Josh Coalson4dc35072002-08-20 03:56:52 +0000535 * length to describe it. \a field_name is undefined
536 * for a vendor string entry.
537 *
538 * A \a field_value is what is on the right side of the
539 * first '=' in the \a field. By definition, this may
Josh Coalson2de11242004-12-30 03:41:19 +0000540 * contain embedded NULs and so a \a field_value_length
Josh Coalsondef597e2004-12-30 00:59:30 +0000541 * is required to describe it. However in practice,
Josh Coalson2de11242004-12-30 03:41:19 +0000542 * embedded NULs are not known to be used, so it is
543 * generally safe to treat field values as NUL-
Josh Coalsondef597e2004-12-30 00:59:30 +0000544 * terminated UTF-8 strings.
Josh Coalson4dc35072002-08-20 03:56:52 +0000545 *
546 * Always check is_valid() after the constructor or operator=
Josh Coalson2de11242004-12-30 03:41:19 +0000547 * to make sure memory was properly allocated and that the
548 * Entry conforms to the Vorbis comment specification.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000549 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000550 class FLACPP_API Entry {
Josh Coalsonb2b53582002-05-31 06:20:50 +0000551 public:
552 Entry();
Josh Coalsondef597e2004-12-30 00:59:30 +0000553
Josh Coalsonb2b53582002-05-31 06:20:50 +0000554 Entry(const char *field, unsigned field_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000555 Entry(const char *field); // assumes \a field is NUL-terminated
Josh Coalsondef597e2004-12-30 00:59:30 +0000556
Josh Coalsonb2b53582002-05-31 06:20:50 +0000557 Entry(const char *field_name, const char *field_value, unsigned field_value_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000558 Entry(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
Josh Coalsondef597e2004-12-30 00:59:30 +0000559
Josh Coalsonb2b53582002-05-31 06:20:50 +0000560 Entry(const Entry &entry);
Josh Coalsondef597e2004-12-30 00:59:30 +0000561
Josh Coalson42372b92005-01-07 01:09:07 +0000562 Entry &operator=(const Entry &entry);
Josh Coalsonb2b53582002-05-31 06:20:50 +0000563
564 virtual ~Entry();
565
566 virtual bool is_valid() const;
Josh Coalsonb2b53582002-05-31 06:20:50 +0000567
568 unsigned get_field_length() const;
569 unsigned get_field_name_length() const;
570 unsigned get_field_value_length() const;
571
Josh Coalsoncc682512002-06-08 04:53:42 +0000572 ::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const;
Josh Coalsonb2b53582002-05-31 06:20:50 +0000573 const char *get_field() const;
574 const char *get_field_name() const;
575 const char *get_field_value() const;
576
577 bool set_field(const char *field, unsigned field_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000578 bool set_field(const char *field); // assumes \a field is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000579 bool set_field_name(const char *field_name);
580 bool set_field_value(const char *field_value, unsigned field_value_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000581 bool set_field_value(const char *field_value); // assumes \a field_value is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000582 protected:
583 bool is_valid_;
Josh Coalsoncc682512002-06-08 04:53:42 +0000584 ::FLAC__StreamMetadata_VorbisComment_Entry entry_;
Josh Coalsonb2b53582002-05-31 06:20:50 +0000585 char *field_name_;
586 unsigned field_name_length_;
587 char *field_value_;
588 unsigned field_value_length_;
589 private:
590 void zero();
591 void clear();
592 void clear_entry();
593 void clear_field_name();
594 void clear_field_value();
595 void construct(const char *field, unsigned field_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000596 void construct(const char *field); // assumes \a field is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000597 void construct(const char *field_name, const char *field_value, unsigned field_value_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000598 void construct(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000599 void compose_field();
600 void parse_field();
601 };
602
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000603 VorbisComment();
Josh Coalson4dc35072002-08-20 03:56:52 +0000604
605 //@{
606 /** Constructs a copy of the given object. This form
607 * always performs a deep copy.
608 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000609 inline VorbisComment(const VorbisComment &object): Prototype(object) { }
610 inline VorbisComment(const ::FLAC__StreamMetadata &object): Prototype(object) { }
611 inline VorbisComment(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000612 //@}
613
614 /** Constructs an object with copy control. See
615 * Prototype(::FLAC__StreamMetadata *object, bool copy).
616 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000617 inline VorbisComment(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000618
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000619 ~VorbisComment();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000620
Josh Coalson4dc35072002-08-20 03:56:52 +0000621 //@{
622 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000623 inline VorbisComment &operator=(const VorbisComment &object) { Prototype::operator=(object); return *this; }
624 inline VorbisComment &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
625 inline VorbisComment &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000626 //@}
Josh Coalsonb2b53582002-05-31 06:20:50 +0000627
Josh Coalson42372b92005-01-07 01:09:07 +0000628 /** Assigns an object with copy control. See
629 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
630 */
631 inline VorbisComment &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
632
Josh Coalson4dc35072002-08-20 03:56:52 +0000633 //@{
634 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000635 inline bool operator==(const VorbisComment &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000636 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
637 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000638 //@}
639
640 //@{
641 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000642 inline bool operator!=(const VorbisComment &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000643 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
644 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000645 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000646
Josh Coalsonb2b53582002-05-31 06:20:50 +0000647 unsigned get_num_comments() const;
Josh Coalson2de11242004-12-30 03:41:19 +0000648 const FLAC__byte *get_vendor_string() const; // NUL-terminated UTF-8 string
Josh Coalsonb2b53582002-05-31 06:20:50 +0000649 Entry get_comment(unsigned index) const;
650
Josh Coalson87977ba2002-08-20 07:09:33 +0000651 //! See FLAC__metadata_object_vorbiscomment_set_vendor_string()
Josh Coalson2de11242004-12-30 03:41:19 +0000652 bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string
Josh Coalson4dc35072002-08-20 03:56:52 +0000653
Josh Coalson87977ba2002-08-20 07:09:33 +0000654 //! See FLAC__metadata_object_vorbiscomment_set_comment()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000655 bool set_comment(unsigned index, const Entry &entry);
Josh Coalson4dc35072002-08-20 03:56:52 +0000656
Josh Coalson87977ba2002-08-20 07:09:33 +0000657 //! See FLAC__metadata_object_vorbiscomment_insert_comment()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000658 bool insert_comment(unsigned index, const Entry &entry);
Josh Coalson4dc35072002-08-20 03:56:52 +0000659
Josh Coalsondef597e2004-12-30 00:59:30 +0000660 //! See FLAC__metadata_object_vorbiscomment_append_comment()
661 bool append_comment(const Entry &entry);
662
Josh Coalson87977ba2002-08-20 07:09:33 +0000663 //! See FLAC__metadata_object_vorbiscomment_delete_comment()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000664 bool delete_comment(unsigned index);
Josh Coalsonfb74f102002-05-22 05:33:29 +0000665 };
666
Josh Coalson863dbf32002-11-16 06:30:30 +0000667 /** CUESHEET metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000668 * See the \link flacpp_metadata_object overview \endlink for more,
669 * and the <A HREF="../format.html#metadata_block_cuesheet">format specification</A>.
Josh Coalson863dbf32002-11-16 06:30:30 +0000670 */
671 class FLACPP_API CueSheet : public Prototype {
672 public:
673 /** Convenience class for encapsulating a cue sheet
674 * track.
675 *
676 * Always check is_valid() after the constructor or operator=
677 * to make sure memory was properly allocated.
678 */
679 class FLACPP_API Track {
680 protected:
681 ::FLAC__StreamMetadata_CueSheet_Track *object_;
682 public:
683 Track();
684 Track(const ::FLAC__StreamMetadata_CueSheet_Track *track);
685 Track(const Track &track);
Josh Coalson42372b92005-01-07 01:09:07 +0000686 Track &operator=(const Track &track);
Josh Coalson863dbf32002-11-16 06:30:30 +0000687
688 virtual ~Track();
689
690 virtual bool is_valid() const;
691
692 inline FLAC__uint64 get_offset() const { return object_->offset; }
693 inline FLAC__byte get_number() const { return object_->number; }
694 inline const char *get_isrc() const { return object_->isrc; }
695 inline unsigned get_type() const { return object_->type; }
696 inline bool get_pre_emphasis() const { return object_->pre_emphasis; }
697
Josh Coalsona7038a92003-01-22 20:16:20 +0000698 inline FLAC__byte get_num_indices() const { return object_->num_indices; }
Josh Coalson863dbf32002-11-16 06:30:30 +0000699 ::FLAC__StreamMetadata_CueSheet_Index get_index(unsigned i) const;
700
701 inline const ::FLAC__StreamMetadata_CueSheet_Track *get_track() const { return object_; }
702
703 inline void set_offset(FLAC__uint64 value) { object_->offset = value; }
704 inline void set_number(FLAC__byte value) { object_->number = value; }
Josh Coalson16219792002-11-19 06:19:29 +0000705 void set_isrc(const char value[12]);
Josh Coalson863dbf32002-11-16 06:30:30 +0000706 void set_type(unsigned value);
707 inline void set_pre_emphasis(bool value) { object_->pre_emphasis = value? 1 : 0; }
708
Josh Coalson16219792002-11-19 06:19:29 +0000709 void set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index);
Josh Coalsonb3538c82003-01-12 08:42:23 +0000710 //@@@ It's awkward but to insert/delete index points
711 //@@@ you must use the routines in the CueSheet class.
Josh Coalson863dbf32002-11-16 06:30:30 +0000712 };
713
714 CueSheet();
715
716 //@{
717 /** Constructs a copy of the given object. This form
718 * always performs a deep copy.
719 */
720 inline CueSheet(const CueSheet &object): Prototype(object) { }
721 inline CueSheet(const ::FLAC__StreamMetadata &object): Prototype(object) { }
722 inline CueSheet(const ::FLAC__StreamMetadata *object): Prototype(object) { }
723 //@}
724
725 /** Constructs an object with copy control. See
726 * Prototype(::FLAC__StreamMetadata *object, bool copy).
727 */
728 inline CueSheet(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
729
730 ~CueSheet();
731
732 //@{
733 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000734 inline CueSheet &operator=(const CueSheet &object) { Prototype::operator=(object); return *this; }
735 inline CueSheet &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
736 inline CueSheet &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson863dbf32002-11-16 06:30:30 +0000737 //@}
738
Josh Coalson42372b92005-01-07 01:09:07 +0000739 /** Assigns an object with copy control. See
740 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
741 */
742 inline CueSheet &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
743
Josh Coalson863dbf32002-11-16 06:30:30 +0000744 //@{
745 /** Check for equality, performing a deep compare by following pointers. */
746 inline bool operator==(const CueSheet &object) const { return Prototype::operator==(object); }
747 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
748 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
749 //@}
750
751 //@{
752 /** Check for inequality, performing a deep compare by following pointers. */
753 inline bool operator!=(const CueSheet &object) const { return Prototype::operator!=(object); }
754 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
755 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
756 //@}
757
758 const char *get_media_catalog_number() const;
759 FLAC__uint64 get_lead_in() const;
Josh Coalson8f0c71b2002-12-05 06:37:46 +0000760 bool get_is_cd() const;
Josh Coalson863dbf32002-11-16 06:30:30 +0000761
762 unsigned get_num_tracks() const;
763 Track get_track(unsigned i) const;
764
Josh Coalson16219792002-11-19 06:19:29 +0000765 void set_media_catalog_number(const char value[128]);
766 void set_lead_in(FLAC__uint64 value);
Josh Coalson8f0c71b2002-12-05 06:37:46 +0000767 void set_is_cd(bool value);
Josh Coalson16219792002-11-19 06:19:29 +0000768
769 void set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
Josh Coalson863dbf32002-11-16 06:30:30 +0000770
771 //! See FLAC__metadata_object_cuesheet_track_insert_index()
772 bool insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
773
774 //! See FLAC__metadata_object_cuesheet_track_delete_index()
775 bool delete_index(unsigned track_num, unsigned index_num);
776
777 //! See FLAC__metadata_object_cuesheet_set_track()
778 bool set_track(unsigned i, const Track &track);
779
780 //! See FLAC__metadata_object_cuesheet_insert_track()
781 bool insert_track(unsigned i, const Track &track);
782
783 //! See FLAC__metadata_object_cuesheet_delete_track()
784 bool delete_track(unsigned i);
785
786 //! See FLAC__metadata_object_cuesheet_is_legal()
787 bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const;
Josh Coalson7cfac0b2006-04-10 05:37:34 +0000788
789 //! See FLAC__metadata_object_cuesheet_calculate_cddb_id()
790 FLAC__uint32 calculate_cddb_id() const;
Josh Coalson863dbf32002-11-16 06:30:30 +0000791 };
792
Josh Coalsone343ab22006-09-23 19:21:19 +0000793 /** PICTURE metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000794 * See the \link flacpp_metadata_object overview \endlink for more,
795 * and the <A HREF="../format.html#metadata_block_picture">format specification</A>.
Josh Coalsone343ab22006-09-23 19:21:19 +0000796 */
797 class FLACPP_API Picture : public Prototype {
798 public:
799 Picture();
800
801 //@{
802 /** Constructs a copy of the given object. This form
803 * always performs a deep copy.
804 */
805 inline Picture(const Picture &object): Prototype(object) { }
806 inline Picture(const ::FLAC__StreamMetadata &object): Prototype(object) { }
807 inline Picture(const ::FLAC__StreamMetadata *object): Prototype(object) { }
808 //@}
809
810 /** Constructs an object with copy control. See
811 * Prototype(::FLAC__StreamMetadata *object, bool copy).
812 */
813 inline Picture(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
814
815 ~Picture();
816
817 //@{
818 /** Assign from another object. Always performs a deep copy. */
819 inline Picture &operator=(const Picture &object) { Prototype::operator=(object); return *this; }
820 inline Picture &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
821 inline Picture &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
822 //@}
823
824 /** Assigns an object with copy control. See
825 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
826 */
827 inline Picture &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
828
829 //@{
830 /** Check for equality, performing a deep compare by following pointers. */
831 inline bool operator==(const Picture &object) const { return Prototype::operator==(object); }
832 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
833 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
834 //@}
835
836 //@{
837 /** Check for inequality, performing a deep compare by following pointers. */
838 inline bool operator!=(const Picture &object) const { return Prototype::operator!=(object); }
839 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
840 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
841 //@}
842
843 ::FLAC__StreamMetadata_Picture_Type get_type() const;
844 const char *get_mime_type() const; // NUL-terminated printable ASCII string
845 const FLAC__byte *get_description() const; // NUL-terminated UTF-8 string
846 FLAC__uint32 get_width() const;
847 FLAC__uint32 get_height() const;
848 FLAC__uint32 get_depth() const;
Josh Coalson74ed2942006-09-23 23:15:05 +0000849 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 +0000850 FLAC__uint32 get_data_length() const;
851 const FLAC__byte *get_data() const;
852
853 void set_type(::FLAC__StreamMetadata_Picture_Type type);
854
855 //! See FLAC__metadata_object_picture_set_mime_type()
856 bool set_mime_type(const char *string); // NUL-terminated printable ASCII string
857
858 //! See FLAC__metadata_object_picture_set_description()
859 bool set_description(const FLAC__byte *string); // NUL-terminated UTF-8 string
860
861 void set_width(FLAC__uint32 value) const;
862 void set_height(FLAC__uint32 value) const;
863 void set_depth(FLAC__uint32 value) const;
Josh Coalson74ed2942006-09-23 23:15:05 +0000864 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 +0000865
866 //! See FLAC__metadata_object_picture_set_data()
867 bool set_data(const FLAC__byte *data, FLAC__uint32 data_length);
868 };
869
Josh Coalson0eea34a2003-01-10 05:29:17 +0000870 /** Opaque metadata block for storing unknown types.
871 * This should not be used unless you know what you are doing;
872 * it is currently used only internally to support forward
873 * compatibility of metadata blocks.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000874 * See the \link flacpp_metadata_object overview \endlink for more,
Josh Coalson0eea34a2003-01-10 05:29:17 +0000875 */
876 class FLACPP_API Unknown : public Prototype {
877 public:
878 Unknown();
879 //
880 //@{
881 /** Constructs a copy of the given object. This form
882 * always performs a deep copy.
883 */
884 inline Unknown(const Unknown &object): Prototype(object) { }
885 inline Unknown(const ::FLAC__StreamMetadata &object): Prototype(object) { }
886 inline Unknown(const ::FLAC__StreamMetadata *object): Prototype(object) { }
887 //@}
888
889 /** Constructs an object with copy control. See
890 * Prototype(::FLAC__StreamMetadata *object, bool copy).
891 */
892 inline Unknown(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
893
894 ~Unknown();
895
896 //@{
897 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000898 inline Unknown &operator=(const Unknown &object) { Prototype::operator=(object); return *this; }
899 inline Unknown &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
900 inline Unknown &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson0eea34a2003-01-10 05:29:17 +0000901 //@}
902
Josh Coalson42372b92005-01-07 01:09:07 +0000903 /** Assigns an object with copy control. See
904 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
905 */
906 inline Unknown &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
907
Josh Coalson0eea34a2003-01-10 05:29:17 +0000908 //@{
909 /** Check for equality, performing a deep compare by following pointers. */
910 inline bool operator==(const Unknown &object) const { return Prototype::operator==(object); }
911 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
912 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
913 //@}
914
915 //@{
916 /** Check for inequality, performing a deep compare by following pointers. */
917 inline bool operator!=(const Unknown &object) const { return Prototype::operator!=(object); }
918 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
919 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
920 //@}
921
922 const FLAC__byte *get_data() const;
923
924 //! This form always copies \a data
925 bool set_data(const FLAC__byte *data, unsigned length);
926 bool set_data(FLAC__byte *data, unsigned length, bool copy);
927 };
928
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000929 /* \} */
930
Josh Coalsonb2b53582002-05-31 06:20:50 +0000931
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000932 /** \defgroup flacpp_metadata_level0 FLAC++/metadata.h: metadata level 0 interface
933 * \ingroup flacpp_metadata
934 *
935 * \brief
Josh Coalson1aca6b12004-07-30 01:54:29 +0000936 * Level 0 metadata iterators.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000937 *
Josh Coalson4dc35072002-08-20 03:56:52 +0000938 * See the \link flac_metadata_level0 C layer equivalent \endlink
939 * for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000940 *
941 * \{
942 */
943
Josh Coalson20ad84a2006-10-07 05:43:01 +0000944 FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo); ///< See FLAC__metadata_get_streaminfo().
Josh Coalson2c75bd82004-12-30 03:55:00 +0000945
Josh Coalson20ad84a2006-10-07 05:43:01 +0000946 FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags); ///< See FLAC__metadata_get_tags().
947 FLACPP_API bool get_tags(const char *filename, VorbisComment &tags); ///< See FLAC__metadata_get_tags().
Josh Coalsonfb74f102002-05-22 05:33:29 +0000948
Josh Coalson20ad84a2006-10-07 05:43:01 +0000949 FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet); ///< See FLAC__metadata_get_cuesheet().
950 FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet); ///< See FLAC__metadata_get_cuesheet().
Josh Coalsone343ab22006-09-23 19:21:19 +0000951
Josh Coalson20ad84a2006-10-07 05:43:01 +0000952 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().
953 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 +0000954
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000955 /* \} */
956
Josh Coalsonb2b53582002-05-31 06:20:50 +0000957
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000958 /** \defgroup flacpp_metadata_level1 FLAC++/metadata.h: metadata level 1 interface
959 * \ingroup flacpp_metadata
960 *
Josh Coalson4dc35072002-08-20 03:56:52 +0000961 * \brief
962 * Level 1 metadata iterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000963 *
Josh Coalson4dc35072002-08-20 03:56:52 +0000964 * The flow through the iterator in the C++ layer is similar
965 * to the C layer:
966 * - Create a SimpleIterator instance
967 * - Check SimpleIterator::is_valid()
968 * - Call SimpleIterator::init() and check the return
969 * - Traverse and/or edit. Edits are written to file
970 * immediately.
971 * - Destroy the SimpleIterator instance
972 *
973 * The ownership of pointers in the C++ layer follows that in
974 * the C layer, i.e.
975 * - The objects returned by get_block() are yours to
976 * modify, but changes are not reflected in the FLAC file
977 * until you call set_block(). The objects are also
978 * yours to delete; they are not automatically deleted
979 * when passed to set_block() or insert_block_after().
980 *
981 * See the \link flac_metadata_level1 C layer equivalent \endlink
982 * for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000983 *
984 * \{
985 */
986
Josh Coalson402da702002-08-21 03:40:11 +0000987 /** This class is a wrapper around the FLAC__metadata_simple_iterator
Josh Coalson20ad84a2006-10-07 05:43:01 +0000988 * structures and methods; see the
989 * \link flacpp_metadata_level1 usage guide \endlink and
990 * ::FLAC__Metadata_SimpleIterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000991 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000992 class FLACPP_API SimpleIterator {
Josh Coalsonfb74f102002-05-22 05:33:29 +0000993 public:
Josh Coalson20ad84a2006-10-07 05:43:01 +0000994 /** This class is a wrapper around FLAC__Metadata_SimpleIteratorStatus.
995 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000996 class FLACPP_API Status {
Josh Coalsonfb74f102002-05-22 05:33:29 +0000997 public:
Josh Coalsoncc682512002-06-08 04:53:42 +0000998 inline Status(::FLAC__Metadata_SimpleIteratorStatus status): status_(status) { }
999 inline operator ::FLAC__Metadata_SimpleIteratorStatus() const { return status_; }
1000 inline const char *as_cstring() const { return ::FLAC__Metadata_SimpleIteratorStatusString[status_]; }
Josh Coalsonfb74f102002-05-22 05:33:29 +00001001 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001002 ::FLAC__Metadata_SimpleIteratorStatus status_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001003 };
1004
1005 SimpleIterator();
1006 virtual ~SimpleIterator();
1007
Josh Coalson20ad84a2006-10-07 05:43:01 +00001008 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 +00001009
1010 bool is_valid() const;
Josh Coalson20ad84a2006-10-07 05:43:01 +00001011 Status status(); ///< See FLAC__metadata_simple_iterator_status().
1012 bool is_writable() const; ///< See FLAC__metadata_simple_iterator_is_writable().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001013
Josh Coalson20ad84a2006-10-07 05:43:01 +00001014 bool next(); ///< See FLAC__metadata_simple_iterator_next().
1015 bool prev(); ///< See FLAC__metadata_simple_iterator_prev().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001016
Josh Coalson20ad84a2006-10-07 05:43:01 +00001017 ::FLAC__MetadataType get_block_type() const; ///< See FLAC__metadata_simple_iterator_get_block_type().
1018 Prototype *get_block(); ///< See FLAC__metadata_simple_iterator_get_block().
1019 bool set_block(Prototype *block, bool use_padding = true); ///< See FLAC__metadata_simple_iterator_set_block().
1020 bool insert_block_after(Prototype *block, bool use_padding = true); ///< See FLAC__metadata_simple_iterator_insert_block_after().
1021 bool delete_block(bool use_padding = true); ///< See FLAC__metadata_simple_iterator_delete_block().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001022
1023 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001024 ::FLAC__Metadata_SimpleIterator *iterator_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001025 void clear();
1026 };
1027
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001028 /* \} */
1029
Josh Coalsonb2b53582002-05-31 06:20:50 +00001030
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001031 /** \defgroup flacpp_metadata_level2 FLAC++/metadata.h: metadata level 2 interface
1032 * \ingroup flacpp_metadata
1033 *
Josh Coalson4dc35072002-08-20 03:56:52 +00001034 * \brief
1035 * Level 2 metadata iterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001036 *
Josh Coalson4dc35072002-08-20 03:56:52 +00001037 * The flow through the iterator in the C++ layer is similar
1038 * to the C layer:
1039 * - Create a Chain instance
1040 * - Check Chain::is_valid()
1041 * - Call Chain::read() and check the return
1042 * - Traverse and/or edit with an Iterator or with
1043 * Chain::merge_padding() or Chain::sort_padding()
1044 * - Write changes back to FLAC file with Chain::write()
1045 * - Destroy the Chain instance
1046 *
Josh Coalson8b9a4772002-12-28 07:03:26 +00001047 * The ownership of pointers in the C++ layer is slightly
1048 * different than in the C layer, i.e.
1049 * - The objects returned by Iterator::get_block() are NOT
1050 * owned by the iterator and should be deleted by the
1051 * caller when finished, BUT, when you modify the block,
1052 * it will directly edit what's in the chain and you do
1053 * not need to call Iterator::set_block(). However the
1054 * changes will not be reflected in the FLAC file until
1055 * the chain is written with Chain::write().
Josh Coalson4dc35072002-08-20 03:56:52 +00001056 * - When you pass an object to Iterator::set_block(),
1057 * Iterator::insert_block_before(), or
1058 * Iterator::insert_block_after(), the iterator takes
Josh Coalson8b9a4772002-12-28 07:03:26 +00001059 * ownership of the block and it will be deleted by the
Josh Coalson4dc35072002-08-20 03:56:52 +00001060 * chain.
1061 *
1062 * See the \link flac_metadata_level2 C layer equivalent \endlink
1063 * for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001064 *
1065 * \{
1066 */
1067
Josh Coalson402da702002-08-21 03:40:11 +00001068 /** This class is a wrapper around the FLAC__metadata_chain
Josh Coalson20ad84a2006-10-07 05:43:01 +00001069 * structures and methods; see the
1070 * \link flacpp_metadata_level2 usage guide \endlink and
1071 * ::FLAC__Metadata_Chain.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001072 */
Josh Coalson55bc5872002-10-16 22:18:32 +00001073 class FLACPP_API Chain {
Josh Coalsonfb74f102002-05-22 05:33:29 +00001074 public:
Josh Coalson20ad84a2006-10-07 05:43:01 +00001075 /** This class is a wrapper around FLAC__Metadata_ChainStatus.
1076 */
Josh Coalson55bc5872002-10-16 22:18:32 +00001077 class FLACPP_API Status {
Josh Coalsonfb74f102002-05-22 05:33:29 +00001078 public:
Josh Coalsoncc682512002-06-08 04:53:42 +00001079 inline Status(::FLAC__Metadata_ChainStatus status): status_(status) { }
1080 inline operator ::FLAC__Metadata_ChainStatus() const { return status_; }
1081 inline const char *as_cstring() const { return ::FLAC__Metadata_ChainStatusString[status_]; }
Josh Coalsonfb74f102002-05-22 05:33:29 +00001082 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001083 ::FLAC__Metadata_ChainStatus status_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001084 };
1085
1086 Chain();
1087 virtual ~Chain();
1088
1089 friend class Iterator;
1090
1091 bool is_valid() const;
Josh Coalson20ad84a2006-10-07 05:43:01 +00001092 Status status(); ///< See FLAC__metadata_chain_status().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001093
Josh Coalson20ad84a2006-10-07 05:43:01 +00001094 bool read(const char *filename); ///< See FLAC__metadata_chain_read().
1095 bool read(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks); ///< See FLAC__metadata_chain_read_with_callbacks().
Josh Coalsondeab4622004-07-15 16:22:43 +00001096
Josh Coalson20ad84a2006-10-07 05:43:01 +00001097 bool check_if_tempfile_needed(bool use_padding); ///< See FLAC__metadata_chain_check_if_tempfile_needed().
Josh Coalsondeab4622004-07-15 16:22:43 +00001098
Josh Coalson20ad84a2006-10-07 05:43:01 +00001099 bool write(bool use_padding = true, bool preserve_file_stats = false); ///< See FLAC__metadata_chain_write().
1100 bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks); ///< See FLAC__metadata_chain_write_with_callbacks().
1101 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 +00001102
Josh Coalson20ad84a2006-10-07 05:43:01 +00001103 void merge_padding(); ///< See FLAC__metadata_chain_merge_padding().
1104 void sort_padding(); ///< See FLAC__metadata_chain_sort_padding().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001105
1106 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001107 ::FLAC__Metadata_Chain *chain_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001108 virtual void clear();
1109 };
1110
Josh Coalson402da702002-08-21 03:40:11 +00001111 /** This class is a wrapper around the FLAC__metadata_iterator
Josh Coalson20ad84a2006-10-07 05:43:01 +00001112 * structures and methods; see the
1113 * \link flacpp_metadata_level2 usage guide \endlink and
1114 * ::FLAC__Metadata_Iterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001115 */
Josh Coalson55bc5872002-10-16 22:18:32 +00001116 class FLACPP_API Iterator {
Josh Coalsonfb74f102002-05-22 05:33:29 +00001117 public:
1118 Iterator();
1119 virtual ~Iterator();
1120
1121 bool is_valid() const;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001122
Josh Coalson20ad84a2006-10-07 05:43:01 +00001123 void init(Chain &chain); ///< See FLAC__metadata_iterator_init().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001124
Josh Coalson20ad84a2006-10-07 05:43:01 +00001125 bool next(); ///< See FLAC__metadata_iterator_next().
1126 bool prev(); ///< See FLAC__metadata_iterator_prev().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001127
Josh Coalson20ad84a2006-10-07 05:43:01 +00001128 ::FLAC__MetadataType get_block_type() const; ///< See FLAC__metadata_iterator_get_block_type().
1129 Prototype *get_block(); ///< See FLAC__metadata_iterator_get_block().
1130 bool set_block(Prototype *block); ///< See FLAC__metadata_iterator_set_block().
1131 bool delete_block(bool replace_with_padding); ///< See FLAC__metadata_iterator_delete_block().
1132 bool insert_block_before(Prototype *block); ///< See FLAC__metadata_iterator_insert_block_before().
1133 bool insert_block_after(Prototype *block); ///< See FLAC__metadata_iterator_insert_block_after().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001134
1135 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001136 ::FLAC__Metadata_Iterator *iterator_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001137 virtual void clear();
Josh Coalsonfda98fb2002-05-17 06:33:39 +00001138 };
1139
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001140 /* \} */
1141
Josh Coalsonc71bfe92005-01-25 02:27:20 +00001142 }
1143}
Josh Coalsonfda98fb2002-05-17 06:33:39 +00001144
1145#endif