From: Erik de Castro Lopo Date: Tue, 8 May 2012 09:12:58 +0000 (+1000) Subject: Add missing functions to VorbisComment class. X-Git-Tag: 1.3.0pre1~61 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=601e96102c6b4f3c4b40df925c40700dda4f039d;p=platform%2Fupstream%2Fflac.git Add missing functions to VorbisComment class. Patch from Bastiaan Timmer sent to the mailing list. --- diff --git a/include/FLAC++/metadata.h b/include/FLAC++/metadata.h index 94eb6fc..adf18b5 100644 --- a/include/FLAC++/metadata.h +++ b/include/FLAC++/metadata.h @@ -675,6 +675,9 @@ namespace FLAC { //! See FLAC__metadata_object_vorbiscomment_set_vendor_string() bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string + //! See FLAC__metadata_object_vorbiscomment_resize_comments() + bool resize_comments(unsigned new_num_comments); + //! See FLAC__metadata_object_vorbiscomment_set_comment() bool set_comment(unsigned index, const Entry &entry); @@ -684,8 +687,20 @@ namespace FLAC { //! See FLAC__metadata_object_vorbiscomment_append_comment() bool append_comment(const Entry &entry); + //! See FLAC__metadata_object_vorbiscomment_replace_comment() + bool replace_comment(const Entry &entry, bool all); + //! See FLAC__metadata_object_vorbiscomment_delete_comment() bool delete_comment(unsigned index); + + //! See FLAC__metadata_object_vorbiscomment_find_entry_from() + int find_entry_from(unsigned offset, const char *field_name); + + //! See FLAC__metadata_object_vorbiscomment_remove_entry_matching() + int remove_entry_matching(const char *field_name); + + //! See FLAC__metadata_object_vorbiscomment_remove_entries_matching() + int remove_entries_matching(const char *field_name); }; /** CUESHEET metadata block. diff --git a/src/libFLAC++/metadata.cpp b/src/libFLAC++/metadata.cpp index 0870d02..5c11dfd 100644 --- a/src/libFLAC++/metadata.cpp +++ b/src/libFLAC++/metadata.cpp @@ -849,6 +849,12 @@ namespace FLAC { return (bool)::FLAC__metadata_object_vorbiscomment_set_vendor_string(object_, vendor_string, /*copy=*/true); } + bool VorbisComment::resize_comments(unsigned new_num_comments) + { + FLAC__ASSERT(is_valid()); + return (bool)::FLAC__metadata_object_vorbiscomment_resize_comments(object_, new_num_comments); + } + bool VorbisComment::set_comment(unsigned index, const VorbisComment::Entry &entry) { FLAC__ASSERT(is_valid()); @@ -869,6 +875,12 @@ namespace FLAC { return (bool)::FLAC__metadata_object_vorbiscomment_append_comment(object_, entry.get_entry(), /*copy=*/true); } + bool VorbisComment::replace_comment(const VorbisComment::Entry &entry, bool all) + { + FLAC__ASSERT(is_valid()); + return (bool)::FLAC__metadata_object_vorbiscomment_replace_comment(object_, entry.get_entry(), all, /*copy=*/true); + } + bool VorbisComment::delete_comment(unsigned index) { FLAC__ASSERT(is_valid()); @@ -876,6 +888,24 @@ namespace FLAC { return (bool)::FLAC__metadata_object_vorbiscomment_delete_comment(object_, index); } + int VorbisComment::find_entry_from(unsigned offset, const char *field_name) + { + FLAC__ASSERT(is_valid()); + return ::FLAC__metadata_object_vorbiscomment_find_entry_from(object_, offset, field_name); + } + + int VorbisComment::remove_entry_matching(const char *field_name) + { + FLAC__ASSERT(is_valid()); + return ::FLAC__metadata_object_vorbiscomment_remove_entry_matching(object_, field_name); + } + + int VorbisComment::remove_entries_matching(const char *field_name) + { + FLAC__ASSERT(is_valid()); + return ::FLAC__metadata_object_vorbiscomment_remove_entries_matching(object_, field_name); + } + // // CueSheet::Track