[Scummvm-git-logs] scummvm master -> 5aa359f090eb814870ca09e9b41ab9e1700b7f05

mduggan noreply at scummvm.org
Sat Jan 21 07:31:45 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5aa359f090 TETRAEDGE: Allow theora loop requests before last frame


Commit: 5aa359f090eb814870ca09e9b41ab9e1700b7f05
    https://github.com/scummvm/scummvm/commit/5aa359f090eb814870ca09e9b41ab9e1700b7f05
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-01-21T16:31:34+09:00

Commit Message:
TETRAEDGE: Allow theora loop requests before last frame

Changed paths:
    engines/tetraedge/te/te_theora.cpp
    engines/tetraedge/te/te_theora.h


diff --git a/engines/tetraedge/te/te_theora.cpp b/engines/tetraedge/te/te_theora.cpp
index a8cbbffa42e..2096d84f71e 100644
--- a/engines/tetraedge/te/te_theora.cpp
+++ b/engines/tetraedge/te/te_theora.cpp
@@ -25,7 +25,7 @@
 
 namespace Tetraedge {
 
-TeTheora::TeTheora() {
+TeTheora::TeTheora() : _hitEnd(false) {
 	_decoder = new Video::TheoraDecoder();
 }
 
@@ -98,16 +98,25 @@ float TeTheora::frameRate() {
 }
 
 bool TeTheora::update(unsigned long i, TeImage &imgout) {
+	if (_decoder->getCurFrame() > (int)i && !_path.empty()) {
+		// rewind.. no good way to do that, but it should
+		// only happen on loop.
+		load(_path);
+	}
+
 	// TODO: Should this seek to frame i? Currently just continues.
 	const Graphics::Surface *frame = nullptr;
-	while (_decoder->getCurFrame() < (int)i && !_decoder->endOfVideo())
+	while (_decoder->getCurFrame() <= (int)i && !_decoder->endOfVideo())
 		frame = _decoder->decodeNextFrame();
 
+	_hitEnd = _decoder->endOfVideo();
+
 	if (frame && frame->getPixels()) {
 		//debug("TeTheora: %s %ld", _path.toString().c_str(), i);
 		imgout.copyFrom(*frame);
 		return true;
-	} else if (isAtEnd() && !_path.empty()) {
+	} else if (_hitEnd && !_path.empty()) {
+		// Loop to the start.
 		load(_path);
 		frame = _decoder->decodeNextFrame();
 		if (frame) {
@@ -119,7 +128,7 @@ bool TeTheora::update(unsigned long i, TeImage &imgout) {
 }
 
 bool TeTheora::isAtEnd() {
-	return _decoder->endOfVideo();
+	return _hitEnd;
 }
 
 void TeTheora::setColorKeyActivated(bool val) {
diff --git a/engines/tetraedge/te/te_theora.h b/engines/tetraedge/te/te_theora.h
index 517777b9dda..5b58d7dbd98 100644
--- a/engines/tetraedge/te/te_theora.h
+++ b/engines/tetraedge/te/te_theora.h
@@ -62,6 +62,7 @@ private:
 	Video::TheoraDecoder *_decoder;
 
 	Common::Path _path;
+	bool _hitEnd;
 
 };
 




More information about the Scummvm-git-logs mailing list