[Bf-blender-cvs] [ff08acc] master: BGE VideoTexture: Fix for loading PNG (and possibly other) files.

Mitchell Stokes noreply at git.blender.org
Fri May 9 22:55:17 CEST 2014


Commit: ff08acc556d8e40d501522efcbecac68bb8973c6
Author: Mitchell Stokes
Date:   Fri May 9 13:51:57 2014 -0700
https://developer.blender.org/rBff08acc556d8e40d501522efcbecac68bb8973c6

BGE VideoTexture: Fix for loading PNG (and possibly other) files.

===================================================================

M	source/gameengine/VideoTexture/VideoFFmpeg.cpp

===================================================================

diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index 44017f3..179f1ce 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -1005,9 +1005,20 @@ AVFrame *VideoFFmpeg::grabFrame(long position)
 	{
 		if (packet.stream_index == m_videoStream) 
 		{
-			avcodec_decode_video2(m_codecCtx, 
-				m_frame, &frameFinished, 
+			if (m_isImage)
+			{
+				// If we're an image, we're probably not going to be here often,
+				// so we don't want to deal with delayed frames from threading.
+				// There might be a better way to handle this, but I'll leave that
+				// for people more knowledgeable with ffmpeg than myself. We don't
+				// need threading for a single image anyways.
+				m_codecCtx->thread_count = 1;
+			}
+
+			avcodec_decode_video2(m_codecCtx,
+				m_frame, &frameFinished,
 				&packet);
+
 			// remember dts to compute exact frame number
 			dts = packet.dts;
 			if (frameFinished && !posFound)




More information about the Bf-blender-cvs mailing list