ScummVM API documentation
vorbis_intern.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
31#ifndef AUDIO_VORBIS_INTERN_H
32#define AUDIO_VORBIS_INTERN_H
33
34#include "common/scummsys.h"
35
36#ifdef USE_VORBIS
37
38#include "common/ptr.h"
39#include "common/stream.h"
40
41#include "audio/audiostream.h"
42#include "audio/timestamp.h"
43
44#ifdef USE_TREMOR
45#include <tremor/ivorbisfile.h>
46#else
47#define OV_EXCLUDE_STATIC_CALLBACKS
48#include <vorbis/vorbisfile.h>
49#endif
50
51namespace Audio {
52
53class VorbisStream : public SeekableAudioStream {
54protected:
56
57 bool _isStereo;
58 int _rate;
59
60 Timestamp _length;
61
62 OggVorbis_File _ovFile;
63
64 int16 _buffer[4096];
65 const int16 *_bufferEnd;
66 const int16 *_pos;
67
68public:
69 VorbisStream(Common::SeekableReadStream *inStream, DisposeAfterUse::Flag dispose);
70 ~VorbisStream();
71
72 int readBuffer(int16 *buffer, const int numSamples) override;
73
74 bool endOfData() const override { return _pos >= _bufferEnd; }
75 bool isStereo() const override { return _isStereo; }
76 int getRate() const override { return _rate; }
77
78 bool seek(const Timestamp &where) override;
79 Timestamp getLength() const override { return _length; }
80
81protected:
82 bool refill();
83};
84
85} // End of namespace Audio
86
87#endif // USE_VORBIS
88#endif // AUDIO_VORBIS_INTERN_H
Definition: stream.h:745
Definition: system.h:39