MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

OggVisitor.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_VISITOR_HXX
21 #define MPD_OGG_VISITOR_HXX
22
23 #include "check.h"
24 #include "OggSyncState.hxx"
25 #include "OggStreamState.hxx"
26
27 #include <ogg/ogg.h>
28
29 #include <stddef.h>
30
31 class Reader;
32
37 class OggVisitor {
38 OggSyncState sync;
39 OggStreamState stream;
40
41 bool has_stream = false;
42
43 public:
44 explicit OggVisitor(Reader &reader)
45 :sync(reader), stream(0) {}
46
47 long GetSerialNo() const {
48 return stream.GetSerialNo();
49 }
50
51 void Visit();
52
56 void PostSeek();
57
58 private:
59 void EndStream();
60 bool ReadNextPage();
61 void HandlePacket(const ogg_packet &packet);
62 void HandlePackets();
63
64 protected:
65 virtual void OnOggBeginning(const ogg_packet &packet) = 0;
66 virtual void OnOggPacket(const ogg_packet &packet) = 0;
67 virtual void OnOggEnd() = 0;
68 };
69
70 #endif
Reader
An interface that can read bytes from a stream until the stream ends.
Definition: Reader.hxx:35
check.h
OggVisitor::OggVisitor
OggVisitor(Reader &reader)
Definition: OggVisitor.hxx:44
OggVisitor::OnOggEnd
virtual void OnOggEnd()=0
OggStreamState
Definition: OggStreamState.hxx:31
OggStreamState::GetSerialNo
long GetSerialNo() const
Definition: OggStreamState.hxx:60
OggVisitor::PostSeek
void PostSeek()
Call this method after seeking the Reader.
OggVisitor::OnOggPacket
virtual void OnOggPacket(const ogg_packet &packet)=0
OggVisitor::Visit
void Visit()
OggStreamState.hxx
OggVisitor
Abstract class which iterates over Ogg packets in a Reader.
Definition: OggVisitor.hxx:37
OggVisitor::OnOggBeginning
virtual void OnOggBeginning(const ogg_packet &packet)=0
OggVisitor::GetSerialNo
long GetSerialNo() const
Definition: OggVisitor.hxx:47
OggSyncState.hxx
OggSyncState
Wrapper for an ogg_sync_state.
Definition: OggSyncState.hxx:34