Beispiel #1
0
    def __init__(self):
        GObject.threads_init()
        Gst.init(None)

        self.rtspServer = GstRtspServer.RTSPServer()
        self.rtspServer.set_service("8554")
        auth = GstRtspServer.RTSPAuth()
        token = GstRtspServer.RTSPToken()
        token.set_string('media.factory.role', "user")
        basic = GstRtspServer.RTSPAuth.make_basic("user", "password")
        auth.add_basic(basic, token)
        self.rtspServer.set_auth(auth)

        permissions = GstRtspServer.RTSPPermissions()
        permissions.add_permission_for_role("user", "media.factory.access", True)
        permissions.add_permission_for_role("user", "media.factory.construct", True)

        # self.factory = SensorFactory("rtsp://*****:*****@huongcangqt.dyndns.info:554/Streaming/Channels/101/")
        self.factory = SensorFactory("rtsp://*****:*****@192.168.101.99:556")
        self.factory.set_permissions(permissions)
        self.factory.set_shared(True)
        mountPoints = self.rtspServer.get_mount_points()
        mountPoints.add_factory("/test", self.factory)
        
        # self.factory2 = SensorFactory("rtsp://*****:*****@huongcangpxl.dyndns.info:554/Streaming/Channels/101/")
        # self.factory2.set_permissions(permissions)
        # self.factory2.set_shared(True)
        # mountPoints = self.rtspServer.get_mount_points()
        # mountPoints.add_factory("/test1", self.factory2)


        self.rtspServer.attach(None)
        loop = GObject.MainLoop()
        loop.run()
Beispiel #2
0
    def __init__(self, port, width, height, IS_DEBUG):
        port_str = str(port)
        self.is_push_buffer_allowed = False
        self.port = port
        self.url = f"http://127.0.0.1:{port}/fitness"
        self.pipe = None
        self.IS_DEBUG = IS_DEBUG
        self.server = GstRtspServer.RTSPServer().new()
        self.server.set_service(port_str)
        self.server.connect("client-connected", self.client_connected)

        self.f = GstRtspServer.RTSPMediaFactory().new()
        self.f.set_eos_shutdown(True)
        if self.IS_DEBUG == 0:
            self.f.set_launch(get_pipe(width, height))
        else:
            self.f.set_launch(get_pipe_test(width, height))

        self.f.set_shared(True)
        self.f.connect("media-constructed", self.on_media_constructed)

        m = self.server.get_mount_points()
        m.add_factory("/fitness", self.f)
        self.server.attach(None)

        logger.info(f"[RTSP] ready at {self.url}")
Beispiel #3
0
    def __init__(self, ip="0.0.0.0",port="8554",factory="/test", user="******", password="******",
                 gst_srt=" videotestsrc ! x264enc ! rtph264pay name=pay0 pt=96 "):
        self.server = GstRtspServer.RTSPServer.new()
        self.address =  ip
        self.port = port
        self.launch_description = gst_srt

        self.server.set_address(self.address)
        self.server.set_service(self.port)
        self.server.connect("client-connected", self.client_connected)

        auth = GstRtspServer.RTSPAuth()
        token = GstRtspServer.RTSPToken()
        token.set_string('media.factory.role', user)
        basic = GstRtspServer.RTSPAuth.make_basic(user, password)
        auth.add_basic(basic, token)
        self.server.set_auth(auth)

        self.permissions = GstRtspServer.RTSPPermissions()
        self.permissions.add_permission_for_role(user, "media.factory.access", True)
        self.permissions.add_permission_for_role(user, "media.factory.construct", True)

        self.factory = GstRtspServer.RTSPMediaFactory.new()
        self.factory.set_permissions(self.permissions)
        self.factory.set_launch(self.launch_description)
        self.factory.set_shared(True)
        self.factory.set_transport_mode(GstRtspServer.RTSPTransportMode.PLAY)
        self.mount_points = self.server.get_mount_points()
        self.mount_points.add_factory(factory, self.factory)

        self.server.attach(None)
        print('Stream ready')
    def __init__(self):
        self.server = GstRtspServer.RTSPServer()
        f = MyFactory()

        # set up basic auth
        auth = GstRtspServer.RTSPAuth()
        token = GstRtspServer.RTSPToken()
        token.set_string("media.factory.role", "user")
        basic = GstRtspServer.RTSPAuth.make_basic("user", "password")
        auth.add_basic(basic, token)

        self.server.set_auth(auth)

        permissons = GstRtspServer.RTSPPermissions()
        permissons.add_role("user")
        permissons.add_permission_for_role("user", "media.factory.access",
                                           True)
        permissons.add_permission_for_role("user", "media.factory.construct",
                                           True)
        f.set_permissions(permissons)

        # mount factory
        f.set_shared(True)
        m = self.server.get_mount_points()
        m.add_factory("/test", f)

        # fire on main loop
        self.server.attach(None)
