当前位置: 首页>>代码示例>>Python>>正文


Python Controller.set_composite_mode方法代码示例

本文整理汇总了Python中gstswitch.controller.Controller.set_composite_mode方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.set_composite_mode方法的具体用法?Python Controller.set_composite_mode怎么用?Python Controller.set_composite_mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gstswitch.controller.Controller的用法示例。


在下文中一共展示了Controller.set_composite_mode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_unpack

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import set_composite_mode [as 别名]
 def test_unpack(self):
     """Test if unpack fails"""
     controller = Controller(address='unix:abstract=abcdefghijk')
     controller.establish_connection = Mock(return_value=None)
     controller.connection = MockConnection(True)
     with pytest.raises(ConnectionReturnError):
         controller.set_composite_mode(1)
开发者ID:bossjones,项目名称:gst-switch,代码行数:9,代码来源:test_controller_unit.py

示例2: adjust_pip

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import set_composite_mode [as 别名]
    def adjust_pip(self,
                   xpos,
                   ypos,
                   width,
                   heigth,
                   index,
                   generate_frames=False):
        """Create Controller object and call adjust_pip"""
        for _ in range(self.NUM):
            serv = Server(path=PATH, video_format="debug")
            try:
                serv.run()
                sources = TestSources(video_port=3000)
                preview = PreviewSinks()
                preview.run()
                out_file = "output-{0}.data".format(index)
                video_sink = VideoFileSink(3001, out_file)
                sources.new_test_video(pattern=4)
                sources.new_test_video(pattern=5)
                controller = Controller()
                controller.set_composite_mode(Controller.COMPOSITE_PIP)
                time.sleep(3)
                res = controller.adjust_pip(xpos, ypos, width, heigth)
                time.sleep(3)
                sources.terminate_video()
                preview.terminate()
                video_sink.terminate()
                serv.terminate(1)
                if not generate_frames:
                    assert res is not None
                    assert self.verify_output(index, out_file) is True

            finally:
                serv.terminate_and_output_status(cov=True)
开发者ID:mithro,项目名称:gst-switch,代码行数:36,代码来源:test_controller.py

示例3: do_set_composite_mode

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import set_composite_mode [as 别名]
 def do_set_composite_mode(self, line):
     try:
         val = self.COMPOSITE_MAPPING[line.lower()]
     except KeyError:
         print "Invalid"
         return
     c = Controller()
     c.establish_connection()
     print c.set_composite_mode(val)
开发者ID:a740122,项目名称:gst-switch,代码行数:11,代码来源:console.py

示例4: adjust_pip

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import set_composite_mode [as 别名]
    def adjust_pip(
        self,
        xpos,
        ypos,
        width,
        heigth,
        index,
            generate_frames=False):
        """Create Controller object and call adjust_pip"""
        for _ in range(self.NUM):
            serv = Server(path=PATH)
            try:
                serv.run()
                sources = TestSources(video_port=3000)
                preview = PreviewSinks()
                preview.run()
                out_file = "output-{0}.data".format(index)
                video_sink = VideoFileSink(PATH, 3001, out_file)
                sources.new_test_video(pattern=4)
                sources.new_test_video(pattern=5)
                controller = Controller()
                controller.set_composite_mode(1)
                time.sleep(3)
                res = controller.adjust_pip(xpos, ypos, width, heigth)
                time.sleep(3)
                sources.terminate_video()
                preview.terminate()
                video_sink.terminate()
                serv.terminate(1)
                if not generate_frames:
                    assert res is not None
                    assert self.verify_output(index, out_file) is True

            finally:
                if serv.proc:
                    poll = serv.proc.poll()
                    print self.__class__
                    if poll == -11:
                        print "SEGMENTATION FAULT OCCURRED"
                    print "ERROR CODE - {0}".format(poll)
                    serv.terminate(1)
                    log = open('server.log')
                    print log.read()
开发者ID:bossjones,项目名称:gst-switch,代码行数:45,代码来源:test_controller.py

示例5: test_on_new_mode_online

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import set_composite_mode [as 别名]
    def test_on_new_mode_online(self):
        """Create a Controller object, call on_new_mode_online method and
        check that the callback fires
        """
        serv = Server(path=PATH)
        try:
            serv.run()

            controller = Controller()
            controller.establish_connection()

            test_cb = Mock(side_effect=self.quit_mainloop)
            controller.on_new_mode_online(test_cb)
            controller.set_composite_mode(0)

            GLib.timeout_add_seconds(5, self.quit_mainloop)
            self.run_mainloop()

            test_cb.assert_called_once_with(0)

            serv.terminate(1)
        finally:
            serv.terminate_and_output_status(cov=True)
