blob: e2ba5c5d6492ba4981baca64d169df4d8e52b675 [file] [log] [blame]
Josh Coalsonfda98fb2002-05-17 06:33:39 +00001/* libFLAC++ - Free Lossless Audio Codec library
Josh Coalsone74bd952007-02-02 06:58:19 +00002 * Copyright (C) 2002,2003,2004,2005,2006,2007 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 Coalson2378fb12006-11-20 05:30:25 +000067 * \link flac_metadata C metadata module \endlink. Note that like the
68 * C layer, currently only the Chain interface (level 2) supports Ogg
69 * FLAC files, and it is read-only i.e. no writing back changed
70 * metadata to file.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +000071 */
72
Josh Coalsonfb74f102002-05-22 05:33:29 +000073
Josh Coalsonfda98fb2002-05-17 06:33:39 +000074namespace FLAC {
75 namespace Metadata {
76
Josh Coalsonfb74f102002-05-22 05:33:29 +000077 // ============================================================
78 //
79 // Metadata objects
80 //
81 // ============================================================
82
Josh Coalsonf6efd9c2002-07-27 04:59:54 +000083 /** \defgroup flacpp_metadata_object FLAC++/metadata.h: metadata object classes
84 * \ingroup flacpp_metadata
85 *
86 * This module contains classes representing FLAC metadata
87 * blocks in memory.
88 *
89 * The behavior closely mimics the C layer interface; be
90 * sure to read the detailed description of the
91 * \link flac_metadata_object C metadata object module \endlink.
92 *
93 * Any time a metadata object is constructed or assigned, you
94 * should check is_valid() to make sure the underlying
95 * ::FLAC__StreamMetadata object was able to be created.
96 *
97 * \warning
98 * When the get_*() methods of any metadata object method
99 * return you a const pointer, DO NOT disobey and write into it.
100 * Always use the set_*() methods.
101 *
102 * \{
103 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000104
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000105 /** Base class for all metadata block types.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000106 * See the \link flacpp_metadata_object overview \endlink for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000107 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000108 class FLACPP_API Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000109 protected:
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000110 //@{
111 /** Constructs a copy of the given object. This form
112 * always performs a deep copy.
113 */
114 Prototype(const Prototype &);
115 Prototype(const ::FLAC__StreamMetadata &);
116 Prototype(const ::FLAC__StreamMetadata *);
117 //@}
Josh Coalson83961752002-07-09 06:12:59 +0000118
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000119 /** Constructs an object with copy control. When \a copy
120 * is \c true, behaves identically to
121 * FLAC::Metadata::Prototype::Prototype(const ::FLAC__StreamMetadata *object).
122 * When \a copy is \c false, the instance takes ownership of
123 * the pointer and the ::FLAC__StreamMetadata object will
124 * be freed by the destructor.
125 *
126 * \assert
127 * \code object != NULL \endcode
128 */
Josh Coalson83961752002-07-09 06:12:59 +0000129 Prototype(::FLAC__StreamMetadata *object, bool copy);
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000130
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000131 //@{
132 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000133 Prototype &operator=(const Prototype &);
134 Prototype &operator=(const ::FLAC__StreamMetadata &);
135 Prototype &operator=(const ::FLAC__StreamMetadata *);
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000136 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000137
Josh Coalson42372b92005-01-07 01:09:07 +0000138 /** Assigns an object with copy control. See
139 * Prototype(::FLAC__StreamMetadata *object, bool copy).
140 */
141 Prototype &assign_object(::FLAC__StreamMetadata *object, bool copy);
142
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000143 /** Deletes the underlying ::FLAC__StreamMetadata object.
144 */
Josh Coalsonfb74f102002-05-22 05:33:29 +0000145 virtual void clear();
146
Josh Coalsoncc682512002-06-08 04:53:42 +0000147 ::FLAC__StreamMetadata *object_;
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000148 public:
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000149 /** Deletes the underlying ::FLAC__StreamMetadata object.
150 */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000151 virtual ~Prototype();
152
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000153 //@{
Josh Coalson20ad84a2006-10-07 05:43:01 +0000154 /** Check for equality, performing a deep compare by following pointers.
155 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000156 inline bool operator==(const Prototype &) const;
157 inline bool operator==(const ::FLAC__StreamMetadata &) const;
158 inline bool operator==(const ::FLAC__StreamMetadata *) const;
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000159 //@}
160
161 //@{
162 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalsoncc682512002-06-08 04:53:42 +0000163 inline bool operator!=(const Prototype &) const;
164 inline bool operator!=(const ::FLAC__StreamMetadata &) const;
165 inline bool operator!=(const ::FLAC__StreamMetadata *) const;
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000166 //@}
Josh Coalsoncc682512002-06-08 04:53:42 +0000167
Josh Coalsonfb74f102002-05-22 05:33:29 +0000168 friend class SimpleIterator;
169 friend class Iterator;
170
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000171 /** Returns \c true if the object was correctly constructed
172 * (i.e. the underlying ::FLAC__StreamMetadata object was
173 * properly allocated), else \c false.
174 */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000175 inline bool is_valid() const;
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000176
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000177 /** Returns \c true if this block is the last block in a
178 * stream, else \c false.
179 *
180 * \assert
181 * \code is_valid() \endcode
182 */
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000183 bool get_is_last() const;
Josh Coalsoncc682512002-06-08 04:53:42 +0000184
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000185 /** Returns the type of the block.
186 *
187 * \assert
188 * \code is_valid() \endcode
189 */
190 ::FLAC__MetadataType get_type() const;
191
192 /** Returns the stream length of the metadata block.
193 *
194 * \note
195 * The length does not include the metadata block header,
196 * per spec.
197 *
198 * \assert
199 * \code is_valid() \endcode
200 */
201 unsigned get_length() const;
202
203 /** Sets the "is_last" flag for the block. When using the iterators
204 * it is not necessary to set this flag; they will do it for you.
205 *
206 * \assert
207 * \code is_valid() \endcode
208 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000209 void set_is_last(bool);
Josh Coalsond113ca32004-07-22 01:03:43 +0000210
211 /** Returns a pointer to the underlying ::FLAC__StreamMetadata
212 * object. This can be useful for plugging any holes between
213 * the C++ and C interfaces.
214 *
215 * \assert
216 * \code is_valid() \endcode
217 */
218 inline operator const ::FLAC__StreamMetadata *() const;
Josh Coalsonfb74f102002-05-22 05:33:29 +0000219 private:
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000220 /** Private and undefined so you can't use it. */
221 Prototype();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000222
223 // These are used only by Iterator
224 bool is_reference_;
225 inline void set_reference(bool x) { is_reference_ = x; }
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000226 };
227
Josh Coalson3cb83412004-07-23 05:11:06 +0000228#ifdef _MSC_VER
229// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
230#pragma warning ( disable : 4800 )
231#endif
232
Josh Coalson765ff502002-08-27 05:46:11 +0000233 inline bool Prototype::operator==(const Prototype &object) const
Josh Coalsond57c8d32002-06-11 06:15:28 +0000234 { return (bool)::FLAC__metadata_object_is_equal(object_, 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 Coalson765ff502002-08-27 05:46:11 +0000239 inline bool Prototype::operator==(const ::FLAC__StreamMetadata *object) const
Josh Coalsond57c8d32002-06-11 06:15:28 +0000240 { return (bool)::FLAC__metadata_object_is_equal(object_, object); }
Josh Coalson57ba6f42002-06-07 05:27:37 +0000241
Josh Coalson3cb83412004-07-23 05:11:06 +0000242#ifdef _MSC_VER
243// @@@ how to re-enable? the following doesn't work
244// #pragma warning ( enable : 4800 )
245#endif
246
Josh Coalson765ff502002-08-27 05:46:11 +0000247 inline bool Prototype::operator!=(const Prototype &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
Josh Coalson765ff502002-08-27 05:46:11 +0000253 inline bool Prototype::operator!=(const ::FLAC__StreamMetadata *object) const
Josh Coalson57ba6f42002-06-07 05:27:37 +0000254 { return !operator==(object); }
255
256 inline bool Prototype::is_valid() const
257 { return 0 != object_; }
258
Josh Coalsond113ca32004-07-22 01:03:43 +0000259 inline Prototype::operator const ::FLAC__StreamMetadata *() const
260 { return object_; }
261
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000262 /** Create a deep copy of an object and return it. */
Josh Coalson55bc5872002-10-16 22:18:32 +0000263 FLACPP_API Prototype *clone(const Prototype *);
Josh Coalson57ba6f42002-06-07 05:27:37 +0000264
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000265
266 /** STREAMINFO metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000267 * See the \link flacpp_metadata_object overview \endlink for more,
268 * and the <A HREF="../format.html#metadata_block_streaminfo">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000269 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000270 class FLACPP_API StreamInfo : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000271 public:
272 StreamInfo();
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000273
274 //@{
275 /** Constructs a copy of the given object. This form
276 * always performs a deep copy.
277 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000278 inline StreamInfo(const StreamInfo &object): Prototype(object) { }
279 inline StreamInfo(const ::FLAC__StreamMetadata &object): Prototype(object) { }
280 inline StreamInfo(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000281 //@}
282
283 /** Constructs an object with copy control. See
284 * Prototype(::FLAC__StreamMetadata *object, bool copy).
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000285 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000286 inline StreamInfo(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000287
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000288 ~StreamInfo();
289
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000290 //@{
291 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000292 inline StreamInfo &operator=(const StreamInfo &object) { Prototype::operator=(object); return *this; }
293 inline StreamInfo &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
294 inline StreamInfo &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000295 //@}
Josh Coalsonfb74f102002-05-22 05:33:29 +0000296
Josh Coalson42372b92005-01-07 01:09:07 +0000297 /** Assigns an object with copy control. See
298 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
299 */
300 inline StreamInfo &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
301
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000302 //@{
303 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000304 inline bool operator==(const StreamInfo &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000305 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
306 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000307 //@}
308
309 //@{
310 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000311 inline bool operator!=(const StreamInfo &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000312 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
313 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000314 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000315
Josh Coalson4dc35072002-08-20 03:56:52 +0000316 //@{
317 /** See <A HREF="../format.html#metadata_block_streaminfo">format specification</A>. */
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000318 unsigned get_min_blocksize() const;
319 unsigned get_max_blocksize() const;
320 unsigned get_min_framesize() const;
321 unsigned get_max_framesize() const;
322 unsigned get_sample_rate() const;
323 unsigned get_channels() const;
324 unsigned get_bits_per_sample() const;
325 FLAC__uint64 get_total_samples() const;
326 const FLAC__byte *get_md5sum() const;
327
328 void set_min_blocksize(unsigned value);
329 void set_max_blocksize(unsigned value);
330 void set_min_framesize(unsigned value);
331 void set_max_framesize(unsigned value);
332 void set_sample_rate(unsigned value);
333 void set_channels(unsigned value);
334 void set_bits_per_sample(unsigned value);
335 void set_total_samples(FLAC__uint64 value);
336 void set_md5sum(const FLAC__byte value[16]);
Josh Coalson4dc35072002-08-20 03:56:52 +0000337 //@}
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000338 };
339
Josh Coalson4dc35072002-08-20 03:56:52 +0000340 /** PADDING metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000341 * See the \link flacpp_metadata_object overview \endlink for more,
342 * and the <A HREF="../format.html#metadata_block_padding">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000343 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000344 class FLACPP_API Padding : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000345 public:
346 Padding();
Josh Coalson4dc35072002-08-20 03:56:52 +0000347
348 //@{
349 /** Constructs a copy of the given object. This form
350 * always performs a deep copy.
351 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000352 inline Padding(const Padding &object): Prototype(object) { }
353 inline Padding(const ::FLAC__StreamMetadata &object): Prototype(object) { }
354 inline Padding(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000355 //@}
356
357 /** Constructs an object with copy control. See
358 * Prototype(::FLAC__StreamMetadata *object, bool copy).
359 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000360 inline Padding(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000361
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000362 ~Padding();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000363
Josh Coalson4dc35072002-08-20 03:56:52 +0000364 //@{
365 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000366 inline Padding &operator=(const Padding &object) { Prototype::operator=(object); return *this; }
367 inline Padding &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
368 inline Padding &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000369 //@}
Josh Coalsonb2b53582002-05-31 06:20:50 +0000370
Josh Coalson42372b92005-01-07 01:09:07 +0000371 /** Assigns an object with copy control. See
372 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
373 */
374 inline Padding &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
375
Josh Coalson4dc35072002-08-20 03:56:52 +0000376 //@{
377 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000378 inline bool operator==(const Padding &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000379 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
380 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000381 //@}
382
383 //@{
384 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000385 inline bool operator!=(const Padding &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000386 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
387 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000388 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000389
Josh Coalsonb2b53582002-05-31 06:20:50 +0000390 void set_length(unsigned length);
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000391 };
392
Josh Coalson4dc35072002-08-20 03:56:52 +0000393 /** APPLICATION metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000394 * See the \link flacpp_metadata_object overview \endlink for more,
395 * and the <A HREF="../format.html#metadata_block_application">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000396 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000397 class FLACPP_API Application : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000398 public:
399 Application();
Josh Coalson4dc35072002-08-20 03:56:52 +0000400 //
401 //@{
402 /** Constructs a copy of the given object. This form
403 * always performs a deep copy.
404 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000405 inline Application(const Application &object): Prototype(object) { }
406 inline Application(const ::FLAC__StreamMetadata &object): Prototype(object) { }
407 inline Application(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000408 //@}
409
410 /** Constructs an object with copy control. See
411 * Prototype(::FLAC__StreamMetadata *object, bool copy).
412 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000413 inline Application(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000414
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000415 ~Application();
416
Josh Coalson4dc35072002-08-20 03:56:52 +0000417 //@{
418 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000419 inline Application &operator=(const Application &object) { Prototype::operator=(object); return *this; }
420 inline Application &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
421 inline Application &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000422 //@}
Josh Coalsonfb74f102002-05-22 05:33:29 +0000423
Josh Coalson42372b92005-01-07 01:09:07 +0000424 /** Assigns an object with copy control. See
425 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
426 */
427 inline Application &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
428
Josh Coalson4dc35072002-08-20 03:56:52 +0000429 //@{
430 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000431 inline bool operator==(const Application &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000432 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
433 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000434 //@}
435
436 //@{
437 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000438 inline bool operator!=(const Application &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000439 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
440 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000441 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000442
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000443 const FLAC__byte *get_id() const;
444 const FLAC__byte *get_data() const;
445
Josh Coalsoncc682512002-06-08 04:53:42 +0000446 void set_id(const FLAC__byte value[4]);
Josh Coalson4dc35072002-08-20 03:56:52 +0000447 //! This form always copies \a data
448 bool set_data(const FLAC__byte *data, unsigned length);
Josh Coalsoncc682512002-06-08 04:53:42 +0000449 bool set_data(FLAC__byte *data, unsigned length, bool copy);
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000450 };
451
Josh Coalson4dc35072002-08-20 03:56:52 +0000452 /** SEEKTABLE metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000453 * See the \link flacpp_metadata_object overview \endlink for more,
454 * and the <A HREF="../format.html#metadata_block_seektable">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000455 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000456 class FLACPP_API SeekTable : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000457 public:
458 SeekTable();
Josh Coalson4dc35072002-08-20 03:56:52 +0000459
460 //@{
461 /** Constructs a copy of the given object. This form
462 * always performs a deep copy.
463 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000464 inline SeekTable(const SeekTable &object): Prototype(object) { }
465 inline SeekTable(const ::FLAC__StreamMetadata &object): Prototype(object) { }
466 inline SeekTable(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000467 //@}
468
469 /** Constructs an object with copy control. See
470 * Prototype(::FLAC__StreamMetadata *object, bool copy).
471 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000472 inline SeekTable(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000473
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000474 ~SeekTable();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000475
Josh Coalson4dc35072002-08-20 03:56:52 +0000476 //@{
477 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000478 inline SeekTable &operator=(const SeekTable &object) { Prototype::operator=(object); return *this; }
479 inline SeekTable &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
480 inline SeekTable &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000481 //@}
Josh Coalsonb2b53582002-05-31 06:20:50 +0000482
Josh Coalson42372b92005-01-07 01:09:07 +0000483 /** Assigns an object with copy control. See
484 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
485 */
486 inline SeekTable &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
487
Josh Coalson4dc35072002-08-20 03:56:52 +0000488 //@{
489 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000490 inline bool operator==(const SeekTable &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000491 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
492 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000493 //@}
494
495 //@{
496 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000497 inline bool operator!=(const SeekTable &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000498 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
499 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000500 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000501
Josh Coalsonb2b53582002-05-31 06:20:50 +0000502 unsigned get_num_points() const;
Josh Coalsoncc682512002-06-08 04:53:42 +0000503 ::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const;
Josh Coalsonb2b53582002-05-31 06:20:50 +0000504
Josh Coalson4dc35072002-08-20 03:56:52 +0000505 //! See FLAC__metadata_object_seektable_set_point()
Josh Coalsoncc682512002-06-08 04:53:42 +0000506 void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
Josh Coalson4dc35072002-08-20 03:56:52 +0000507
508 //! See FLAC__metadata_object_seektable_insert_point()
Josh Coalsoncc682512002-06-08 04:53:42 +0000509 bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
Josh Coalson4dc35072002-08-20 03:56:52 +0000510
511 //! See FLAC__metadata_object_seektable_delete_point()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000512 bool delete_point(unsigned index);
Josh Coalson28e08d82002-06-05 05:56:41 +0000513
Josh Coalson4dc35072002-08-20 03:56:52 +0000514 //! See FLAC__metadata_object_seektable_is_legal()
Josh Coalson28e08d82002-06-05 05:56:41 +0000515 bool is_legal() const;
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000516 };
517
Josh Coalson4dc35072002-08-20 03:56:52 +0000518 /** VORBIS_COMMENT metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000519 * See the \link flacpp_metadata_object overview \endlink for more,
520 * and the <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000521 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000522 class FLACPP_API VorbisComment : public Prototype {
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000523 public:
Josh Coalson4dc35072002-08-20 03:56:52 +0000524 /** Convenience class for encapsulating Vorbis comment
525 * entries. An entry is a vendor string or a comment
526 * field. In the case of a vendor string, the field
527 * name is undefined; only the field value is relevant.
528 *
529 * A \a field as used in the methods refers to an
Josh Coalsondef597e2004-12-30 00:59:30 +0000530 * entire 'NAME=VALUE' string; for convenience the
Josh Coalson2de11242004-12-30 03:41:19 +0000531 * string is NUL-terminated. A length field is
Josh Coalsondef597e2004-12-30 00:59:30 +0000532 * required in the unlikely event that the value
Josh Coalson2de11242004-12-30 03:41:19 +0000533 * contains contain embedded NULs.
Josh Coalson4dc35072002-08-20 03:56:52 +0000534 *
535 * A \a field_name is what is on the left side of the
536 * first '=' in the \a field. By definition it is ASCII
Josh Coalson2de11242004-12-30 03:41:19 +0000537 * and so is NUL-terminated and does not require a
Josh Coalson4dc35072002-08-20 03:56:52 +0000538 * length to describe it. \a field_name is undefined
539 * for a vendor string entry.
540 *
541 * A \a field_value is what is on the right side of the
542 * first '=' in the \a field. By definition, this may
Josh Coalson2de11242004-12-30 03:41:19 +0000543 * contain embedded NULs and so a \a field_value_length
Josh Coalsondef597e2004-12-30 00:59:30 +0000544 * is required to describe it. However in practice,
Josh Coalson2de11242004-12-30 03:41:19 +0000545 * embedded NULs are not known to be used, so it is
546 * generally safe to treat field values as NUL-
Josh Coalsondef597e2004-12-30 00:59:30 +0000547 * terminated UTF-8 strings.
Josh Coalson4dc35072002-08-20 03:56:52 +0000548 *
549 * Always check is_valid() after the constructor or operator=
Josh Coalson2de11242004-12-30 03:41:19 +0000550 * to make sure memory was properly allocated and that the
551 * Entry conforms to the Vorbis comment specification.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000552 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000553 class FLACPP_API Entry {
Josh Coalsonb2b53582002-05-31 06:20:50 +0000554 public:
555 Entry();
Josh Coalsondef597e2004-12-30 00:59:30 +0000556
Josh Coalsonb2b53582002-05-31 06:20:50 +0000557 Entry(const char *field, unsigned field_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000558 Entry(const char *field); // assumes \a field is NUL-terminated
Josh Coalsondef597e2004-12-30 00:59:30 +0000559
Josh Coalsonb2b53582002-05-31 06:20:50 +0000560 Entry(const char *field_name, const char *field_value, unsigned field_value_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000561 Entry(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
Josh Coalsondef597e2004-12-30 00:59:30 +0000562
Josh Coalsonb2b53582002-05-31 06:20:50 +0000563 Entry(const Entry &entry);
Josh Coalsondef597e2004-12-30 00:59:30 +0000564
Josh Coalson42372b92005-01-07 01:09:07 +0000565 Entry &operator=(const Entry &entry);
Josh Coalsonb2b53582002-05-31 06:20:50 +0000566
567 virtual ~Entry();
568
Josh Coalson3c917542006-10-15 07:50:44 +0000569 virtual bool is_valid() const; ///< Returns \c true iff object was properly constructed.
Josh Coalsonb2b53582002-05-31 06:20:50 +0000570
571 unsigned get_field_length() const;
572 unsigned get_field_name_length() const;
573 unsigned get_field_value_length() const;
574
Josh Coalsoncc682512002-06-08 04:53:42 +0000575 ::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const;
Josh Coalsonb2b53582002-05-31 06:20:50 +0000576 const char *get_field() const;
577 const char *get_field_name() const;
578 const char *get_field_value() const;
579
580 bool set_field(const char *field, unsigned field_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000581 bool set_field(const char *field); // assumes \a field is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000582 bool set_field_name(const char *field_name);
583 bool set_field_value(const char *field_value, unsigned field_value_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000584 bool set_field_value(const char *field_value); // assumes \a field_value is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000585 protected:
586 bool is_valid_;
Josh Coalsoncc682512002-06-08 04:53:42 +0000587 ::FLAC__StreamMetadata_VorbisComment_Entry entry_;
Josh Coalsonb2b53582002-05-31 06:20:50 +0000588 char *field_name_;
589 unsigned field_name_length_;
590 char *field_value_;
591 unsigned field_value_length_;
592 private:
593 void zero();
594 void clear();
595 void clear_entry();
596 void clear_field_name();
597 void clear_field_value();
598 void construct(const char *field, unsigned field_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000599 void construct(const char *field); // assumes \a field is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000600 void construct(const char *field_name, const char *field_value, unsigned field_value_length);
Josh Coalson2de11242004-12-30 03:41:19 +0000601 void construct(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
Josh Coalsonb2b53582002-05-31 06:20:50 +0000602 void compose_field();
603 void parse_field();
604 };
605
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000606 VorbisComment();
Josh Coalson4dc35072002-08-20 03:56:52 +0000607
608 //@{
609 /** Constructs a copy of the given object. This form
610 * always performs a deep copy.
611 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000612 inline VorbisComment(const VorbisComment &object): Prototype(object) { }
613 inline VorbisComment(const ::FLAC__StreamMetadata &object): Prototype(object) { }
614 inline VorbisComment(const ::FLAC__StreamMetadata *object): Prototype(object) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000615 //@}
616
617 /** Constructs an object with copy control. See
618 * Prototype(::FLAC__StreamMetadata *object, bool copy).
619 */
Josh Coalsoncc682512002-06-08 04:53:42 +0000620 inline VorbisComment(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
Josh Coalson4dc35072002-08-20 03:56:52 +0000621
Josh Coalsonfda98fb2002-05-17 06:33:39 +0000622 ~VorbisComment();
Josh Coalsonfb74f102002-05-22 05:33:29 +0000623
Josh Coalson4dc35072002-08-20 03:56:52 +0000624 //@{
625 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000626 inline VorbisComment &operator=(const VorbisComment &object) { Prototype::operator=(object); return *this; }
627 inline VorbisComment &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
628 inline VorbisComment &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson4dc35072002-08-20 03:56:52 +0000629 //@}
Josh Coalsonb2b53582002-05-31 06:20:50 +0000630
Josh Coalson42372b92005-01-07 01:09:07 +0000631 /** Assigns an object with copy control. See
632 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
633 */
634 inline VorbisComment &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
635
Josh Coalson4dc35072002-08-20 03:56:52 +0000636 //@{
637 /** Check for equality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000638 inline bool operator==(const VorbisComment &object) const { return Prototype::operator==(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000639 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
640 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000641 //@}
642
643 //@{
644 /** Check for inequality, performing a deep compare by following pointers. */
Josh Coalson57ba6f42002-06-07 05:27:37 +0000645 inline bool operator!=(const VorbisComment &object) const { return Prototype::operator!=(object); }
Josh Coalsoncc682512002-06-08 04:53:42 +0000646 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
647 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
Josh Coalson4dc35072002-08-20 03:56:52 +0000648 //@}
Josh Coalson57ba6f42002-06-07 05:27:37 +0000649
Josh Coalsonb2b53582002-05-31 06:20:50 +0000650 unsigned get_num_comments() const;
Josh Coalson2de11242004-12-30 03:41:19 +0000651 const FLAC__byte *get_vendor_string() const; // NUL-terminated UTF-8 string
Josh Coalsonb2b53582002-05-31 06:20:50 +0000652 Entry get_comment(unsigned index) const;
653
Josh Coalson87977ba2002-08-20 07:09:33 +0000654 //! See FLAC__metadata_object_vorbiscomment_set_vendor_string()
Josh Coalson2de11242004-12-30 03:41:19 +0000655 bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string
Josh Coalson4dc35072002-08-20 03:56:52 +0000656
Josh Coalson87977ba2002-08-20 07:09:33 +0000657 //! See FLAC__metadata_object_vorbiscomment_set_comment()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000658 bool set_comment(unsigned index, const Entry &entry);
Josh Coalson4dc35072002-08-20 03:56:52 +0000659
Josh Coalson87977ba2002-08-20 07:09:33 +0000660 //! See FLAC__metadata_object_vorbiscomment_insert_comment()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000661 bool insert_comment(unsigned index, const Entry &entry);
Josh Coalson4dc35072002-08-20 03:56:52 +0000662
Josh Coalsondef597e2004-12-30 00:59:30 +0000663 //! See FLAC__metadata_object_vorbiscomment_append_comment()
664 bool append_comment(const Entry &entry);
665
Josh Coalson87977ba2002-08-20 07:09:33 +0000666 //! See FLAC__metadata_object_vorbiscomment_delete_comment()
Josh Coalsonb2b53582002-05-31 06:20:50 +0000667 bool delete_comment(unsigned index);
Josh Coalsonfb74f102002-05-22 05:33:29 +0000668 };
669
Josh Coalson863dbf32002-11-16 06:30:30 +0000670 /** CUESHEET metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000671 * See the \link flacpp_metadata_object overview \endlink for more,
672 * and the <A HREF="../format.html#metadata_block_cuesheet">format specification</A>.
Josh Coalson863dbf32002-11-16 06:30:30 +0000673 */
674 class FLACPP_API CueSheet : public Prototype {
675 public:
676 /** Convenience class for encapsulating a cue sheet
677 * track.
678 *
679 * Always check is_valid() after the constructor or operator=
680 * to make sure memory was properly allocated.
681 */
682 class FLACPP_API Track {
683 protected:
684 ::FLAC__StreamMetadata_CueSheet_Track *object_;
685 public:
686 Track();
687 Track(const ::FLAC__StreamMetadata_CueSheet_Track *track);
688 Track(const Track &track);
Josh Coalson42372b92005-01-07 01:09:07 +0000689 Track &operator=(const Track &track);
Josh Coalson863dbf32002-11-16 06:30:30 +0000690
691 virtual ~Track();
692
Josh Coalson3c917542006-10-15 07:50:44 +0000693 virtual bool is_valid() const; ///< Returns \c true iff object was properly constructed.
694
Josh Coalson863dbf32002-11-16 06:30:30 +0000695
696 inline FLAC__uint64 get_offset() const { return object_->offset; }
697 inline FLAC__byte get_number() const { return object_->number; }
698 inline const char *get_isrc() const { return object_->isrc; }
699 inline unsigned get_type() const { return object_->type; }
700 inline bool get_pre_emphasis() const { return object_->pre_emphasis; }
701
Josh Coalsona7038a92003-01-22 20:16:20 +0000702 inline FLAC__byte get_num_indices() const { return object_->num_indices; }
Josh Coalson863dbf32002-11-16 06:30:30 +0000703 ::FLAC__StreamMetadata_CueSheet_Index get_index(unsigned i) const;
704
705 inline const ::FLAC__StreamMetadata_CueSheet_Track *get_track() const { return object_; }
706
707 inline void set_offset(FLAC__uint64 value) { object_->offset = value; }
708 inline void set_number(FLAC__byte value) { object_->number = value; }
Josh Coalson16219792002-11-19 06:19:29 +0000709 void set_isrc(const char value[12]);
Josh Coalson863dbf32002-11-16 06:30:30 +0000710 void set_type(unsigned value);
711 inline void set_pre_emphasis(bool value) { object_->pre_emphasis = value? 1 : 0; }
712
Josh Coalson16219792002-11-19 06:19:29 +0000713 void set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index);
Josh Coalsonb3538c82003-01-12 08:42:23 +0000714 //@@@ It's awkward but to insert/delete index points
715 //@@@ you must use the routines in the CueSheet class.
Josh Coalson863dbf32002-11-16 06:30:30 +0000716 };
717
718 CueSheet();
719
720 //@{
721 /** Constructs a copy of the given object. This form
722 * always performs a deep copy.
723 */
724 inline CueSheet(const CueSheet &object): Prototype(object) { }
725 inline CueSheet(const ::FLAC__StreamMetadata &object): Prototype(object) { }
726 inline CueSheet(const ::FLAC__StreamMetadata *object): Prototype(object) { }
727 //@}
728
729 /** Constructs an object with copy control. See
730 * Prototype(::FLAC__StreamMetadata *object, bool copy).
731 */
732 inline CueSheet(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
733
734 ~CueSheet();
735
736 //@{
737 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000738 inline CueSheet &operator=(const CueSheet &object) { Prototype::operator=(object); return *this; }
739 inline CueSheet &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
740 inline CueSheet &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson863dbf32002-11-16 06:30:30 +0000741 //@}
742
Josh Coalson42372b92005-01-07 01:09:07 +0000743 /** Assigns an object with copy control. See
744 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
745 */
746 inline CueSheet &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
747
Josh Coalson863dbf32002-11-16 06:30:30 +0000748 //@{
749 /** Check for equality, performing a deep compare by following pointers. */
750 inline bool operator==(const CueSheet &object) const { return Prototype::operator==(object); }
751 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
752 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
753 //@}
754
755 //@{
756 /** Check for inequality, performing a deep compare by following pointers. */
757 inline bool operator!=(const CueSheet &object) const { return Prototype::operator!=(object); }
758 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
759 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
760 //@}
761
762 const char *get_media_catalog_number() const;
763 FLAC__uint64 get_lead_in() const;
Josh Coalson8f0c71b2002-12-05 06:37:46 +0000764 bool get_is_cd() const;
Josh Coalson863dbf32002-11-16 06:30:30 +0000765
766 unsigned get_num_tracks() const;
767 Track get_track(unsigned i) const;
768
Josh Coalson16219792002-11-19 06:19:29 +0000769 void set_media_catalog_number(const char value[128]);
770 void set_lead_in(FLAC__uint64 value);
Josh Coalson8f0c71b2002-12-05 06:37:46 +0000771 void set_is_cd(bool value);
Josh Coalson16219792002-11-19 06:19:29 +0000772
773 void set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
Josh Coalson863dbf32002-11-16 06:30:30 +0000774
775 //! See FLAC__metadata_object_cuesheet_track_insert_index()
776 bool insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
777
778 //! See FLAC__metadata_object_cuesheet_track_delete_index()
779 bool delete_index(unsigned track_num, unsigned index_num);
780
781 //! See FLAC__metadata_object_cuesheet_set_track()
782 bool set_track(unsigned i, const Track &track);
783
784 //! See FLAC__metadata_object_cuesheet_insert_track()
785 bool insert_track(unsigned i, const Track &track);
786
787 //! See FLAC__metadata_object_cuesheet_delete_track()
788 bool delete_track(unsigned i);
789
790 //! See FLAC__metadata_object_cuesheet_is_legal()
791 bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const;
Josh Coalson7cfac0b2006-04-10 05:37:34 +0000792
793 //! See FLAC__metadata_object_cuesheet_calculate_cddb_id()
794 FLAC__uint32 calculate_cddb_id() const;
Josh Coalson863dbf32002-11-16 06:30:30 +0000795 };
796
Josh Coalsone343ab22006-09-23 19:21:19 +0000797 /** PICTURE metadata block.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000798 * See the \link flacpp_metadata_object overview \endlink for more,
799 * and the <A HREF="../format.html#metadata_block_picture">format specification</A>.
Josh Coalsone343ab22006-09-23 19:21:19 +0000800 */
801 class FLACPP_API Picture : public Prototype {
802 public:
803 Picture();
804
805 //@{
806 /** Constructs a copy of the given object. This form
807 * always performs a deep copy.
808 */
809 inline Picture(const Picture &object): Prototype(object) { }
810 inline Picture(const ::FLAC__StreamMetadata &object): Prototype(object) { }
811 inline Picture(const ::FLAC__StreamMetadata *object): Prototype(object) { }
812 //@}
813
814 /** Constructs an object with copy control. See
815 * Prototype(::FLAC__StreamMetadata *object, bool copy).
816 */
817 inline Picture(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
818
819 ~Picture();
820
821 //@{
822 /** Assign from another object. Always performs a deep copy. */
823 inline Picture &operator=(const Picture &object) { Prototype::operator=(object); return *this; }
824 inline Picture &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
825 inline Picture &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
826 //@}
827
828 /** Assigns an object with copy control. See
829 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
830 */
831 inline Picture &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
832
833 //@{
834 /** Check for equality, performing a deep compare by following pointers. */
835 inline bool operator==(const Picture &object) const { return Prototype::operator==(object); }
836 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
837 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
838 //@}
839
840 //@{
841 /** Check for inequality, performing a deep compare by following pointers. */
842 inline bool operator!=(const Picture &object) const { return Prototype::operator!=(object); }
843 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
844 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
845 //@}
846
847 ::FLAC__StreamMetadata_Picture_Type get_type() const;
848 const char *get_mime_type() const; // NUL-terminated printable ASCII string
849 const FLAC__byte *get_description() const; // NUL-terminated UTF-8 string
850 FLAC__uint32 get_width() const;
851 FLAC__uint32 get_height() const;
852 FLAC__uint32 get_depth() const;
Josh Coalson74ed2942006-09-23 23:15:05 +0000853 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 +0000854 FLAC__uint32 get_data_length() const;
855 const FLAC__byte *get_data() const;
856
857 void set_type(::FLAC__StreamMetadata_Picture_Type type);
858
859 //! See FLAC__metadata_object_picture_set_mime_type()
860 bool set_mime_type(const char *string); // NUL-terminated printable ASCII string
861
862 //! See FLAC__metadata_object_picture_set_description()
863 bool set_description(const FLAC__byte *string); // NUL-terminated UTF-8 string
864
865 void set_width(FLAC__uint32 value) const;
866 void set_height(FLAC__uint32 value) const;
867 void set_depth(FLAC__uint32 value) const;
Josh Coalson74ed2942006-09-23 23:15:05 +0000868 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 +0000869
870 //! See FLAC__metadata_object_picture_set_data()
871 bool set_data(const FLAC__byte *data, FLAC__uint32 data_length);
872 };
873
Josh Coalson0eea34a2003-01-10 05:29:17 +0000874 /** Opaque metadata block for storing unknown types.
875 * This should not be used unless you know what you are doing;
876 * it is currently used only internally to support forward
877 * compatibility of metadata blocks.
Josh Coalson20ad84a2006-10-07 05:43:01 +0000878 * See the \link flacpp_metadata_object overview \endlink for more,
Josh Coalson0eea34a2003-01-10 05:29:17 +0000879 */
880 class FLACPP_API Unknown : public Prototype {
881 public:
882 Unknown();
883 //
884 //@{
885 /** Constructs a copy of the given object. This form
886 * always performs a deep copy.
887 */
888 inline Unknown(const Unknown &object): Prototype(object) { }
889 inline Unknown(const ::FLAC__StreamMetadata &object): Prototype(object) { }
890 inline Unknown(const ::FLAC__StreamMetadata *object): Prototype(object) { }
891 //@}
892
893 /** Constructs an object with copy control. See
894 * Prototype(::FLAC__StreamMetadata *object, bool copy).
895 */
896 inline Unknown(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
897
898 ~Unknown();
899
900 //@{
901 /** Assign from another object. Always performs a deep copy. */
Josh Coalson42372b92005-01-07 01:09:07 +0000902 inline Unknown &operator=(const Unknown &object) { Prototype::operator=(object); return *this; }
903 inline Unknown &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
904 inline Unknown &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
Josh Coalson0eea34a2003-01-10 05:29:17 +0000905 //@}
906
Josh Coalson42372b92005-01-07 01:09:07 +0000907 /** Assigns an object with copy control. See
908 * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
909 */
910 inline Unknown &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
911
Josh Coalson0eea34a2003-01-10 05:29:17 +0000912 //@{
913 /** Check for equality, performing a deep compare by following pointers. */
914 inline bool operator==(const Unknown &object) const { return Prototype::operator==(object); }
915 inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
916 inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
917 //@}
918
919 //@{
920 /** Check for inequality, performing a deep compare by following pointers. */
921 inline bool operator!=(const Unknown &object) const { return Prototype::operator!=(object); }
922 inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
923 inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
924 //@}
925
926 const FLAC__byte *get_data() const;
927
928 //! This form always copies \a data
929 bool set_data(const FLAC__byte *data, unsigned length);
930 bool set_data(FLAC__byte *data, unsigned length, bool copy);
931 };
932
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000933 /* \} */
934
Josh Coalsonb2b53582002-05-31 06:20:50 +0000935
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000936 /** \defgroup flacpp_metadata_level0 FLAC++/metadata.h: metadata level 0 interface
937 * \ingroup flacpp_metadata
938 *
939 * \brief
Josh Coalson1aca6b12004-07-30 01:54:29 +0000940 * Level 0 metadata iterators.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000941 *
Josh Coalson4dc35072002-08-20 03:56:52 +0000942 * See the \link flac_metadata_level0 C layer equivalent \endlink
943 * for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000944 *
945 * \{
946 */
947
Josh Coalson20ad84a2006-10-07 05:43:01 +0000948 FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo); ///< See FLAC__metadata_get_streaminfo().
Josh Coalson2c75bd82004-12-30 03:55:00 +0000949
Josh Coalson20ad84a2006-10-07 05:43:01 +0000950 FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags); ///< See FLAC__metadata_get_tags().
951 FLACPP_API bool get_tags(const char *filename, VorbisComment &tags); ///< See FLAC__metadata_get_tags().
Josh Coalsonfb74f102002-05-22 05:33:29 +0000952
Josh Coalson20ad84a2006-10-07 05:43:01 +0000953 FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet); ///< See FLAC__metadata_get_cuesheet().
954 FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet); ///< See FLAC__metadata_get_cuesheet().
Josh Coalsone343ab22006-09-23 19:21:19 +0000955
Josh Coalson20ad84a2006-10-07 05:43:01 +0000956 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().
957 FLACPP_API bool get_picture(const char *filename, Picture &picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors); ///< See FLAC__metadata_get_picture().
Josh Coalson7cfac0b2006-04-10 05:37:34 +0000958
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000959 /* \} */
960
Josh Coalsonb2b53582002-05-31 06:20:50 +0000961
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000962 /** \defgroup flacpp_metadata_level1 FLAC++/metadata.h: metadata level 1 interface
963 * \ingroup flacpp_metadata
964 *
Josh Coalson4dc35072002-08-20 03:56:52 +0000965 * \brief
966 * Level 1 metadata iterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000967 *
Josh Coalson4dc35072002-08-20 03:56:52 +0000968 * The flow through the iterator in the C++ layer is similar
969 * to the C layer:
970 * - Create a SimpleIterator instance
971 * - Check SimpleIterator::is_valid()
972 * - Call SimpleIterator::init() and check the return
973 * - Traverse and/or edit. Edits are written to file
974 * immediately.
975 * - Destroy the SimpleIterator instance
976 *
977 * The ownership of pointers in the C++ layer follows that in
978 * the C layer, i.e.
979 * - The objects returned by get_block() are yours to
980 * modify, but changes are not reflected in the FLAC file
981 * until you call set_block(). The objects are also
982 * yours to delete; they are not automatically deleted
983 * when passed to set_block() or insert_block_after().
984 *
985 * See the \link flac_metadata_level1 C layer equivalent \endlink
986 * for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000987 *
988 * \{
989 */
990
Josh Coalson402da702002-08-21 03:40:11 +0000991 /** This class is a wrapper around the FLAC__metadata_simple_iterator
Josh Coalson20ad84a2006-10-07 05:43:01 +0000992 * structures and methods; see the
993 * \link flacpp_metadata_level1 usage guide \endlink and
994 * ::FLAC__Metadata_SimpleIterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +0000995 */
Josh Coalson55bc5872002-10-16 22:18:32 +0000996 class FLACPP_API SimpleIterator {
Josh Coalsonfb74f102002-05-22 05:33:29 +0000997 public:
Josh Coalson20ad84a2006-10-07 05:43:01 +0000998 /** This class is a wrapper around FLAC__Metadata_SimpleIteratorStatus.
999 */
Josh Coalson55bc5872002-10-16 22:18:32 +00001000 class FLACPP_API Status {
Josh Coalsonfb74f102002-05-22 05:33:29 +00001001 public:
Josh Coalsoncc682512002-06-08 04:53:42 +00001002 inline Status(::FLAC__Metadata_SimpleIteratorStatus status): status_(status) { }
1003 inline operator ::FLAC__Metadata_SimpleIteratorStatus() const { return status_; }
1004 inline const char *as_cstring() const { return ::FLAC__Metadata_SimpleIteratorStatusString[status_]; }
Josh Coalsonfb74f102002-05-22 05:33:29 +00001005 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001006 ::FLAC__Metadata_SimpleIteratorStatus status_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001007 };
1008
1009 SimpleIterator();
1010 virtual ~SimpleIterator();
1011
Josh Coalson3c917542006-10-15 07:50:44 +00001012 bool is_valid() const; ///< Returns \c true iff object was properly constructed.
1013
Josh Coalson20ad84a2006-10-07 05:43:01 +00001014 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 +00001015
Josh Coalson20ad84a2006-10-07 05:43:01 +00001016 Status status(); ///< See FLAC__metadata_simple_iterator_status().
1017 bool is_writable() const; ///< See FLAC__metadata_simple_iterator_is_writable().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001018
Josh Coalson20ad84a2006-10-07 05:43:01 +00001019 bool next(); ///< See FLAC__metadata_simple_iterator_next().
1020 bool prev(); ///< See FLAC__metadata_simple_iterator_prev().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001021
Josh Coalson20ad84a2006-10-07 05:43:01 +00001022 ::FLAC__MetadataType get_block_type() const; ///< See FLAC__metadata_simple_iterator_get_block_type().
1023 Prototype *get_block(); ///< See FLAC__metadata_simple_iterator_get_block().
1024 bool set_block(Prototype *block, bool use_padding = true); ///< See FLAC__metadata_simple_iterator_set_block().
1025 bool insert_block_after(Prototype *block, bool use_padding = true); ///< See FLAC__metadata_simple_iterator_insert_block_after().
1026 bool delete_block(bool use_padding = true); ///< See FLAC__metadata_simple_iterator_delete_block().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001027
1028 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001029 ::FLAC__Metadata_SimpleIterator *iterator_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001030 void clear();
1031 };
1032
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001033 /* \} */
1034
Josh Coalsonb2b53582002-05-31 06:20:50 +00001035
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001036 /** \defgroup flacpp_metadata_level2 FLAC++/metadata.h: metadata level 2 interface
1037 * \ingroup flacpp_metadata
1038 *
Josh Coalson4dc35072002-08-20 03:56:52 +00001039 * \brief
1040 * Level 2 metadata iterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001041 *
Josh Coalson4dc35072002-08-20 03:56:52 +00001042 * The flow through the iterator in the C++ layer is similar
1043 * to the C layer:
1044 * - Create a Chain instance
1045 * - Check Chain::is_valid()
1046 * - Call Chain::read() and check the return
1047 * - Traverse and/or edit with an Iterator or with
1048 * Chain::merge_padding() or Chain::sort_padding()
1049 * - Write changes back to FLAC file with Chain::write()
1050 * - Destroy the Chain instance
1051 *
Josh Coalson8b9a4772002-12-28 07:03:26 +00001052 * The ownership of pointers in the C++ layer is slightly
1053 * different than in the C layer, i.e.
1054 * - The objects returned by Iterator::get_block() are NOT
1055 * owned by the iterator and should be deleted by the
1056 * caller when finished, BUT, when you modify the block,
1057 * it will directly edit what's in the chain and you do
1058 * not need to call Iterator::set_block(). However the
1059 * changes will not be reflected in the FLAC file until
1060 * the chain is written with Chain::write().
Josh Coalson4dc35072002-08-20 03:56:52 +00001061 * - When you pass an object to Iterator::set_block(),
1062 * Iterator::insert_block_before(), or
1063 * Iterator::insert_block_after(), the iterator takes
Josh Coalson8b9a4772002-12-28 07:03:26 +00001064 * ownership of the block and it will be deleted by the
Josh Coalson4dc35072002-08-20 03:56:52 +00001065 * chain.
1066 *
1067 * See the \link flac_metadata_level2 C layer equivalent \endlink
1068 * for more.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001069 *
1070 * \{
1071 */
1072
Josh Coalson402da702002-08-21 03:40:11 +00001073 /** This class is a wrapper around the FLAC__metadata_chain
Josh Coalson20ad84a2006-10-07 05:43:01 +00001074 * structures and methods; see the
1075 * \link flacpp_metadata_level2 usage guide \endlink and
1076 * ::FLAC__Metadata_Chain.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001077 */
Josh Coalson55bc5872002-10-16 22:18:32 +00001078 class FLACPP_API Chain {
Josh Coalsonfb74f102002-05-22 05:33:29 +00001079 public:
Josh Coalson20ad84a2006-10-07 05:43:01 +00001080 /** This class is a wrapper around FLAC__Metadata_ChainStatus.
1081 */
Josh Coalson55bc5872002-10-16 22:18:32 +00001082 class FLACPP_API Status {
Josh Coalsonfb74f102002-05-22 05:33:29 +00001083 public:
Josh Coalsoncc682512002-06-08 04:53:42 +00001084 inline Status(::FLAC__Metadata_ChainStatus status): status_(status) { }
1085 inline operator ::FLAC__Metadata_ChainStatus() const { return status_; }
1086 inline const char *as_cstring() const { return ::FLAC__Metadata_ChainStatusString[status_]; }
Josh Coalsonfb74f102002-05-22 05:33:29 +00001087 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001088 ::FLAC__Metadata_ChainStatus status_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001089 };
1090
1091 Chain();
1092 virtual ~Chain();
1093
1094 friend class Iterator;
1095
Josh Coalson3c917542006-10-15 07:50:44 +00001096 bool is_valid() const; ///< Returns \c true iff object was properly constructed.
1097
Josh Coalson20ad84a2006-10-07 05:43:01 +00001098 Status status(); ///< See FLAC__metadata_chain_status().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001099
Josh Coalson7d273b42006-11-15 06:12:30 +00001100 bool read(const char *filename, bool is_ogg = false); ///< See FLAC__metadata_chain_read(), FLAC__metadata_chain_read_ogg().
1101 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 +00001102
Josh Coalson20ad84a2006-10-07 05:43:01 +00001103 bool check_if_tempfile_needed(bool use_padding); ///< See FLAC__metadata_chain_check_if_tempfile_needed().
Josh Coalsondeab4622004-07-15 16:22:43 +00001104
Josh Coalson20ad84a2006-10-07 05:43:01 +00001105 bool write(bool use_padding = true, bool preserve_file_stats = false); ///< See FLAC__metadata_chain_write().
1106 bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks); ///< See FLAC__metadata_chain_write_with_callbacks().
1107 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 +00001108
Josh Coalson20ad84a2006-10-07 05:43:01 +00001109 void merge_padding(); ///< See FLAC__metadata_chain_merge_padding().
1110 void sort_padding(); ///< See FLAC__metadata_chain_sort_padding().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001111
1112 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001113 ::FLAC__Metadata_Chain *chain_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001114 virtual void clear();
1115 };
1116
Josh Coalson402da702002-08-21 03:40:11 +00001117 /** This class is a wrapper around the FLAC__metadata_iterator
Josh Coalson20ad84a2006-10-07 05:43:01 +00001118 * structures and methods; see the
1119 * \link flacpp_metadata_level2 usage guide \endlink and
1120 * ::FLAC__Metadata_Iterator.
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001121 */
Josh Coalson55bc5872002-10-16 22:18:32 +00001122 class FLACPP_API Iterator {
Josh Coalsonfb74f102002-05-22 05:33:29 +00001123 public:
1124 Iterator();
1125 virtual ~Iterator();
1126
Josh Coalson3c917542006-10-15 07:50:44 +00001127 bool is_valid() const; ///< Returns \c true iff object was properly constructed.
1128
Josh Coalsonfb74f102002-05-22 05:33:29 +00001129
Josh Coalson20ad84a2006-10-07 05:43:01 +00001130 void init(Chain &chain); ///< See FLAC__metadata_iterator_init().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001131
Josh Coalson20ad84a2006-10-07 05:43:01 +00001132 bool next(); ///< See FLAC__metadata_iterator_next().
1133 bool prev(); ///< See FLAC__metadata_iterator_prev().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001134
Josh Coalson20ad84a2006-10-07 05:43:01 +00001135 ::FLAC__MetadataType get_block_type() const; ///< See FLAC__metadata_iterator_get_block_type().
1136 Prototype *get_block(); ///< See FLAC__metadata_iterator_get_block().
1137 bool set_block(Prototype *block); ///< See FLAC__metadata_iterator_set_block().
1138 bool delete_block(bool replace_with_padding); ///< See FLAC__metadata_iterator_delete_block().
1139 bool insert_block_before(Prototype *block); ///< See FLAC__metadata_iterator_insert_block_before().
1140 bool insert_block_after(Prototype *block); ///< See FLAC__metadata_iterator_insert_block_after().
Josh Coalsonfb74f102002-05-22 05:33:29 +00001141
1142 protected:
Josh Coalsoncc682512002-06-08 04:53:42 +00001143 ::FLAC__Metadata_Iterator *iterator_;
Josh Coalsonfb74f102002-05-22 05:33:29 +00001144 virtual void clear();
Josh Coalsonfda98fb2002-05-17 06:33:39 +00001145 };
1146
Josh Coalsonf6efd9c2002-07-27 04:59:54 +00001147 /* \} */
1148
Josh Coalsonc71bfe92005-01-25 02:27:20 +00001149 }
1150}
Josh Coalsonfda98fb2002-05-17 06:33:39 +00001151
1152#endif