aboutsummaryrefslogtreecommitdiff
path: root/image/codecs/indeo4.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-08 23:07:26 -0400
committerPaul Gilbert2016-09-10 10:08:19 -0400
commit3a2ee8ea23247f72628294b48b43716c1b84d8a8 (patch)
tree27cd1dd05c3dcc313ed5a16cc94d8ded84e744dd /image/codecs/indeo4.cpp
parent400661182efae9659e664fec0e81c7ed8c3a10ec (diff)
downloadscummvm-rg350-3a2ee8ea23247f72628294b48b43716c1b84d8a8.tar.gz
scummvm-rg350-3a2ee8ea23247f72628294b48b43716c1b84d8a8.tar.bz2
scummvm-rg350-3a2ee8ea23247f72628294b48b43716c1b84d8a8.zip
IMAGE: Fixes for setup of Indeo4 decoder
Diffstat (limited to 'image/codecs/indeo4.cpp')
-rw-r--r--image/codecs/indeo4.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/image/codecs/indeo4.cpp b/image/codecs/indeo4.cpp
index 936d4b0456..11a6577a7a 100644
--- a/image/codecs/indeo4.cpp
+++ b/image/codecs/indeo4.cpp
@@ -42,6 +42,9 @@ namespace Image {
Indeo4Decoder::Indeo4Decoder(uint16 width, uint16 height) : IndeoDecoderBase(width, height) {
_ctx.is_indeo4 = true;
+ _ctx.ref_buf = 1;
+ _ctx.b_ref_buf = 3;
+ _ctx.p_frame = new AVFrame();
}
bool Indeo4Decoder::isIndeo4(Common::SeekableReadStream &stream) {
@@ -66,15 +69,24 @@ const Graphics::Surface *Indeo4Decoder::decodeFrame(Common::SeekableReadStream &
if (!isIndeo4(stream))
return nullptr;
- // Set up the GetBits instance for reading the stream
- _ctx.gb = new GetBits(stream);
+ // Set up the frame data buffer
+ byte *frameData = new byte[stream.size()];
+ stream.read(frameData, stream.size());
+ _ctx.frame_data = frameData;
+ _ctx.frame_size = stream.size();
+
+ // Set up the GetBits instance for reading the data
+ _ctx.gb = new GetBits(_ctx.frame_data, _ctx.frame_size * 8);
// Decode the frame
int err = decodeIndeoFrame();
- // Free the bit reader
+ // Free the bit reader and frame buffer
delete _ctx.gb;
_ctx.gb = nullptr;
+ delete[] frameData;
+ _ctx.frame_data = nullptr;
+ _ctx.frame_size = 0;
return (err < 0) ? nullptr : &_surface->rawSurface();
}