Listing 3. Clutter Rotating a Video

import clutter
import gst
from clutter import cluttergst

class HelloWorld:
    def __init__ (self):
        self.stage = clutter.Stage()
        self.stage.set_color(clutter.color_parse('Black'))
        self.stage.set_size(500, 400)
        self.stage.set_title('Clutter 3-D Video Player')

        # Setup video.
        video_tex = cluttergst.VideoTexture()
        self.pipeline = gst.Pipeline("mypipe")
        playbin = video_tex.get_playbin()
        movfile = "file:///home/user/Videos/Video.mov"
        playbin.set_property('uri', movfile)
        self.pipeline.add(playbin)
        video_tex.set_position(90,80)
        self.stage.add(video_tex)
        self.pipeline.set_state(gst.STATE_PLAYING)

        # Create timeline that lasts for 100 frames
        # at ten frames per second.
        timeline = clutter.Timeline(100, 10)

        # Set timeline to loop forever.
        timeline.set_loop(True)

        # Create an alpha.
        alpha = clutter.Alpha(timeline, clutter.smoothstep_dec_func)

        # Set up rotation.
        Rotation = clutter.BehaviourRotate(
                               axis=clutter.Y_AXIS,
                               direction=clutter.ROTATE_CW,
                               angle_start=0,
                               angle_end=360,
                               alpha=alpha)
        Rotation.set_center(160, 160, 0)
        Rotation.apply(video_tex)

        # Start it all up.
        timeline.start()
        self.stage.show_all()
        clutter.main()


# Run program.
main = HelloWorld()

