1 /* plugin_common - Routines common to several plugins
2 * Copyright (C) 2002-2009 Josh Coalson
3 * Copyright (C) 2011-2013 Xiph.Org Foundation
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef FLAC__PLUGIN_COMMON__TAGS_H
21 #define FLAC__PLUGIN_COMMON__TAGS_H
23 #include "FLAC/format.h"
25 FLAC__bool FLAC_plugin__tags_get(const char *filename, FLAC__StreamMetadata **tags);
26 FLAC__bool FLAC_plugin__tags_set(const char *filename, const FLAC__StreamMetadata *tags);
29 * Deletes the tags object and sets '*tags' to NULL.
31 void FLAC_plugin__tags_destroy(FLAC__StreamMetadata **tags);
34 * Gets the value (in UTF-8) of the first tag with the given name (NULL if no
37 const char *FLAC_plugin__tags_get_tag_utf8(const FLAC__StreamMetadata *tags, const char *name);
40 * Gets the value (in UCS-2) of the first tag with the given name (NULL if no
43 * NOTE: the returned string is malloc()ed and must be free()d by the caller.
45 FLAC__uint16 *FLAC_plugin__tags_get_tag_ucs2(const FLAC__StreamMetadata *tags, const char *name);
48 * Removes all tags with the given 'name'. Returns the number of tags removed,
49 * or -1 on memory allocation error.
51 int FLAC_plugin__tags_delete_tag(FLAC__StreamMetadata *tags, const char *name);
54 * Removes all tags. Returns the number of tags removed, or -1 on memory
57 int FLAC_plugin__tags_delete_all(FLAC__StreamMetadata *tags);
60 * Adds a "name=value" tag to the tags. 'value' must be in UTF-8. If
61 * 'separator' is non-NULL and 'tags' already contains a tag for 'name', the
62 * first such tag's value is appended with separator, then value.
64 FLAC__bool FLAC_plugin__tags_add_tag_utf8(FLAC__StreamMetadata *tags, const char *name, const char *value, const char *separator);
67 * Adds a "name=value" tag to the tags. 'value' must be in UCS-2. If 'tags'
68 * already contains a tag or tags for 'name', then they will be replaced
69 * according to 'replace_all': if 'replace_all' is false, only the first such
70 * tag will be replaced; if true, all matching tags will be replaced by the one
73 FLAC__bool FLAC_plugin__tags_set_tag_ucs2(FLAC__StreamMetadata *tags, const char *name, const FLAC__uint16 *value, FLAC__bool replace_all);