()
| 38 | if count > 2: loop.quit() |
| 39 | |
| 40 | def main(): |
| 41 | type = 'async' |
| 42 | loop = gobject.MainLoop() |
| 43 | |
| 44 | pipeline = gst.Pipeline("cutter") |
| 45 | src = gst.element_factory_make("sinesrc", "src") |
| 46 | cutter = gst.element_factory_make("cutter") |
| 47 | cutter.set_property('threshold', 0.5) |
| 48 | sink = gst.element_factory_make("fakesink", "sink") |
| 49 | pipeline.add(src, cutter, sink) |
| 50 | src.link(cutter) |
| 51 | cutter.link(sink) |
| 52 | |
| 53 | control = gst.Controller(src, "volume") |
| 54 | control.set_interpolation_mode("volume", gst.INTERPOLATE_LINEAR) |
| 55 | |
| 56 | control.set("volume", 0, 0.0) |
| 57 | control.set("volume", 2 * gst.SECOND, 1.0) |
| 58 | control.set("volume", 4 * gst.SECOND, 0.0) |
| 59 | control.set("volume", 6 * gst.SECOND, 1.0) |
| 60 | control.set("volume", 8 * gst.SECOND, 0.0) |
| 61 | control.set("volume", 10 * gst.SECOND, 1.0) |
| 62 | |
| 63 | bus = pipeline.get_bus() |
| 64 | |
| 65 | if type == 'async': |
| 66 | bus.add_signal_watch() |
| 67 | bus.connect('message::element', on_message_application, loop) |
| 68 | else: |
| 69 | # FIXME: needs wrapping in gst-python |
| 70 | bus.set_sync_handler(bus.sync_signal_handler) |
| 71 | bus.connect('sync-message::element', on_message_application, loop) |
| 72 | |
| 73 | pipeline.set_state(gst.STATE_PLAYING) |
| 74 | |
| 75 | loop.run() |
| 76 | |
| 77 | pipeline.set_state(gst.STATE_NULL) |
| 78 | |
| 79 | if __name__ == "__main__": |
| 80 | main() |
no test coverage detected