From 1294b6499609e377573d6a9d4841769cb5b2a10d Mon Sep 17 00:00:00 2001 From: Bastiaan Timmer Date: Thu, 21 Jun 2012 01:48:56 -0700 Subject: [PATCH] Adds last functions from C metadata api to C++ metadata api Signed-off-by: Erik de Castro Lopo --- include/FLAC++/metadata.h | 15 +++++++++++++++ src/libFLAC++/metadata.cpp | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/include/FLAC++/metadata.h b/include/FLAC++/metadata.h index adf18b5..90bf198 100644 --- a/include/FLAC++/metadata.h +++ b/include/FLAC++/metadata.h @@ -808,18 +808,30 @@ namespace FLAC { void set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index); + //! See FLAC__metadata_object_cuesheet_track_resize_indices() + bool resize_indices(unsigned track_num, unsigned new_num_indices); + //! 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_insert_blank_index() + bool insert_blank_index(unsigned track_num, unsigned index_num); + //! See FLAC__metadata_object_cuesheet_track_delete_index() bool delete_index(unsigned track_num, unsigned index_num); + //! See FLAC__metadata_object_cuesheet_resize_tracks() + bool resize_tracks(unsigned new_num_tracks); + //! 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_insert_blank_track() + bool insert_blank_track(unsigned i); + //! See FLAC__metadata_object_cuesheet_delete_track() bool delete_track(unsigned i); @@ -905,6 +917,9 @@ namespace FLAC { //! See FLAC__metadata_object_picture_set_data() bool set_data(const FLAC__byte *data, FLAC__uint32 data_length); + + //! See FLAC__metadata_object_picture_is_legal() + bool is_legal(const char **violation); }; /** Opaque metadata block for storing unknown types. diff --git a/src/libFLAC++/metadata.cpp b/src/libFLAC++/metadata.cpp index 427529b..ee671a0 100644 --- a/src/libFLAC++/metadata.cpp +++ b/src/libFLAC++/metadata.cpp @@ -1042,6 +1042,13 @@ namespace FLAC { object_->data.cue_sheet.tracks[track_num].indices[index_num] = index; } + bool CueSheet::resize_indices(unsigned track_num, unsigned new_num_indices) + { + FLAC__ASSERT(is_valid()); + FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks); + return (bool)::FLAC__metadata_object_cuesheet_track_resize_indices(object_, track_num, new_num_indices); + } + bool CueSheet::insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index) { FLAC__ASSERT(is_valid()); @@ -1050,6 +1057,14 @@ namespace FLAC { return (bool)::FLAC__metadata_object_cuesheet_track_insert_index(object_, track_num, index_num, index); } + bool CueSheet::insert_blank_index(unsigned track_num, unsigned index_num) + { + FLAC__ASSERT(is_valid()); + FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks); + FLAC__ASSERT(index_num <= object_->data.cue_sheet.tracks[track_num].num_indices); + return (bool)::FLAC__metadata_object_cuesheet_track_insert_blank_index(object_, track_num, index_num); + } + bool CueSheet::delete_index(unsigned track_num, unsigned index_num) { FLAC__ASSERT(is_valid()); @@ -1058,6 +1073,12 @@ namespace FLAC { return (bool)::FLAC__metadata_object_cuesheet_track_delete_index(object_, track_num, index_num); } + bool CueSheet::resize_tracks(unsigned new_num_tracks) + { + FLAC__ASSERT(is_valid()); + return (bool)::FLAC__metadata_object_cuesheet_resize_tracks(object_, new_num_tracks); + } + bool CueSheet::set_track(unsigned i, const CueSheet::Track &track) { FLAC__ASSERT(is_valid()); @@ -1074,6 +1095,13 @@ namespace FLAC { return (bool)::FLAC__metadata_object_cuesheet_insert_track(object_, i, const_cast< ::FLAC__StreamMetadata_CueSheet_Track*>(track.get_track()), /*copy=*/true); } + bool CueSheet::insert_blank_track(unsigned i) + { + FLAC__ASSERT(is_valid()); + FLAC__ASSERT(i <= object_->data.cue_sheet.num_tracks); + return (bool)::FLAC__metadata_object_cuesheet_insert_blank_track(object_, i); + } + bool CueSheet::delete_track(unsigned i) { FLAC__ASSERT(is_valid()); @@ -1210,6 +1238,12 @@ namespace FLAC { return (bool)::FLAC__metadata_object_picture_set_data(object_, const_cast(data), data_length, /*copy=*/true); } + bool Picture::is_legal(const char **violation) + { + FLAC__ASSERT(is_valid()); + return (bool)::FLAC__metadata_object_picture_is_legal(object_, violation); + } + // // Unknown -- 2.7.4