Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2010-02-07 22:18:00 +0300
committerBenoit Bolsee <benoit.bolsee@online.be>2010-02-07 22:18:00 +0300
commita8a99a628f6f3bc8ddefec8dfae8a7aa27b8f863 (patch)
treecd635f8d5cec45c5c8eeb330396b05f05a492f52 /source/gameengine/VideoTexture/ImageBase.cpp
parent064345ad8c72d0af21b31c3da47bad6ceb3a7023 (diff)
BGE: add audio/video synchronization capability to VideoTexture
Add optional parameter to VideoTexture.Texture refresh() method to specify timestamp (in seconds from start of movie) of the frame to be loaded. This value is passed down to image source and for VideoFFmpeg source, it is used instead of current time to load the frame from the video file. When combined with an audio actuator, it can be used to synchronize the sound and the image: specify the same video file in the sound actuator and use the KX_SoundActuator time attribute as timestamp to refresh: the frame corresponding to the sound will be loaded: GameLogic.video.refresh(True, soundAct.time)
Diffstat (limited to 'source/gameengine/VideoTexture/ImageBase.cpp')
-rw-r--r--source/gameengine/VideoTexture/ImageBase.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp
index 0740afed2c6..1c5425c932c 100644
--- a/source/gameengine/VideoTexture/ImageBase.cpp
+++ b/source/gameengine/VideoTexture/ImageBase.cpp
@@ -71,7 +71,7 @@ bool ImageBase::release (void)
// get image
-unsigned int * ImageBase::getImage (unsigned int texId)
+unsigned int * ImageBase::getImage (unsigned int texId, double ts)
{
// if image is not available
if (!m_avail)
@@ -82,12 +82,12 @@ unsigned int * ImageBase::getImage (unsigned int texId)
// get images from sources
for (ImageSourceList::iterator it = m_sources.begin(); it != m_sources.end(); ++it)
// get source image
- (*it)->getImage();
+ (*it)->getImage(ts);
// init image
init(m_sources[0]->getSize()[0], m_sources[0]->getSize()[1]);
}
// calculate new image
- calcImage(texId);
+ calcImage(texId, ts);
}
// if image is available, return it, otherwise NULL
return m_avail ? m_image : NULL;
@@ -305,12 +305,12 @@ void ImageSource::setSource (PyImage * source)
// get image from source
-unsigned int * ImageSource::getImage (void)
+unsigned int * ImageSource::getImage (double ts)
{
// if source is available
if (m_source != NULL)
// get image from source
- m_image = m_source->m_image->getImage();
+ m_image = m_source->m_image->getImage(0, ts);
// otherwise reset buffer
else
m_image = NULL;