Exemplo n.º 1
0
    def _create_default_audio_source(self):
        _gstelement = GstElement("audiotestsrc", "default_audio_source")
        if not _gstelement:
            raise GstElementInitError
        _gstelement.set_property("volume", 0)  # muted source

        return _gstelement
Exemplo n.º 2
0
    def _create_default_video_source(self):
        _gstelement = GstElement("videotestsrc", "default_video_source")
        if not _gstelement:
            raise GstElementInitError
        _gstelement.set_property("pattern", 2)

        return _gstelement
Exemplo n.º 3
0
    def _create_usbcam_input(self, device, **kwargs):
        if not device:
            raise DeviceMissing
        name = "usb_camera_" + device
        _gstelement = GstElement("v4l2src", name, **kwargs)
        if not _gstelement:
            raise GstElementInitError
        _gstelement.set_property("device", device)

        return _gstelement
Exemplo n.º 4
0
    def _create_audio_source(self, device, **kwargs):
        if not device:
            raise DeviceMissing

        name = "microphone_" + device
        _gstelement = GstElement("pulsesrc", name, **kwargs)
        if not _gstelement:
            raise GstElementInitError
        _gstelement.set_property("device", device)

        return _gstelement
Exemplo n.º 5
0
    def _create_rtsp_input(self, location, **kwargs):
        if not location:
            raise LocationMissing

        if utils.has_valid_ip(location) and utils.get_port(location) == 554:
            if "rtsp://" not in location:
                location = "rtsp://" + location
        else:
            raise LocationNotValid

        _gstelement = GstElement("rtspsrc", "ip_camera", **kwargs)
        if not _gstelement:
            raise GstElementInitError
        _gstelement.set_property("location", location)

        return _gstelement
Exemplo n.º 6
0
    def create_gstelement(self, path, **kwargs):
        """
        Creates a GStreamer file sink.
        """
        if not path:
            raise ValueError

        _gstelement = GstElement("filesink", self.description, **kwargs)
        if not _gstelement:
            raise GstElementInitError
        _gstelement.set_property("location", path)
        _gstelement.set_property("sync", False)

        return _gstelement
Exemplo n.º 7
0
    def create_gstelement(self, ip, port, mount, password, **kwargs):
        """
        Create GStreamer streaming sink. It streams over an IceCast server.
        """
        if not (ip or port or mount):
            raise StreamInfoIncomplete

        _gstelement = GstElement("shout2send", self.description, **kwargs)
        if not _gstelement:
            raise GstElementInitError
        _gstelement.set_property("sync", False)
        _gstelement.set_property("ip", ip)
        _gstelement.set_property("port", port)
        _gstelement.set_property("mount", mount)
        if password:
            _gstelement.set_property("password", password)

        return _gstelement