Hello,
I am trying to apply effects on video textures. Previously I tried,
without success, to clone a video texture. This time I tried to use the
"live" redirection of a texture. I works!
Issues:
* Gst pipeline must be in a pause/play state
* Gst bus connections slow down video play back (see code below)

So here is the program I ended up with. Any other way to accomplish the
same in a cleaner way?

#!/usr/bin/python

import clutter
from clutter import cluttergst
from clutter import tidy
import gst

actor = None
stage = None
trans = False

def on_message(bus, message):
    global actor
    global stage 
    global trans

    t = message.type
    print 'msg_type:', t
    if t == gst.MESSAGE_STATE_CHANGED:
        (s1,s2,s3) = message.parse_state_changed()
        print s1,s2,s3
        if s1 == gst.STATE_PAUSED and s2 == gst.STATE_PLAYING:
            # We started to play
            print 'Rolling...'

             # redirect video to another texture
            fbo = clutter.texture_new_from_actor(actor)
            fbo.set_position(192*6, 0)
            fbo.show()

            stage.add(fbo)

            # create reflect effect on redirected texture
            reflect = tidy.TextureReflection(fbo)
            reflect.set_position(0, 108*6)
            reflect.show()
            stage.add(reflect)

            trans = True

            # video is jerky if this is not done 
            # even tho this handler is called only 3 or 4 times
            # too much locking inside gtk/gst?
            bus.disconnect_by_func(on_message)
            

stage = clutter.Stage()
stage.set_property('fullscreen', True)
actor = cluttergst.VideoTexture()
actor.set_filename("/home/kashyapa/Videos/Warren.mp4")
#(x, y) = stage.get_size()
(x, y) = (192*6, 108*6)
actor.set_size(x, y)
actor.set_playing(True)
actor.show()
stage.add(actor)

playbin = actor.get_playbin()
bus = playbin.get_bus()
bus.connect('message', on_message)

stage.show_all()

clutter.main()


-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to