def _matchFactoryStreams(self, factory, old_factory): old_streams = old_factory.getOutputStreams() streams = factory.getOutputStreams() self.debug("matching factory streams old (%s) %s new (%s) %s", len(old_streams), old_streams, len(streams), streams) if len(old_streams) != len(streams): raise FormatterError("cant find all streams") stream_map = match_stream_groups_map(old_streams, streams) self.debug("stream map (%s) %s", len(stream_map), stream_map) if len(stream_map) != len(old_streams): raise FormatterError("streams don't match") return stream_map
def makeBin(self, output_stream=None): """ Create a bin that outputs the stream described by C{output_stream}. If C{output_stream} is None, it's up to the implementations to return a suitable "default" bin. @param output_stream: A L{MultimediaStream} @return: The bin. @rtype: C{gst.Bin} @see: L{releaseBin} """ compatible_stream = None self.debug("stream %r", output_stream) if output_stream is not None: self.debug("output_streams:%r", self.output_streams) stream_map = match_stream_groups_map([output_stream], self.output_streams) if output_stream not in stream_map: self.warning("stream not available in map %r", stream_map) raise ObjectFactoryError("can not create stream") compatible_stream = stream_map[output_stream] if self.max_bins != -1 and self.current_bins == self.max_bins: raise ObjectFactoryError('no bins available') bin = self._makeBin(compatible_stream) bin.factory = self self.bins.append(bin) self.current_bins += 1 self.emit('bin-created', bin) return bin