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):
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
.vbox
.pack_start(self
.buttons
)
36 self
.window
.add(self
.vbox
)
38 # Create GStreamer bits and bobs
39 self
.videosrc
= videosrc
40 self
.pipeline
= pipeline
41 self
.pipeline
.add(self
.videosrc
)
42 self
.sink
= gst
.element_factory_make("ximagesink", "sink")
43 self
.pipeline
.add(self
.sink
)
44 self
.videosrc
.link(self
.sink
)
46 self
.window
.show_all()
48 self
.sink
.set_xwindow_id(self
.screen
.window
.xid
)
49 self
.pipeline
.set_state(gst
.STATE_PLAYING
)
55 self
.screen
= gtk
.DrawingArea()
56 self
.screen
.set_size_request(WIDTH
, HEIGHT
)
59 self
.play_button
= gtk
.Button(stock
=gtk
.STOCK_MEDIA_PLAY
)
60 self
.play_button
.connect("clicked", self
.play_onclick
)
61 self
.stop_button
= gtk
.Button(stock
=gtk
.STOCK_MEDIA_STOP
)
62 self
.stop_button
.connect("clicked", self
.stop_onclick
)
63 self
.quit_button
= gtk
.Button(stock
=gtk
.STOCK_QUIT
)
64 self
.quit_button
.connect("clicked", self
.quit_onclick
)
66 self
.buttons
= gtk
.HButtonBox()
67 self
.buttons
.add(self
.play_button
)
68 self
.buttons
.add(self
.stop_button
)
69 self
.buttons
.add(self
.quit_button
)
72 self
.window
= gtk
.Window()
73 self
.vbox
= gtk
.VBox() # vertical box
74 self
.vbox
.pack_start(self
.screen
)
75 self
.vbox
.pack_start(self
.buttons
)
76 self
.window
.add(self
.vbox
)
78 # Create GStreamer pipeline
79 self
.pipeline
= gst
.Pipeline()
80 self
.videosrc
= videotestsrc()
81 self
.pipeline
.add(self
.videosrc
)
82 self
.sink
= gst
.element_factory_make("ximagesink", "sink")
83 self
.pipeline
.add(self
.sink
)
84 self
.videosrc
.link(self
.sink
)
86 #self.window.connect("delete_event", self.delete_event)
87 self
.window
.connect("destroy", self
.destroy
)
89 self
.window
.show_all()
91 def play_onclick(self
, widget
):
93 self
.sink
.set_xwindow_id(self
.screen
.window
.xid
)
94 self
.pipeline
.set_state(gst
.STATE_PLAYING
)
96 def stop_onclick(self
, widget
):
98 self
.pipeline
.set_state(gst
.STATE_READY
)
100 def destroy(self
, widget
, data
=None):
104 quit_onclick
= destroy