const char *grabbag__replaygain_store_to_vorbiscomment_title(FLAC__StreamMetadata *block, float title_gain, float title_peak) { FLAC__ASSERT(0 != block); FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); if( FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)tag_title_gain_) < 0 || FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)tag_title_peak_) < 0 ) return "memory allocation error"; if( !append_tag_(block, peak_format_, tag_title_peak_, title_peak) || !append_tag_(block, gain_format_, tag_title_gain_, title_gain) ) return "memory allocation error"; return 0; }
FLAC__bool remove_vc_field(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write) { int n; FLAC__ASSERT(0 != needs_write); n = FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, field_name); if(n < 0) { fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); return false; } else if(n > 0) *needs_write = true; return true; }