22#include "common/scummsys.h"
26#ifndef VIDEO_MKV_DECODER_H
27#define VIDEO_MKV_DECODER_H
29#include "common/queue.h"
30#include "video/video_decoder.h"
31#include "audio/mixer.h"
32#include "graphics/surface.h"
35#include <tremor/ivorbiscodec.h>
37#include <vorbis/codec.h>
40#include <vpx/vpx_decoder.h>
45class SeekableReadStream;
50class QueuingAudioStream;
73class MKVDecoder :
public VideoDecoder {
76 virtual ~MKVDecoder();
83 void close()
override;
86 void readNextPacket()
override;
89 class VPXVideoTrack :
public VideoTrack {
94 bool endOfTrack()
const override;
95 uint16 getWidth()
const override {
return _width; }
96 uint16 getHeight()
const override {
return _height; }
99 if (format.bytesPerPixel != 2 && format.bytesPerPixel != 4)
101 _pixelFormat = format;
105 int getCurFrame()
const override {
return _curFrame; }
106 uint32 getNextFrameStartTime()
const override {
return (uint32)(_nextFrameStartTime * 1000); }
108 bool decodeFrame(
byte *frame,
long size);
109 void setEndOfVideo() { _endOfVideo =
true; }
114 double _nextFrameStartTime;
123 vpx_codec_ctx_t *_codec =
nullptr;
126 class VorbisAudioTrack :
public AudioTrack {
131 bool decodeSamples(
byte *frame,
long size);
132 bool hasAudio()
const;
133 bool needsAudio()
const;
134 bool synthesizePacket(
byte *frame,
long size);
135 void setEndOfAudio() { _endOfAudio =
true; }
143 vorbis_block _vorbisBlock;
144 vorbis_dsp_state _vorbisDSP;
146 vorbis_info _vorbisInfo;
149 ogg_packet oggPacket;
152 bool queueAudio(
long size);
156 bool _hasVideo, _hasAudio;
158 VPXVideoTrack *_videoTrack =
nullptr;
159 VorbisAudioTrack *_audioTrack =
nullptr;
161 mkvparser::MkvReader *_reader =
nullptr;
168 byte *_frame =
nullptr;
169 int _frameCounter = 0;
Definition: audiostream.h:50
Definition: audiostream.h:370
Definition: mkvparser.h:119
Definition: mkvparser.h:71
Definition: mkvparser.h:970
Definition: mkvparser.h:1050
Definition: mkvparser.h:299
Definition: mkvparser.h:566
Definition: algorithm.h:29