Beispiel #5
0
def make_server(launch: str, port: int = 8554, url: str = '/test'):
    # GObject.type_register(Factory)

    # loop = GLib.MainLoop()
    rtsp = GstRtspServer.RTSPServer()
    rtsp.set_service(str(port))
    #g_object_set(server, "service", port, NULL);
    mp = rtsp.get_mount_points()
    factory = GstRtspServer.RTSPMediaFactory()
    factory.set_launch(launch)
    # str(GstBuilder(
    #     'tcambin name=source',
    #     '\'video/x-raw,format=RGBx,width=1280,height=720,framerate=(fraction)60/1\''
    #     #'capsfilter name=filter',
    #     'videoconvert',
    #     '\'video/x-raw,format=I420\'',
    #     'videoconvert',
    #     'x264enc qp-min=18 speed-preset=superfast ! h264parse ! rtph264pay  name=pay0 pt=96 config-interval=1'
    # )))
    factory.set_shared(True)
    # mf = factory.g_type_instance
    mp.add_factory(url, factory)
    mp = None
    rtsp.attach(None)
    media = factory.construct(url)
    media.set_reusable(True)
    return media.pipeline
Beispiel #6
0
    def __init__(self):
        # Load the configuration.
        self.config = config.get_config()

        # Initialize GStreamer.
        Gst.init(None)

        # Create a media factory.
        factory = MediaFactory(self.config['canvas']['width'],
                               self.config['canvas']['height'],
                               self.config['hikvision']['host'],
                               self.config['hikvision']['username'],
                               self.config['hikvision']['password'])
        factory.connect("media-configure", self.on_media_configure)
        factory.set_shared(True)

        # Make the server and provide it at the mount point.
        server = GstRtspServer.RTSPServer()
        server.set_auth(None)
        server.set_service(str(self.config['rtsp_server']['port']))
        server.connect("client-connected", self.on_client_connected)

        mount_points = server.get_mount_points()
        mount_points.add_factory(self.config['rtsp_server']['mount_point'],
                                 factory)

        server.attach(None)

        # Create the event loop and run.
        loop = GObject.MainLoop()
        try:
            loop.run()
        except:
            pass
Beispiel #7
0
 def __init__(self):
     self.server = GstRtspServer.RTSPServer()
     f = MyFactory()
     f.set_shared(True)
     m = self.server.get_mount_points()
     m.add_factory("/test", f)
     self.server.attach(None)
Beispiel #8
0
 def __init__(self, args):
     self.rtspServer = GstRtspServer.RTSPServer()
     factory = TestRtspMediaFactory(args.video)
     factory.set_shared(True)
     mountPoints = self.rtspServer.get_mount_points()
     mountPoints.add_factory("/stream1", factory)
     self.rtspServer.attach(None)
Beispiel #9
0
 def __init__(self):
     self.rtspServer = GstRtspServer.RTSPServer()
     factory = TestRtspMediaFactory()
     factory.set_shared(True)
     mountPoints = self.rtspServer.get_mount_points()
     mountPoints.add_factory('/{}'.format(dst_stream), factory)
     self.rtspServer.attach(None)
Beispiel #10
0
 def __call__(self):
     self.server = GstRtspServer.RTSPServer()
     self.server.set_service(self.port)
     self.server.set_address(self.ip)
     self.factory = GstRtspServer.RTSPMediaFactory()
     self.factory.set_launch("( {} )".format(self.pipeline))
     self.factory.set_shared(True)
     self.factory.props.latency = 50
     self.server.get_mount_points().add_factory("/{}".format(self.mount), self.factory)
     self.server_id = self.server.attach(None)
     if self.server_id == 0:
         logging.debug("Return value: {}".format(self.server_id))
         logging.debug("SNAFU. Exiting...")
         sys.exit(-1)
     logging.info("stream ready at rtsp://{}:{}/{}".format(self.server.get_address(),
                                                           self.server.get_service(),
                                                           self.mount))
 def __init__(self):
     self.server = GstRtspServer.RTSPServer()
     f = MyFactory()
     f.set_shared(True)
     m = self.server.get_mount_points()
     self.server.set_service('5003')
     m.add_factory("/faceblur", f)
     self.server.attach(None)
