comparison Plugins/Input/flac/plugin_common/tags.h @ 61:fa848bd484d8 trunk

[svn] Move plugins to Plugins/
author nenolod
date Fri, 28 Oct 2005 22:58:11 -0700
parents
children f12d7e208b43
comparison
equal deleted inserted replaced
60:1771f253e1b2 61:fa848bd484d8
1 /* plugin_common - Routines common to several plugins
2 * Copyright (C) 2002,2003,2004,2005 Josh Coalson
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program 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
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 #ifndef FLAC__PLUGIN_COMMON__TAGS_H
20 #define FLAC__PLUGIN_COMMON__TAGS_H
21
22 #include "FLAC/format.h"
23
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);
26
27 /*
28 * Deletes the tags object and sets '*tags' to NULL.
29 */
30 void FLAC_plugin__tags_destroy(FLAC__StreamMetadata **tags);
31
32 /*
33 * Gets the value (in UTF-8) of the first tag with the given name (NULL if no
34 * such tag exists).
35 */
36 const char *FLAC_plugin__tags_get_tag_utf8(const FLAC__StreamMetadata *tags, const char *name);
37
38 /*
39 * Gets the value (in UCS-2) of the first tag with the given name (NULL if no
40 * such tag exists).
41 *
42 * NOTE: the returned string is malloc()ed and must be free()d by the caller.
43 */
44 FLAC__uint16 *FLAC_plugin__tags_get_tag_ucs2(const FLAC__StreamMetadata *tags, const char *name);
45
46 /*
47 * Removes all tags with the given 'name'. Returns the number of tags removed,
48 * or -1 on memory allocation error.
49 */
50 int FLAC_plugin__tags_delete_tag(FLAC__StreamMetadata *tags, const char *name);
51
52 /*
53 * Removes all tags. Returns the number of tags removed, or -1 on memory
54 * allocation error.
55 */
56 int FLAC_plugin__tags_delete_all(FLAC__StreamMetadata *tags);
57
58 /*
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.
62 */
63 FLAC__bool FLAC_plugin__tags_add_tag_utf8(FLAC__StreamMetadata *tags, const char *name, const char *value, const char *separator);
64
65 /*
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
70 * new tag.
71 */
72 FLAC__bool FLAC_plugin__tags_set_tag_ucs2(FLAC__StreamMetadata *tags, const char *name, const FLAC__uint16 *value, FLAC__bool replace_all);
73
74 #endif