Commit cd9053cd authored by Erik de Castro Lopo's avatar Erik de Castro Lopo
Browse files

Add functionality present in the C library to the to C++ SeekTable class.

Patch from Bastiaan Timmer <basjetimmer@yahoo.com> sent to the
<flac-dev@xiph.org> mailing list.
parent c5c4ce91
...@@ -502,6 +502,9 @@ namespace FLAC { ...@@ -502,6 +502,9 @@ namespace FLAC {
unsigned get_num_points() const; unsigned get_num_points() const;
::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const; ::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const;
//! See FLAC__metadata_object_seektable_resize_points()
bool resize_points(unsigned new_num_points);
//! See FLAC__metadata_object_seektable_set_point() //! See FLAC__metadata_object_seektable_set_point()
void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point); void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
...@@ -513,6 +516,24 @@ namespace FLAC { ...@@ -513,6 +516,24 @@ namespace FLAC {
//! See FLAC__metadata_object_seektable_is_legal() //! See FLAC__metadata_object_seektable_is_legal()
bool is_legal() const; bool is_legal() const;
//! See FLAC__metadata_object_seektable_template_append_placeholders()
bool template_append_placeholders(unsigned num);
//! See FLAC__metadata_object_seektable_template_append_point()
bool template_append_point(FLAC__uint64 sample_number);
//! See FLAC__metadata_object_seektable_template_append_points()
bool template_append_points(FLAC__uint64 sample_numbers[], unsigned num);
//! See FLAC__metadata_object_seektable_template_append_spaced_points()
bool template_append_spaced_points(unsigned num, FLAC__uint64 total_samples);
//! See FLAC__metadata_object_seektable_template_append_spaced_points_by_samples()
bool template_append_spaced_points_by_samples(unsigned samples, FLAC__uint64 total_samples);
//! See FLAC__metadata_object_seektable_template_sort()
bool template_sort(bool compact);
}; };
/** VORBIS_COMMENT metadata block. /** VORBIS_COMMENT metadata block.
......
...@@ -438,6 +438,12 @@ namespace FLAC { ...@@ -438,6 +438,12 @@ namespace FLAC {
return object_->data.seek_table.points[index]; return object_->data.seek_table.points[index];
} }
bool SeekTable::resize_points(unsigned new_num_points)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__metadata_object_seektable_resize_points(object_, new_num_points);
}
void SeekTable::set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point) void SeekTable::set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point)
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
...@@ -465,6 +471,42 @@ namespace FLAC { ...@@ -465,6 +471,42 @@ namespace FLAC {
return (bool)::FLAC__metadata_object_seektable_is_legal(object_); return (bool)::FLAC__metadata_object_seektable_is_legal(object_);
} }
bool SeekTable::template_append_placeholders(unsigned num)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__metadata_object_seektable_template_append_placeholders(object_, num);
}
bool SeekTable::template_append_point(FLAC__uint64 sample_number)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__metadata_object_seektable_template_append_point(object_, sample_number);
}
bool SeekTable::template_append_points(FLAC__uint64 sample_numbers[], unsigned num)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__metadata_object_seektable_template_append_points(object_, sample_numbers, num);
}
bool SeekTable::template_append_spaced_points(unsigned num, FLAC__uint64 total_samples)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__metadata_object_seektable_template_append_spaced_points(object_, num, total_samples);
}
bool SeekTable::template_append_spaced_points_by_samples(unsigned samples, FLAC__uint64 total_samples)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(object_, samples, total_samples);
}
bool SeekTable::template_sort(bool compact)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__metadata_object_seektable_template_sort(object_, compact);
}
// //
// VorbisComment::Entry // VorbisComment::Entry
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment