def __init__(self, vsource, asource, previewsink): SBinManager.__init__(self) from gstmanager.sbins.encoders.ogg import OggEncoder profile = OggRecordingProfile() self.encoder = encoder = OggEncoder(filename="/tmp/test", profile=profile) self.add_many(vsource, asource, previewsink, encoder) PipelineManager.__init__(self, self.pipeline_desc)
def evt_eos(self, event): # This is the callback used for every evt_MSGNAME received logger.info("EOS Recieved") def set_brightness(pipelinel, value): # set_property_on_element example pipelinel.set_property_on_element(element_name="balance", property_name="brightness", value=value) if __name__ == '__main__': import logging, sys logging.basicConfig( level=getattr(logging, "DEBUG"), format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', stream=sys.stderr ) from gstmanager.gstmanager import PipelineManager pipeline_desc = "videotestsrc num-buffers=100 ! videobalance name=balance ! xvimagesink" pipelinel = PipelineManager(pipeline_desc) pipelinel.run() # Let's schedule some property changing import gobject gobject.timeout_add(2000, set_brightness, pipelinel, 0.2) import gtk gtk.main()
self.registerEvent("drop_value_change") def evt_drop_value_change(self, event): data = event.content["value"] src = event.content["source"] property = event.content["property"] print "%s reports %s prop change to value %s" % (src, property, data) from gstmanager.gstmanager import PipelineManager caps_in = "video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1" caps_out = "video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240, framerate=(fraction)25/1" pip = "videotestsrc ! %s ! videorate ! %s ! fakesink" % (caps_in, caps_out) p = PipelineManager(pip) p.play() p.activate_polling_of_property_on_element(element_name="videorate0", property="drop", interval_ms=500) print "Will poll element videorate for drop values for 10 seconds on 500ms interval" t = Test() import gobject gobject.timeout_add_seconds(10, p.deactivate_pollings) import gtk gobject.timeout_add_seconds(12, gtk.main_quit) gtk.main()