Video playback

ErnstHot

08-09-2006 17:33:26

I'm trying to use the wmvideo_plugin from pyogre but i get:

File "fx\SampleFX.py", line 48, in instateFXNode
videoTexture.start('VideoMaterial')
AttributeError: 'ExternalTextureSource' object has no attribute 'start'


and here's what I do in my code:

videoTexture = ogre.ExternalTextureSourceManager.getSingleton().getExternalTextureSource('wmvideo')
videoTexture.start('VideoMaterial')


And basically everything is set up according to the info here: http://www.universas.com/projects/wmvideo_plugin/

Is this something missing in PyOgre, or is it a defective chair to keyboard adaptor on my part?

EDIT:
Just noticed these to bits:
Registering Texture Controller: Type = wmvideo Name =

and:
WARNING: Texture instance 'VideoMaterial' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.

...wondering if there's supposed to be a Name specified somehow.

dermont

08-09-2006 18:07:43

There is no 'start' attribute for 'ExternalTextureSource':
http://www.ogre3d.org/docs/api/html/cla ... ource.html

I haven't used the wmvideo_plugin but looks like, using it in pyogre, you'll probably have use swig to wrap/create a helper class to access the video stop, pause, volume methods etc.

pjcast

08-09-2006 19:23:15

I havn't looked at that video plugin, however, iirc it supports string commands. That is one of the main points of using the ExternalTextureSource plugins - allowing plugins to create custom commands via strings :)

Format is:
ExternalTextureSourceManager::getSingleton().getCurrentPlugIn()->setParameter( "SomeCommand", "someparameters seperated by spaces );

Where Somcommand is a name of the command to use, and parameters are a space seprated list. I suggest you look at the source code of the plugin to see what it defines. There should also be away to query the string command interface for a list of commands with params.

ErnstHot

09-09-2006 00:44:22

As far as I can tell it only provides width and height through the string interface, but it seems simple enough to add what I need, provided that I am able to get it to compile (easier than writing a wrapper with swig anyway, I suppose)

Thanks to both of you.

broehl

12-09-2006 01:51:55

As it happens, I'm also working on this and I got to the same spot -- I can't figure out how to get the texture to start playing.

I've tried the string interface, and it silently ignores me. No errors, but no video playing either.

Specifically, what I'm doing is this:
ogre.ExternalTextureSourceManager.getSingleton().getCurrentPlugIn().setParameter("start", "mVideoMaterialName")

broehl

12-09-2006 02:51:30

Here's what I'm trying...

entity.getSubEntity(0).materialName = "bigVideo"
plugin = ogre.ExternalTextureSourceManager.getSingleton().getCurrentPlugIn()

plugin.playMode = ogre.TextureEffectPlay_Looping
print plugin.getInputName(), plugin.getFPS(), plugin.playMode


It correctly finds the video plugin, and the input name is the value of the filename parameter ifrom the material file. The frame rate is 24, which seems reasonable, and the playMode is 2 (TextureEffectPlay_Looping).

So everything seems to be right, except that instead of a playing video, I get a black texture.

Anyone have any suggestions?

ErnstHot

14-09-2006 13:29:05

From wmvideotexture.cpp:
dict->addParameter(ParameterDef("video_width",
"A source for the texture effect (only certain plugins require this)"
, PT_STRING),
&CWMVideoTexture::s_cmdVideoWidth);

dict->addParameter(ParameterDef("video_height",
"A source for the texture effect (only certain plugins require this)"
, PT_STRING),
&CWMVideoTexture::s_cmdVideoHeight);


That's all that get's added to the string interface, I'm afraid. Current options are: use swig to wrap/create a helper class to access the commands for playback, or modify the plugin to use the string interface for playback.

I've been trying the latter, but I get all sorts of linker errors and have no Idea how to proceed :/

BernieRoehl

14-09-2006 20:59:11

I've created a modified version of ggarber2's wmvideo plugin, which now supports a "PlayMode" string parameter that lets you start, stop and pause the video from Python.

You can find it at http://www.bernieroehl.com/goodies (including my modified source code and instructions for how to get it to build under Visual C++ 2005 Express Edition).

ErnstHot

14-09-2006 23:34:28

:lol: happyhappyjoyjoy :lol:

Thanks! Good job... I can't imagine how tedious it turned out to be (from reading the compiling instructions) I didn't get nearly that far in a couple of evenings... This pretty much sums up why I prefer python :)

bharling

15-09-2006 11:12:53

Again great job!

pyogre is getting rather nice now I think.

Bernie, surely u have to join the pyogre dev team ? :)

BernieRoehl

15-09-2006 14:55:49

Glad you're finding these useful. I may have time to do one (or possibly two) more small things before work hits again.

If I had more time, I would definitely be putting it into PyOgre, and I really appreciate the efforts of everyone working on it!

BernieRoehl

19-09-2006 13:45:35

I've got a new version of my interface to ggarber2's wmvideo plugin. It's easier to use (not using the StringParameter interface any more), it's easier to extend, and it provides support for repositioning the video (seeking back to the start, jumping to the end, that sort of thing).

You can find it at www.bernieroehl.com/goodies