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/Texture.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/Texture.cpp')
-rw-r--r--source/gameengine/VideoTexture/Texture.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp
index 04b39f0b05c..09c95b929c5 100644
--- a/source/gameengine/VideoTexture/Texture.cpp
+++ b/source/gameengine/VideoTexture/Texture.cpp
@@ -279,7 +279,9 @@ PyObject * Texture_refresh (Texture * self, PyObject * args)
{
// get parameter - refresh source
PyObject * param;
- if (!PyArg_ParseTuple(args, "O:refresh", &param) || !PyBool_Check(param))
+ double ts = -1.0;
+
+ if (!PyArg_ParseTuple(args, "O|d:refresh", &param, &ts) || !PyBool_Check(param))
{
// report error
PyErr_SetString(PyExc_TypeError, "The value must be a bool");
@@ -315,7 +317,7 @@ PyObject * Texture_refresh (Texture * self, PyObject * args)
}
// get texture
- unsigned int * texture = self->m_source->m_image->getImage(self->m_actTex);
+ unsigned int * texture = self->m_source->m_image->getImage(self->m_actTex, ts);
// if texture is available
if (texture != NULL)
{