MPD  0.20.18
IcyInputStream.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_INPUT_STREAM_HXX
21 #define MPD_ICY_INPUT_STREAM_HXX
22 
23 #include "ProxyInputStream.hxx"
24 #include "IcyMetaDataParser.hxx"
25 #include "Compiler.h"
26 
27 struct Tag;
28 
32 class IcyInputStream final : public ProxyInputStream {
33  IcyMetaDataParser parser;
34 
38  Tag *input_tag;
39 
43  Tag *icy_tag;
44 
45  offset_type override_offset;
46 
47 public:
48  IcyInputStream(InputStream *_input);
49  virtual ~IcyInputStream();
50 
51  IcyInputStream(const IcyInputStream &) = delete;
52  IcyInputStream &operator=(const IcyInputStream &) = delete;
53 
54  void Enable(size_t _data_size) {
55  parser.Start(_data_size);
56  }
57 
58  bool IsEnabled() const {
59  return parser.IsDefined();
60  }
61 
62  /* virtual methods from InputStream */
63  void Update() override;
64  Tag *ReadTag() override;
65  size_t Read(void *ptr, size_t size) override;
66 };
67 
68 #endif
The meta information about a song file.
Definition: Tag.hxx:34
Tag * ReadTag() override
Reads the tag from the stream.
size_t Read(void *ptr, size_t size) override
Reads data from the stream into the caller-supplied buffer.
::offset_type offset_type
Definition: InputStream.hxx:38
offset_type size
the size of the resource, or UNKNOWN_SIZE if unknown
Definition: InputStream.hxx:84
IcyInputStream(InputStream *_input)
An InputStream filter that parses Icy metadata.
bool IsEnabled() const
void Enable(size_t _data_size)
An InputStream that forwards all methods call to another InputStream instance.
IcyInputStream & operator=(const IcyInputStream &)=delete
void Update() override
Update the public attributes.
virtual ~IcyInputStream()