Beispiel #12
0
 def __init__(self):
     self.rtspServer = GstRtspServer.RTSPServer()
     self.rtspServer.set_service("9000")
     factory = TestRtspMediaFactory()
     factory.set_shared(True)
     mountPoints = self.rtspServer.get_mount_points()
     mountPoints.add_factory("/stream1", factory)
     self.rtspServer.attach(None)
Beispiel #13
0
	def __init__(self, **properties):
		#super(GstServer, self).__init__(**properties)
		self.server = GstRtspServer.RTSPServer()
		self.server.set_service("3002")
		self.factory = MyFactory()
		self.factory.set_shared(True)
		self.server.get_mount_points().add_factory("/capture", self.factory)
		self.server.attach(None)
Beispiel #14
0
    def __init__(self, port):
        '''
		**On init:** Some initialization code.

		:param int port: RTSP server port.
		'''
        #: GStreamer RTSP server instance.
        self.server = GstRtspServer.RTSPServer()
        self.server.set_service(str(port))
 def __init__(self):
     self.server = GstRtspServer.RTSPServer()
     self.server.set_address("192.168.10.142")
     self.server.set_service("15000")
     f = MyFactory()
     f.set_shared(True)
     m = self.server.get_mount_points()
     m.add_factory("/test", f)
     self.server.attach(None)
Beispiel #16
0
    def __init__(self, port, width, height, fps, device_path):
        port_str = str(port)
        pipe = get_pipeline(width, height, fps)
        self.pipe = None

        self.server = GstRtspServer.RTSPServer().new()
        self.server.set_service(port_str)
        self.server.connect("client-connected", self.client_connected)

        self.f = GstRtspServer.RTSPMediaFactory().new()
        self.f.set_eos_shutdown(True)
        self.f.set_launch(pipe)
        self.f.set_shared(True)
        self.f.connect("media-constructed", self.on_media_constructed)
        self.device_path = device_path

        m = self.server.get_mount_points()
        m.add_factory(DEFAULT_URI, self.f)
        self.server.attach(None)
Beispiel #17
0
 def __init__(self):
     '''
     '''
     self.server = GstRtspServer.RTSPServer()
     self.server.set_service('3002')
     f = RtspFactory()
     f.set_shared(True)
     m = self.server.get_mount_points()
     m.add_factory('/test', f)
     self.server.attach(None)
