2
* Copyright (C) 2003-2011 The Music Player Daemon Project
3
* http://www.musicpd.org
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program 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
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License along
16
* with this program; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
#ifndef ICY_METADATA_H
21
#define ICY_METADATA_H
27
size_t data_size, data_rest;
29
size_t meta_size, meta_position;
36
* Initialize a disabled icy_metadata object.
39
icy_clear(struct icy_metadata *im)
45
* Initialize an enabled icy_metadata object with the specified
46
* data_size (from the icy-metaint HTTP response header).
49
icy_start(struct icy_metadata *im, size_t data_size)
51
im->data_size = im->data_rest = data_size;
57
* Resets the icy_metadata. Call this after rewinding the stream.
60
icy_reset(struct icy_metadata *im);
63
icy_deinit(struct icy_metadata *im);
66
* Checks whether the icy_metadata object is enabled.
69
icy_defined(const struct icy_metadata *im)
71
return im->data_size > 0;
75
* Evaluates data. Returns the number of bytes of normal data which
76
* can be read by the caller, but not more than "length". If the
77
* return value is smaller than "length", the caller should invoke
81
icy_data(struct icy_metadata *im, size_t length);
84
* Reads metadata from the stream. Returns the number of bytes
85
* consumed. If the return value is smaller than "length", the caller
86
* should invoke icy_data().
89
icy_meta(struct icy_metadata *im, const void *data, size_t length);
91
static inline struct tag *
92
icy_tag(struct icy_metadata *im)
94
struct tag *tag = im->tag;