update copyright to 2004
[platform/upstream/flac.git] / include / FLAC / metadata.h
1 /* libFLAC - Free Lossless Audio Codec library
2  * Copyright (C) 2001,2002,2003,2004  Josh Coalson
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * - Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * - 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.
30  */
31
32 #ifndef FLAC__METADATA_H
33 #define FLAC__METADATA_H
34
35 #include "export.h"
36 #include "format.h"
37
38 /******************************************************************************
39         (For an example of how all these routines are used, see the source
40         code for the unit tests in src/test_libFLAC/metadata_*.c, or metaflac
41         in src/metaflac/)
42 ******************************************************************************/
43
44 /** \file include/FLAC/metadata.h
45  *
46  *  \brief
47  *  This module provides functions for creating and manipulating FLAC
48  *  metadata blocks in memory, and three progressively more powerful
49  *  interfaces for traversing and editing metadata in FLAC files.
50  *
51  *  See the detailed documentation for each interface in the
52  *  \link flac_metadata metadata \endlink module.
53  */
54
55 /** \defgroup flac_metadata FLAC/metadata.h: metadata interfaces
56  *  \ingroup flac
57  *
58  *  \brief
59  *  This module provides functions for creating and manipulating FLAC
60  *  metadata blocks in memory, and three progressively more powerful
61  *  interfaces for traversing and editing metadata in FLAC files.
62  *
63  *  There are three metadata interfaces of increasing complexity:
64  *
65  *  Level 0:
66  *  Read-only access to the STREAMINFO block.
67  *
68  *  Level 1:
69  *  Read-write access to all metadata blocks.  This level is write-
70  *  efficient in most cases (more on this below), and uses less memory
71  *  than level 2.
72  *
73  *  Level 2:
74  *  Read-write access to all metadata blocks.  This level is write-
75  *  efficient in all cases, but uses more memory since all metadata for
76  *  the whole file is read into memory and manipulated before writing
77  *  out again.
78  *
79  *  What do we mean by efficient?  When writing metadata back to a FLAC
80  *  file it is possible to grow or shrink the metadata such that the entire
81  *  file must be rewritten.  However, if the size remains the same during
82  *  changes or PADDING blocks are utilized, only the metadata needs to be
83  *  overwritten, which is much faster.
84  *
85  *  Efficient means the whole file is rewritten at most one time, and only
86  *  when necessary.  Level 1 is not efficient only in the case that you
87  *  cause more than one metadata block to grow or shrink beyond what can
88  *  be accomodated by padding.  In this case you should probably use level
89  *  2, which allows you to edit all the metadata for a file in memory and
90  *  write it out all at once.
91  *
92  *  All levels know how to skip over and not disturb an ID3v2 tag at the
93  *  front of the file.
94  *
95  *  In addition to the three interfaces, this module defines functions for
96  *  creating and manipulating various metadata objects in memory.  As we see
97  *  from the Format module, FLAC metadata blocks in memory are very primitive
98  *  structures for storing information in an efficient way.  Reading
99  *  information from the structures is easy but creating or modifying them
100  *  directly is more complex.  The metadata object routines here facilitate
101  *  this by taking care of the consistency and memory management drudgery.
102  *
103  *  Unless you will be using the level 1 or 2 interfaces to modify existing
104  *  metadata however, you will not probably not need these.
105  *
106  *  From a dependency standpoint, none of the encoders or decoders require
107  *  the metadata module.  This is so that embedded users can strip out the
108  *  metadata module from libFLAC to reduce the size and complexity.
109  */
110
111 #ifdef __cplusplus
112 extern "C" {
113 #endif
114
115
116 /** \defgroup flac_metadata_level0 FLAC/metadata.h: metadata level 0 interface
117  *  \ingroup flac_metadata
118  *
119  *  \brief
120  *  The level 0 interface consists of a single routine to read the
121  *  STREAMINFO block.
122  *
123  *  It skips any ID3v2 tag at the head of the file.
124  *
125  * \{
126  */
127
128 /** Read the STREAMINFO metadata block of the given FLAC file.  This function
129  *  will skip any ID3v2 tag at the head of the file.
130  *
131  * \param filename    The path to the FLAC file to read.
132  * \param streaminfo  A pointer to space for the STREAMINFO block.
133  * \assert
134  *    \code filename != NULL \endcode
135  *    \code streaminfo != NULL \endcode
136  * \retval FLAC__bool
137  *    \c true if a valid STREAMINFO block was read from \a filename.  Returns
138  *    \c false if there was a memory allocation error, a file decoder error,
139  *    or the file contained no STREAMINFO block.
140  */
141 FLAC_API FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata *streaminfo);
142
143 /* \} */
144
145
146 /** \defgroup flac_metadata_level1 FLAC/metadata.h: metadata level 1 interface
147  *  \ingroup flac_metadata
148  *
149  * \brief
150  * The level 1 interface provides read-write access to FLAC file metadata and
151  * operates directly on the FLAC file.
152  *
153  * The general usage of this interface is:
154  *
155  * - Create an iterator using FLAC__metadata_simple_iterator_new()
156  * - Attach it to a file using FLAC__metadata_simple_iterator_init() and check
157  *   the exit code.  Call FLAC__metadata_simple_iterator_is_writable() to
158  *   see if the file is writable, or read-only access is allowed.
159  * - Use FLAC__metadata_simple_iterator_next() and
160  *   FLAC__metadata_simple_iterator_prev() to move around the blocks.
161  *   This is does not read the actual blocks themselves.
162  *   FLAC__metadata_simple_iterator_next() is relatively fast.
163  *   FLAC__metadata_simple_iterator_prev() is slower since it needs to search
164  *   forward from the front of the file.
165  * - Use FLAC__metadata_simple_iterator_get_block_type() or
166  *   FLAC__metadata_simple_iterator_get_block() to access the actual data at
167  *   the current iterator position.  The returned object is yours to modify
168  *   and free.
169  * - Use FLAC__metadata_simple_iterator_set_block() to write a modified block
170  *   back.  You must have write permission to the original file.  Make sure to
171  *   read the whole comment to FLAC__metadata_simple_iterator_set_block()
172  *   below.
173  * - Use FLAC__metadata_simple_iterator_insert_block_after() to add new blocks.
174  *   Use the object creation functions from
175  *   \link flac_metadata_object here \endlink to generate new objects.
176  * - Use FLAC__metadata_simple_iterator_delete_block() to remove the block
177  *   currently referred to by the iterator, or replace it with padding.
178  * - Destroy the iterator with FLAC__metadata_simple_iterator_delete() when
179  *   finished.
180  *
181  * \note
182  * The FLAC file remains open the whole time between
183  * FLAC__metadata_simple_iterator_init() and
184  * FLAC__metadata_simple_iterator_delete(), so make sure you are not altering
185  * the file during this time.
186  *
187  * \note
188  * Do not modify the \a is_last, \a length, or \a type fields of returned
189  * FLAC__MetadataType objects.  These are managed automatically.
190  *
191  * \note
192  * If any of the modification functions
193  * (FLAC__metadata_simple_iterator_set_block(),
194  * FLAC__metadata_simple_iterator_delete_block(),
195  * FLAC__metadata_simple_iterator_insert_block_after(), etc.) return \c false,
196  * you should delete the iterator as it may no longer be valid.
197  *
198  * \{
199  */
200
201 struct FLAC__Metadata_SimpleIterator;
202 /** The opaque structure definition for the level 1 iterator type.
203  *  See the
204  *  \link flac_metadata_level1 metadata level 1 module \endlink
205  *  for a detailed description.
206  */
207 typedef struct FLAC__Metadata_SimpleIterator FLAC__Metadata_SimpleIterator;
208
209 /** Status type for FLAC__Metadata_SimpleIterator.
210  *
211  *  The iterator's current status can be obtained by calling FLAC__metadata_simple_iterator_status().
212  */
213 typedef enum {
214
215         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK = 0,
216         /**< The iterator is in the normal OK state */
217
218         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT,
219         /**< The data passed into a function violated the function's usage criteria */
220
221         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE,
222         /**< The iterator could not open the target file */
223
224         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE,
225         /**< The iterator could not find the FLAC signature at the start of the file */
226
227         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE,
228         /**< The iterator tried to write to a file that was not writable */
229
230         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA,
231         /**< The iterator encountered input that does not conform to the FLAC metadata specification */
232
233         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR,
234         /**< The iterator encountered an error while reading the FLAC file */
235
236         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR,
237         /**< The iterator encountered an error while seeking in the FLAC file */
238
239         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR,
240         /**< The iterator encountered an error while writing the FLAC file */
241
242         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR,
243         /**< The iterator encountered an error renaming the FLAC file */
244
245         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR,
246         /**< The iterator encountered an error removing the temporary file */
247
248         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR,
249         /**< Memory allocation failed */
250
251         FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR
252         /**< The caller violated an assertion or an unexpected error occurred */
253
254 } FLAC__Metadata_SimpleIteratorStatus;
255
256 /** Maps a FLAC__Metadata_SimpleIteratorStatus to a C string.
257  *
258  *  Using a FLAC__Metadata_SimpleIteratorStatus as the index to this array
259  *  will give the string equivalent.  The contents should not be modified.
260  */
261 extern FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[];
262
263
264 /** Create a new iterator instance.
265  *
266  * \retval FLAC__Metadata_SimpleIterator*
267  *    \c NULL if there was an error allocating memory, else the new instance.
268  */
269 FLAC_API FLAC__Metadata_SimpleIterator *FLAC__metadata_simple_iterator_new();
270
271 /** Free an iterator instance.  Deletes the object pointed to by \a iterator.
272  *
273  * \param iterator  A pointer to an existing iterator.
274  * \assert
275  *    \code iterator != NULL \endcode
276  */
277 FLAC_API void FLAC__metadata_simple_iterator_delete(FLAC__Metadata_SimpleIterator *iterator);
278
279 /** Get the current status of the iterator.  Call this after a function
280  *  returns \c false to get the reason for the error.  Also resets the status
281  *  to FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK.
282  *
283  * \param iterator  A pointer to an existing iterator.
284  * \assert
285  *    \code iterator != NULL \endcode
286  * \retval FLAC__Metadata_SimpleIteratorStatus
287  *    The current status of the iterator.
288  */
289 FLAC_API FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_status(FLAC__Metadata_SimpleIterator *iterator);
290
291 /** Initialize the iterator to point to the first metadata block in the
292  *  given FLAC file.
293  *
294  * \param iterator             A pointer to an existing iterator.
295  * \param filename             The path to the FLAC file.
296  * \param read_only            If \c true, the FLAC file will be opened
297  *                             in read-only mode; if \c false, the FLAC
298  *                             file will be opened for edit even if no
299  *                             edits are performed.
300  * \param preserve_file_stats  If \c true, the owner and modification
301  *                             time will be preserved even if the FLAC
302  *                             file is written to.
303  * \assert
304  *    \code iterator != NULL \endcode
305  *    \code filename != NULL \endcode
306  * \retval FLAC__bool
307  *    \c false if a memory allocation error occurs, the file can't be
308  *    opened, or another error occurs, else \c true.
309  */
310 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool read_only, FLAC__bool preserve_file_stats);
311
312 /** Returns \c true if the FLAC file is writable.  If \c false, calls to
313  *  FLAC__metadata_simple_iterator_set_block() and
314  *  FLAC__metadata_simple_iterator_insert_block_after() will fail.
315  *
316  * \param iterator             A pointer to an existing iterator.
317  * \assert
318  *    \code iterator != NULL \endcode
319  * \retval FLAC__bool
320  *    See above.
321  */
322 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_writable(const FLAC__Metadata_SimpleIterator *iterator);
323
324 /** Moves the iterator forward one metadata block, returning \c false if
325  *  already at the end.
326  *
327  * \param iterator  A pointer to an existing initialized iterator.
328  * \assert
329  *    \code iterator != NULL \endcode
330  *    \a iterator has been successfully initialized with
331  *    FLAC__metadata_simple_iterator_init()
332  * \retval FLAC__bool
333  *    \c false if already at the last metadata block of the chain, else
334  *    \c true.
335  */
336 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIterator *iterator);
337
338 /** Moves the iterator backward one metadata block, returning \c false if
339  *  already at the beginning.
340  *
341  * \param iterator  A pointer to an existing initialized iterator.
342  * \assert
343  *    \code iterator != NULL \endcode
344  *    \a iterator has been successfully initialized with
345  *    FLAC__metadata_simple_iterator_init()
346  * \retval FLAC__bool
347  *    \c false if already at the first metadata block of the chain, else
348  *    \c true.
349  */
350 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator);
351
352 /** Get the type of the metadata block at the current position.  This
353  *  avoids reading the actual block data which can save time for large
354  *  blocks.
355  *
356  * \param iterator  A pointer to an existing initialized iterator.
357  * \assert
358  *    \code iterator != NULL \endcode
359  *    \a iterator has been successfully initialized with
360  *    FLAC__metadata_simple_iterator_init()
361  * \retval FLAC__MetadataType
362  *    The type of the metadata block at the current iterator position.
363  */
364
365 FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator);
366
367 /** Get the metadata block at the current position.  You can modify the
368  *  block but must use FLAC__metadata_simple_iterator_set_block() to
369  *  write it back to the FLAC file.
370  *
371  *  You must call FLAC__metadata_object_delete() on the returned object
372  *  when you are finished with it.
373  *
374  * \param iterator  A pointer to an existing initialized iterator.
375  * \assert
376  *    \code iterator != NULL \endcode
377  *    \a iterator has been successfully initialized with
378  *    FLAC__metadata_simple_iterator_init()
379  * \retval FLAC__StreamMetadata*
380  *    The current metadata block.
381  */
382 FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Metadata_SimpleIterator *iterator);
383
384 /** Write a block back to the FLAC file.  This function tries to be
385  *  as efficient as possible; how the block is actually written is
386  *  shown by the following:
387  *
388  *  Existing block is a STREAMINFO block and the new block is a
389  *  STREAMINFO block: the new block is written in place.  Make sure
390  *  you know what you're doing when changing the values of a
391  *  STREAMINFO block.
392  *
393  *  Existing block is a STREAMINFO block and the new block is a
394  *  not a STREAMINFO block: this is an error since the first block
395  *  must be a STREAMINFO block.  Returns \c false without altering the
396  *  file.
397  *
398  *  Existing block is not a STREAMINFO block and the new block is a
399  *  STREAMINFO block: this is an error since there may be only one
400  *  STREAMINFO block.  Returns \c false without altering the file.
401  *
402  *  Existing block and new block are the same length: the existing
403  *  block will be replaced by the new block, written in place.
404  *
405  *  Existing block is longer than new block: if use_padding is \c true,
406  *  the existing block will be overwritten in place with the new
407  *  block followed by a PADDING block, if possible, to make the total
408  *  size the same as the existing block.  Remember that a padding
409  *  block requires at least four bytes so if the difference in size
410  *  between the new block and existing block is less than that, the
411  *  entire file will have to be rewritten, using the new block's
412  *  exact size.  If use_padding is \c false, the entire file will be
413  *  rewritten, replacing the existing block by the new block.
414  *
415  *  Existing block is shorter than new block: if use_padding is \c true,
416  *  the function will try and expand the new block into the following
417  *  PADDING block, if it exists and doing so won't shrink the PADDING
418  *  block to less than 4 bytes.  If there is no following PADDING
419  *  block, or it will shrink to less than 4 bytes, or use_padding is
420  *  \c false, the entire file is rewritten, replacing the existing block
421  *  with the new block.  Note that in this case any following PADDING
422  *  block is preserved as is.
423  *
424  *  After writing the block, the iterator will remain in the same
425  *  place, i.e. pointing to the new block.
426  *
427  * \param iterator     A pointer to an existing initialized iterator.
428  * \param block        The block to set.
429  * \param use_padding  See above.
430  * \assert
431  *    \code iterator != NULL \endcode
432  *    \a iterator has been successfully initialized with
433  *    FLAC__metadata_simple_iterator_init()
434  *    \code block != NULL \endcode
435  * \retval FLAC__bool
436  *    \c true if successful, else \c false.
437  */
438 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding);
439
440 /** This is similar to FLAC__metadata_simple_iterator_set_block()
441  *  except that instead of writing over an existing block, it appends
442  *  a block after the existing block.  \a use_padding is again used to
443  *  tell the function to try an expand into following padding in an
444  *  attempt to avoid rewriting the entire file.
445  *
446  *  This function will fail and return \c false if given a STREAMINFO
447  *  block.
448  *
449  *  After writing the block, the iterator will be pointing to the
450  *  new block.
451  *
452  * \param iterator     A pointer to an existing initialized iterator.
453  * \param block        The block to set.
454  * \param use_padding  See above.
455  * \assert
456  *    \code iterator != NULL \endcode
457  *    \a iterator has been successfully initialized with
458  *    FLAC__metadata_simple_iterator_init()
459  *    \code block != NULL \endcode
460  * \retval FLAC__bool
461  *    \c true if successful, else \c false.
462  */
463 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding);
464
465 /** Deletes the block at the current position.  This will cause the
466  *  entire FLAC file to be rewritten, unless \a use_padding is \c true,
467  *  in which case the block will be replaced by an equal-sized PADDING
468  *  block.  The iterator will be left pointing to the block before the
469  *  one just deleted.
470  *
471  *  You may not delete the STREAMINFO block.
472  *
473  * \param iterator     A pointer to an existing initialized iterator.
474  * \param use_padding  See above.
475  * \assert
476  *    \code iterator != NULL \endcode
477  *    \a iterator has been successfully initialized with
478  *    FLAC__metadata_simple_iterator_init()
479  * \retval FLAC__bool
480  *    \c true if successful, else \c false.
481  */
482 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool use_padding);
483
484 /* \} */
485
486
487 /** \defgroup flac_metadata_level2 FLAC/metadata.h: metadata level 2 interface
488  *  \ingroup flac_metadata
489  *
490  * \brief
491  * The level 2 interface provides read-write access to FLAC file metadata;
492  * all metadata is read into memory, operated on in memory, and then written
493  * to file, which is more efficient than level 1 when editing multiple blocks.
494  *
495  * The general usage of this interface is:
496  *
497  * - Create a new chain using FLAC__metadata_chain_new().  A chain is a
498  *   linked list of FLAC metadata blocks.
499  * - Read all metadata into the the chain from a FLAC file using
500  *   FLAC__metadata_chain_read() and check the status.
501  * - Optionally, consolidate the padding using
502  *   FLAC__metadata_chain_merge_padding() or
503  *   FLAC__metadata_chain_sort_padding().
504  * - Create a new iterator using FLAC__metadata_iterator_new()
505  * - Initialize the iterator to point to the first element in the chain
506  *   using FLAC__metadata_iterator_init()
507  * - Traverse the chain using FLAC__metadata_iterator_next and
508  *   FLAC__metadata_iterator_prev().
509  * - Get a block for reading or modification using
510  *   FLAC__metadata_iterator_get_block().  The pointer to the object
511  *   inside the chain is returned, so the block is yours to modify.
512  *   Changes will be reflected in the FLAC file when you write the
513  *   chain.  You can also add and delete blocks (see functions below).
514  * - When done, write out the chain using FLAC__metadata_chain_write().
515  *   Make sure to read the whole comment to the function below.
516  * - Delete the chain using FLAC__metadata_chain_delete().
517  *
518  * \note
519  * Even though the FLAC file is not open while the chain is being
520  * manipulated, you must not alter the file externally during
521  * this time.  The chain assumes the FLAC file will not change
522  * between the time of FLAC__metadata_chain_read() and
523  * FLAC__metadata_chain_write().
524  *
525  * \note
526  * Do not modify the is_last, length, or type fields of returned
527  * FLAC__MetadataType objects.  These are managed automatically.
528  *
529  * \note
530  * The metadata objects returned by FLAC__metadata_iterator_get_block()
531  * are owned by the chain; do not FLAC__metadata_object_delete() them.
532  * In the same way, blocks passed to FLAC__metadata_iterator_set_block()
533  * become owned by the chain and they will be deleted when the chain is
534  * deleted.
535  *
536  * \{
537  */
538
539 struct FLAC__Metadata_Chain;
540 /** The opaque structure definition for the level 2 chain type.
541  */
542 typedef struct FLAC__Metadata_Chain FLAC__Metadata_Chain;
543
544 struct FLAC__Metadata_Iterator;
545 /** The opaque structure definition for the level 2 iterator type.
546  */
547 typedef struct FLAC__Metadata_Iterator FLAC__Metadata_Iterator;
548
549 typedef enum {
550         FLAC__METADATA_CHAIN_STATUS_OK = 0,
551         /**< The chain is in the normal OK state */
552
553         FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT,
554         /**< The data passed into a function violated the function's usage criteria */
555
556         FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE,
557         /**< The chain could not open the target file */
558
559         FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE,
560         /**< The chain could not find the FLAC signature at the start of the file */
561
562         FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE,
563         /**< The chain tried to write to a file that was not writable */
564
565         FLAC__METADATA_CHAIN_STATUS_BAD_METADATA,
566         /**< The chain encountered input that does not conform to the FLAC metadata specification */
567
568         FLAC__METADATA_CHAIN_STATUS_READ_ERROR,
569         /**< The chain encountered an error while reading the FLAC file */
570
571         FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR,
572         /**< The chain encountered an error while seeking in the FLAC file */
573
574         FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR,
575         /**< The chain encountered an error while writing the FLAC file */
576
577         FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR,
578         /**< The chain encountered an error renaming the FLAC file */
579
580         FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR,
581         /**< The chain encountered an error removing the temporary file */
582
583         FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR,
584         /**< Memory allocation failed */
585
586         FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR
587         /**< The caller violated an assertion or an unexpected error occurred */
588
589 } FLAC__Metadata_ChainStatus;
590
591 /** Maps a FLAC__Metadata_ChainStatus to a C string.
592  *
593  *  Using a FLAC__Metadata_ChainStatus as the index to this array
594  *  will give the string equivalent.  The contents should not be modified.
595  */
596 extern FLAC_API const char * const FLAC__Metadata_ChainStatusString[];
597
598 /*********** FLAC__Metadata_Chain ***********/
599
600 /** Create a new chain instance.
601  *
602  * \retval FLAC__Metadata_Chain*
603  *    \c NULL if there was an error allocating memory, else the new instance.
604  */
605 FLAC_API FLAC__Metadata_Chain *FLAC__metadata_chain_new();
606
607 /** Free a chain instance.  Deletes the object pointed to by \a chain.
608  *
609  * \param chain  A pointer to an existing chain.
610  * \assert
611  *    \code chain != NULL \endcode
612  */
613 FLAC_API void FLAC__metadata_chain_delete(FLAC__Metadata_Chain *chain);
614
615 /** Get the current status of the chain.  Call this after a function
616  *  returns \c false to get the reason for the error.  Also resets the
617  *  status to FLAC__METADATA_CHAIN_STATUS_OK.
618  *
619  * \param chain    A pointer to an existing chain.
620  * \assert
621  *    \code chain != NULL \endcode
622  * \retval FLAC__Metadata_ChainStatus
623  *    The current status of the chain.
624  */
625 FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_Chain *chain);
626
627 /** Read all metadata from a FLAC file into the chain.
628  *
629  * \param chain    A pointer to an existing chain.
630  * \param filename The path to the FLAC file to read.
631  * \assert
632  *    \code chain != NULL \endcode
633  *    \code filename != NULL \endcode
634  * \retval FLAC__bool
635  *    \c true if a valid list of metadata blocks was read from
636  *    \a filename, else \c false.  On failure, check the status with
637  *    FLAC__metadata_chain_status().
638  */
639 FLAC_API FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename);
640
641 /** Write all metadata out to the FLAC file.  This function tries to be as
642  *  efficient as possible; how the metadata is actually written is shown by
643  *  the following:
644  *
645  *  If the current chain is the same size as the existing metadata, the new
646  *  data is written in place.
647  *
648  *  If the current chain is longer than the existing metadata, and
649  *  \a use_padding is \c true, and the last block is a PADDING block of
650  *  sufficient length, the function will truncate the final padding block
651  *  so that the overall size of the metadata is the same as the existing
652  *  metadata, and then just rewrite the metadata.  Otherwise, if not all of
653  *  the above conditions are met, the entire FLAC file must be rewritten.
654  *  If you want to use padding this way it is a good idea to call
655  *  FLAC__metadata_chain_sort_padding() first so that you have the maximum
656  *  amount of padding to work with, unless you need to preserve ordering
657  *  of the PADDING blocks for some reason.
658  *
659  *  If the current chain is shorter than the existing metadata, and
660  *  \a use_padding is \c true, and the final block is a PADDING block, the padding
661  *  is extended to make the overall size the same as the existing data.  If
662  *  \a use_padding is \c true and the last block is not a PADDING block, a new
663  *  PADDING block is added to the end of the new data to make it the same
664  *  size as the existing data (if possible, see the note to
665  *  FLAC__metadata_simple_iterator_set_block() about the four byte limit)
666  *  and the new data is written in place.  If none of the above apply or
667  *  \a use_padding is \c false, the entire FLAC file is rewritten.
668  *
669  *  If \a preserve_file_stats is \c true, the owner and modification time will
670  *  be preserved even if the FLAC file is written.
671  *
672  * \param chain               A pointer to an existing chain.
673  * \param use_padding         See above.
674  * \param preserve_file_stats See above.
675  * \assert
676  *    \code chain != NULL \endcode
677  * \retval FLAC__bool
678  *    \c true if the write succeeded, else \c false.  On failure,
679  *    check the status with FLAC__metadata_chain_status().
680  */
681 FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats);
682
683 /** Merge adjacent PADDING blocks into a single block.
684  *
685  * \note This function does not write to the FLAC file, it only
686  * modifies the chain.
687  *
688  * \warning Any iterator on the current chain will become invalid after this
689  * call.  You should delete the iterator and get a new one.
690  *
691  * \param chain               A pointer to an existing chain.
692  * \assert
693  *    \code chain != NULL \endcode
694  */
695 FLAC_API void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain);
696
697 /** This function will move all PADDING blocks to the end on the metadata,
698  *  then merge them into a single block.
699  *
700  * \note This function does not write to the FLAC file, it only
701  * modifies the chain.
702  *
703  * \warning Any iterator on the current chain will become invalid after this
704  * call.  You should delete the iterator and get a new one.
705  *
706  * \param chain  A pointer to an existing chain.
707  * \assert
708  *    \code chain != NULL \endcode
709  */
710 FLAC_API void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain);
711
712
713 /*********** FLAC__Metadata_Iterator ***********/
714
715 /** Create a new iterator instance.
716  *
717  * \retval FLAC__Metadata_Iterator*
718  *    \c NULL if there was an error allocating memory, else the new instance.
719  */
720 FLAC_API FLAC__Metadata_Iterator *FLAC__metadata_iterator_new();
721
722 /** Free an iterator instance.  Deletes the object pointed to by \a iterator.
723  *
724  * \param iterator  A pointer to an existing iterator.
725  * \assert
726  *    \code iterator != NULL \endcode
727  */
728 FLAC_API void FLAC__metadata_iterator_delete(FLAC__Metadata_Iterator *iterator);
729
730 /** Initialize the iterator to point to the first metadata block in the
731  *  given chain.
732  *
733  * \param iterator  A pointer to an existing iterator.
734  * \param chain     A pointer to an existing and initialized (read) chain.
735  * \assert
736  *    \code iterator != NULL \endcode
737  *    \code chain != NULL \endcode
738  */
739 FLAC_API void FLAC__metadata_iterator_init(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Chain *chain);
740
741 /** Moves the iterator forward one metadata block, returning \c false if
742  *  already at the end.
743  *
744  * \param iterator  A pointer to an existing initialized iterator.
745  * \assert
746  *    \code iterator != NULL \endcode
747  *    \a iterator has been successfully initialized with
748  *    FLAC__metadata_iterator_init()
749  * \retval FLAC__bool
750  *    \c false if already at the last metadata block of the chain, else
751  *    \c true.
752  */
753 FLAC_API FLAC__bool FLAC__metadata_iterator_next(FLAC__Metadata_Iterator *iterator);
754
755 /** Moves the iterator backward one metadata block, returning \c false if
756  *  already at the beginning.
757  *
758  * \param iterator  A pointer to an existing initialized iterator.
759  * \assert
760  *    \code iterator != NULL \endcode
761  *    \a iterator has been successfully initialized with
762  *    FLAC__metadata_iterator_init()
763  * \retval FLAC__bool
764  *    \c false if already at the first metadata block of the chain, else
765  *    \c true.
766  */
767 FLAC_API FLAC__bool FLAC__metadata_iterator_prev(FLAC__Metadata_Iterator *iterator);
768
769 /** Get the type of the metadata block at the current position.
770  *
771  * \param iterator  A pointer to an existing initialized iterator.
772  * \assert
773  *    \code iterator != NULL \endcode
774  *    \a iterator has been successfully initialized with
775  *    FLAC__metadata_iterator_init()
776  * \retval FLAC__MetadataType
777  *    The type of the metadata block at the current iterator position.
778  */
779 FLAC_API FLAC__MetadataType FLAC__metadata_iterator_get_block_type(const FLAC__Metadata_Iterator *iterator);
780
781 /** Get the metadata block at the current position.  You can modify
782  *  the block in place but must write the chain before the changes
783  *  are reflected to the FLAC file.  You do not need to call
784  *  FLAC__metadata_iterator_set_block() to reflect the changes;
785  *  the pointer returned by FLAC__metadata_iterator_get_block()
786  *  points directly into the chain.
787  *
788  * \warning
789  * Do not call FLAC__metadata_object_delete() on the returned object;
790  * to delete a block use FLAC__metadata_iterator_delete_block().
791  *
792  * \param iterator  A pointer to an existing initialized iterator.
793  * \assert
794  *    \code iterator != NULL \endcode
795  *    \a iterator has been successfully initialized with
796  *    FLAC__metadata_iterator_init()
797  * \retval FLAC__StreamMetadata*
798  *    The current metadata block.
799  */
800 FLAC_API FLAC__StreamMetadata *FLAC__metadata_iterator_get_block(FLAC__Metadata_Iterator *iterator);
801
802 /** Set the metadata block at the current position, replacing the existing
803  *  block.  The new block passed in becomes owned by the chain and it will be
804  *  deleted when the chain is deleted.
805  *
806  * \param iterator  A pointer to an existing initialized iterator.
807  * \param block     A pointer to a metadata block.
808  * \assert
809  *    \code iterator != NULL \endcode
810  *    \a iterator has been successfully initialized with
811  *    FLAC__metadata_iterator_init()
812  *    \code block != NULL \endcode
813  * \retval FLAC__bool
814  *    \c false if the conditions in the above description are not met, or
815  *    a memory allocation error occurs, otherwise \c true.
816  */
817 FLAC_API FLAC__bool FLAC__metadata_iterator_set_block(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);
818
819 /** Removes the current block from the chain.  If \a replace_with_padding is
820  *  \c true, the block will instead be replaced with a padding block of equal
821  *  size.  You can not delete the STREAMINFO block.  The iterator will be
822  *  left pointing to the block before the one just "deleted", even if
823  *  \a replace_with_padding is \c true.
824  *
825  * \param iterator              A pointer to an existing initialized iterator.
826  * \param replace_with_padding  See above.
827  * \assert
828  *    \code iterator != NULL \endcode
829  *    \a iterator has been successfully initialized with
830  *    FLAC__metadata_iterator_init()
831  * \retval FLAC__bool
832  *    \c false if the conditions in the above description are not met,
833  *    otherwise \c true.
834  */
835 FLAC_API FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__Metadata_Iterator *iterator, FLAC__bool replace_with_padding);
836
837 /** Insert a new block before the current block.  You cannot insert a block
838  *  before the first STREAMINFO block.  You cannot insert a STREAMINFO block
839  *  as there can be only one, the one that already exists at the head when you
840  *  read in a chain.  The chain takes ownership of the new block and it will be
841  *  deleted when the chain is deleted.  The iterator will be left pointing to
842  *  the new block.
843  *
844  * \param iterator  A pointer to an existing initialized iterator.
845  * \param block     A pointer to a metadata block to insert.
846  * \assert
847  *    \code iterator != NULL \endcode
848  *    \a iterator has been successfully initialized with
849  *    FLAC__metadata_iterator_init()
850  * \retval FLAC__bool
851  *    \c false if the conditions in the above description are not met, or
852  *    a memory allocation error occurs, otherwise \c true.
853  */
854 FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);
855
856 /** Insert a new block after the current block.  You cannot insert a STREAMINFO
857  *  block as there can be only one, the one that already exists at the head when
858  *  you read in a chain.  The chain takes ownership of the new block and it will
859  *  be deleted when the chain is deleted.  The iterator will be left pointing to
860  *  the new block.
861  *
862  * \param iterator  A pointer to an existing initialized iterator.
863  * \param block     A pointer to a metadata block to insert.
864  * \assert
865  *    \code iterator != NULL \endcode
866  *    \a iterator has been successfully initialized with
867  *    FLAC__metadata_iterator_init()
868  * \retval FLAC__bool
869  *    \c false if the conditions in the above description are not met, or
870  *    a memory allocation error occurs, otherwise \c true.
871  */
872 FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);
873
874 /* \} */
875
876
877 /** \defgroup flac_metadata_object FLAC/metadata.h: metadata object methods
878  *  \ingroup flac_metadata
879  *
880  * \brief
881  * This module contains methods for manipulating FLAC metadata objects.
882  *
883  * Since many are variable length we have to be careful about the memory
884  * management.  We decree that all pointers to data in the object are
885  * owned by the object and memory-managed by the object.
886  *
887  * Use the FLAC__metadata_object_new() and FLAC__metadata_object_delete()
888  * functions to create all instances.  When using the
889  * FLAC__metadata_object_set_*() functions to set pointers to data, set
890  * \a copy to \c true to have the function make it's own copy of the data, or
891  * to \c false to give the object ownership of your data.  In the latter case
892  * your pointer must be freeable by free() and will be free()d when the object
893  * is FLAC__metadata_object_delete()d.  It is legal to pass a null pointer as
894  * the data pointer to a FLAC__metadata_object_set_*() function as long as
895  * the length argument is 0 and the \a copy argument is \c false.
896  *
897  * The FLAC__metadata_object_new() and FLAC__metadata_object_clone() function
898  * will return \c NULL in the case of a memory allocation error, otherwise a new
899  * object.  The FLAC__metadata_object_set_*() functions return \c false in the
900  * case of a memory allocation error.
901  *
902  * We don't have the convenience of C++ here, so note that the library relies
903  * on you to keep the types straight.  In other words, if you pass, for
904  * example, a FLAC__StreamMetadata* that represents a STREAMINFO block to
905  * FLAC__metadata_object_application_set_data(), you will get an assertion
906  * failure.
907  *
908  * There is no need to recalculate the length field on metadata blocks you
909  * have modified.  They will be calculated automatically before they  are
910  * written back to a file.
911  *
912  * \{
913  */
914
915
916 /** Create a new metadata object instance of the given type.
917  *
918  *  The object will be "empty"; i.e. values and data pointers will be \c 0,
919  *  with the exception of FLAC__METADATA_TYPE_VORBIS_COMMENT, which will have
920  *  the vendor string set (but zero comments).
921  *
922  *  Do not pass in a value greater than or equal to
923  *  \a FLAC__METADATA_TYPE_UNDEFINED unless you really know what you're
924  *  doing.
925  *
926  * \param type  Type of object to create
927  * \retval FLAC__StreamMetadata*
928  *    \c NULL if there was an error allocating memory, else the new instance.
929  */
930 FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type);
931
932 /** Create a copy of an existing metadata object.
933  *
934  *  The copy is a "deep" copy, i.e. dynamically allocated data within the
935  *  object is also copied.  The caller takes ownership of the new block and
936  *  is responsible for freeing it with FLAC__metadata_object_delete().
937  *
938  * \param object  Pointer to object to copy.
939  * \assert
940  *    \code object != NULL \endcode
941  * \retval FLAC__StreamMetadata*
942  *    \c NULL if there was an error allocating memory, else the new instance.
943  */
944 FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMetadata *object);
945
946 /** Free a metadata object.  Deletes the object pointed to by \a object.
947  *
948  *  The delete is a "deep" delete, i.e. dynamically allocated data within the
949  *  object is also deleted.
950  *
951  * \param object  A pointer to an existing object.
952  * \assert
953  *    \code object != NULL \endcode
954  */
955 FLAC_API void FLAC__metadata_object_delete(FLAC__StreamMetadata *object);
956
957 /** Compares two metadata objects.
958  *
959  *  The compare is "deep", i.e. dynamically allocated data within the
960  *  object is also compared.
961  *
962  * \param block1  A pointer to an existing object.
963  * \param block2  A pointer to an existing object.
964  * \assert
965  *    \code block1 != NULL \endcode
966  *    \code block2 != NULL \endcode
967  * \retval FLAC__bool
968  *    \c true if objects are identical, else \c false.
969  */
970 FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2);
971
972 /** Sets the application data of an APPLICATION block.
973  *
974  *  If \a copy is \c true, a copy of the data is stored; otherwise, the object
975  *  takes ownership of the pointer.  Returns \c false if \a copy == \c true
976  *  and malloc fails.
977  *
978  * \param object  A pointer to an existing APPLICATION object.
979  * \param data    A pointer to the data to set.
980  * \param length  The length of \a data in bytes.
981  * \param copy    See above.
982  * \assert
983  *    \code object != NULL \endcode
984  *    \code object->type == FLAC__METADATA_TYPE_APPLICATION \endcode
985  *    \code (data != NULL && length > 0) ||
986  * (data == NULL && length == 0 && copy == false) \endcode
987  * \retval FLAC__bool
988  *    \c false if \a copy is \c true and malloc fails, else \c true.
989  */
990 FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy);
991
992 /** Resize the seekpoint array.
993  *
994  *  If the size shrinks, elements will truncated; if it grows, new placeholder
995  *  points will be added to the end.
996  *
997  * \param object          A pointer to an existing SEEKTABLE object.
998  * \param new_num_points  The desired length of the array; may be \c 0.
999  * \assert
1000  *    \code object != NULL \endcode
1001  *    \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
1002  *    \code (object->data.seek_table.points == NULL && object->data.seek_table.num_points == 0) ||
1003  * (object->data.seek_table.points != NULL && object->data.seek_table.num_points > 0) \endcode
1004  * \retval FLAC__bool
1005  *    \c false if memory allocation error, else \c true.
1006  */
1007 FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points);
1008
1009 /** Set a seekpoint in a seektable.
1010  *
1011  * \param object     A pointer to an existing SEEKTABLE object.
1012  * \param point_num  Index into seekpoint array to set.
1013  * \param point      The point to set.
1014  * \assert
1015  *    \code object != NULL \endcode
1016  *    \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
1017  *    \code object->data.seek_table.num_points > point_num \endcode
1018  */
1019 FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point);
1020
1021 /** Insert a seekpoint into a seektable.
1022  *
1023  * \param object     A pointer to an existing SEEKTABLE object.
1024  * \param point_num  Index into seekpoint array to set.
1025  * \param point      The point to set.
1026  * \assert
1027  *    \code object != NULL \endcode
1028  *    \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
1029  *    \code object->data.seek_table.num_points >= point_num \endcode
1030  * \retval FLAC__bool
1031  *    \c false if memory allocation error, else \c true.
1032  */
1033 FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point);
1034
1035 /** Delete a seekpoint from a seektable.
1036  *
1037  * \param object     A pointer to an existing SEEKTABLE object.
1038  * \param point_num  Index into seekpoint array to set.
1039  * \assert
1040  *    \code object != NULL \endcode
1041  *    \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
1042  *    \code object->data.seek_table.num_points > point_num \endcode
1043  * \retval FLAC__bool
1044  *    \c false if memory allocation error, else \c true.
1045  */
1046 FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, unsigned point_num);
1047
1048 /** Check a seektable to see if it conforms to the FLAC specification.
1049  *  See the format specification for limits on the contents of the
1050  *  seektable.
1051  *
1052  * \param object  A pointer to an existing SEEKTABLE object.
1053  * \assert
1054  *    \code object != NULL \endcode
1055  *    \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
1056  * \retval FLAC__bool
1057  *    \c false if seek table is illegal, else \c true.
1058  */
1059 FLAC_API FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamMetadata *object);
1060
1061 /** Append a number of placeholder points to the end of a seek table.
1062  *
1063  * \note
1064  * As with the other ..._seektable_template_... functions, you should
1065  * call FLAC__metadata_object_seektable_template_sort() when finished
1066  * to make the seek table legal.
1067  *
1068  * \param object  A pointer to an existing SEEKTABLE object.
1069  * \param num     The number of placeholder points to append.
1070  * \assert
1071  *    \code object != NULL \endcode
1072  *    \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
1073  * \retval FLAC__bool
1074  *    \c false if memory allocation fails, else \c true.
1075  */
1076 FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, unsigned num);
1077
1078 /** Append a specific seek point template to the end of a seek table.
1079  *
1080  * \note
1081  * As with the other ..._seektable_template_... functions, you should
1082  * call FLAC__metadata_object_seektable_template_sort() when finished
1083  * to make the seek table legal.
1084  *
1085  * \param object  A pointer to an existing SEEKTABLE object.
1086  * \param sample_number  The sample number of the seek point template.
1087  * \assert
1088  *    \code object != NULL \endcode
1089  *    \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
1090  * \retval FLAC__bool
1091  *    \c false if memory allocation fails, else \c true.
1092  */
1093 FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point(FLAC__StreamMetadata *object, FLAC__uint64 sample_number);
1094
1095 /** Append specific seek point templates to the end of a seek table.
1096  *
1097  * \note
1098  * As with the other ..._seektable_template_... functions, you should
1099  * call FLAC__metadata_object_seektable_template_sort() when finished
1100  * to make the seek table legal.
1101  *
1102  * \param object  A pointer to an existing SEEKTABLE object.
1103  * \param sample_numbers  An array of sample numbers for the seek points.
1104  * \param num     The number of seek point templates to append.
1105  * \assert
1106  *    \code object != NULL \endcode
1107  *    \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
1108  * \retval FLAC__bool
1109  *    \c false if memory allocation fails, else \c true.
1110  */
1111 FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], unsigned num);
1112
1113 /** Append a set of evenly-spaced seek point templates to the end of a
1114  *  seek table.
1115  *
1116  * \note
1117  * As with the other ..._seektable_template_... functions, you should
1118  * call FLAC__metadata_object_seektable_template_sort() when finished
1119  * to make the seek table legal.
1120  *
1121  * \param object  A pointer to an existing SEEKTABLE object.
1122  * \param num     The number of placeholder points to append.
1123  * \param total_samples  The total number of samples to be encoded;
1124  *                       the seekpoints will be spaced approximately
1125  *                       \a total_samples / \a num samples apart.
1126  * \assert
1127  *    \code object != NULL \endcode
1128  *    \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
1129  * \retval FLAC__bool
1130  *    \c false if memory allocation fails, else \c true.
1131  */
1132 FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, unsigned num, FLAC__uint64 total_samples);
1133
1134 /** Sort a seek table's seek points according to the format specification,
1135  *  removing duplicates.
1136  *
1137  * \param object   A pointer to a seek table to be sorted.
1138  * \param compact  If \c false, behaves like FLAC__format_seektable_sort().
1139  *                 If \c true, duplicates are deleted and the seek table is
1140  *                 shrunk appropriately; the number of placeholder points
1141  *                 present in the seek table will be the same after the call
1142  *                 as before.
1143  * \assert
1144  *    \code object != NULL \endcode
1145  *    \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
1146  * \retval FLAC__bool
1147  *    \c false if realloc fails, else \c true.
1148  */
1149 FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_sort(FLAC__StreamMetadata *object, FLAC__bool compact);
1150
1151 /** Sets the vendor string in a VORBIS_COMMENT block.
1152  *
1153  *  If \a copy is \c true, a copy of the entry is stored; otherwise, the object
1154  *  takes ownership of the \c entry->entry pointer.  Returns \c false if
1155  *  \a copy == \c true and malloc fails.
1156  *
1157  * \param object  A pointer to an existing VORBIS_COMMENT object.
1158  * \param entry   The entry to set the vendor string to.
1159  * \param copy    See above.
1160  * \assert
1161  *    \code object != NULL \endcode
1162  *    \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
1163  *    \code (entry->entry != NULL && entry->length > 0) ||
1164  * (entry->entry == NULL && entry->length == 0 && copy == false) \endcode
1165  * \retval FLAC__bool
1166  *    \c false if \a copy is \c true and malloc fails, else \c true.
1167  */
1168 FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
1169
1170 /** Resize the comment array.
1171  *
1172  *  If the size shrinks, elements will truncated; if it grows, new empty
1173  *  fields will be added to the end.
1174  *
1175  * \param object            A pointer to an existing VORBIS_COMMENT object.
1176  * \param new_num_comments  The desired length of the array; may be \c 0.
1177  * \assert
1178  *    \code object != NULL \endcode
1179  *    \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
1180  *    \code (object->data.vorbis_comment.comments == NULL && object->data.vorbis_comment.num_comments == 0) ||
1181  * (object->data.vorbis_comment.comments != NULL && object->data.vorbis_comment.num_comments > 0) \endcode
1182  * \retval FLAC__bool
1183  *    \c false if memory allocation error, else \c true.
1184  */
1185 FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, unsigned new_num_comments);
1186
1187 /** Sets a comment in a VORBIS_COMMENT block.
1188  *
1189  *  If \a copy is \c true, a copy of the entry is stored; otherwise, the object
1190  *  takes ownership of the \c entry->entry pointer.  Returns \c false if
1191  *  \a copy == \c true and malloc fails.
1192  *
1193  * \param object       A pointer to an existing VORBIS_COMMENT object.
1194  * \param comment_num  Index into comment array to set.
1195  * \param entry        The entry to set the comment to.
1196  * \param copy         See above.
1197  * \assert
1198  *    \code object != NULL \endcode
1199  *    \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
1200  *    \code comment_num < object->data.vorbis_comment.num_comments \endcode
1201  *    \code (entry->entry != NULL && entry->length > 0) ||
1202  * (entry->entry == NULL && entry->length == 0 && copy == false) \endcode
1203  * \retval FLAC__bool
1204  *    \c false if \a copy is \c true and malloc fails, else \c true.
1205  */
1206 FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
1207
1208 /** Insert a comment in a VORBIS_COMMENT block at the given index.
1209  *
1210  *  If \a copy is \c true, a copy of the entry is stored; otherwise, the object
1211  *  takes ownership of the \c entry->entry pointer.  Returns \c false if
1212  *  \a copy == \c true and malloc fails.
1213  *
1214  * \param object       A pointer to an existing VORBIS_COMMENT object.
1215  * \param comment_num  The index at which to insert the comment.  The comments
1216  *                     at and after \a comment_num move right one position.
1217  *                     To append a comment to the end, set \a comment_num to
1218  *                     \c object->data.vorbis_comment.num_comments .
1219  * \param entry        The comment to insert.
1220  * \param copy         See above.
1221  * \assert
1222  *    \code object != NULL \endcode
1223  *    \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
1224  *    \code object->data.vorbis_comment.num_comments >= comment_num \endcode
1225  *    \code (entry->entry != NULL && entry->length > 0) ||
1226  * (entry->entry == NULL && entry->length == 0 && copy == false) \endcode
1227  * \retval FLAC__bool
1228  *    \c false if \a copy is \c true and malloc fails, else \c true.
1229  */
1230 FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
1231
1232 /** Delete a comment in a VORBIS_COMMENT block at the given index.
1233  *
1234  * \param object       A pointer to an existing VORBIS_COMMENT object.
1235  * \param comment_num  The index of the comment to delete.
1236  * \assert
1237  *    \code object != NULL \endcode
1238  *    \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
1239  *    \code object->data.vorbis_comment.num_comments > comment_num \endcode
1240  *    \code (entry->entry != NULL && entry->length > 0) ||
1241  * (entry->entry == NULL && entry->length == 0 && copy == false) \endcode
1242  * \retval FLAC__bool
1243  *    \c false if realloc fails, else \c true.
1244  */
1245 FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, unsigned comment_num);
1246
1247 /*@@@@ add to unit tests */
1248 /** Check if the given Vorbis comment entry's field name matches the given
1249  *  field name.
1250  *
1251  * \param entry              A pointer to an existing Vorbis comment entry.
1252  * \param field_name         The field name to check.
1253  * \param field_name_length  The length of \a field_name, not including the
1254  *                           terminating \c NULL.
1255  * \assert
1256  *    \code entry != NULL \endcode
1257  *    \code (entry->entry != NULL && entry->length > 0) \endcode
1258  * \retval FLAC__bool
1259  *    \c true if the field names match, else \c false
1260  */
1261 FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field_name, unsigned field_name_length);
1262
1263 /*@@@@ add to unit tests */
1264 /** Find a Vorbis comment with the given field name.
1265  *
1266  *  The search begins at entry number \a offset; use and offset of 0 to
1267  *  search from the beginning of the comment array.
1268  *
1269  * \param object      A pointer to an existing VORBIS_COMMENT object.
1270  * \param offset      The offset into the comment array from where to start
1271  *                    the search.
1272  * \param field_name  The field name of the comment to find.
1273  * \assert
1274  *    \code object != NULL \endcode
1275  *    \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
1276  * \retval int
1277  *    The offset in the comment array of the first comment whose field
1278  *    name matches \a field_name, or \c -1 if no match was found.
1279  */
1280 FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name);
1281
1282 /*@@@@ add to unit tests */
1283 /** Remove first Vorbis comment matching the given field name.
1284  *
1285  * \param object      A pointer to an existing VORBIS_COMMENT object.
1286  * \param field_name  The field name of comment to delete.
1287  * \assert
1288  *    \code object != NULL \endcode
1289  *    \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
1290  * \retval int
1291  *    \c -1 for memory allocation error, \c 0 for no matching entries,
1292  *    \c 1 for one matching entry deleted.
1293  */
1294 FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching(FLAC__StreamMetadata *object, const char *field_name);
1295
1296 /*@@@@ add to unit tests */
1297 /** Remove all Vorbis comments matching the given field name.
1298  *
1299  * \param object      A pointer to an existing VORBIS_COMMENT object.
1300  * \param field_name  The field name of comments to delete.
1301  * \assert
1302  *    \code object != NULL \endcode
1303  *    \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
1304  * \retval int
1305  *    \c -1 for memory allocation error, \c 0 for no matching entries,
1306  *    else the number of matching entries deleted.
1307  */
1308 FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching(FLAC__StreamMetadata *object, const char *field_name);
1309
1310 /** Create a new CUESHEET track instance.
1311  *
1312  *  The object will be "empty"; i.e. values and data pointers will be \c 0.
1313  *
1314  * \retval FLAC__StreamMetadata_CueSheet_Track*
1315  *    \c NULL if there was an error allocating memory, else the new instance.
1316  */
1317 FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_new();
1318
1319 /** Create a copy of an existing CUESHEET track object.
1320  *
1321  *  The copy is a "deep" copy, i.e. dynamically allocated data within the
1322  *  object is also copied.  The caller takes ownership of the new object and
1323  *  is responsible for freeing it with
1324  *  FLAC__metadata_object_cuesheet_track_delete().
1325  *
1326  * \param object  Pointer to object to copy.
1327  * \assert
1328  *    \code object != NULL \endcode
1329  * \retval FLAC__StreamMetadata_CueSheet_Track*
1330  *    \c NULL if there was an error allocating memory, else the new instance.
1331  */
1332 FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_clone(const FLAC__StreamMetadata_CueSheet_Track *object);
1333
1334 /** Delete a CUESHEET track object
1335  *
1336  * \param object       A pointer to an existing CUESHEET track object.
1337  * \assert
1338  *    \code object != NULL \endcode
1339  */
1340 FLAC_API void FLAC__metadata_object_cuesheet_track_delete(FLAC__StreamMetadata_CueSheet_Track *object);
1341
1342 /** Resize a track's index point array.
1343  *
1344  *  If the size shrinks, elements will truncated; if it grows, new blank
1345  *  indices will be added to the end.
1346  *
1347  * \param object           A pointer to an existing CUESHEET object.
1348  * \param track_num        The index of the track to modify.  NOTE: this is not
1349  *                         necessarily the same as the track's \a number field.
1350  * \param new_num_indices  The desired length of the array; may be \c 0.
1351  * \assert
1352  *    \code object != NULL \endcode
1353  *    \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
1354  *    \code object->data.cue_sheet.num_tracks > track_num \endcode
1355  *    \code (object->data.cue_sheet.tracks[track_num].indices == NULL && object->data.cue_sheet.tracks[track_num].num_indices == 0) ||
1356  * (object->data.cue_sheet.tracks[track_num].indices != NULL && object->data.cue_sheet.tracks[track_num].num_indices > 0) \endcode
1357  * \retval FLAC__bool
1358  *    \c false if memory allocation error, else \c true.
1359  */
1360 FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, unsigned track_num, unsigned new_num_indices);
1361
1362 /** Insert an index point in a CUESHEET track at the given index.
1363  *
1364  * \param object       A pointer to an existing CUESHEET object.
1365  * \param track_num    The index of the track to modify.  NOTE: this is not
1366  *                     necessarily the same as the track's \a number field.
1367  * \param index_num    The index into the track's index array at which to
1368  *                     insert the index point.  NOTE: this is not necessarily
1369  *                     the same as the index point's \a number field.  The
1370  *                     indices at and after \a index_num move right one
1371  *                     position.  To append an index point to the end, set
1372  *                     \a index_num to
1373  *                     \c object->data.cue_sheet.tracks[track_num].num_indices .
1374  * \param index        The index point to insert.
1375  * \assert
1376  *    \code object != NULL \endcode
1377  *    \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
1378  *    \code object->data.cue_sheet.num_tracks > track_num \endcode
1379  *    \code object->data.cue_sheet.tracks[track_num].num_indices >= index_num \endcode
1380  * \retval FLAC__bool
1381  *    \c false if realloc fails, else \c true.
1382  */
1383 FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index index);
1384
1385 /** Insert a blank index point in a CUESHEET track at the given index.
1386  *
1387  *  A blank index point is one in which all field values are zero.
1388  *
1389  * \param object       A pointer to an existing CUESHEET object.
1390  * \param track_num    The index of the track to modify.  NOTE: this is not
1391  *                     necessarily the same as the track's \a number field.
1392  * \param index_num    The index into the track's index array at which to
1393  *                     insert the index point.  NOTE: this is not necessarily
1394  *                     the same as the index point's \a number field.  The
1395  *                     indices at and after \a index_num move right one
1396  *                     position.  To append an index point to the end, set
1397  *                     \a index_num to
1398  *                     \c object->data.cue_sheet.tracks[track_num].num_indices .
1399  * \assert
1400  *    \code object != NULL \endcode
1401  *    \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
1402  *    \code object->data.cue_sheet.num_tracks > track_num \endcode
1403  *    \code object->data.cue_sheet.tracks[track_num].num_indices >= index_num \endcode
1404  * \retval FLAC__bool
1405  *    \c false if realloc fails, else \c true.
1406  */
1407 FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num);
1408
1409 /** Delete an index point in a CUESHEET track at the given index.
1410  *
1411  * \param object       A pointer to an existing CUESHEET object.
1412  * \param track_num    The index into the track array of the track to
1413  *                     modify.  NOTE: this is not necessarily the same
1414  *                     as the track's \a number field.
1415  * \param index_num    The index into the track's index array of the index
1416  *                     to delete.  NOTE: this is not necessarily the same
1417  *                     as the index's \a number field.
1418  * \assert
1419  *    \code object != NULL \endcode
1420  *    \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
1421  *    \code object->data.cue_sheet.num_tracks > track_num \endcode
1422  *    \code object->data.cue_sheet.tracks[track_num].num_indices > index_num \endcode
1423  * \retval FLAC__bool
1424  *    \c false if realloc fails, else \c true.
1425  */
1426 FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num);
1427
1428 /** Resize the track array.
1429  *
1430  *  If the size shrinks, elements will truncated; if it grows, new blank
1431  *  tracks will be added to the end.
1432  *
1433  * \param object            A pointer to an existing CUESHEET object.
1434  * \param new_num_tracks    The desired length of the array; may be \c 0.
1435  * \assert
1436  *    \code object != NULL \endcode
1437  *    \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
1438  *    \code (object->data.cue_sheet.tracks == NULL && object->data.cue_sheet.num_tracks == 0) ||
1439  * (object->data.cue_sheet.tracks != NULL && object->data.cue_sheet.num_tracks > 0) \endcode
1440  * \retval FLAC__bool
1441  *    \c false if memory allocation error, else \c true.
1442  */
1443 FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, unsigned new_num_tracks);
1444
1445 /** Sets a track in a CUESHEET block.
1446  *
1447  *  If \a copy is \c true, a copy of the track is stored; otherwise, the object
1448  *  takes ownership of the \a track pointer.  Returns \c false if
1449  *  \a copy == \c true and malloc fails.
1450  *
1451  * \param object       A pointer to an existing CUESHEET object.
1452  * \param track_num    Index into track array to set.  NOTE: this is not
1453  *                     necessarily the same as the track's \a number field.
1454  * \param track        The track to set the track to.  You may safely pass in
1455  *                     a const pointer if \a copy is \c true.
1456  * \param copy         See above.
1457  * \assert
1458  *    \code object != NULL \endcode
1459  *    \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
1460  *    \code track_num < object->data.cue_sheet.num_tracks \endcode
1461  *    \code (track->indices != NULL && track->num_indices > 0) ||
1462  * (track->indices == NULL && track->num_indices == 0)
1463  * \retval FLAC__bool
1464  *    \c false if \a copy is \c true and malloc fails, else \c true.
1465  */
1466 FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy);
1467
1468 /** Insert a track in a CUESHEET block at the given index.
1469  *
1470  *  If \a copy is \c true, a copy of the track is stored; otherwise, the object
1471  *  takes ownership of the \a track pointer.  Returns \c false if
1472  *  \a copy == \c true and malloc fails.
1473  *
1474  * \param object       A pointer to an existing CUESHEET object.
1475  * \param track_num    The index at which to insert the track.  NOTE: this
1476  *                     is not necessarily the same as the track's \a number
1477  *                     field.  The tracks at and after \a track_num move right
1478  *                     one position.  To append a track to the end, set
1479  *                     \a track_num to \c object->data.cue_sheet.num_tracks .
1480  * \param track        The track to insert.  You may safely pass in a const
1481  *                     pointer if \a copy is \c true.
1482  * \param copy         See above.
1483  * \assert
1484  *    \code object != NULL \endcode
1485  *    \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
1486  *    \code object->data.cue_sheet.num_tracks >= track_num \endcode
1487  * \retval FLAC__bool
1488  *    \c false if \a copy is \c true and malloc fails, else \c true.
1489  */
1490 FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy);
1491
1492 /** Insert a blank track in a CUESHEET block at the given index.
1493  *
1494  *  A blank track is one in which all field values are zero.
1495  *
1496  * \param object       A pointer to an existing CUESHEET object.
1497  * \param track_num    The index at which to insert the track.  NOTE: this
1498  *                     is not necessarily the same as the track's \a number
1499  *                     field.  The tracks at and after \a track_num move right
1500  *                     one position.  To append a track to the end, set
1501  *                     \a track_num to \c object->data.cue_sheet.num_tracks .
1502  * \assert
1503  *    \code object != NULL \endcode
1504  *    \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
1505  *    \code object->data.cue_sheet.num_tracks >= track_num \endcode
1506  * \retval FLAC__bool
1507  *    \c false if \a copy is \c true and malloc fails, else \c true.
1508  */
1509 FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, unsigned track_num);
1510
1511 /** Delete a track in a CUESHEET block at the given index.
1512  *
1513  * \param object       A pointer to an existing CUESHEET object.
1514  * \param track_num    The index into the track array of the track to
1515  *                     delete.  NOTE: this is not necessarily the same
1516  *                     as the track's \a number field.
1517  * \assert
1518  *    \code object != NULL \endcode
1519  *    \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
1520  *    \code object->data.cue_sheet.num_tracks > track_num \endcode
1521  * \retval FLAC__bool
1522  *    \c false if realloc fails, else \c true.
1523  */
1524 FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, unsigned track_num);
1525
1526 /** Check a cue sheet to see if it conforms to the FLAC specification.
1527  *  See the format specification for limits on the contents of the
1528  *  cue sheet.
1529  *
1530  * \param object     A pointer to an existing CUESHEET object.
1531  * \param check_cd_da_subset  If \c true, check CUESHEET against more
1532  *                   stringent requirements for a CD-DA (audio) disc.
1533  * \param violation  Address of a pointer to a string.  If there is a
1534  *                   violation, a pointer to a string explanation of the
1535  *                   violation will be returned here. \a violation may be
1536  *                   \c NULL if you don't need the returned string.  Do not
1537  *                   free the returned string; it will always point to static
1538  *                   data.
1539  * \assert
1540  *    \code object != NULL \endcode
1541  *    \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
1542  * \retval FLAC__bool
1543  *    \c false if cue sheet is illegal, else \c true.
1544  */
1545 FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal(const FLAC__StreamMetadata *object, FLAC__bool check_cd_da_subset, const char **violation);
1546
1547 /* \} */
1548
1549 #ifdef __cplusplus
1550 }
1551 #endif
1552
1553 #endif