當前位置: 首頁>>代碼示例>>Python>>正文


Python SourceTrackObject.release方法代碼示例

本文整理匯總了Python中pitivi.timeline.track.SourceTrackObject.release方法的典型用法代碼示例。如果您正苦於以下問題:Python SourceTrackObject.release方法的具體用法?Python SourceTrackObject.release怎麽用?Python SourceTrackObject.release使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pitivi.timeline.track.SourceTrackObject的用法示例。


在下文中一共展示了SourceTrackObject.release方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TestTrackObject

# 需要導入模塊: from pitivi.timeline.track import SourceTrackObject [as 別名]
# 或者: from pitivi.timeline.track.SourceTrackObject import release [as 別名]
class TestTrackObject(TestCase):
    def setUp(self):
        TestCase.setUp(self)
        stream = AudioStream(gst.Caps("audio/x-raw-int"))
        self.factory = StubFactory()
        gst.debug("%r" % self.factory.duration)
        self.factory.addOutputStream(stream)
        self.track_object = SourceTrackObject(self.factory, stream)
        self.monitor = TrackSignalMonitor(self.track_object)

    def tearDown(self):
        self.monitor = None
        self.track_object.release()
        self.track_oject = None
        self.factory = None
        TestCase.tearDown(self)

    def testDefaultProperties(self):
        obj = self.track_object
        self.failUnlessEqual(obj.start, 0)
        self.failUnlessEqual(obj.duration, self.factory.duration)
        self.failUnlessEqual(obj.in_point, 0)
        self.failUnlessEqual(obj.out_point, self.factory.duration)
        self.failUnlessEqual(obj.media_duration, self.factory.duration)
        self.failUnlessEqual(obj.rate, 1)
        self.failUnlessEqual(obj.priority, 0)

        gnl_object = obj.gnl_object
        self.failUnlessEqual(gnl_object.props.start, 0)
        self.failUnlessEqual(gnl_object.props.duration, self.factory.duration)
        self.failUnlessEqual(gnl_object.props.media_start, 0)
        self.failUnlessEqual(gnl_object.props.media_stop,
                self.factory.duration)
        self.failUnlessEqual(gnl_object.props.media_duration,
                self.factory.duration)
        self.failUnlessEqual(gnl_object.props.rate, 1)
        self.failUnlessEqual(obj.priority, 0)

    def testChangePropertiesFromTrackObject(self):
        obj = self.track_object
        gnl_object = obj.gnl_object

        start = 1 * gst.SECOND
        obj.start = start
        self.failUnlessEqual(obj.start, start)
        self.failUnlessEqual(gnl_object.props.start, start)
        self.failUnlessEqual(self.monitor.start_changed_count, 1)

        duration = 10 * gst.SECOND
        obj.duration = duration
        self.failUnlessEqual(obj.duration, duration)
        self.failUnlessEqual(gnl_object.props.duration, duration)
        self.failUnlessEqual(self.monitor.duration_changed_count, 1)

        in_point = 5 * gst.SECOND
        obj.in_point = in_point
        self.failUnlessEqual(obj.in_point, in_point)
        self.failUnlessEqual(gnl_object.props.media_start, in_point)
        self.failUnlessEqual(self.monitor.in_point_changed_count, 1)

        media_duration = 5 * gst.SECOND
        obj.media_duration = media_duration
        self.failUnlessEqual(obj.media_duration, media_duration)
        self.failUnlessEqual(gnl_object.props.media_duration, media_duration)
        self.failUnlessEqual(obj.out_point, in_point + media_duration)
        self.failUnlessEqual(gnl_object.props.media_stop,
                in_point + media_duration)
        self.failUnlessEqual(self.monitor.media_duration_changed_count, 1)
        self.failUnlessEqual(self.monitor.out_point_changed_count, 1)

        # test video stream$
        obj.stream_type = VideoStream
        priority = 100
        gnl_priority = 3 * 100 + 3 + obj._stagger
        obj.priority = priority
        self.failUnlessEqual(obj.priority, priority)
        self.failUnlessEqual(gnl_object.props.priority, gnl_priority)
        self.failUnlessEqual(self.monitor.priority_changed_count, 1)

        # test audio stream
        obj.stream_type = AudioStream
        priority = 55
        gnl_priority = 4 * 55 + 3 + 2 * obj._stagger
        obj.priority = priority
        self.failUnlessEqual(obj.priority, priority)
        self.failUnlessEqual(gnl_object.props.priority, gnl_priority)
        self.failUnlessEqual(self.monitor.priority_changed_count, 2)


    def testChangePropertiesFromGnlObject(self):
        obj = self.track_object
        gnl_object = obj.gnl_object

        start = 1 * gst.SECOND
        gnl_object.props.start = start
        self.failUnlessEqual(obj.start, start)
        self.failUnlessEqual(self.monitor.start_changed_count, 1)

        duration = 10 * gst.SECOND
        gnl_object.props.duration = duration
#.........這裏部分代碼省略.........
開發者ID:Mathieu69,項目名稱:Pitivi_Gargamel,代碼行數:103,代碼來源:test_track.py


注:本文中的pitivi.timeline.track.SourceTrackObject.release方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。