Beispiel #1
0
    def unwire(self):
        if isinstance(self.get_owner(), Stream):
            #if type(self.get_port()) == VideoPort:
            # XXX: we could do this automatically ...
            raise XineError, "Can't unwire a Stream source.  Try rewiring to a null port."

        # Given previous -> me -> next, connect previous to next.  The problem
        # is that for multiple inputs/outputs this could do the wrong thing.
        # So we make a guess and use the first input/output and hope for the
        # best.  If anything more intelligent is needed, it will have to be
        # done manually.
        old_target = _wrap_xine_object(self._obj.get_port())

        # If we're here, owner is a Post.
        post = self._obj.get_owner()
        # Get the list of audio/video inputs for this post.
        inputs = [ post.post_input(x) for x in post.list_inputs() ]
        inputs = filter(lambda x: x.get_type() in (POST_DATA_AUDIO, POST_DATA_VIDEO), inputs)
        if len(inputs) > 1:
            raise XineError, "Can't automatically unwire a post with multiple inputs"

        # Get each PostOut connected to this.
        for previous_id in inputs[0].get_port().wire_list[:]:
            previous = _xine.get_object_by_id(previous_id)
            previous_port = previous.get_port()
            #print "WIRE OBJET", previous_id, previous, previous_port
            #rint "** STREAM:", self._get_stream_from_port(previous_port)
            # Wire this one to our old target.
            _wrap_xine_object(previous).wire(old_target)
Beispiel #2
0
 def _get_stream_from_port(self, port):
     if not port:
         return
     for ptr in port.wire_list:
         o = _xine.get_object_by_id(ptr)
         if type(o.get_owner()) == _xine.Stream:
             return o.get_owner()
         elif type(o.get_owner()) == _xine.Post:
             for input_name in o.get_owner().list_inputs():
                 input = o.get_owner().post_input(input_name)
                 res = self._get_stream_from_port(input.get_port())
                 if res:
                     return res
Beispiel #3
0
 def _get_wire_list(self):
     l = []
     for ptr in self._obj.wire_list:
         l.append(_xine.get_object_by_id(ptr))
         #l.append(_wrap_xine_object(_xine.get_object_by_id(ptr)))
     return l