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

This commit is contained in:
2014-05-09 13:51:57 -07:00
parent f622691691
commit ff08acc556

View File

@@ -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)