MPD: IcyMetaDataParser.hxx Source File

MPD 0.20.18

IcyMetaDataParser.hxx
Go to the documentation of this file.
1 /*
2 * Copyright 2003-2017 The Music Player Daemon Project
3 * http://www.musicpd.org
4 *
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.
9 *
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.
14 *
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.
18 */
19
20 #ifndef MPD_ICY_META_DATA_PARSER_HXX
21 #define MPD_ICY_META_DATA_PARSER_HXX
22
23 #include <stddef.h>
24
25 struct Tag;
26
27 class IcyMetaDataParser {
28 size_t data_size, data_rest;
29
30 size_t meta_size, meta_position;
31 char *meta_data;
32
33 Tag *tag;
34
35 public:
36 IcyMetaDataParser():data_size(0) {}
37 ~IcyMetaDataParser() {
38 Reset();
39 }
40
45 void Start(size_t _data_size) {
46 data_size = data_rest = _data_size;
47 meta_size = 0;
48 tag = nullptr;
49 }
50
54 void Reset();
55
59 bool IsDefined() const {
60 return data_size > 0;
61 }
62
69 size_t Data(size_t length);
70
76 size_t Meta(const void *data, size_t length);
77
83 size_t ParseInPlace(void *data, size_t length);
84
85 Tag *ReadTag() {
86 Tag *result = tag;
87 tag = nullptr;
88 return result;
89 }
90 };
91
92 #endif
IcyMetaDataParser::Start
void Start(size_t _data_size)
Initialize an enabled icy_metadata object with the specified data_size (from the icy-metaint HTTP res...
Definition: IcyMetaDataParser.hxx:45
IcyMetaDataParser::ParseInPlace
size_t ParseInPlace(void *data, size_t length)
Parse data and eliminate metadata.
IcyMetaDataParser::IsDefined
bool IsDefined() const
Checks whether the icy_metadata object is enabled.
Definition: IcyMetaDataParser.hxx:59
Tag
The meta information about a song file.
Definition: Tag.hxx:34
IcyMetaDataParser::~IcyMetaDataParser
~IcyMetaDataParser()
Definition: IcyMetaDataParser.hxx:37
IcyMetaDataParser::Data
size_t Data(size_t length)
Evaluates data.
IcyMetaDataParser::IcyMetaDataParser
IcyMetaDataParser()
Definition: IcyMetaDataParser.hxx:36
IcyMetaDataParser::ReadTag
Tag * ReadTag()
Definition: IcyMetaDataParser.hxx:85
IcyMetaDataParser
Definition: IcyMetaDataParser.hxx:27
IcyMetaDataParser::Meta
size_t Meta(const void *data, size_t length)
Reads metadata from the stream.
IcyMetaDataParser::Reset
void Reset()
Resets the icy_metadata.