~ubuntu-branches/ubuntu/raring/flac/raring

« back to all changes in this revision

Viewing changes to include/FLAC/metadata.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-12-06 16:57:20 UTC
  • mto: (8.1.1 lenny)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20071206165720-4przr8grn6ha3e3a
Tags: upstream-1.2.1
ImportĀ upstreamĀ versionĀ 1.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#ifndef FLAC__METADATA_H
33
33
#define FLAC__METADATA_H
34
34
 
 
35
#include <sys/types.h> /* for off_t */
35
36
#include "export.h"
36
37
#include "callback.h"
37
38
#include "format.h"
443
444
 */
444
445
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator);
445
446
 
 
447
/** Returns a flag telling if the current metadata block is the last.
 
448
 *
 
449
 * \param iterator  A pointer to an existing initialized iterator.
 
450
 * \assert
 
451
 *    \code iterator != NULL \endcode
 
452
 *    \a iterator has been successfully initialized with
 
453
 *    FLAC__metadata_simple_iterator_init()
 
454
 * \retval FLAC__bool
 
455
 *    \c true if the current metadata block is the last in the file,
 
456
 *    else \c false.
 
457
 */
 
458
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_last(const FLAC__Metadata_SimpleIterator *iterator);
 
459
 
 
460
/** Get the offset of the metadata block at the current position.  This
 
461
 *  avoids reading the actual block data which can save time for large
 
462
 *  blocks.
 
463
 *
 
464
 * \param iterator  A pointer to an existing initialized iterator.
 
465
 * \assert
 
466
 *    \code iterator != NULL \endcode
 
467
 *    \a iterator has been successfully initialized with
 
468
 *    FLAC__metadata_simple_iterator_init()
 
469
 * \retval off_t
 
470
 *    The offset of the metadata block at the current iterator position.
 
471
 *    This is the byte offset relative to the beginning of the file of
 
472
 *    the current metadata block's header.
 
473
 */
 
474
FLAC_API off_t FLAC__metadata_simple_iterator_get_block_offset(const FLAC__Metadata_SimpleIterator *iterator);
 
475
 
446
476
/** Get the type of the metadata block at the current position.  This
447
477
 *  avoids reading the actual block data which can save time for large
448
478
 *  blocks.
455
485
 * \retval FLAC__MetadataType
456
486
 *    The type of the metadata block at the current iterator position.
457
487
 */
458
 
 
459
488
FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator);
460
489
 
 
490
/** Get the length of the metadata block at the current position.  This
 
491
 *  avoids reading the actual block data which can save time for large
 
492
 *  blocks.
 
493
 *
 
494
 * \param iterator  A pointer to an existing initialized iterator.
 
495
 * \assert
 
496
 *    \code iterator != NULL \endcode
 
497
 *    \a iterator has been successfully initialized with
 
498
 *    FLAC__metadata_simple_iterator_init()
 
499
 * \retval unsigned
 
500
 *    The length of the metadata block at the current iterator position.
 
501
 *    The is same length as that in the
 
502
 *    <a href="http://flac.sourceforge.net/format.html#metadata_block_header">metadata block header</a>,
 
503
 *    i.e. the length of the metadata body that follows the header.
 
504
 */
 
505
FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator);
 
506
 
 
507
/** Get the application ID of the \c APPLICATION block at the current
 
508
 *  position.  This avoids reading the actual block data which can save
 
509
 *  time for large blocks.
 
510
 *
 
511
 * \param iterator  A pointer to an existing initialized iterator.
 
512
 * \param id        A pointer to a buffer of at least \c 4 bytes where
 
513
 *                  the ID will be stored.
 
514
 * \assert
 
515
 *    \code iterator != NULL \endcode
 
516
 *    \code id != NULL \endcode
 
517
 *    \a iterator has been successfully initialized with
 
518
 *    FLAC__metadata_simple_iterator_init()
 
519
 * \retval FLAC__bool
 
520
 *    \c true if the ID was successfully read, else \c false, in which
 
521
 *    case you should check FLAC__metadata_simple_iterator_status() to
 
522
 *    find out why.  If the status is
 
523
 *    \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT, then the
 
524
 *    current metadata block is not an \c APPLICATION block.  Otherwise
 
525
 *    if the status is
 
526
 *    \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR or
 
527
 *    \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR, an I/O error
 
528
 *    occurred and the iterator can no longer be used.
 
529
 */
 
530
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_get_application_id(FLAC__Metadata_SimpleIterator *iterator, FLAC__byte *id);
 
531
 
461
532
/** Get the metadata block at the current position.  You can modify the
462
533
 *  block but must use FLAC__metadata_simple_iterator_set_block() to
463
534
 *  write it back to the FLAC file.
471
542
 *    \a iterator has been successfully initialized with
472
543
 *    FLAC__metadata_simple_iterator_init()
473
544
 * \retval FLAC__StreamMetadata*
474
 
 *    The current metadata block.
 
545
 *    The current metadata block, or \c NULL if there was a memory
 
546
 *    allocation error.
475
547
 */
476
548
FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Metadata_SimpleIterator *iterator);
477
549
 
759
831
 */
760
832
FLAC_API FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename);
761
833
 
762
 
/*@@@@ add to unit tests*/
763
834
/** Read all metadata from an Ogg FLAC file into the chain.
764
835
 *
765
836
 * \note Ogg FLAC metadata data writing is not supported yet and
799
870
 */
800
871
FLAC_API FLAC__bool FLAC__metadata_chain_read_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks);
801
872
 
802
 
/*@@@@ add to unit tests*/
803
873
/** Read all metadata from an Ogg FLAC stream into the chain via I/O callbacks.
804
874
 *
805
875
 *  The \a handle need only be open for reading, but must be seekable.
2000
2070
 */
2001
2071
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal(const FLAC__StreamMetadata *object, FLAC__bool check_cd_da_subset, const char **violation);
2002
2072
 
2003
 
/* @@@@ add to unit tests */
2004
2073
/** Calculate and return the CDDB/freedb ID for a cue sheet.  The function
2005
2074
 *  assumes the cue sheet corresponds to a CD; the result is undefined
2006
2075
 *  if the cuesheet's is_cd bit is not set.