1 /* plugin_common - Routines common to several plugins
2 * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef FLAC__PLUGIN_COMMON__TAGS_H
20 #define FLAC__PLUGIN_COMMON__TAGS_H
22 #include "FLAC/format.h"
24 FLAC__bool FLAC_plugin__tags_get(const char *filename, FLAC__StreamMetadata **tags);
25 FLAC__bool FLAC_plugin__tags_set(const char *filename, const FLAC__StreamMetadata *tags);
28 * Deletes the tags object and sets '*tags' to NULL.
30 void FLAC_plugin__tags_destroy(FLAC__StreamMetadata **tags);
33 * Gets the value (in UTF-8) of the first tag with the given name (NULL if no
36 const char *FLAC_plugin__tags_get_tag_utf8(const FLAC__StreamMetadata *tags, const char *name);
39 * Gets the value (in UCS-2) of the first tag with the given name (NULL if no
42 * NOTE: the returned string is malloc()ed and must be free()d by the caller.
44 FLAC__uint16 *FLAC_plugin__tags_get_tag_ucs2(const FLAC__StreamMetadata *tags, const char *name);
47 * Removes all tags with the given 'name'. Returns the number of tags removed,
48 * or -1 on memory allocation error.
50 int FLAC_plugin__tags_delete_tag(FLAC__StreamMetadata *tags, const char *name);
53 * Removes all tags. Returns the number of tags removed, or -1 on memory
56 int FLAC_plugin__tags_delete_all(FLAC__StreamMetadata *tags);
59 * Adds a "name=value" tag to the tags. 'value' must be in UTF-8. If
60 * 'separator' is non-NULL and 'tags' already contains a tag for 'name', the
61 * first such tag's value is appended with separator, then value.
63 FLAC__bool FLAC_plugin__tags_add_tag_utf8(FLAC__StreamMetadata *tags, const char *name, const char *value, const char *separator);
66 * Adds a "name=value" tag to the tags. 'value' must be in UCS-2. If 'tags'
67 * already contains a tag or tags for 'name', then they will be replaced
68 * according to 'replace_all': if 'replace_all' is false, only the first such
69 * tag will be replaced; if true, all matching tags will be replaced by the one
72 FLAC__bool FLAC_plugin__tags_set_tag_ucs2(FLAC__StreamMetadata *tags, const char *name, const FLAC__uint16 *value, FLAC__bool replace_all);