mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
add FLAC__metadata_simple_iterator_get_block_offset(), FLAC__metadata_simple_iterator_get_block_length(), FLAC__metadata_simple_iterator_is_last()
This commit is contained in:
@@ -118,13 +118,17 @@
|
||||
<li>
|
||||
libFLAC:
|
||||
<ul>
|
||||
<li>(none)</li>
|
||||
<li><b>Added</b> FLAC__metadata_simple_iterator_is_last()</li>
|
||||
<li><b>Added</b> FLAC__metadata_simple_iterator_get_block_offset()</li>
|
||||
<li><b>Added</b> FLAC__metadata_simple_iterator_get_block_length()</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
libFLAC++:
|
||||
<ul>
|
||||
<li>(none)</li>
|
||||
<li><b>Added</b> FLAC::Metadata::SimpleIterator::is_last()</li>
|
||||
<li><b>Added</b> FLAC::Metadata::SimpleIterator::get_block_offset()</li>
|
||||
<li><b>Added</b> FLAC::Metadata::SimpleIterator::get_block_length()</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -1018,8 +1018,11 @@ namespace FLAC {
|
||||
|
||||
bool next(); ///< See FLAC__metadata_simple_iterator_next().
|
||||
bool prev(); ///< See FLAC__metadata_simple_iterator_prev().
|
||||
bool is_last() const; ///< See FLAC__metadata_simple_iterator_is_last().
|
||||
|
||||
off_t get_block_offset() const; ///< See FLAC__metadata_simple_iterator_get_block_offset().
|
||||
::FLAC__MetadataType get_block_type() const; ///< See FLAC__metadata_simple_iterator_get_block_type().
|
||||
unsigned get_block_length() const; ///< See FLAC__metadata_simple_iterator_get_block_length().
|
||||
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().
|
||||
|
||||
@@ -443,6 +443,38 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIte
|
||||
*/
|
||||
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator);
|
||||
|
||||
/*@@@@add to tests*/
|
||||
/** Returns a flag telling if the current metadata block is the last.
|
||||
*
|
||||
* \param iterator A pointer to an existing initialized iterator.
|
||||
* \assert
|
||||
* \code iterator != NULL \endcode
|
||||
* \a iterator has been successfully initialized with
|
||||
* FLAC__metadata_simple_iterator_init()
|
||||
* \retval FLAC__bool
|
||||
* \c true if the current metadata block is the last in the file,
|
||||
* else \c false.
|
||||
*/
|
||||
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_last(const FLAC__Metadata_SimpleIterator *iterator);
|
||||
|
||||
/*@@@@add to tests*/
|
||||
/** Get the offset of the metadata block at the current position. This
|
||||
* avoids reading the actual block data which can save time for large
|
||||
* blocks.
|
||||
*
|
||||
* \param iterator A pointer to an existing initialized iterator.
|
||||
* \assert
|
||||
* \code iterator != NULL \endcode
|
||||
* \a iterator has been successfully initialized with
|
||||
* FLAC__metadata_simple_iterator_init()
|
||||
* \retval off_t
|
||||
* The offset of the metadata block at the current iterator position.
|
||||
* This is the byte offset relative to the beginning of the file of
|
||||
* the current metadata block's header.
|
||||
*/
|
||||
|
||||
FLAC_API off_t FLAC__metadata_simple_iterator_get_block_offset(const FLAC__Metadata_SimpleIterator *iterator);
|
||||
|
||||
/** Get the type of the metadata block at the current position. This
|
||||
* avoids reading the actual block data which can save time for large
|
||||
* blocks.
|
||||
@@ -458,6 +490,25 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIte
|
||||
|
||||
FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator);
|
||||
|
||||
/*@@@@add to tests*/
|
||||
/** Get the length of the metadata block at the current position. This
|
||||
* avoids reading the actual block data which can save time for large
|
||||
* blocks.
|
||||
*
|
||||
* \param iterator A pointer to an existing initialized iterator.
|
||||
* \assert
|
||||
* \code iterator != NULL \endcode
|
||||
* \a iterator has been successfully initialized with
|
||||
* FLAC__metadata_simple_iterator_init()
|
||||
* \retval unsigned
|
||||
* The length of the metadata block at the current iterator position.
|
||||
* The is same length as that in the
|
||||
* <a href="http://flac.sourceforge.net/format.html#metadata_block_header">metadata block header</a>,
|
||||
* i.e. the length of the metadata body that follows the header.
|
||||
*/
|
||||
|
||||
FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator);
|
||||
|
||||
/** Get the metadata block at the current position. You can modify the
|
||||
* block but must use FLAC__metadata_simple_iterator_set_block() to
|
||||
* write it back to the FLAC file.
|
||||
|
||||
@@ -1336,12 +1336,33 @@ namespace FLAC {
|
||||
return (bool)::FLAC__metadata_simple_iterator_prev(iterator_);
|
||||
}
|
||||
|
||||
//@@@@ add to tests
|
||||
bool SimpleIterator::is_last() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__metadata_simple_iterator_is_last(iterator_);
|
||||
}
|
||||
|
||||
//@@@@ add to tests
|
||||
off_t SimpleIterator::get_block_offset() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__metadata_simple_iterator_get_block_offset(iterator_);
|
||||
}
|
||||
|
||||
::FLAC__MetadataType SimpleIterator::get_block_type() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__metadata_simple_iterator_get_block_type(iterator_);
|
||||
}
|
||||
|
||||
//@@@@ add to tests
|
||||
unsigned SimpleIterator::get_block_length() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__metadata_simple_iterator_get_block_length(iterator_);
|
||||
}
|
||||
|
||||
Prototype *SimpleIterator::get_block()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
|
||||
@@ -577,6 +577,22 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIte
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_last(const FLAC__Metadata_SimpleIterator *iterator)
|
||||
{
|
||||
FLAC__ASSERT(0 != iterator);
|
||||
FLAC__ASSERT(0 != iterator->file);
|
||||
|
||||
return iterator->is_last;
|
||||
}
|
||||
|
||||
FLAC_API off_t FLAC__metadata_simple_iterator_get_block_offset(const FLAC__Metadata_SimpleIterator *iterator)
|
||||
{
|
||||
FLAC__ASSERT(0 != iterator);
|
||||
FLAC__ASSERT(0 != iterator->file);
|
||||
|
||||
return iterator->offset[iterator->depth];
|
||||
}
|
||||
|
||||
FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator)
|
||||
{
|
||||
FLAC__ASSERT(0 != iterator);
|
||||
@@ -585,6 +601,14 @@ FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const
|
||||
return iterator->type;
|
||||
}
|
||||
|
||||
FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator)
|
||||
{
|
||||
FLAC__ASSERT(0 != iterator);
|
||||
FLAC__ASSERT(0 != iterator->file);
|
||||
|
||||
return iterator->length;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Metadata_SimpleIterator *iterator)
|
||||
{
|
||||
FLAC__StreamMetadata *block = FLAC__metadata_object_new(iterator->type);
|
||||
|
||||
Reference in New Issue
Block a user