def testTrueProbe(self): probe_id = self.src.add_event_probe(self._probe_handler, True) self.event = gst.event_new_eos() gst.debug('created new eos %r, id %x' % ( self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) # a True probe lets it pass self.assertEquals(self.src.push_event(self.event), True) # one refcount is held by our scope, another is held on # self.events through _probe self.assertEquals(self.event.__grefcount__, 2) # they are not the same Python object ... self.failIf(self.event is self.events[0]) self.failIf(id(self.event) == id(self.events[0])) # ... but they wrap the same GstEvent self.assertEquals(repr(self.event), repr(self.events[0])) self.failUnless(self.event == self.events[0]) self.src.remove_buffer_probe(probe_id) self.assertEquals(len(self.events), 1) self.events = None self.assertEquals(self.event.__grefcount__, 1) # the event has reffed the src pad as the src of the event self.assertEquals(self.src.__grefcount__, 2) # clear it self.event = None self.assertEquals(self.src.__grefcount__, 1)
def testTrueProbe(self): probe_id = self.src.add_event_probe(self._probe_handler, True) self.event = gst.event_new_eos() gst.debug('created new eos %r, id %x' % (self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) # a True probe lets it pass self.assertEquals(self.src.push_event(self.event), True) # one refcount is held by our scope, another is held on # self.events through _probe self.assertEquals(self.event.__grefcount__, 2) # they are not the same Python object ... self.failIf(self.event is self.events[0]) self.failIf(id(self.event) == id(self.events[0])) # ... but they wrap the same GstEvent self.assertEquals(repr(self.event), repr(self.events[0])) self.failUnless(self.event == self.events[0]) self.src.remove_buffer_probe(probe_id) self.assertEquals(len(self.events), 1) self.events = None self.assertEquals(self.event.__grefcount__, 1) # the event has reffed the src pad as the src of the event self.assertEquals(self.src.__grefcount__, 2) # clear it self.event = None self.assertEquals(self.src.__grefcount__, 1)
def testEmit(self): object = testhelper.get_object() object.connect('event', self._event_cb) # First emit from C testhelper.emit_event(object) # Then emit from Python object.emit('event', gst.event_new_eos())
def testFalseProbe(self): probe_id = self.src.add_event_probe(self._probe_handler, False) self.event = gst.event_new_eos() gst.debug('created new eos %r, id %x' % ( self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) # a false probe return drops the event and returns False self.assertEquals(self.src.push_event(self.event), False) # one ref in our local scope, another in self.events self.assertEquals(self.event.__grefcount__, 2) self.assertEquals(self.sink.__grefcount__, 1) self.src.remove_buffer_probe(probe_id)
def testNoProbe(self): self.event = gst.event_new_eos() gst.debug('created new eos %r, id %x' % (self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) gst.debug('pushing event on linked pad, no probe') self.assertEquals(self.src.push_event(self.event), True) gst.debug('pushed event on linked pad, no probe') # one refcount is held by our scope self.assertEquals(self.event.__grefcount__, 1) # the event has reffed the src pad as the src of the event self.assertEquals(self.src.__grefcount__, 2) # clear it self.event = None self.assertEquals(self.src.__grefcount__, 1)
def testNoProbe(self): self.event = gst.event_new_eos() gst.debug("created new eos %r, id %x" % (self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) gst.debug("pushing event on linked pad, no probe") self.assertEquals(self.src.push_event(self.event), True) gst.debug("pushed event on linked pad, no probe") # one refcount is held by our scope self.assertEquals(self.event.__grefcount__, 1) # the event has reffed the src pad as the src of the event self.assertEquals(self.src.__grefcount__, 2) # clear it self.event = None self.assertEquals(self.src.__grefcount__, 1)
def testFalseProbe(self): probe_id = self.src.add_event_probe(self._probe_handler, False) self.event = gst.event_new_eos() gst.debug('created new eos %r, id %x' % (self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) # a false probe return drops the event and returns False self.assertEquals(self.src.push_event(self.event), False) # one ref in our local scope, another in self.events self.assertEquals(self.event.__grefcount__, 2) self.assertEquals(self.sink.__grefcount__, 1) # the event has reffed the src pad as the src of the event self.assertEquals(self.src.__grefcount__, 2) # remove the event from existence self.event = None self.events = None self.assertEquals(self.src.__grefcount__, 1) self.src.remove_buffer_probe(probe_id)
def testFalseProbe(self): probe_id = self.src.add_event_probe(self._probe_handler, False) self.event = gst.event_new_eos() gst.debug("created new eos %r, id %x" % (self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) # a false probe return drops the event and returns False self.assertEquals(self.src.push_event(self.event), False) # one ref in our local scope, another in self.events self.assertEquals(self.event.__grefcount__, 2) self.assertEquals(self.sink.__grefcount__, 1) # the event has reffed the src pad as the src of the event self.assertEquals(self.src.__grefcount__, 2) # remove the event from existence self.event = None self.events = None self.assertEquals(self.src.__grefcount__, 1) self.src.remove_buffer_probe(probe_id)