On 5/13/08, Mikhail Arefiev <m.a...@gm...> wrote:
> Hello! I have a few d3d.Media instances (videos) in my little program
> and they are to be rendered into a texture sequentially, and it works
> fine until I try to resize the window. In this case, all Media
> objects start to play simultaneously and it freezes everything. In
> MEDIA.WINDOW mode, however, they don't, but getScreenshot() is
> painfully slow (it should be, if I understand correctly).
>
> Is it possible to avoid such behavior?
>
> Is it possible to render videos into a window using MEDIA.WINDOW mode
> and then draw some overlay (sprites and text) over them?
>
> Thanks in advance!
>
Hi,
d3d.Media and its render-to-texture mode is currently quite fragile
and experimental. The coordination between DirectShow, drivers, codecs
and applications can be quite complex and error prone.
There are some known issues with the object, especially some codecs
don't support certain features correctly. For example when you resize
the DirectPython window, the internal D3D device which is used to
render the videos is reset. This also requires reloading the video and
setting it's position, but things can go wrong just like you
described. There are also some bugs in DirectPython side which can
affect this. You could try to track the videos and their state
manually, and when the window is resized set the state (is it running,
postition etc) yourself.
If you use the WINDOW-mode with a video, you should not be drawing
anything else as the DirectShow updates the window and can mess up
your your present() calls. Getting a screenshot of the video in this
mode is slow (by design) as you noticed, so using this method with
your scene graphics is not very solid. There are other ways to get
data from video using DirectShow and VMR9, but most of them are not
very solid (SampleGrabber-way could be one, but I havent implemented
it).
Hopefully most of the issues should be fixed for DirectPython 1.0, but
the VMR9 renderless mode is quite tricky to get right in all
configurations. So I am afraid you have to wait until the next
realease. Fortunately I will have some spare time during the summer,
so it should not take that long (month or slightly more).
--
Heikki Salo
|