2002-05-17 06:33:39 +00:00
/* libFLAC++ - Free Lossless Audio Codec library
2006-04-25 06:59:33 +00:00
* Copyright ( C ) 2002 , 2003 , 2004 , 2005 , 2006 Josh Coalson
2002-05-17 06:33:39 +00:00
*
2003-01-31 23:34:56 +00:00
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions
* are met :
2002-05-17 06:33:39 +00:00
*
2003-01-31 23:34:56 +00:00
* - Redistributions of source code must retain the above copyright
* notice , this list of conditions and the following disclaimer .
2002-05-17 06:33:39 +00:00
*
2003-01-31 23:34:56 +00:00
* - Redistributions in binary form must reproduce the above copyright
* notice , this list of conditions and the following disclaimer in the
* documentation and / or other materials provided with the distribution .
*
* - Neither the name of the Xiph . org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ` ` AS IS ' ' AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT
* LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL ,
* EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO ,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR
* PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT ( INCLUDING
* NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
2002-05-17 06:33:39 +00:00
*/
# ifndef FLACPP__METADATA_H
# define FLACPP__METADATA_H
2002-10-16 22:18:32 +00:00
# include "export.h"
2002-05-17 06:33:39 +00:00
# include "FLAC/metadata.h"
2002-05-22 05:33:29 +00:00
// ===============================================================
//
// Full documentation for the metadata interface can be found
// in the C layer in include/FLAC/metadata.h
//
// ===============================================================
2002-07-27 04:59:54 +00:00
/** \file include/FLAC++/metadata.h
*
* \ brief
* This module provides classes for creating and manipulating FLAC
* metadata blocks in memory , and three progressively more powerful
* interfaces for traversing and editing metadata in FLAC files .
*
* See the detailed documentation for each interface in the
* \ link flacpp_metadata metadata \ endlink module .
*/
/** \defgroup flacpp_metadata FLAC++/metadata.h: metadata interfaces
* \ ingroup flacpp
*
* \ brief
* This module provides classes for creating and manipulating FLAC
* metadata blocks in memory , and three progressively more powerful
* interfaces for traversing and editing metadata in FLAC files .
*
* The behavior closely mimics the C layer interface ; be sure to read
* the detailed description of the
* \ link flac_metadata C metadata module \ endlink .
*/
2002-05-22 05:33:29 +00:00
2002-05-17 06:33:39 +00:00
namespace FLAC {
namespace Metadata {
2002-05-22 05:33:29 +00:00
// ============================================================
//
// Metadata objects
//
// ============================================================
2002-07-27 04:59:54 +00:00
/** \defgroup flacpp_metadata_object FLAC++/metadata.h: metadata object classes
* \ ingroup flacpp_metadata
*
* This module contains classes representing FLAC metadata
* blocks in memory .
*
* The behavior closely mimics the C layer interface ; be
* sure to read the detailed description of the
* \ link flac_metadata_object C metadata object module \ endlink .
*
* Any time a metadata object is constructed or assigned , you
* should check is_valid ( ) to make sure the underlying
* : : FLAC__StreamMetadata object was able to be created .
*
* \ warning
* When the get_ * ( ) methods of any metadata object method
* return you a const pointer , DO NOT disobey and write into it .
* Always use the set_ * ( ) methods .
*
* \ {
*/
/** Base class for all metadata block types.
2006-10-07 05:43:01 +00:00
* See the \ link flacpp_metadata_object overview \ endlink for more .
2002-07-27 04:59:54 +00:00
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API Prototype {
2002-05-17 06:33:39 +00:00
protected :
2002-07-27 04:59:54 +00:00
//@{
/** Constructs a copy of the given object. This form
* always performs a deep copy .
*/
Prototype ( const Prototype & ) ;
Prototype ( const : : FLAC__StreamMetadata & ) ;
Prototype ( const : : FLAC__StreamMetadata * ) ;
//@}
/** Constructs an object with copy control. When \a copy
* is \ c true , behaves identically to
* FLAC : : Metadata : : Prototype : : Prototype ( const : : FLAC__StreamMetadata * object ) .
* When \ a copy is \ c false , the instance takes ownership of
* the pointer and the : : FLAC__StreamMetadata object will
* be freed by the destructor .
*
* \ assert
* \ code object ! = NULL \ endcode
*/
2002-07-09 06:12:59 +00:00
Prototype ( : : FLAC__StreamMetadata * object , bool copy ) ;
2002-05-17 06:33:39 +00:00
2002-07-27 04:59:54 +00:00
//@{
/** Assign from another object. Always performs a deep copy. */
2005-01-07 01:09:07 +00:00
Prototype & operator = ( const Prototype & ) ;
Prototype & operator = ( const : : FLAC__StreamMetadata & ) ;
Prototype & operator = ( const : : FLAC__StreamMetadata * ) ;
2002-07-27 04:59:54 +00:00
//@}
2002-06-07 05:27:37 +00:00
2005-01-07 01:09:07 +00:00
/** Assigns an object with copy control. See
* Prototype ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
Prototype & assign_object ( : : FLAC__StreamMetadata * object , bool copy ) ;
2002-07-27 04:59:54 +00:00
/** Deletes the underlying ::FLAC__StreamMetadata object.
*/
2002-05-22 05:33:29 +00:00
virtual void clear ( ) ;
2002-06-08 04:53:42 +00:00
: : FLAC__StreamMetadata * object_ ;
2002-05-17 06:33:39 +00:00
public :
2002-07-27 04:59:54 +00:00
/** Deletes the underlying ::FLAC__StreamMetadata object.
*/
2002-06-07 05:27:37 +00:00
virtual ~ Prototype ( ) ;
2002-07-27 04:59:54 +00:00
//@{
2006-10-07 05:43:01 +00:00
/** Check for equality, performing a deep compare by following pointers.
*/
2002-06-08 04:53:42 +00:00
inline bool operator = = ( const Prototype & ) const ;
inline bool operator = = ( const : : FLAC__StreamMetadata & ) const ;
inline bool operator = = ( const : : FLAC__StreamMetadata * ) const ;
2002-07-27 04:59:54 +00:00
//@}
//@{
/** Check for inequality, performing a deep compare by following pointers. */
2002-06-08 04:53:42 +00:00
inline bool operator ! = ( const Prototype & ) const ;
inline bool operator ! = ( const : : FLAC__StreamMetadata & ) const ;
inline bool operator ! = ( const : : FLAC__StreamMetadata * ) const ;
2002-07-27 04:59:54 +00:00
//@}
2002-06-08 04:53:42 +00:00
2002-05-22 05:33:29 +00:00
friend class SimpleIterator ;
friend class Iterator ;
2002-07-27 04:59:54 +00:00
/** Returns \c true if the object was correctly constructed
* ( i . e . the underlying : : FLAC__StreamMetadata object was
* properly allocated ) , else \ c false .
*/
2002-06-07 05:27:37 +00:00
inline bool is_valid ( ) const ;
2002-05-17 06:33:39 +00:00
2002-07-27 04:59:54 +00:00
/** Returns \c true if this block is the last block in a
* stream , else \ c false .
*
* \ assert
* \ code is_valid ( ) \ endcode
*/
2002-05-17 06:33:39 +00:00
bool get_is_last ( ) const ;
2002-06-08 04:53:42 +00:00
2002-07-27 04:59:54 +00:00
/** Returns the type of the block.
*
* \ assert
* \ code is_valid ( ) \ endcode
*/
: : FLAC__MetadataType get_type ( ) const ;
/** Returns the stream length of the metadata block.
*
* \ note
* The length does not include the metadata block header ,
* per spec .
*
* \ assert
* \ code is_valid ( ) \ endcode
*/
unsigned get_length ( ) const ;
/** Sets the "is_last" flag for the block. When using the iterators
* it is not necessary to set this flag ; they will do it for you .
*
* \ assert
* \ code is_valid ( ) \ endcode
*/
2002-06-08 04:53:42 +00:00
void set_is_last ( bool ) ;
2004-07-22 01:03:43 +00:00
/** Returns a pointer to the underlying ::FLAC__StreamMetadata
* object . This can be useful for plugging any holes between
* the C + + and C interfaces .
*
* \ assert
* \ code is_valid ( ) \ endcode
*/
inline operator const : : FLAC__StreamMetadata * ( ) const ;
2002-05-22 05:33:29 +00:00
private :
2002-07-27 04:59:54 +00:00
/** Private and undefined so you can't use it. */
Prototype ( ) ;
2002-05-22 05:33:29 +00:00
// These are used only by Iterator
bool is_reference_ ;
inline void set_reference ( bool x ) { is_reference_ = x ; }
2002-05-17 06:33:39 +00:00
} ;
2004-07-23 05:11:06 +00:00
# ifdef _MSC_VER
// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
# pragma warning ( disable : 4800 )
# endif
2002-08-27 05:46:11 +00:00
inline bool Prototype : : operator = = ( const Prototype & object ) const
2002-06-11 06:15:28 +00:00
{ return ( bool ) : : FLAC__metadata_object_is_equal ( object_ , object . object_ ) ; }
2002-06-07 05:27:37 +00:00
2002-08-27 05:46:11 +00:00
inline bool Prototype : : operator = = ( const : : FLAC__StreamMetadata & object ) const
2002-06-11 06:15:28 +00:00
{ return ( bool ) : : FLAC__metadata_object_is_equal ( object_ , & object ) ; }
2002-06-07 05:27:37 +00:00
2002-08-27 05:46:11 +00:00
inline bool Prototype : : operator = = ( const : : FLAC__StreamMetadata * object ) const
2002-06-11 06:15:28 +00:00
{ return ( bool ) : : FLAC__metadata_object_is_equal ( object_ , object ) ; }
2002-06-07 05:27:37 +00:00
2004-07-23 05:11:06 +00:00
# ifdef _MSC_VER
// @@@ how to re-enable? the following doesn't work
// #pragma warning ( enable : 4800 )
# endif
2002-08-27 05:46:11 +00:00
inline bool Prototype : : operator ! = ( const Prototype & object ) const
2002-06-07 05:27:37 +00:00
{ return ! operator = = ( object ) ; }
2002-08-27 05:46:11 +00:00
inline bool Prototype : : operator ! = ( const : : FLAC__StreamMetadata & object ) const
2002-06-07 05:27:37 +00:00
{ return ! operator = = ( object ) ; }
2002-08-27 05:46:11 +00:00
inline bool Prototype : : operator ! = ( const : : FLAC__StreamMetadata * object ) const
2002-06-07 05:27:37 +00:00
{ return ! operator = = ( object ) ; }
inline bool Prototype : : is_valid ( ) const
{ return 0 ! = object_ ; }
2004-07-22 01:03:43 +00:00
inline Prototype : : operator const : : FLAC__StreamMetadata * ( ) const
{ return object_ ; }
2002-07-27 04:59:54 +00:00
/** Create a deep copy of an object and return it. */
2002-10-16 22:18:32 +00:00
FLACPP_API Prototype * clone ( const Prototype * ) ;
2002-06-07 05:27:37 +00:00
2002-07-27 04:59:54 +00:00
/** STREAMINFO metadata block.
2006-10-07 05:43:01 +00:00
* See the \ link flacpp_metadata_object overview \ endlink for more ,
* and the < A HREF = " ../format.html#metadata_block_streaminfo " > format specification < / A > .
2002-07-27 04:59:54 +00:00
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API StreamInfo : public Prototype {
2002-05-17 06:33:39 +00:00
public :
StreamInfo ( ) ;
2002-07-27 04:59:54 +00:00
//@{
/** Constructs a copy of the given object. This form
* always performs a deep copy .
*/
2002-06-08 04:53:42 +00:00
inline StreamInfo ( const StreamInfo & object ) : Prototype ( object ) { }
inline StreamInfo ( const : : FLAC__StreamMetadata & object ) : Prototype ( object ) { }
inline StreamInfo ( const : : FLAC__StreamMetadata * object ) : Prototype ( object ) { }
2002-07-27 04:59:54 +00:00
//@}
/** Constructs an object with copy control. See
* Prototype ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
2002-06-08 04:53:42 +00:00
inline StreamInfo ( : : FLAC__StreamMetadata * object , bool copy ) : Prototype ( object , copy ) { }
2002-07-27 04:59:54 +00:00
2002-05-17 06:33:39 +00:00
~ StreamInfo ( ) ;
2002-07-27 04:59:54 +00:00
//@{
/** Assign from another object. Always performs a deep copy. */
2005-01-07 01:09:07 +00:00
inline StreamInfo & operator = ( const StreamInfo & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline StreamInfo & operator = ( const : : FLAC__StreamMetadata & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline StreamInfo & operator = ( const : : FLAC__StreamMetadata * object ) { Prototype : : operator = ( object ) ; return * this ; }
2002-07-27 04:59:54 +00:00
//@}
2002-05-22 05:33:29 +00:00
2005-01-07 01:09:07 +00:00
/** Assigns an object with copy control. See
* Prototype : : assign_object ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
inline StreamInfo & assign ( : : FLAC__StreamMetadata * object , bool copy ) { Prototype : : assign_object ( object , copy ) ; return * this ; }
2002-07-27 04:59:54 +00:00
//@{
/** Check for equality, performing a deep compare by following pointers. */
2002-06-07 05:27:37 +00:00
inline bool operator = = ( const StreamInfo & object ) const { return Prototype : : operator = = ( object ) ; }
2002-06-08 04:53:42 +00:00
inline bool operator = = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator = = ( object ) ; }
inline bool operator = = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator = = ( object ) ; }
2002-07-27 04:59:54 +00:00
//@}
//@{
/** Check for inequality, performing a deep compare by following pointers. */
2002-06-07 05:27:37 +00:00
inline bool operator ! = ( const StreamInfo & object ) const { return Prototype : : operator ! = ( object ) ; }
2002-06-08 04:53:42 +00:00
inline bool operator ! = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator ! = ( object ) ; }
inline bool operator ! = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator ! = ( object ) ; }
2002-07-27 04:59:54 +00:00
//@}
2002-06-07 05:27:37 +00:00
2002-08-20 03:56:52 +00:00
//@{
/** See <A HREF="../format.html#metadata_block_streaminfo">format specification</A>. */
2002-05-17 06:33:39 +00:00
unsigned get_min_blocksize ( ) const ;
unsigned get_max_blocksize ( ) const ;
unsigned get_min_framesize ( ) const ;
unsigned get_max_framesize ( ) const ;
unsigned get_sample_rate ( ) const ;
unsigned get_channels ( ) const ;
unsigned get_bits_per_sample ( ) const ;
FLAC__uint64 get_total_samples ( ) const ;
const FLAC__byte * get_md5sum ( ) const ;
void set_min_blocksize ( unsigned value ) ;
void set_max_blocksize ( unsigned value ) ;
void set_min_framesize ( unsigned value ) ;
void set_max_framesize ( unsigned value ) ;
void set_sample_rate ( unsigned value ) ;
void set_channels ( unsigned value ) ;
void set_bits_per_sample ( unsigned value ) ;
void set_total_samples ( FLAC__uint64 value ) ;
void set_md5sum ( const FLAC__byte value [ 16 ] ) ;
2002-08-20 03:56:52 +00:00
//@}
2002-05-17 06:33:39 +00:00
} ;
2002-08-20 03:56:52 +00:00
/** PADDING metadata block.
2006-10-07 05:43:01 +00:00
* See the \ link flacpp_metadata_object overview \ endlink for more ,
* and the < A HREF = " ../format.html#metadata_block_padding " > format specification < / A > .
2002-07-27 04:59:54 +00:00
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API Padding : public Prototype {
2002-05-17 06:33:39 +00:00
public :
Padding ( ) ;
2002-08-20 03:56:52 +00:00
//@{
/** Constructs a copy of the given object. This form
* always performs a deep copy .
*/
2002-06-08 04:53:42 +00:00
inline Padding ( const Padding & object ) : Prototype ( object ) { }
inline Padding ( const : : FLAC__StreamMetadata & object ) : Prototype ( object ) { }
inline Padding ( const : : FLAC__StreamMetadata * object ) : Prototype ( object ) { }
2002-08-20 03:56:52 +00:00
//@}
/** Constructs an object with copy control. See
* Prototype ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
2002-06-08 04:53:42 +00:00
inline Padding ( : : FLAC__StreamMetadata * object , bool copy ) : Prototype ( object , copy ) { }
2002-08-20 03:56:52 +00:00
2002-05-17 06:33:39 +00:00
~ Padding ( ) ;
2002-05-22 05:33:29 +00:00
2002-08-20 03:56:52 +00:00
//@{
/** Assign from another object. Always performs a deep copy. */
2005-01-07 01:09:07 +00:00
inline Padding & operator = ( const Padding & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline Padding & operator = ( const : : FLAC__StreamMetadata & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline Padding & operator = ( const : : FLAC__StreamMetadata * object ) { Prototype : : operator = ( object ) ; return * this ; }
2002-08-20 03:56:52 +00:00
//@}
2002-05-31 06:20:50 +00:00
2005-01-07 01:09:07 +00:00
/** Assigns an object with copy control. See
* Prototype : : assign_object ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
inline Padding & assign ( : : FLAC__StreamMetadata * object , bool copy ) { Prototype : : assign_object ( object , copy ) ; return * this ; }
2002-08-20 03:56:52 +00:00
//@{
/** Check for equality, performing a deep compare by following pointers. */
2002-06-07 05:27:37 +00:00
inline bool operator = = ( const Padding & object ) const { return Prototype : : operator = = ( object ) ; }
2002-06-08 04:53:42 +00:00
inline bool operator = = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator = = ( object ) ; }
inline bool operator = = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator = = ( object ) ; }
2002-08-20 03:56:52 +00:00
//@}
//@{
/** Check for inequality, performing a deep compare by following pointers. */
2002-06-07 05:27:37 +00:00
inline bool operator ! = ( const Padding & object ) const { return Prototype : : operator ! = ( object ) ; }
2002-06-08 04:53:42 +00:00
inline bool operator ! = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator ! = ( object ) ; }
inline bool operator ! = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator ! = ( object ) ; }
2002-08-20 03:56:52 +00:00
//@}
2002-06-07 05:27:37 +00:00
2002-05-31 06:20:50 +00:00
void set_length ( unsigned length ) ;
2002-05-17 06:33:39 +00:00
} ;
2002-08-20 03:56:52 +00:00
/** APPLICATION metadata block.
2006-10-07 05:43:01 +00:00
* See the \ link flacpp_metadata_object overview \ endlink for more ,
* and the < A HREF = " ../format.html#metadata_block_application " > format specification < / A > .
2002-07-27 04:59:54 +00:00
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API Application : public Prototype {
2002-05-17 06:33:39 +00:00
public :
Application ( ) ;
2002-08-20 03:56:52 +00:00
//
//@{
/** Constructs a copy of the given object. This form
* always performs a deep copy .
*/
2002-06-08 04:53:42 +00:00
inline Application ( const Application & object ) : Prototype ( object ) { }
inline Application ( const : : FLAC__StreamMetadata & object ) : Prototype ( object ) { }
inline Application ( const : : FLAC__StreamMetadata * object ) : Prototype ( object ) { }
2002-08-20 03:56:52 +00:00
//@}
/** Constructs an object with copy control. See
* Prototype ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
2002-06-08 04:53:42 +00:00
inline Application ( : : FLAC__StreamMetadata * object , bool copy ) : Prototype ( object , copy ) { }
2002-08-20 03:56:52 +00:00
2002-05-17 06:33:39 +00:00
~ Application ( ) ;
2002-08-20 03:56:52 +00:00
//@{
/** Assign from another object. Always performs a deep copy. */
2005-01-07 01:09:07 +00:00
inline Application & operator = ( const Application & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline Application & operator = ( const : : FLAC__StreamMetadata & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline Application & operator = ( const : : FLAC__StreamMetadata * object ) { Prototype : : operator = ( object ) ; return * this ; }
2002-08-20 03:56:52 +00:00
//@}
2002-05-22 05:33:29 +00:00
2005-01-07 01:09:07 +00:00
/** Assigns an object with copy control. See
* Prototype : : assign_object ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
inline Application & assign ( : : FLAC__StreamMetadata * object , bool copy ) { Prototype : : assign_object ( object , copy ) ; return * this ; }
2002-08-20 03:56:52 +00:00
//@{
/** Check for equality, performing a deep compare by following pointers. */
2002-06-07 05:27:37 +00:00
inline bool operator = = ( const Application & object ) const { return Prototype : : operator = = ( object ) ; }
2002-06-08 04:53:42 +00:00
inline bool operator = = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator = = ( object ) ; }
inline bool operator = = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator = = ( object ) ; }
2002-08-20 03:56:52 +00:00
//@}
//@{
/** Check for inequality, performing a deep compare by following pointers. */
2002-06-07 05:27:37 +00:00
inline bool operator ! = ( const Application & object ) const { return Prototype : : operator ! = ( object ) ; }
2002-06-08 04:53:42 +00:00
inline bool operator ! = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator ! = ( object ) ; }
inline bool operator ! = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator ! = ( object ) ; }
2002-08-20 03:56:52 +00:00
//@}
2002-06-07 05:27:37 +00:00
2002-05-17 06:33:39 +00:00
const FLAC__byte * get_id ( ) const ;
const FLAC__byte * get_data ( ) const ;
2002-06-08 04:53:42 +00:00
void set_id ( const FLAC__byte value [ 4 ] ) ;
2002-08-20 03:56:52 +00:00
//! This form always copies \a data
bool set_data ( const FLAC__byte * data , unsigned length ) ;
2002-06-08 04:53:42 +00:00
bool set_data ( FLAC__byte * data , unsigned length , bool copy ) ;
2002-05-17 06:33:39 +00:00
} ;
2002-08-20 03:56:52 +00:00
/** SEEKTABLE metadata block.
2006-10-07 05:43:01 +00:00
* See the \ link flacpp_metadata_object overview \ endlink for more ,
* and the < A HREF = " ../format.html#metadata_block_seektable " > format specification < / A > .
2002-07-27 04:59:54 +00:00
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API SeekTable : public Prototype {
2002-05-17 06:33:39 +00:00
public :
SeekTable ( ) ;
2002-08-20 03:56:52 +00:00
//@{
/** Constructs a copy of the given object. This form
* always performs a deep copy .
*/
2002-06-08 04:53:42 +00:00
inline SeekTable ( const SeekTable & object ) : Prototype ( object ) { }
inline SeekTable ( const : : FLAC__StreamMetadata & object ) : Prototype ( object ) { }
inline SeekTable ( const : : FLAC__StreamMetadata * object ) : Prototype ( object ) { }
2002-08-20 03:56:52 +00:00
//@}
/** Constructs an object with copy control. See
* Prototype ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
2002-06-08 04:53:42 +00:00
inline SeekTable ( : : FLAC__StreamMetadata * object , bool copy ) : Prototype ( object , copy ) { }
2002-08-20 03:56:52 +00:00
2002-05-17 06:33:39 +00:00
~ SeekTable ( ) ;
2002-05-22 05:33:29 +00:00
2002-08-20 03:56:52 +00:00
//@{
/** Assign from another object. Always performs a deep copy. */
2005-01-07 01:09:07 +00:00
inline SeekTable & operator = ( const SeekTable & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline SeekTable & operator = ( const : : FLAC__StreamMetadata & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline SeekTable & operator = ( const : : FLAC__StreamMetadata * object ) { Prototype : : operator = ( object ) ; return * this ; }
2002-08-20 03:56:52 +00:00
//@}
2002-05-31 06:20:50 +00:00
2005-01-07 01:09:07 +00:00
/** Assigns an object with copy control. See
* Prototype : : assign_object ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
inline SeekTable & assign ( : : FLAC__StreamMetadata * object , bool copy ) { Prototype : : assign_object ( object , copy ) ; return * this ; }
2002-08-20 03:56:52 +00:00
//@{
/** Check for equality, performing a deep compare by following pointers. */
2002-06-07 05:27:37 +00:00
inline bool operator = = ( const SeekTable & object ) const { return Prototype : : operator = = ( object ) ; }
2002-06-08 04:53:42 +00:00
inline bool operator = = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator = = ( object ) ; }
inline bool operator = = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator = = ( object ) ; }
2002-08-20 03:56:52 +00:00
//@}
//@{
/** Check for inequality, performing a deep compare by following pointers. */
2002-06-07 05:27:37 +00:00
inline bool operator ! = ( const SeekTable & object ) const { return Prototype : : operator ! = ( object ) ; }
2002-06-08 04:53:42 +00:00
inline bool operator ! = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator ! = ( object ) ; }
inline bool operator ! = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator ! = ( object ) ; }
2002-08-20 03:56:52 +00:00
//@}
2002-06-07 05:27:37 +00:00
2002-05-31 06:20:50 +00:00
unsigned get_num_points ( ) const ;
2002-06-08 04:53:42 +00:00
: : FLAC__StreamMetadata_SeekPoint get_point ( unsigned index ) const ;
2002-05-31 06:20:50 +00:00
2002-08-20 03:56:52 +00:00
//! See FLAC__metadata_object_seektable_set_point()
2002-06-08 04:53:42 +00:00
void set_point ( unsigned index , const : : FLAC__StreamMetadata_SeekPoint & point ) ;
2002-08-20 03:56:52 +00:00
//! See FLAC__metadata_object_seektable_insert_point()
2002-06-08 04:53:42 +00:00
bool insert_point ( unsigned index , const : : FLAC__StreamMetadata_SeekPoint & point ) ;
2002-08-20 03:56:52 +00:00
//! See FLAC__metadata_object_seektable_delete_point()
2002-05-31 06:20:50 +00:00
bool delete_point ( unsigned index ) ;
2002-06-05 05:56:41 +00:00
2002-08-20 03:56:52 +00:00
//! See FLAC__metadata_object_seektable_is_legal()
2002-06-05 05:56:41 +00:00
bool is_legal ( ) const ;
2002-05-17 06:33:39 +00:00
} ;
2002-08-20 03:56:52 +00:00
/** VORBIS_COMMENT metadata block.
2006-10-07 05:43:01 +00:00
* See the \ link flacpp_metadata_object overview \ endlink for more ,
* and the < A HREF = " ../format.html#metadata_block_vorbis_comment " > format specification < / A > .
2002-07-27 04:59:54 +00:00
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API VorbisComment : public Prototype {
2002-05-17 06:33:39 +00:00
public :
2002-08-20 03:56:52 +00:00
/** Convenience class for encapsulating Vorbis comment
* entries . An entry is a vendor string or a comment
* field . In the case of a vendor string , the field
* name is undefined ; only the field value is relevant .
*
* A \ a field as used in the methods refers to an
2004-12-30 00:59:30 +00:00
* entire ' NAME = VALUE ' string ; for convenience the
2004-12-30 03:41:19 +00:00
* string is NUL - terminated . A length field is
2004-12-30 00:59:30 +00:00
* required in the unlikely event that the value
2004-12-30 03:41:19 +00:00
* contains contain embedded NULs .
2002-08-20 03:56:52 +00:00
*
* A \ a field_name is what is on the left side of the
* first ' = ' in the \ a field . By definition it is ASCII
2004-12-30 03:41:19 +00:00
* and so is NUL - terminated and does not require a
2002-08-20 03:56:52 +00:00
* length to describe it . \ a field_name is undefined
* for a vendor string entry .
*
* A \ a field_value is what is on the right side of the
* first ' = ' in the \ a field . By definition , this may
2004-12-30 03:41:19 +00:00
* contain embedded NULs and so a \ a field_value_length
2004-12-30 00:59:30 +00:00
* is required to describe it . However in practice ,
2004-12-30 03:41:19 +00:00
* embedded NULs are not known to be used , so it is
* generally safe to treat field values as NUL -
2004-12-30 00:59:30 +00:00
* terminated UTF - 8 strings .
2002-08-20 03:56:52 +00:00
*
* Always check is_valid ( ) after the constructor or operator =
2004-12-30 03:41:19 +00:00
* to make sure memory was properly allocated and that the
* Entry conforms to the Vorbis comment specification .
2002-07-27 04:59:54 +00:00
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API Entry {
2002-05-31 06:20:50 +00:00
public :
Entry ( ) ;
2004-12-30 00:59:30 +00:00
2002-05-31 06:20:50 +00:00
Entry ( const char * field , unsigned field_length ) ;
2004-12-30 03:41:19 +00:00
Entry ( const char * field ) ; // assumes \a field is NUL-terminated
2004-12-30 00:59:30 +00:00
2002-05-31 06:20:50 +00:00
Entry ( const char * field_name , const char * field_value , unsigned field_value_length ) ;
2004-12-30 03:41:19 +00:00
Entry ( const char * field_name , const char * field_value ) ; // assumes \a field_value is NUL-terminated
2004-12-30 00:59:30 +00:00
2002-05-31 06:20:50 +00:00
Entry ( const Entry & entry ) ;
2004-12-30 00:59:30 +00:00
2005-01-07 01:09:07 +00:00
Entry & operator = ( const Entry & entry ) ;
2002-05-31 06:20:50 +00:00
virtual ~ Entry ( ) ;
virtual bool is_valid ( ) const ;
unsigned get_field_length ( ) const ;
unsigned get_field_name_length ( ) const ;
unsigned get_field_value_length ( ) const ;
2002-06-08 04:53:42 +00:00
: : FLAC__StreamMetadata_VorbisComment_Entry get_entry ( ) const ;
2002-05-31 06:20:50 +00:00
const char * get_field ( ) const ;
const char * get_field_name ( ) const ;
const char * get_field_value ( ) const ;
bool set_field ( const char * field , unsigned field_length ) ;
2004-12-30 03:41:19 +00:00
bool set_field ( const char * field ) ; // assumes \a field is NUL-terminated
2002-05-31 06:20:50 +00:00
bool set_field_name ( const char * field_name ) ;
bool set_field_value ( const char * field_value , unsigned field_value_length ) ;
2004-12-30 03:41:19 +00:00
bool set_field_value ( const char * field_value ) ; // assumes \a field_value is NUL-terminated
2002-05-31 06:20:50 +00:00
protected :
bool is_valid_ ;
2002-06-08 04:53:42 +00:00
: : FLAC__StreamMetadata_VorbisComment_Entry entry_ ;
2002-05-31 06:20:50 +00:00
char * field_name_ ;
unsigned field_name_length_ ;
char * field_value_ ;
unsigned field_value_length_ ;
private :
void zero ( ) ;
void clear ( ) ;
void clear_entry ( ) ;
void clear_field_name ( ) ;
void clear_field_value ( ) ;
void construct ( const char * field , unsigned field_length ) ;
2004-12-30 03:41:19 +00:00
void construct ( const char * field ) ; // assumes \a field is NUL-terminated
2002-05-31 06:20:50 +00:00
void construct ( const char * field_name , const char * field_value , unsigned field_value_length ) ;
2004-12-30 03:41:19 +00:00
void construct ( const char * field_name , const char * field_value ) ; // assumes \a field_value is NUL-terminated
2002-05-31 06:20:50 +00:00
void compose_field ( ) ;
void parse_field ( ) ;
} ;
2002-05-17 06:33:39 +00:00
VorbisComment ( ) ;
2002-08-20 03:56:52 +00:00
//@{
/** Constructs a copy of the given object. This form
* always performs a deep copy .
*/
2002-06-08 04:53:42 +00:00
inline VorbisComment ( const VorbisComment & object ) : Prototype ( object ) { }
inline VorbisComment ( const : : FLAC__StreamMetadata & object ) : Prototype ( object ) { }
inline VorbisComment ( const : : FLAC__StreamMetadata * object ) : Prototype ( object ) { }
2002-08-20 03:56:52 +00:00
//@}
/** Constructs an object with copy control. See
* Prototype ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
2002-06-08 04:53:42 +00:00
inline VorbisComment ( : : FLAC__StreamMetadata * object , bool copy ) : Prototype ( object , copy ) { }
2002-08-20 03:56:52 +00:00
2002-05-17 06:33:39 +00:00
~ VorbisComment ( ) ;
2002-05-22 05:33:29 +00:00
2002-08-20 03:56:52 +00:00
//@{
/** Assign from another object. Always performs a deep copy. */
2005-01-07 01:09:07 +00:00
inline VorbisComment & operator = ( const VorbisComment & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline VorbisComment & operator = ( const : : FLAC__StreamMetadata & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline VorbisComment & operator = ( const : : FLAC__StreamMetadata * object ) { Prototype : : operator = ( object ) ; return * this ; }
2002-08-20 03:56:52 +00:00
//@}
2002-05-31 06:20:50 +00:00
2005-01-07 01:09:07 +00:00
/** Assigns an object with copy control. See
* Prototype : : assign_object ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
inline VorbisComment & assign ( : : FLAC__StreamMetadata * object , bool copy ) { Prototype : : assign_object ( object , copy ) ; return * this ; }
2002-08-20 03:56:52 +00:00
//@{
/** Check for equality, performing a deep compare by following pointers. */
2002-06-07 05:27:37 +00:00
inline bool operator = = ( const VorbisComment & object ) const { return Prototype : : operator = = ( object ) ; }
2002-06-08 04:53:42 +00:00
inline bool operator = = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator = = ( object ) ; }
inline bool operator = = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator = = ( object ) ; }
2002-08-20 03:56:52 +00:00
//@}
//@{
/** Check for inequality, performing a deep compare by following pointers. */
2002-06-07 05:27:37 +00:00
inline bool operator ! = ( const VorbisComment & object ) const { return Prototype : : operator ! = ( object ) ; }
2002-06-08 04:53:42 +00:00
inline bool operator ! = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator ! = ( object ) ; }
inline bool operator ! = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator ! = ( object ) ; }
2002-08-20 03:56:52 +00:00
//@}
2002-06-07 05:27:37 +00:00
2002-05-31 06:20:50 +00:00
unsigned get_num_comments ( ) const ;
2004-12-30 03:41:19 +00:00
const FLAC__byte * get_vendor_string ( ) const ; // NUL-terminated UTF-8 string
2002-05-31 06:20:50 +00:00
Entry get_comment ( unsigned index ) const ;
2002-08-20 07:09:33 +00:00
//! See FLAC__metadata_object_vorbiscomment_set_vendor_string()
2004-12-30 03:41:19 +00:00
bool set_vendor_string ( const FLAC__byte * string ) ; // NUL-terminated UTF-8 string
2002-08-20 03:56:52 +00:00
2002-08-20 07:09:33 +00:00
//! See FLAC__metadata_object_vorbiscomment_set_comment()
2002-05-31 06:20:50 +00:00
bool set_comment ( unsigned index , const Entry & entry ) ;
2002-08-20 03:56:52 +00:00
2002-08-20 07:09:33 +00:00
//! See FLAC__metadata_object_vorbiscomment_insert_comment()
2002-05-31 06:20:50 +00:00
bool insert_comment ( unsigned index , const Entry & entry ) ;
2002-08-20 03:56:52 +00:00
2004-12-30 00:59:30 +00:00
//! See FLAC__metadata_object_vorbiscomment_append_comment()
bool append_comment ( const Entry & entry ) ;
2002-08-20 07:09:33 +00:00
//! See FLAC__metadata_object_vorbiscomment_delete_comment()
2002-05-31 06:20:50 +00:00
bool delete_comment ( unsigned index ) ;
2002-05-22 05:33:29 +00:00
} ;
2002-11-16 06:30:30 +00:00
/** CUESHEET metadata block.
2006-10-07 05:43:01 +00:00
* See the \ link flacpp_metadata_object overview \ endlink for more ,
* and the < A HREF = " ../format.html#metadata_block_cuesheet " > format specification < / A > .
2002-11-16 06:30:30 +00:00
*/
class FLACPP_API CueSheet : public Prototype {
public :
/** Convenience class for encapsulating a cue sheet
* track .
*
* Always check is_valid ( ) after the constructor or operator =
* to make sure memory was properly allocated .
*/
class FLACPP_API Track {
protected :
: : FLAC__StreamMetadata_CueSheet_Track * object_ ;
public :
Track ( ) ;
Track ( const : : FLAC__StreamMetadata_CueSheet_Track * track ) ;
Track ( const Track & track ) ;
2005-01-07 01:09:07 +00:00
Track & operator = ( const Track & track ) ;
2002-11-16 06:30:30 +00:00
virtual ~ Track ( ) ;
virtual bool is_valid ( ) const ;
inline FLAC__uint64 get_offset ( ) const { return object_ - > offset ; }
inline FLAC__byte get_number ( ) const { return object_ - > number ; }
inline const char * get_isrc ( ) const { return object_ - > isrc ; }
inline unsigned get_type ( ) const { return object_ - > type ; }
inline bool get_pre_emphasis ( ) const { return object_ - > pre_emphasis ; }
2003-01-22 20:16:20 +00:00
inline FLAC__byte get_num_indices ( ) const { return object_ - > num_indices ; }
2002-11-16 06:30:30 +00:00
: : FLAC__StreamMetadata_CueSheet_Index get_index ( unsigned i ) const ;
inline const : : FLAC__StreamMetadata_CueSheet_Track * get_track ( ) const { return object_ ; }
inline void set_offset ( FLAC__uint64 value ) { object_ - > offset = value ; }
inline void set_number ( FLAC__byte value ) { object_ - > number = value ; }
2002-11-19 06:19:29 +00:00
void set_isrc ( const char value [ 12 ] ) ;
2002-11-16 06:30:30 +00:00
void set_type ( unsigned value ) ;
inline void set_pre_emphasis ( bool value ) { object_ - > pre_emphasis = value ? 1 : 0 ; }
2002-11-19 06:19:29 +00:00
void set_index ( unsigned i , const : : FLAC__StreamMetadata_CueSheet_Index & index ) ;
2003-01-12 08:42:23 +00:00
//@@@ It's awkward but to insert/delete index points
//@@@ you must use the routines in the CueSheet class.
2002-11-16 06:30:30 +00:00
} ;
CueSheet ( ) ;
//@{
/** Constructs a copy of the given object. This form
* always performs a deep copy .
*/
inline CueSheet ( const CueSheet & object ) : Prototype ( object ) { }
inline CueSheet ( const : : FLAC__StreamMetadata & object ) : Prototype ( object ) { }
inline CueSheet ( const : : FLAC__StreamMetadata * object ) : Prototype ( object ) { }
//@}
/** Constructs an object with copy control. See
* Prototype ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
inline CueSheet ( : : FLAC__StreamMetadata * object , bool copy ) : Prototype ( object , copy ) { }
~ CueSheet ( ) ;
//@{
/** Assign from another object. Always performs a deep copy. */
2005-01-07 01:09:07 +00:00
inline CueSheet & operator = ( const CueSheet & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline CueSheet & operator = ( const : : FLAC__StreamMetadata & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline CueSheet & operator = ( const : : FLAC__StreamMetadata * object ) { Prototype : : operator = ( object ) ; return * this ; }
2002-11-16 06:30:30 +00:00
//@}
2005-01-07 01:09:07 +00:00
/** Assigns an object with copy control. See
* Prototype : : assign_object ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
inline CueSheet & assign ( : : FLAC__StreamMetadata * object , bool copy ) { Prototype : : assign_object ( object , copy ) ; return * this ; }
2002-11-16 06:30:30 +00:00
//@{
/** Check for equality, performing a deep compare by following pointers. */
inline bool operator = = ( const CueSheet & object ) const { return Prototype : : operator = = ( object ) ; }
inline bool operator = = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator = = ( object ) ; }
inline bool operator = = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator = = ( object ) ; }
//@}
//@{
/** Check for inequality, performing a deep compare by following pointers. */
inline bool operator ! = ( const CueSheet & object ) const { return Prototype : : operator ! = ( object ) ; }
inline bool operator ! = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator ! = ( object ) ; }
inline bool operator ! = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator ! = ( object ) ; }
//@}
const char * get_media_catalog_number ( ) const ;
FLAC__uint64 get_lead_in ( ) const ;
2002-12-05 06:37:46 +00:00
bool get_is_cd ( ) const ;
2002-11-16 06:30:30 +00:00
unsigned get_num_tracks ( ) const ;
Track get_track ( unsigned i ) const ;
2002-11-19 06:19:29 +00:00
void set_media_catalog_number ( const char value [ 128 ] ) ;
void set_lead_in ( FLAC__uint64 value ) ;
2002-12-05 06:37:46 +00:00
void set_is_cd ( bool value ) ;
2002-11-19 06:19:29 +00:00
void set_index ( unsigned track_num , unsigned index_num , const : : FLAC__StreamMetadata_CueSheet_Index & index ) ;
2002-11-16 06:30:30 +00:00
//! See FLAC__metadata_object_cuesheet_track_insert_index()
bool insert_index ( unsigned track_num , unsigned index_num , const : : FLAC__StreamMetadata_CueSheet_Index & index ) ;
//! See FLAC__metadata_object_cuesheet_track_delete_index()
bool delete_index ( unsigned track_num , unsigned index_num ) ;
//! See FLAC__metadata_object_cuesheet_set_track()
bool set_track ( unsigned i , const Track & track ) ;
//! See FLAC__metadata_object_cuesheet_insert_track()
bool insert_track ( unsigned i , const Track & track ) ;
//! See FLAC__metadata_object_cuesheet_delete_track()
bool delete_track ( unsigned i ) ;
//! See FLAC__metadata_object_cuesheet_is_legal()
bool is_legal ( bool check_cd_da_subset = false , const char * * violation = 0 ) const ;
2006-04-10 05:37:34 +00:00
//! See FLAC__metadata_object_cuesheet_calculate_cddb_id()
FLAC__uint32 calculate_cddb_id ( ) const ;
2002-11-16 06:30:30 +00:00
} ;
2006-09-23 19:21:19 +00:00
/** PICTURE metadata block.
2006-10-07 05:43:01 +00:00
* See the \ link flacpp_metadata_object overview \ endlink for more ,
* and the < A HREF = " ../format.html#metadata_block_picture " > format specification < / A > .
2006-09-23 19:21:19 +00:00
*/
class FLACPP_API Picture : public Prototype {
public :
Picture ( ) ;
//@{
/** Constructs a copy of the given object. This form
* always performs a deep copy .
*/
inline Picture ( const Picture & object ) : Prototype ( object ) { }
inline Picture ( const : : FLAC__StreamMetadata & object ) : Prototype ( object ) { }
inline Picture ( const : : FLAC__StreamMetadata * object ) : Prototype ( object ) { }
//@}
/** Constructs an object with copy control. See
* Prototype ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
inline Picture ( : : FLAC__StreamMetadata * object , bool copy ) : Prototype ( object , copy ) { }
~ Picture ( ) ;
//@{
/** Assign from another object. Always performs a deep copy. */
inline Picture & operator = ( const Picture & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline Picture & operator = ( const : : FLAC__StreamMetadata & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline Picture & operator = ( const : : FLAC__StreamMetadata * object ) { Prototype : : operator = ( object ) ; return * this ; }
//@}
/** Assigns an object with copy control. See
* Prototype : : assign_object ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
inline Picture & assign ( : : FLAC__StreamMetadata * object , bool copy ) { Prototype : : assign_object ( object , copy ) ; return * this ; }
//@{
/** Check for equality, performing a deep compare by following pointers. */
inline bool operator = = ( const Picture & object ) const { return Prototype : : operator = = ( object ) ; }
inline bool operator = = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator = = ( object ) ; }
inline bool operator = = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator = = ( object ) ; }
//@}
//@{
/** Check for inequality, performing a deep compare by following pointers. */
inline bool operator ! = ( const Picture & object ) const { return Prototype : : operator ! = ( object ) ; }
inline bool operator ! = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator ! = ( object ) ; }
inline bool operator ! = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator ! = ( object ) ; }
//@}
: : FLAC__StreamMetadata_Picture_Type get_type ( ) const ;
const char * get_mime_type ( ) const ; // NUL-terminated printable ASCII string
const FLAC__byte * get_description ( ) const ; // NUL-terminated UTF-8 string
FLAC__uint32 get_width ( ) const ;
FLAC__uint32 get_height ( ) const ;
FLAC__uint32 get_depth ( ) const ;
2006-09-23 23:15:05 +00:00
FLAC__uint32 get_colors ( ) const ; ///< a return value of \c 0 means true-color, i.e. 2^depth colors
2006-09-23 19:21:19 +00:00
FLAC__uint32 get_data_length ( ) const ;
const FLAC__byte * get_data ( ) const ;
void set_type ( : : FLAC__StreamMetadata_Picture_Type type ) ;
//! See FLAC__metadata_object_picture_set_mime_type()
bool set_mime_type ( const char * string ) ; // NUL-terminated printable ASCII string
//! See FLAC__metadata_object_picture_set_description()
bool set_description ( const FLAC__byte * string ) ; // NUL-terminated UTF-8 string
void set_width ( FLAC__uint32 value ) const ;
void set_height ( FLAC__uint32 value ) const ;
void set_depth ( FLAC__uint32 value ) const ;
2006-09-23 23:15:05 +00:00
void set_colors ( FLAC__uint32 value ) const ; ///< a value of \c 0 means true-color, i.e. 2^depth colors
2006-09-23 19:21:19 +00:00
//! See FLAC__metadata_object_picture_set_data()
bool set_data ( const FLAC__byte * data , FLAC__uint32 data_length ) ;
} ;
2003-01-10 05:29:17 +00:00
/** Opaque metadata block for storing unknown types.
* This should not be used unless you know what you are doing ;
* it is currently used only internally to support forward
* compatibility of metadata blocks .
2006-10-07 05:43:01 +00:00
* See the \ link flacpp_metadata_object overview \ endlink for more ,
2003-01-10 05:29:17 +00:00
*/
class FLACPP_API Unknown : public Prototype {
public :
Unknown ( ) ;
//
//@{
/** Constructs a copy of the given object. This form
* always performs a deep copy .
*/
inline Unknown ( const Unknown & object ) : Prototype ( object ) { }
inline Unknown ( const : : FLAC__StreamMetadata & object ) : Prototype ( object ) { }
inline Unknown ( const : : FLAC__StreamMetadata * object ) : Prototype ( object ) { }
//@}
/** Constructs an object with copy control. See
* Prototype ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
inline Unknown ( : : FLAC__StreamMetadata * object , bool copy ) : Prototype ( object , copy ) { }
~ Unknown ( ) ;
//@{
/** Assign from another object. Always performs a deep copy. */
2005-01-07 01:09:07 +00:00
inline Unknown & operator = ( const Unknown & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline Unknown & operator = ( const : : FLAC__StreamMetadata & object ) { Prototype : : operator = ( object ) ; return * this ; }
inline Unknown & operator = ( const : : FLAC__StreamMetadata * object ) { Prototype : : operator = ( object ) ; return * this ; }
2003-01-10 05:29:17 +00:00
//@}
2005-01-07 01:09:07 +00:00
/** Assigns an object with copy control. See
* Prototype : : assign_object ( : : FLAC__StreamMetadata * object , bool copy ) .
*/
inline Unknown & assign ( : : FLAC__StreamMetadata * object , bool copy ) { Prototype : : assign_object ( object , copy ) ; return * this ; }
2003-01-10 05:29:17 +00:00
//@{
/** Check for equality, performing a deep compare by following pointers. */
inline bool operator = = ( const Unknown & object ) const { return Prototype : : operator = = ( object ) ; }
inline bool operator = = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator = = ( object ) ; }
inline bool operator = = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator = = ( object ) ; }
//@}
//@{
/** Check for inequality, performing a deep compare by following pointers. */
inline bool operator ! = ( const Unknown & object ) const { return Prototype : : operator ! = ( object ) ; }
inline bool operator ! = ( const : : FLAC__StreamMetadata & object ) const { return Prototype : : operator ! = ( object ) ; }
inline bool operator ! = ( const : : FLAC__StreamMetadata * object ) const { return Prototype : : operator ! = ( object ) ; }
//@}
const FLAC__byte * get_data ( ) const ;
//! This form always copies \a data
bool set_data ( const FLAC__byte * data , unsigned length ) ;
bool set_data ( FLAC__byte * data , unsigned length , bool copy ) ;
} ;
2002-07-27 04:59:54 +00:00
/* \} */
2002-05-31 06:20:50 +00:00
2002-07-27 04:59:54 +00:00
/** \defgroup flacpp_metadata_level0 FLAC++/metadata.h: metadata level 0 interface
* \ ingroup flacpp_metadata
*
* \ brief
2004-07-30 01:54:29 +00:00
* Level 0 metadata iterators .
2002-07-27 04:59:54 +00:00
*
2002-08-20 03:56:52 +00:00
* See the \ link flac_metadata_level0 C layer equivalent \ endlink
* for more .
2002-07-27 04:59:54 +00:00
*
* \ {
*/
2006-10-07 05:43:01 +00:00
FLACPP_API bool get_streaminfo ( const char * filename , StreamInfo & streaminfo ) ; ///< See FLAC__metadata_get_streaminfo().
2006-09-23 19:21:19 +00:00
2006-10-07 05:43:01 +00:00
FLACPP_API bool get_tags ( const char * filename , VorbisComment * & tags ) ; ///< See FLAC__metadata_get_tags().
FLACPP_API bool get_tags ( const char * filename , VorbisComment & tags ) ; ///< See FLAC__metadata_get_tags().
2004-12-30 03:55:00 +00:00
2006-10-07 05:43:01 +00:00
FLACPP_API bool get_cuesheet ( const char * filename , CueSheet * & cuesheet ) ; ///< See FLAC__metadata_get_cuesheet().
FLACPP_API bool get_cuesheet ( const char * filename , CueSheet & cuesheet ) ; ///< See FLAC__metadata_get_cuesheet().
2002-05-22 05:33:29 +00:00
2006-10-07 05:43:01 +00:00
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().
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().
2006-04-10 05:37:34 +00:00
2002-07-27 04:59:54 +00:00
/* \} */
2002-05-31 06:20:50 +00:00
2002-07-27 04:59:54 +00:00
/** \defgroup flacpp_metadata_level1 FLAC++/metadata.h: metadata level 1 interface
* \ ingroup flacpp_metadata
*
2002-08-20 03:56:52 +00:00
* \ brief
* Level 1 metadata iterator .
*
* The flow through the iterator in the C + + layer is similar
* to the C layer :
* - Create a SimpleIterator instance
* - Check SimpleIterator : : is_valid ( )
* - Call SimpleIterator : : init ( ) and check the return
* - Traverse and / or edit . Edits are written to file
* immediately .
* - Destroy the SimpleIterator instance
*
* The ownership of pointers in the C + + layer follows that in
* the C layer , i . e .
* - The objects returned by get_block ( ) are yours to
* modify , but changes are not reflected in the FLAC file
* until you call set_block ( ) . The objects are also
* yours to delete ; they are not automatically deleted
* when passed to set_block ( ) or insert_block_after ( ) .
2002-07-27 04:59:54 +00:00
*
2002-08-20 03:56:52 +00:00
* See the \ link flac_metadata_level1 C layer equivalent \ endlink
* for more .
2002-07-27 04:59:54 +00:00
*
* \ {
*/
2002-08-21 03:40:11 +00:00
/** This class is a wrapper around the FLAC__metadata_simple_iterator
2006-10-07 05:43:01 +00:00
* structures and methods ; see the
* \ link flacpp_metadata_level1 usage guide \ endlink and
* : : FLAC__Metadata_SimpleIterator .
2002-07-27 04:59:54 +00:00
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API SimpleIterator {
2002-05-22 05:33:29 +00:00
public :
2006-10-07 05:43:01 +00:00
/** This class is a wrapper around FLAC__Metadata_SimpleIteratorStatus.
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API Status {
2002-05-22 05:33:29 +00:00
public :
2002-06-08 04:53:42 +00:00
inline Status ( : : FLAC__Metadata_SimpleIteratorStatus status ) : status_ ( status ) { }
inline operator : : FLAC__Metadata_SimpleIteratorStatus ( ) const { return status_ ; }
inline const char * as_cstring ( ) const { return : : FLAC__Metadata_SimpleIteratorStatusString [ status_ ] ; }
2002-05-22 05:33:29 +00:00
protected :
2002-06-08 04:53:42 +00:00
: : FLAC__Metadata_SimpleIteratorStatus status_ ;
2002-05-22 05:33:29 +00:00
} ;
SimpleIterator ( ) ;
virtual ~ SimpleIterator ( ) ;
2006-10-07 05:43:01 +00:00
bool init ( const char * filename , bool read_only , bool preserve_file_stats ) ; ///< See FLAC__metadata_simple_iterator_init().
2002-05-22 05:33:29 +00:00
bool is_valid ( ) const ;
2006-10-07 05:43:01 +00:00
Status status ( ) ; ///< See FLAC__metadata_simple_iterator_status().
bool is_writable ( ) const ; ///< See FLAC__metadata_simple_iterator_is_writable().
2002-05-22 05:33:29 +00:00
2006-10-07 05:43:01 +00:00
bool next ( ) ; ///< See FLAC__metadata_simple_iterator_next().
bool prev ( ) ; ///< See FLAC__metadata_simple_iterator_prev().
2002-05-22 05:33:29 +00:00
2006-10-07 05:43:01 +00:00
: : FLAC__MetadataType get_block_type ( ) const ; ///< See FLAC__metadata_simple_iterator_get_block_type().
Prototype * get_block ( ) ; ///< See FLAC__metadata_simple_iterator_get_block().
bool set_block ( Prototype * block , bool use_padding = true ) ; ///< See FLAC__metadata_simple_iterator_set_block().
bool insert_block_after ( Prototype * block , bool use_padding = true ) ; ///< See FLAC__metadata_simple_iterator_insert_block_after().
bool delete_block ( bool use_padding = true ) ; ///< See FLAC__metadata_simple_iterator_delete_block().
2002-05-22 05:33:29 +00:00
protected :
2002-06-08 04:53:42 +00:00
: : FLAC__Metadata_SimpleIterator * iterator_ ;
2002-05-22 05:33:29 +00:00
void clear ( ) ;
} ;
2002-07-27 04:59:54 +00:00
/* \} */
2002-05-31 06:20:50 +00:00
2002-07-27 04:59:54 +00:00
/** \defgroup flacpp_metadata_level2 FLAC++/metadata.h: metadata level 2 interface
* \ ingroup flacpp_metadata
*
2002-08-20 03:56:52 +00:00
* \ brief
* Level 2 metadata iterator .
*
* The flow through the iterator in the C + + layer is similar
* to the C layer :
* - Create a Chain instance
* - Check Chain : : is_valid ( )
* - Call Chain : : read ( ) and check the return
* - Traverse and / or edit with an Iterator or with
* Chain : : merge_padding ( ) or Chain : : sort_padding ( )
* - Write changes back to FLAC file with Chain : : write ( )
* - Destroy the Chain instance
*
2002-12-28 07:03:26 +00:00
* The ownership of pointers in the C + + layer is slightly
* different than in the C layer , i . e .
* - The objects returned by Iterator : : get_block ( ) are NOT
* owned by the iterator and should be deleted by the
* caller when finished , BUT , when you modify the block ,
* it will directly edit what ' s in the chain and you do
* not need to call Iterator : : set_block ( ) . However the
* changes will not be reflected in the FLAC file until
* the chain is written with Chain : : write ( ) .
2002-08-20 03:56:52 +00:00
* - When you pass an object to Iterator : : set_block ( ) ,
* Iterator : : insert_block_before ( ) , or
* Iterator : : insert_block_after ( ) , the iterator takes
2002-12-28 07:03:26 +00:00
* ownership of the block and it will be deleted by the
2002-08-20 03:56:52 +00:00
* chain .
2002-07-27 04:59:54 +00:00
*
2002-08-20 03:56:52 +00:00
* See the \ link flac_metadata_level2 C layer equivalent \ endlink
* for more .
2002-07-27 04:59:54 +00:00
*
* \ {
*/
2002-08-21 03:40:11 +00:00
/** This class is a wrapper around the FLAC__metadata_chain
2006-10-07 05:43:01 +00:00
* structures and methods ; see the
* \ link flacpp_metadata_level2 usage guide \ endlink and
* : : FLAC__Metadata_Chain .
2002-07-27 04:59:54 +00:00
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API Chain {
2002-05-22 05:33:29 +00:00
public :
2006-10-07 05:43:01 +00:00
/** This class is a wrapper around FLAC__Metadata_ChainStatus.
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API Status {
2002-05-22 05:33:29 +00:00
public :
2002-06-08 04:53:42 +00:00
inline Status ( : : FLAC__Metadata_ChainStatus status ) : status_ ( status ) { }
inline operator : : FLAC__Metadata_ChainStatus ( ) const { return status_ ; }
inline const char * as_cstring ( ) const { return : : FLAC__Metadata_ChainStatusString [ status_ ] ; }
2002-05-22 05:33:29 +00:00
protected :
2002-06-08 04:53:42 +00:00
: : FLAC__Metadata_ChainStatus status_ ;
2002-05-22 05:33:29 +00:00
} ;
Chain ( ) ;
virtual ~ Chain ( ) ;
friend class Iterator ;
bool is_valid ( ) const ;
2006-10-07 05:43:01 +00:00
Status status ( ) ; ///< See FLAC__metadata_chain_status().
2002-05-22 05:33:29 +00:00
2006-10-07 05:43:01 +00:00
bool read ( const char * filename ) ; ///< See FLAC__metadata_chain_read().
bool read ( FLAC__IOHandle handle , FLAC__IOCallbacks callbacks ) ; ///< See FLAC__metadata_chain_read_with_callbacks().
2004-07-15 16:22:43 +00:00
2006-10-07 05:43:01 +00:00
bool check_if_tempfile_needed ( bool use_padding ) ; ///< See FLAC__metadata_chain_check_if_tempfile_needed().
2004-07-15 16:22:43 +00:00
2006-10-07 05:43:01 +00:00
bool write ( bool use_padding = true , bool preserve_file_stats = false ) ; ///< See FLAC__metadata_chain_write().
bool write ( bool use_padding , : : FLAC__IOHandle handle , : : FLAC__IOCallbacks callbacks ) ; ///< See FLAC__metadata_chain_write_with_callbacks().
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().
2002-05-22 05:33:29 +00:00
2006-10-07 05:43:01 +00:00
void merge_padding ( ) ; ///< See FLAC__metadata_chain_merge_padding().
void sort_padding ( ) ; ///< See FLAC__metadata_chain_sort_padding().
2002-05-22 05:33:29 +00:00
protected :
2002-06-08 04:53:42 +00:00
: : FLAC__Metadata_Chain * chain_ ;
2002-05-22 05:33:29 +00:00
virtual void clear ( ) ;
} ;
2002-08-21 03:40:11 +00:00
/** This class is a wrapper around the FLAC__metadata_iterator
2006-10-07 05:43:01 +00:00
* structures and methods ; see the
* \ link flacpp_metadata_level2 usage guide \ endlink and
* : : FLAC__Metadata_Iterator .
2002-07-27 04:59:54 +00:00
*/
2002-10-16 22:18:32 +00:00
class FLACPP_API Iterator {
2002-05-22 05:33:29 +00:00
public :
Iterator ( ) ;
virtual ~ Iterator ( ) ;
bool is_valid ( ) const ;
2006-10-07 05:43:01 +00:00
void init ( Chain & chain ) ; ///< See FLAC__metadata_iterator_init().
2002-05-22 05:33:29 +00:00
2006-10-07 05:43:01 +00:00
bool next ( ) ; ///< See FLAC__metadata_iterator_next().
bool prev ( ) ; ///< See FLAC__metadata_iterator_prev().
2002-05-22 05:33:29 +00:00
2006-10-07 05:43:01 +00:00
: : FLAC__MetadataType get_block_type ( ) const ; ///< See FLAC__metadata_iterator_get_block_type().
Prototype * get_block ( ) ; ///< See FLAC__metadata_iterator_get_block().
bool set_block ( Prototype * block ) ; ///< See FLAC__metadata_iterator_set_block().
bool delete_block ( bool replace_with_padding ) ; ///< See FLAC__metadata_iterator_delete_block().
bool insert_block_before ( Prototype * block ) ; ///< See FLAC__metadata_iterator_insert_block_before().
bool insert_block_after ( Prototype * block ) ; ///< See FLAC__metadata_iterator_insert_block_after().
2002-05-22 05:33:29 +00:00
protected :
2002-06-08 04:53:42 +00:00
: : FLAC__Metadata_Iterator * iterator_ ;
2002-05-22 05:33:29 +00:00
virtual void clear ( ) ;
2002-05-17 06:33:39 +00:00
} ;
2002-07-27 04:59:54 +00:00
/* \} */
2005-01-25 02:27:20 +00:00
}
}
2002-05-17 06:33:39 +00:00
# endif