当前位置: 首页>>代码示例>>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;未经允许,请勿转载。