Beispiel #18
0
    def runServer(self):
        self.logger.info("Server wird gestartet")
        self.__ml = GLib.MainLoop()
        self.__srv = GstRtspServer.RTSPServer()
        self.__srv.connect("client-connected", self.client_connected_call)
        mounts = self.__srv.get_mount_points()
        self.__fac = GstRtspServer.RTSPMediaFactory()
        self.__srv.set_address("0.0.0.0")
        self.__fac.set_shared(True)
        # Bitrate * Sekunden // 8
        self.__fac.set_buffer_size((17000000 * 1 // 8))  # was // 8 )/2)
        self.__fac.set_latency(250)
        self.__fac.set_launch(
            '( filesrc location=/tmp/motion-gst-pipe do-timestamp=true ! video/x-h264, framerate={}/1 ! h264parse ! rtph264pay name=pay0 pt=96 )'
            .format(self._fps))
        mounts.add_factory("/h264", self.__fac)

        self.__srv.attach(None)
        self.__ml.run()
        self.logger.info("Server beendet")
    def __init__(self, device,h, w, bitrate, format, rotation, framerate):
        self.server = GstRtspServer.RTSPServer()
        f = MyFactory(device, h, w, bitrate, format, rotation, framerate)
        f.set_shared(True)
        m = self.server.get_mount_points()
        m.add_factory("/video", f)
        self.sourceID = self.server.attach(None)

        print("Server available on rtsp://<IP>:8554/video")
        print("Use: gst-launch-1.0 rtspsrc location=rtsp://<IP>:8554/video latency=0 ! queue ! decodebin ! autovideosink")
        print("Where IP is {0}".format(ip4_addresses()))
Beispiel #20
0
    def __init__(self):

        self.rtspServer = GstRtspServer.RTSPServer()

        factories = [TestRtspMediaFactory(pth) for pth in PATHS]

        for i, factory in enumerate(factories):
            factory.set_shared(True)
            mountPoints = self.rtspServer.get_mount_points()
            mountPoints.add_factory(f"/stream{i}", factory)

        self.rtspServer.attach(None)
Beispiel #21
0
		def __init__(self):
            #GstRtspServer를 클래스 내에서 선언하고
			self.server = GstRtspServer.RTSPServer()
            #포트를 지정해줍니다.
			self.server.set_service("3002")
            #팩토리를 생성하는데 이 부분은 위의 MyFactory 클래스에서 설명하겠습니다.
			f = MyFactory()
            #이 팩토리를 공유 할것이라 설정하고
			f.set_shared(True)
            #서버 마운트 포인트를 선언하고
			m = self.server.get_mount_points()
            #마운트 포인트에 주소와 공유할 팩토리를 넣어줍니다.
			m.add_factory("/test", f)
			self.server.attach(None)
Beispiel #22
0
 def __init__(self, port):
     self._logger = logging.get_logger('GSTRtspServer', is_static=True)
     Gst.init(None)
     self._stopped = False
     self._port = port
     self._server = GstRtspServer.RTSPServer()
     self._server.set_service(str(port))
     self._context = None
     self._mainloop = None
     self._mount_points = self._server.get_mount_points()
     self._streams = {}
     self._thread = None
     self._factory = GStreamerRtspFactory(self)
     self._factory.set_shared(True)
Beispiel #23
0
    def addMedia(self, videos, bitrate, framerate, path):
        '''
		Add videos to the server.

		:param list videos: List of available videos.
		:param int bitrate: The bitrate (in kbps).
		:param int framerate: The framerate (in fps).
		:param string path: Path to the video directory.
		'''
        for i, video in enumerate(videos):
            for codec, items in supported_codecs.iteritems():
                launch = 'filesrc location=%s/%s ! decodebin ! videorate ! video/x-raw,framerate=%s/1 ! %s bitrate=%s ! %s name=pay0' % (
                    path, video, framerate, items['encoder'],
                    items['bitrate_from_kbps'](bitrate), items['rtppay'])
                pool = GstRtspServer.RTSPAddressPool()
                pool.add_range("224.3.0.0", "224.3.0.10", 5000, 5010, 10)
                factory = GstRtspServer.RTSPMediaFactory()
                factory.set_address_pool(pool)
                factory.set_launch(launch)
                factory.set_shared(True)
                factory.set_eos_shutdown(True)
                name = '/video%s.' % (i) + codec
                self.server.get_mount_points().add_factory(name, factory)
 def __init__(self):
     self.server = GstRtspServer.RTSPServer()
     f = MyFactory()
     f.set_shared(True)
     m = self.server.get_mount_points()
     m.add_factory("/test", f)
     # auth = GstRtspServer.RTSPAuth()
     # token = GstRtspServer.RTSPToken()
     # structure = token.get_structure()
     # basic = GstRtspServer.RTSPAuth.make_basic('user', 'user')
     # GstRtspServer.RTSPAuth.set_default_token(auth, token)
     # GstRtspServer.RTSPAuth.add_basic(auth, basic, token)
     #
     # self.server.set_auth(auth)
     self.server.attach(None)
Beispiel #25
0
    def _add_media(self, file_path, directory_root):
        file = directory_root / file_path[1:]
        if not vstreamer_utils.is_video_file(file):
            raise ValueError("'%s' is not a valid video file" % str(file))

        demuxer = VideoServer._corresponding_demuxer(file)
        pipeline = "filesrc location=\"%s\" ! %s name=dmux " \
                   "dmux.video_0 ! queue ! rtph264pay name=pay0 pt=96 " \
                   "dmux.audio_0 ! queue ! rtpmp4apay name=pay1" % (file, demuxer)
        factory = GstRtspServer.RTSPMediaFactory()
        factory.set_launch(pipeline)
        factory.set_shared(True)
        encoded = urllib.parse.quote(file_path)
        self.server.get_mount_points().add_factory(encoded, factory)
        vstreamer_utils.log_info("Added '%s' to video server mount points" % str(file_path))
Beispiel #26
0
    def __init__(self):
        self.discovery_proc = None
        self.server = GstRtspServer.RTSPServer()
        self.server.set_service(str(obplayer.Config.setting('streamer_rtsp_port')))
        self.server.connect("client-connected", self.client_connected) 

        self.clock_rate = obplayer.Config.setting('streamer_rtsp_clock_rate')

        #auth = GstRtspServer.RTSPAuth.new()
        #self.server.set_auth(auth)

        factory = GstRtspServer.RTSPMediaFactory.new()
        #factory.set_launch('( uridecodebin uri="file:///media/obsuser/Wheatley/GoaTrance.mp3" is-live=1 ! audioconvert ! lamemp3enc ! rtpmpapay name=pay0 pt=96 )')
        #factory.set_launch('( uridecodebin uri="file:///media/obsuser/Wheatley/GoaTrance.mp3" is-live=1 ! audioconvert ! audioresample ! "audio/x-raw,clock-rate=48000,channels=2" ! rtpL24pay name=pay0 pt=96 )')
        #factory.set_launch('uridecodebin uri="file:///media/obsuser/Wheatley/GoaTrance.mp3" is-live=1 ! audioresample ! audioconvert ! capsfilter caps="audio/x-raw,rate=48000,channels=2" ! queue2 ! rtpL24pay name=pay0 pt=96 max-ptime=1000000')
        factory.set_launch('pulsesrc client-name="AudioOut@ObPlayer" ! audioresample ! audioconvert ! capsfilter caps="audio/x-raw,rate=' + self.clock_rate + ',channels=2" ! queue2 ! rtpL24pay name=pay0 pt=96 max-ptime=1000000')
        #factory.set_launch("( videotestsrc is-live=1 ! x264enc ! rtph264pay name=pay0 pt=96 )")
        factory.set_shared(True)
        #factory.set_protocols(GstRtsp.RTSPLowerTrans.UDP | GstRtsp.RTSPLowerTrans.UDP_MCAST)
        factory.set_protocols(GstRtsp.RTSPLowerTrans.UDP_MCAST)
        factory.set_transport_mode(GstRtspServer.RTSPTransportMode.PLAY)
        #factory.set_clock(GstNet.PtpClock.new())
        factory.set_latency(1)
        factory.connect("media-configure", self.media_configure) 

        addrpool = GstRtspServer.RTSPAddressPool.new()
        addrpool.add_range('239.192.1.101', '239.192.1.108', 5004, 5008, 100)
        factory.set_address_pool(addrpool)

        mounts = self.server.get_mount_points()
        mounts.add_factory('/by-id/1', factory)
        mounts.add_factory('/by-name/AudioOut%40ObPlayer', factory)

        # NOTE this is to circumvent a bug in Axia xNode (2.0.0r): non-numeric session IDs are ignored
        class SessPool (GstRtspServer.RTSPSessionPool):
            last = 1
            def do_create_session_id(self):
                self.last += 1
                return str(self.last)
        sesspool = SessPool()
        #sesspool = GstRtspServer.RTSPSessionPool.new()
        self.server.set_session_pool(sesspool)

        self.server.attach(None)

        if obplayer.Config.setting('streamer_rtsp_allow_discovery'):
            self.start_discovery()
Beispiel #27
0
    def output_rtsp(self):
        self.logger.info("Attaching output 'rtsp'")
        self.rtspserver = GstRtspServer.RTSPServer()
        self.rtspserver.set_address(self.dest)
        self.rtspserver.set_service(str(self.port))

        try:
            # Here we override RTSPMediaFactory to use the constructed object pipeline rather than the usual
            #  set_launch which parses a pipeline string.
            self.rtspfactory = MavRTSPMediaFactory(self.pipeline)
        except Exception as e:
            self.logger.critical("Error creating rstpfactory: " + repr(e))

        # Set the media to shared and reusable
        self.rtspfactory.set_shared(True)
        self.rtspfactory.set_eos_shutdown(False)
        self.rtspfactory.set_stop_on_disconnect(False)
        self.rtspfactory.set_suspend_mode(
            GstRtspServer.RTSPSuspendMode.NONE)  # Do not suspend the media

        # Tune for minimum latency
        self.rtspfactory.set_buffer_size(0)
        self.rtspfactory.set_latency(0)
        try:
            self.rtspfactory.set_do_retransmission(False)
        except:
            self.logger.info(
                'RTSP set_do_retransmission not available in this version of GStreamer'
            )

        # Add the /video endpoint.  More/dynamic endpoints will be added in the future
        self.rtspfactory.set_transport_mode(
            GstRtspServer.RTSPTransportMode.PLAY)
        self.rtspmounts = self.rtspserver.get_mount_points()
        self.rtspmounts.add_factory('/video', self.rtspfactory)
        self.rtspserver.attach(None)

        # Attach a signal callback for when the media is constructed
        self.rtspfactory.connect("media_constructed", self.on_rtsp_media)

        # Create a fake rtsp client that sits and listens permanently, to stop GSTMedia pipeline from being destroyed
        self.rtsp_fakeclient()

        self.logger.info("RTSP stream running at rtsp://" + str(self.dest) +
                         ":" + str(self.port) + "/video")
Beispiel #28
0
    def __init__(self,ip="0.0.0.0",port="8554",factory="/test",
                 gst_str=" videotestsrc ! x264enc ! rtph264pay name=pay0 pt=96 "):
        self.server = GstRtspServer.RTSPServer.new()
        self.address = ip
        self.port = port

        self.launch_description = gst_str

        self.server.set_address(self.address)
        self.server.set_service(self.port)
        self.server.connect("client-connected", self.client_connected)

        self.factory = GstRtspServer.RTSPMediaFactory().new()
        self.factory.set_launch(self.launch_description)
        #self.factory.set_latency(0)
        self.factory.set_shared(True)
        #self.factory.set_transport_mode(GstRtspServer.RTSPTransportMode.PLAY)
        self.mount_points = self.server.get_mount_points()
        self.mount_points.add_factory(factory, self.factory)

        self.server.attach(None)
        print('Stream ready')
Beispiel #29
0
    def __init__(self, shared: bool = False):
        # https://lazka.github.io/pgi-docs/GstRtspServer-1.0/classes/RTSPServer.html
        self.server = GstRtspServer.RTSPServer()

        # https://lazka.github.io/pgi-docs/GstRtspServer-1.0/classes/RTSPMediaFactory.html#GstRtspServer.RTSPMediaFactory.set_shared
        # f.set_shared(True)

        # https://lazka.github.io/pgi-docs/GstRtspServer-1.0/classes/RTSPServer.html#GstRtspServer.RTSPServer.get_mount_points
        # https://lazka.github.io/pgi-docs/GstRtspServer-1.0/classes/RTSPMountPoints.html#GstRtspServer.RTSPMountPoints
        m = self.server.get_mount_points()

        generator = functools.partial(FakeGstBufferGenerator,
                                      width=WIDTH,
                                      height=HEIGHT,
                                      fps=FPS,
                                      video_frmt=GST_VIDEO_FORMAT)

        # pipeline
        # pipeline = "videotestsrc num-buffers=1000 ! capsfilter caps=video/x-raw,format=RGB,width=640,height=480 ! appsink emit-signals=True"

        # path = "/home/taras/coder/datai/production/sales_zone/data/videos/letoile/sales_zone_letoile.mp4"
        # pipeline = f"filesrc location={path} ! decodebin ! videoconvert n-threads=0 ! video/x-raw,format=RGB ! appsink emit-signals=True"

        # generator = functools.partial(
        #     GstBufferGeneratorFromPipeline, gst_launch=pipeline, loop=True
        # )

        # https://lazka.github.io/pgi-docs/GstRtspServer-1.0/classes/RTSPMountPoints.html#GstRtspServer.RTSPMountPoints.add_factory
        mount_point = "/stream.rtp"
        factory = RTSPMediaFactoryCustom(generator)
        factory.set_shared(shared)
        m.add_factory(mount_point, factory)  # adding streams

        port = self.server.get_property("service")
        print(f"rtsp://localhost:{port}/{mount_point}")

        # https://lazka.github.io/pgi-docs/GstRtspServer-1.0/classes/RTSPServer.html#GstRtspServer.RTSPServer.attach
        self.server.attach(None)
Beispiel #30
0
    def __init__(self):
        self.server = GstRtspServer.RTSPServer()

        frontCam = FrontCamFactory()
        frontCam.set_shared(True)

        potatoCam = PotatoCamFactory()
        potatoCam.set_shared(True)

        m = self.server.get_mount_points()
        m.add_factory("/front", frontCam)
        m.add_factory("/potato", potatoCam)

        self.server.attach(None)
        # Рисование
        port_FrontServer = self.server.get_bound_port()
        print('RTSP server started: rtsp://%s:%d/front' %
              (getIP(), port_FrontServer))
        print('RTSP server started: rtsp://%s:%d/potato' %
              (getIP(), port_FrontServer))
        print_display(line="Robot started", y=0, shutdown=0)
        print_display(line="ip:" + getIP(), y=8, shutdown=0)
        print_display(line="RTSP server started", y=16, shutdown=0)