(self, infiles, outfile)
| 87 | caps = gst.caps_from_string('audio/x-raw-float, rate=44100, channels=2, endianness=1234, width=32') |
| 88 | |
| 89 | def __init__(self, infiles, outfile): |
| 90 | # These are used in iteration through infiles |
| 91 | self.infiles = infiles |
| 92 | self.i = 0 |
| 93 | self.start = 0L |
| 94 | |
| 95 | # The pipeline |
| 96 | self.pipeline = gst.Pipeline() |
| 97 | |
| 98 | # Create bus and connect 'eos' and 'error' handlers |
| 99 | self.bus = self.pipeline.get_bus() |
| 100 | self.bus.add_signal_watch() |
| 101 | self.bus.connect('message::eos', self.on_eos) |
| 102 | self.bus.connect('message::error', self.on_error) |
| 103 | |
| 104 | # Create elements |
| 105 | self.comp = gst.element_factory_make('gnlcomposition') |
| 106 | self.enc = gst.element_factory_make('vorbisenc') |
| 107 | self.mux = gst.element_factory_make('oggmux') |
| 108 | self.sink = gst.element_factory_make('filesink') |
| 109 | |
| 110 | # Connect handler for 'pad-added' signal |
| 111 | self.comp.connect('pad-added', self.on_pad_added) |
| 112 | |
| 113 | # Set 'location' property on filesink |
| 114 | self.sink.set_property('location', outfile) |
| 115 | |
| 116 | # Add elements to pipeline |
| 117 | self.pipeline.add(self.comp, self.enc, self.mux, self.sink) |
| 118 | |
| 119 | # Link *some* elements |
| 120 | # This in completed in self.on_pad_added() |
| 121 | gst.element_link_many(self.enc, self.mux, self.sink) |
| 122 | |
| 123 | # Reference used in self.on_pad_added() |
| 124 | self.apad = self.enc.get_pad('sink') |
| 125 | |
| 126 | # The MainLoop |
| 127 | self.mainloop = gobject.MainLoop() |
| 128 | |
| 129 | # Iterate through infiles |
| 130 | gobject.idle_add(self.discover) |
| 131 | self.mainloop.run() |
| 132 | |
| 133 | |
| 134 | def discover(self): |
nothing calls this directly
no test coverage detected