13 """Make an interesting video test src"""
14 videosrc
= gst
.element_factory_make("videotestsrc", "video")
15 sp
= videosrc
.set_property
16 sp("pattern", "zone-plate")
26 def __init__(self
, pipeline
, videosrc
=None, index
, n
):
28 self
.screen
= gtk
.DrawingArea()
29 self
.screen
.set_size_request(WIDTH
, HEIGHT
)
32 self
.window
= gtk
.Window()
33 self
.vbox
= gtk
.VBox() # vertical box
34 self
.vbox
.pack_start(self
.screen
)
35 self
.window
.add(self
.vbox
)
37 # Create GStreamer bits and bobs
38 self
.videosrc
= videosrc
39 self
.pipeline
= pipeline
40 self
.pipeline
.add(self
.videosrc
)
41 self
.sink
= gst
.element_factory_make("ximagesink", "sink")
42 self
.pipeline
.add(self
.sink
)
43 self
.videosrc
.link(self
.sink
)
45 self
.window
.show_all()
47 self
.sink
.set_xwindow_id(self
.screen
.window
.xid
)
48 self
.pipeline
.set_state(gst
.STATE_PLAYING
)
53 self
.pipeline
= gst
.Pipeline()
55 self
.play_button
= gtk
.Button(stock
=gtk
.STOCK_MEDIA_PLAY
)
56 self
.play_button
.connect("clicked", self
.play_onclick
)
57 self
.stop_button
= gtk
.Button(stock
=gtk
.STOCK_MEDIA_STOP
)
58 self
.stop_button
.connect("clicked", self
.stop_onclick
)
59 self
.quit_button
= gtk
.Button(stock
=gtk
.STOCK_QUIT
)
60 self
.quit_button
.connect("clicked", self
.quit_onclick
)
62 self
.buttons
= gtk
.HButtonBox()
63 self
.buttons
.add(self
.play_button
)
64 self
.buttons
.add(self
.stop_button
)
65 self
.buttons
.add(self
.quit_button
)
68 self
.window
= gtk
.Window()
69 self
.vbox
= gtk
.VBox() # vertical box
70 self
.vbox
.pack_start(self
.buttons
)
71 self
.window
.add(self
.vbox
)
72 self
.window
.connect("destroy", self
.destroy
)
73 self
.window
.show_all()
77 def play_onclick(self
, widget
):
82 def stop_onclick(self
, widget
):
84 self
.pipeline
.set_state(gst
.STATE_READY
)
86 def destroy(self
, widget
, data
=None):
90 quit_onclick
= destroy
92 def start_playing(self
):
93 self
.videosrc
= videotestsrc()
94 self
.pipeline
.add(self
.videosrc
)
98 self
.screens
= [Screen(pipeline
, videosrc
, x
, SCREENS
) for x
in range(SCREENS
)]
100 self
.sink
= gst
.element_factory_make("ximagesink", "sink")
101 self
.pipeline
.add(self
.sink
)
102 self
.videosrc
.link(self
.sink
)
104 self
.sink
.set_xwindow_id(self
.screen
.window
.xid
)
106 self
.pipeline
.set_state(gst
.STATE_PLAYING
)