MPD: decoder/plugins/OggDecoder.hxx Source File

MPD 0.20.18

OggDecoder.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_OGG_DECODER_HXX
21 #define MPD_OGG_DECODER_HXX
22
23 #include "config.h" /* must be first for large file support */
24 #include "lib/xiph/OggVisitor.hxx"
25 #include "decoder/Reader.hxx"
26
27 class OggDecoder : public OggVisitor {
28 ogg_int64_t end_granulepos;
29
30 protected:
31 DecoderClient &client;
32 InputStream &input_stream;
33
34 public:
35 explicit OggDecoder(DecoderReader &reader)
36 :OggVisitor(reader),
37 client(reader.GetClient()),
38 input_stream(reader.GetInputStream()) {}
39
40 bool Seek(OggSyncState &oy, uint64_t where_frame);
41
42 private:
47 bool LoadEndPacket(ogg_packet &packet) const;
48 ogg_int64_t LoadEndGranulePos() const;
49
50 protected:
51 ogg_int64_t UpdateEndGranulePos() {
52 return end_granulepos = LoadEndGranulePos();
53 }
54
55 bool IsSeekable() const {
56 return end_granulepos > 0;
57 }
58
59 void SeekGranulePos(ogg_int64_t where_granulepos);
60 };
61
62 #endif
OggDecoder::OggDecoder
OggDecoder(DecoderReader &reader)
Definition: OggDecoder.hxx:35
DecoderClient
An interface between the decoder plugin and the MPD core.
Definition: Client.hxx:39
OggDecoder::UpdateEndGranulePos
ogg_int64_t UpdateEndGranulePos()
Definition: OggDecoder.hxx:51
config.h
InputStream
Definition: InputStream.hxx:36
OggDecoder
Definition: OggDecoder.hxx:27
OggDecoder::Seek
bool Seek(OggSyncState &oy, uint64_t where_frame)
OggVisitor.hxx
OggDecoder::SeekGranulePos
void SeekGranulePos(ogg_int64_t where_granulepos)
OggVisitor
Abstract class which iterates over Ogg packets in a Reader.
Definition: OggVisitor.hxx:37
OggDecoder::input_stream
InputStream & input_stream
Definition: OggDecoder.hxx:32
OggDecoder::client
DecoderClient & client
Definition: OggDecoder.hxx:31
OggDecoder::IsSeekable
bool IsSeekable() const
Definition: OggDecoder.hxx:55
Reader.hxx
DecoderReader
A wrapper for decoder_read() which implements the Reader interface.
Definition: Reader.hxx:34
OggSyncState
Wrapper for an ogg_sync_state.
Definition: OggSyncState.hxx:34