开发者ID:mithro,项目名称:gst-switch,代码行数:25,代码来源:test_controller.py

示例6: permutate_composite_mode

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import set_composite_mode [as 别名]
def permutate_composite_mode(num, delay):
    """Change composite mode num number of times"""
    import random

    video_port = 3000
    serv = Server(path=PATH, video_port=video_port)
    try:
        serv.run()
        sources = TestSources(video_port=video_port)
        sources.new_test_video(pattern=6)
        sources.new_test_video(pattern=5)
        preview = PreviewSinks()
        preview.run()
        controller = Controller()
        res = controller.set_composite_mode(0)
        assert res is True

        prev_mode = 0
        for _ in range(num-1):

            time.sleep(delay)
            mode = random.randint(0,3)
            expected_res = bool(prev_mode ^ mode)
            prev_mode = mode
            assert expected_res == controller.set_composite_mode(mode)
        preview.terminate()
        sources.terminate_video()

    finally:
        if serv.proc:
                poll = serv.proc.poll()
                if poll == -11:
                    print "SEGMENTATION FAULT OCCURRED"
                print "ERROR CODE - {0}".format(poll)
                serv.terminate(1)
                log = open('server.log')
                print log.read()
开发者ID:bossjones,项目名称:gst-switch,代码行数:39,代码来源:performance_dbus.py

示例7: set_composite_mode

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import set_composite_mode [as 别名]
    def set_composite_mode(self, mode, generate_frames=False):
        """Create Controller object and call set_composite_mode method"""
        for _ in range(self.NUM):

            serv = Server(path=PATH)
            try:
                serv.run()

                preview = PreviewSinks()
                preview.run()

                out_file = 'output-{0}.data'.format(mode)
                video_sink = VideoFileSink(serv.video_port + 1, out_file)

                sources = TestSources(video_port=3000)
                sources.new_test_video(pattern=4)
                sources.new_test_video(pattern=5)

                time.sleep(3)
                # expected_result = [mode != 3] * self.FACTOR
                # print mode, expected_result
                controller = Controller()
                res = controller.set_composite_mode(mode)
                print res
                time.sleep(3)
                video_sink.terminate()
                preview.terminate()
                sources.terminate_video()
                serv.terminate(1)
                if not generate_frames:
                    if mode == 3:
                        assert res is False
                    else:
                        assert res is True
                    assert self.verify_output(mode, out_file) is True
                # assert expected_result == res

            finally:
                if serv.proc:
                    poll = serv.proc.poll()
                    print self.__class__
                    if poll == -11:
                        print "SEGMENTATION FAULT OCCURRED"
                    print "ERROR CODE - {0}".format(poll)
                    serv.terminate(1)
                    log = open('server.log')
                    print log.read()
开发者ID:hyades,项目名称:gst-switch,代码行数:49,代码来源:test_controller.py

示例8: set_composite_mode

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import set_composite_mode [as 别名]
    def set_composite_mode(self, mode, generate_frames=False):
        """Create Controller object and call set_composite_mode method"""
        for _ in range(self.NUM):

            serv = Server(path=PATH, video_format="debug")
            try:
                serv.run()

                preview = PreviewSinks()
                preview.run()

                out_file = 'output-{0}.data'.format(mode)
                video_sink = VideoFileSink(serv.video_port + 1, out_file)

                sources = TestSources(video_port=3000)
                sources.new_test_video(pattern=4)
                sources.new_test_video(pattern=5)

                time.sleep(3)
                # expected_result = [mode != 3] * self.FACTOR
                # print(mode, expected_result)
                controller = Controller()
                res = controller.set_composite_mode(mode)
                print(res)
                time.sleep(3)
                video_sink.terminate()
                preview.terminate()
                sources.terminate_video()
                serv.terminate(1)
                if not generate_frames:
                    controller = Controller()
                    if mode == Controller.COMPOSITE_DUAL_EQUAL:
                        assert res is False
                    else:
                        assert res is True
                    assert self.verify_output(mode, out_file) is True
                # assert expected_result == res

            finally:
                serv.terminate_and_output_status(cov=True)
开发者ID:mithro,项目名称:gst-switch,代码行数:42,代码来源:test_controller.py

示例9: test_normal_unpack

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import set_composite_mode [as 别名]
 def test_normal_unpack(self):
     """Test if valid"""
     controller = Controller(address='unix:abstract=abcdef')
     controller.establish_connection = Mock(return_value=None)
     controller.connection = MockConnection(False)
     assert controller.set_composite_mode(1) is True
开发者ID:bossjones,项目名称:gst-switch,代码行数:8,代码来源:test_controller_unit.py


注:本文中的gstswitch.controller.Controller.set_composite_mode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。