ScummVM API documentation
asf.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
22#ifndef VIDEO_ASF_H
23#define VIDEO_ASF_H
24
25#include "audio/audiostream.h"
26#include "audio/decoders/wma.h"
27#include "common/array.h"
28#include "common/stream.h"
29
30namespace Video {
31
33public:
34 static const int64 kNoTimestamp = (-0x7fffffffffffffffLL - 1);
35 enum StreamType { kAudio, kVideo, kData, kUnknown };
36 enum ReadResult { kObject, kEnd, kError };
37
38 struct Stream {
39 uint8 id = 0;
40 StreamType type = kUnknown;
41 uint64 timeOffset = 0;
42 uint64 frameTime = 0;
43 uint32 aspectNum = 0, aspectDen = 0;
44 Common::Array<byte> typeData;
45 Common::Array<byte> errorData;
46 };
47
48 struct Object {
49 uint8 stream = 0;
50 uint32 sequence = 0;
51 int64 pts = kNoTimestamp, dts = kNoTimestamp;
52 int64 position = -1;
53 bool keyframe = false;
56 };
57
58 ASFDemuxer();
60 bool open(Common::SeekableReadStream *stream);
61 void close();
62 bool rewind();
63 ReadResult readObject(Object &object);
64 const Common::Array<Stream> &getStreams() const;
65 uint64 getDuration() const;
66 uint64 getSendDuration() const;
67 uint64 getPreroll() const;
68 bool endOfData() const;
69
70private:
71 ASFDemuxer(const ASFDemuxer &) = delete;
72 ASFDemuxer &operator=(const ASFDemuxer &) = delete;
73 struct Context;
74 Context *_ctx;
75};
76
77Audio::SeekableAudioStream *makeASFAudioStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse);
78
80public:
81 ASFAudioCodec() : _codec(nullptr), _rate(0), _channels(0) {}
82 ~ASFAudioCodec() { delete _codec; }
83 bool open(const ASFDemuxer::Stream &stream);
84 Audio::AudioStream *decode(const ASFDemuxer::Object &object);
85 int getRate() const { return _rate; }
86 bool isStereo() const { return _channels == 2; }
87private:
88 Audio::WMACodec *_codec;
89 uint32 _rate;
90 uint16 _channels;
91};
92
93} // End of namespace Video
94
95#endif
Definition: audiostream.h:50
Definition: audiostream.h:212
Definition: wma.h:46
Definition: stream.h:745
Definition: asf.h:79
Definition: asf.h:32
Definition: asf.h:48
Definition: asf.h:38