ScummVM API documentation
mpeg.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 IMAGE_CODECS_MPEG_H
23#define IMAGE_CODECS_MPEG_H
24
25#include "image/codecs/codec.h"
26#include "graphics/pixelformat.h"
27
28typedef struct mpeg2dec_s mpeg2dec_t;
29typedef struct mpeg2_info_s mpeg2_info_t;
30
31namespace Common {
32class SeekableReadStream;
33}
34
35namespace Graphics {
36struct Surface;
37}
38
39namespace Image {
40
46class MPEGDecoder : public Codec {
47public:
49 ~MPEGDecoder() override;
50
51 // Codec interface
53 Graphics::PixelFormat getPixelFormat() const override { return _pixelFormat; }
54 bool setOutputPixelFormat(const Graphics::PixelFormat &format) override {
55 if (format.bytesPerPixel != 2 && format.bytesPerPixel != 4)
56 return false;
57 _pixelFormat = format;
58 return true;
59 }
60
61 // MPEGPSDecoder call
62 bool decodePacket(Common::SeekableReadStream &packet, uint32 &framePeriod, Graphics::Surface *dst = 0);
63
64private:
65 Graphics::PixelFormat _pixelFormat;
66 Graphics::Surface *_surface;
67
68 enum {
69 BUFFER_SIZE = 4096
70 };
71
72 byte _buffer[BUFFER_SIZE];
73 mpeg2dec_t *_mpegDecoder;
74 const mpeg2_info_t *_mpegInfo;
75};
76
77} // End of namespace Image
78
79#endif // IMAGE_CODECS_MPEG_H
Definition: stream.h:745
Definition: codec.h:57
Definition: mpeg.h:46
Graphics::PixelFormat getPixelFormat() const override
Definition: mpeg.h:53
const Graphics::Surface * decodeFrame(Common::SeekableReadStream &stream) override
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override
Definition: mpeg.h:54
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: pixelformat.h:138
Definition: surface.h:67