diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2014-05-10 00:51:57 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2014-05-10 00:53:42 +0400 |
commit | ff08acc556d8e40d501522efcbecac68bb8973c6 (patch) | |
tree | 7a411ed28f84d5a835691521fc8aecb3bd30f48d | |
parent | f622691691547bb364fe6a560124583030d55c11 (diff) |
BGE VideoTexture: Fix for loading PNG (and possibly other) files.
-rw-r--r-- | source/gameengine/VideoTexture/VideoFFmpeg.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp index 44017f37d29..179f1ced03b 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) |