def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) gcvideosink = get_videosink(videosink=self.options['videosink'], name='sink-'+self.options['name']) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-audio-'+self.options['name']) aux = (pipestr.replace('gc-vsink', gcvideosink) .replace('gc-asink', gcaudiosink)) if self.options["caps-preview"]: aux = aux.replace("caps-preview !","videoscale ! videorate ! "+self.options["caps-preview"]+" !") else: aux = aux.replace("caps-preview !","") #bin = Gst.parse_bin_from_description(aux, False) bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) sink = self.get_by_name("gc-firewireavi-sink") sink.set_property('location', path.join(self.options['path'], self.options['file'])) if self.options["vumeter"] == False: level = self.get_by_name("gc-firewireavi-level") level.set_property("message", False) if self.options["player"] == False: self.mute = True element = self.get_by_name("gc-firewireavi-volume") element.set_property("mute", True) else: self.mute = False
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-'+self.options['name']) aux = (pipestr.replace('gc-asink', gcaudiosink) .replace("gc-autoaudio-enc", self.options["audioencoder"]) .replace("gc-audio-channels", str(self.options["channels"]))) #bin = Gst.parse_bin_from_description(aux, True) bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) if self.options['location'] != "default": sink = self.get_by_name("gc-autoaudio-src") sink.set_property("device", self.options['location']) sink = self.get_by_name("gc-autoaudio-sink") sink.set_property('location', path.join(self.options['path'], self.options['file'])) if "player" in self.options and self.options["player"] == False: self.mute = True element = self.get_by_name("gc-autoaudio-volume") element.set_property("mute", True) else: self.mute = False if "vumeter" in self.options: level = self.get_by_name("gc-autoaudio-level") if self.options["vumeter"] == False: level.set_property("message", False) if "amplification" in self.options: ampli = self.get_by_name("gc-autoaudio-amplify") ampli.set_property("amplification", float(self.options["amplification"]))
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) pipestr = videostr gcvideosink = get_videosink(videosink=self.options['videosink'], name='sink-'+self.options['name'], properties={"sync":"true"}) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-audio-'+self.options['name'], properties={"sync":"true"}) aux = (pipestr.replace('gc-vsink', gcvideosink) .replace('gc-ndi-enc', self.options['videoencoder']) .replace('gc-ndi-mux', self.options['muxer'] + " name=gc-ndi-mux")) if self.options["audio"]: self.has_audio = True aux += audiostr aux = aux.replace('gc-asink', gcaudiosink) aux = aux.replace('gc-ndi-audioenc', self.options['audioencoder']) else: self.has_audio = False if self.options["caps-preview"]: aux = aux.replace("caps-preview !","videoscale ! videorate ! "+self.options["caps-preview"]+" !") else: aux = aux.replace("caps-preview !","") # aux = (' ndivideosrc stream-name="GC-DEV2 (OBS)" ! capsfilter name=gc-ndi-filter ! videobox name=gc-ndi-videobox top=0 bottom=0 ! videorate ! tee name=gc-ndi-tee ! xvimagesink name=sink-Webcam async=false qos=true force-aspect-ratio=true gc-ndi-tee. ! queue ! valve drop=false name=gc-ndi-valve ! videoconvert ! x264enc pass=5 quantizer=22 speed-preset=4 ! queue ! avimux name=gc-ndi-mux ! queue ! filesink location=/tmp/test.avi async=false ndiaudiosrc ! queue ! decodebin ! audiorate ! volume name=gc-ndi-volumeinput ! audioamplify name=gc-ndi-amplify amplification=1 ! tee name=gc-ndi-audiotee ! queue ! level name=gc-ndi-level message=true interval=100000000 ! volume name=gc-ndi-volume ! queue ! autoaudiosink async=false qos=true gc-ndi-audiotee. ! queue ! valve drop=false name=gc-ndi-audio-valve ! decodebin ! audioconvert ! lamemp3enc target=1 bitrate=192 cbr=true ! queue ! gc-ndi-mux.') #bin = Gst.parse_bin_from_description(aux, True) bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) test_ip = re.compile("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):[0-9]+$") if self.options['location']: if test_ip.match(self.options['location']): self.set_option_in_pipeline('location', 'gc-ndi-src', 'ip') self.set_option_in_pipeline('location', 'gc-ndi-audiosrc', 'ip') else: self.set_option_in_pipeline('location', 'gc-ndi-src', 'stream-name') self.set_option_in_pipeline('location', 'gc-ndi-audiosrc', 'stream-name') self.set_value_in_pipeline(path.join(self.options['path'], self.options['file']), 'gc-ndi-sink', 'location') # Audio properties if self.has_audio: if "player" in self.options and self.options["player"] == False: self.mute = True element = self.get_by_name("gc-ndi-volume") element.set_property("mute", True) else: self.mute = False if "vumeter" in self.options: level = self.get_by_name("gc-ndi-level") if self.options["vumeter"] == False: level.set_property("message", False) if "amplification" in self.options: ampli = self.get_by_name("gc-ndi-amplify") ampli.set_property("amplification", float(self.options["amplification"]))
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-' + self.options['name']) aux = (pipestr.replace('gc-asink', gcaudiosink).replace( "gc-audio-enc", self.options["audioencoder"]).replace( "gc-audio-channels", str(self.options["channels"]))) if self.options["audiomuxer"]: aux = aux.replace("gc-audio-mux", self.options["audiomuxer"]) else: aux = aux.replace("gc-audio-mux !", "") if self.options["delay"] > 0.0: aux = aux.replace('gc-max-size-time', 'max-size-time=0') aux = aux.replace('gc-max-size-buffers', 'max-size-buffers=0') aux = aux.replace('gc-max-size-bytes', 'max-size-bytes=0') aux = aux.replace('gc-leaky', 'leaky=0') else: aux = aux.replace('gc-max-size-time', '') aux = aux.replace('gc-max-size-buffers', '') aux = aux.replace('gc-max-size-bytes', '') aux = aux.replace('gc-leaky', '') #bin = Gst.parse_bin_from_description(aux, True) bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) if self.options['location'] != "default": sink = self.get_by_name("gc-audio-src") sink.set_property("device", self.options['location']) sink = self.get_by_name("gc-audio-sink") sink.set_property( 'location', path.join(self.options['path'], self.options['file'])) if "player" in self.options and self.options["player"] == False: self.mute = True element = self.get_by_name("gc-audio-volumemaster") element.set_property("mute", True) else: self.mute = False if "vumeter" in self.options: level = self.get_by_name("gc-audio-level") if self.options["vumeter"] == False: level.set_property("message", False) if "amplification" in self.options: ampli = self.get_by_name("gc-audio-amplify") ampli.set_property("amplification", float(self.options["amplification"])) if self.options["delay"] > 0.0: delay = float(self.options["delay"]) minttime = self.get_by_name('gc-min-threshold-time') minttime.set_property('min-threshold-time', long(delay * 1000000000))
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) gcvideosink = get_videosink(videosink=self.options['videosink'], name='sink-' + self.options['name']) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-audio-' + self.options['name']) aux = (pipestr.replace('gc-vsink', gcvideosink).replace( 'gc-rtp-depay', pipe_config[self.options['cameratype']]['depay']).replace( 'gc-rtp-videoparse', pipe_config[self.options['cameratype']]['parse']).replace( 'gc-rtp-dec', pipe_config[self.options['cameratype']]['dec']).replace( 'gc-rtp-muxer', self.options['muxer'])) if self.options["audio"]: self.has_audio = True aux += (audiostr.replace( "gc-rtp-audio-depay", pipe_config_audio[self.options['audiotype']]['depay'] ).replace('gc-asink', gcaudiosink).replace( "gc-rtp-audioparse", pipe_config_audio[self.options['audiotype']]['parse']).replace( "gc-rtp-audio-dec", pipe_config_audio[self.options['audiotype']]['dec'])) else: self.has_audio = False if self.options["caps-preview"]: aux = aux.replace( "caps-preview !", "videoscale ! videorate ! " + self.options["caps-preview"] + " !") else: aux = aux.replace("caps-preview !", "") bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) self.set_option_in_pipeline('location', 'gc-rtp-src', 'location') self.set_value_in_pipeline( path.join(self.options['path'], self.options['file']), 'gc-rtp-sink', 'location') if self.has_audio: if "player" in self.options and self.options["player"] == False: self.mute = True element = self.get_by_name("gc-rtp-volume") element.set_property("mute", True) else: self.mute = False if "vumeter" in self.options: level = self.get_by_name("gc-rtp-level") if self.options["vumeter"] == False: level.set_property("message", False)
def __init__(self, options={}): raise Exception("Not implemented. Using gst 0.10") base.Base.__init__(self, options) Gst.Bin.__init__(self) gcvideosink = get_videosink(videosink=self.options['videosink'], name='sink-' + self.options['name']) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-audio-' + self.options['name']) aux = (pipestr.replace('gc-vsink', gcvideosink).replace('gc-asink', gcaudiosink)) if self.options["caps-preview"]: aux = aux.replace( "caps-preview !", "videoscale ! videorate ! " + self.options["caps-preview"] + " !") else: aux = aux.replace("caps-preview !", "") #bin = Gst.parse_bin_from_description(aux, True) bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) sink = self.get_by_name("gc-hauppauge-device-src") sink.set_property("device", self.options["locprevideo"]) sink = self.get_by_name("gc-hauppauge-file-src") sink.set_property("location", self.options["location"]) sink = self.get_by_name("gc-hauppauge-audio-src") sink.set_property("location", self.options["locpreaudio"]) if self.options["player"] == False: self.mute = True element = self.get_by_name("gc-hauppauge-volume") element.set_property("mute", True) else: self.mute = False sink = self.get_by_name("gc-hauppauge-sink") sink.set_property( 'location', path.join(self.options['path'], self.options['file'])) if self.options["vumeter"] == False: level = self.get_by_name("gc-hauppauge-level") level.set_property("message", False)
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) gcvideosink = get_videosink(videosink=self.options['videosink'], name='sink-' + self.options['name']) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-audio-' + self.options['name']) aux = (pipestr.replace('gc-vsink', gcvideosink).replace( 'gc-asink', gcaudiosink).replace('gc-firewire_renc-videoenc', self.options['videoencoder']).replace( 'gc-firewire_renc-muxer', self.options['muxer'] + ' name=gc-firewire_renc-mux').replace( 'gc-firewire_renc-audioenc', self.options['audioencoder']).replace( 'gc-firewire_renc-capsfilter', self.options['caps'])) if self.options["caps-preview"]: aux = aux.replace( "caps-preview !", "videoscale ! videorate ! " + self.options["caps-preview"] + " !") else: aux = aux.replace("caps-preview !", "") #bin = Gst.parse_bin_from_description(aux, False) bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) sink = self.get_by_name("gc-firewire_renc-sink") sink.set_property( 'location', path.join(self.options['path'], self.options['file'])) if self.options["vumeter"] == False: level = self.get_by_name("gc-firewire_renc-level") level.set_property("message", False) if self.options["player"] == False: self.mute = True element = self.get_by_name("gc-firewire_renc-volume") element.set_property("mute", True) else: self.mute = False
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) gcvideosink = get_videosink(videosink=self.options['videosink'], name='sink-'+self.options['name']) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-audio-'+self.options['name']) aux = (pipestr.replace('gc-vsink', gcvideosink) .replace('gc-rtp-depay', pipe_config[self.options['cameratype']]['depay']) .replace('gc-rtp-videoparse', pipe_config[self.options['cameratype']]['parse']) .replace('gc-rtp-dec', pipe_config[self.options['cameratype']]['dec']) .replace('gc-rtp-muxer', self.options['muxer'])) if self.options["audio"]: self.has_audio = True aux += (audiostr.replace("gc-rtp-audio-depay", pipe_config_audio[self.options['audiotype']]['depay']) .replace('gc-asink', gcaudiosink) .replace("gc-rtp-audioparse", pipe_config_audio[self.options['audiotype']]['parse']) .replace("gc-rtp-audio-dec", pipe_config_audio[self.options['audiotype']]['dec'])) else: self.has_audio = False if self.options["caps-preview"]: aux = aux.replace("caps-preview !","videoscale ! videorate ! "+self.options["caps-preview"]+" !") else: aux = aux.replace("caps-preview !","") bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) self.set_option_in_pipeline('location', 'gc-rtp-src', 'location') self.set_value_in_pipeline(path.join(self.options['path'], self.options['file']), 'gc-rtp-sink', 'location') if self.has_audio: if "player" in self.options and self.options["player"] == False: self.mute = True element = self.get_by_name("gc-rtp-volume") element.set_property("mute", True) else: self.mute = False if "vumeter" in self.options: level = self.get_by_name("gc-rtp-level") if self.options["vumeter"] == False: level.set_property("message", False)
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-'+self.options['name']) aux = (pipestr.replace('gc-asink', gcaudiosink) .replace("gc-audio-enc", self.options["audioencoder"]) ) bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) test_ip = re.compile("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):[0-9]+$") if self.options['location']: if test_ip.match(self.options['location']): self.set_option_in_pipeline('location', 'gc-audio-src', 'ip') else: self.set_option_in_pipeline('location', 'gc-audio-src', 'stream-name') sink = self.get_by_name("gc-audio-sink") sink.set_property('location', path.join(self.options['path'], self.options['file'])) if "player" in self.options and self.options["player"] == False: self.mute = True element = self.get_by_name("gc-audio-volumemaster") element.set_property("mute", True) else: self.mute = False if "vumeter" in self.options: level = self.get_by_name("gc-audio-level") if self.options["vumeter"] == False: level.set_property("message", False) if "amplification" in self.options: ampli = self.get_by_name("gc-audio-amplify") ampli.set_property("amplification", float(self.options["amplification"]))
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) pipestr = videostr gcvideosink = get_videosink(videosink=self.options['videosink'], name='sink-' + self.options['name'], properties={"sync": "true"}) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-audio-' + self.options['name'], properties={"sync": "true"}) aux = (pipestr.replace('gc-vsink', gcvideosink).replace( 'gc-ndi-enc', self.options['videoencoder']).replace( 'gc-ndi-mux', self.options['muxer'] + " name=gc-ndi-mux")) if self.options["audio"]: self.has_audio = True aux += audiostr aux = aux.replace('gc-asink', gcaudiosink) aux = aux.replace('gc-ndi-audioenc', self.options['audioencoder']) else: self.has_audio = False if self.options["caps-preview"]: aux = aux.replace( "caps-preview !", "videoscale ! videorate ! " + self.options["caps-preview"] + " !") else: aux = aux.replace("caps-preview !", "") # aux = (' ndivideosrc stream-name="GC-DEV2 (OBS)" ! capsfilter name=gc-ndi-filter ! videobox name=gc-ndi-videobox top=0 bottom=0 ! videorate ! tee name=gc-ndi-tee ! xvimagesink name=sink-Webcam async=false qos=true force-aspect-ratio=true gc-ndi-tee. ! queue ! valve drop=false name=gc-ndi-valve ! videoconvert ! x264enc pass=5 quantizer=22 speed-preset=4 ! queue ! avimux name=gc-ndi-mux ! queue ! filesink location=/tmp/test.avi async=false ndiaudiosrc ! queue ! decodebin ! audiorate ! volume name=gc-ndi-volumeinput ! audioamplify name=gc-ndi-amplify amplification=1 ! tee name=gc-ndi-audiotee ! queue ! level name=gc-ndi-level message=true interval=100000000 ! volume name=gc-ndi-volume ! queue ! autoaudiosink async=false qos=true gc-ndi-audiotee. ! queue ! valve drop=false name=gc-ndi-audio-valve ! decodebin ! audioconvert ! lamemp3enc target=1 bitrate=192 cbr=true ! queue ! gc-ndi-mux.') #bin = Gst.parse_bin_from_description(aux, True) bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) test_ip = re.compile( "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):[0-9]+$" ) if self.options['location']: if test_ip.match(self.options['location']): self.set_option_in_pipeline('location', 'gc-ndi-src', 'ip') self.set_option_in_pipeline('location', 'gc-ndi-audiosrc', 'ip') else: self.set_option_in_pipeline('location', 'gc-ndi-src', 'stream-name') self.set_option_in_pipeline('location', 'gc-ndi-audiosrc', 'stream-name') self.set_value_in_pipeline( path.join(self.options['path'], self.options['file']), 'gc-ndi-sink', 'location') # Audio properties if self.has_audio: if "player" in self.options and self.options["player"] == False: self.mute = True element = self.get_by_name("gc-ndi-volume") element.set_property("mute", True) else: self.mute = False if "vumeter" in self.options: level = self.get_by_name("gc-ndi-level") if self.options["vumeter"] == False: level.set_property("message", False) if "amplification" in self.options: ampli = self.get_by_name("gc-ndi-amplify") ampli.set_property("amplification", float(self.options["amplification"]))
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) gcvideosink = get_videosink(videosink=self.options['videosink'], name='sink-' + self.options['name']) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-' + self.options['name'] + '-audio') aux = (pipestr.replace('gc-vsink', gcvideosink).replace( 'gc-multi-enc', self.options['videoencoder']).replace( 'gc-multi-muxer', self.options['muxer'] + ' name=gc-multi-mux').replace( 'gc-asink', gcaudiosink).replace("gc-audio-enc", self.options["audioencoder"]).replace( "gc-audio-channels", str(self.options["channels"]))) if self.options['videofilter']: aux = aux.replace('gc-videofilter', self.options['videofilter']) else: aux = aux.replace('gc-videofilter !', '') if 'image/jpeg' in self.options['caps']: aux = aux.replace('gc-multi-dec !', 'jpegdec max-errors=-1 ! queue !') else: aux = aux.replace('gc-multi-dec !', '') if self.options["caps-preview"]: aux = aux.replace( "caps-preview !", "videoscale ! videorate ! " + self.options["caps-preview"] + " !") else: aux = aux.replace("caps-preview !", "") if self.options["delay"] > 0.0: aux = aux.replace('gc-max-size-time', 'max-size-time=0') aux = aux.replace('gc-max-size-buffers', 'max-size-buffers=0') aux = aux.replace('gc-max-size-bytes', 'max-size-bytes=0') aux = aux.replace('gc-leaky', 'leaky=0') else: aux = aux.replace('gc-max-size-time', '') aux = aux.replace('gc-max-size-buffers', '') aux = aux.replace('gc-max-size-bytes', '') aux = aux.replace('gc-leaky', '') bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) if self.options['location']: self.set_option_in_pipeline('location', 'gc-multi-src', 'device') if self.options['audiolocation'] != "default": sink = self.get_by_name("gc-audio-src") sink.set_property("device", self.options['audiolocation']) self.set_option_in_pipeline('io-mode', 'gc-multi-src', 'io-mode') self.set_value_in_pipeline( path.join(self.options['path'], self.options['file']), 'gc-multi-sink', 'location') self.set_option_in_pipeline('caps', 'gc-multi-filter', 'caps', None) if "player" in self.options and self.options["player"] is False: self.mute = True element = self.get_by_name("gc-audio-volumemaster") element.set_property("mute", True) else: self.mute = False if "vumeter" in self.options: level = self.get_by_name("gc-audio-level") if self.options["vumeter"] is False: level.set_property("message", False) if "amplification" in self.options: ampli = self.get_by_name("gc-audio-amplify") ampli.set_property("amplification", float(self.options["amplification"])) if self.options["delay"] > 0.0: delay = float(self.options["delay"]) minttime = self.get_by_name('gc-min-threshold-time') minttime.set_property('min-threshold-time', long(delay * 1000000000))
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) pipestr = videostr if self.options['framerate'] == "auto": self.options['framerate'] = FRAMERATE[self.options["input-mode"]] gcvideosink = get_videosink(videosink=self.options['videosink'], name='sink-'+self.options['name']) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-audio-'+self.options['name']) aux = (pipestr.replace('gc-vsink', gcvideosink) .replace('gc-blackmagic-conn', self.options['input']) .replace('gc-blackmagic-mode', self.options['input-mode']) .replace('gc-blackmagic-subd', str(self.options['subdevice'])) .replace('gc-blackmagic-enc', self.options['videoencoder']) .replace('gc-blackmagic-muxer', self.options['muxer']+" name=gc-blackmagic-muxer") .replace('gc-blackmagic-capsfilter', "video/x-raw,framerate={0}".format(self.options['framerate'])) ) if self.options["audio-input"] == "none": self.has_audio = False else: self.has_audio = True aux += audiostr aux = aux.replace('gc-asink', gcaudiosink) aux = aux.replace('gc-blackmagic-audioenc', self.options['audioencoder']) aux = aux.replace('gc-blackmagic-audioconn', self.options['audio-input']) aux = aux.replace('gc-blackmagic-audiosubd', str(self.options['subdevice'])) if self.options["deinterlace"]: aux = aux.replace("deinterlace !","deinterlace mode="+self.options["deinterlace"]+" !") else: aux = aux.replace("deinterlace !","") if self.options["caps-preview"]: aux = aux.replace("caps-preview !","videoscale ! videorate ! "+self.options["caps-preview"]+" !") else: aux = aux.replace("caps-preview !","") #bin = Gst.parse_bin_from_description(aux, False) bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) sink = self.get_by_name('gc-blackmagic-sink') sink.set_property('location', path.join(self.options['path'], self.options['file'])) # Video cropping for pos in ['right','left','top','bottom']: element = self.get_by_name('gc-blackmagic-crop') element.set_property(pos, int(self.options['videocrop-' + pos])) # Audio properties if self.has_audio: if "player" in self.options and self.options["player"] == False: self.mute = True element = self.get_by_name("gc-blackmagic-volume") element.set_property("mute", True) else: self.mute = False if "vumeter" in self.options: level = self.get_by_name("gc-blackmagic-level") if self.options["vumeter"] == False: level.set_property("message", False) if "amplification" in self.options: ampli = self.get_by_name("gc-blackmagic-amplify") ampli.set_property("amplification", float(self.options["amplification"]))
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-'+self.options['name']) aux = (pipestr.replace('gc-asink', gcaudiosink) .replace("gc-audio-enc", self.options["audioencoder"]) .replace("gc-audio-channels", str(self.options["channels"]))) if self.options["audiomuxer"]: aux = aux.replace("gc-audio-mux", self.options["audiomuxer"]) else: aux = aux.replace("gc-audio-mux !", "") if self.options["delay"] > 0.0: aux = aux.replace('gc-max-size-time', 'max-size-time=0') aux = aux.replace('gc-max-size-buffers', 'max-size-buffers=0') aux = aux.replace('gc-max-size-bytes', 'max-size-bytes=0') aux = aux.replace('gc-leaky', 'leaky=0') else: aux = aux.replace('gc-max-size-time', '') aux = aux.replace('gc-max-size-buffers', '') aux = aux.replace('gc-max-size-bytes', '') aux = aux.replace('gc-leaky', '') if self.options["buffer_time"] != 200000: aux = aux.replace('buffer-time','buffer-time='+str(self.options["buffer_time"])) else: aux = aux.replace('buffer-time','') #bin = Gst.parse_bin_from_description(aux, True) bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) if self.options['location'] != "default": sink = self.get_by_name("gc-audio-src") sink.set_property("device", self.options['location']) sink = self.get_by_name("gc-audio-sink") sink.set_property('location', path.join(self.options['path'], self.options['file'])) if "player" in self.options and self.options["player"] == False: self.mute = True element = self.get_by_name("gc-audio-volumemaster") element.set_property("mute", True) else: self.mute = False if "vumeter" in self.options: level = self.get_by_name("gc-audio-level") if self.options["vumeter"] == False: level.set_property("message", False) if "amplification" in self.options: ampli = self.get_by_name("gc-audio-amplify") ampli.set_property("amplification", float(self.options["amplification"])) if self.options["delay"] > 0.0: delay = float(self.options["delay"]) minttime = self.get_by_name('gc-min-threshold-time') minttime.set_property('min-threshold-time', long(delay * 1000000000))
def __init__(self, options={}): base.Base.__init__(self, options) Gst.Bin.__init__(self) pipestr = videostr gcvideosink = get_videosink(videosink=self.options['videosink'], name='sink-'+self.options['name']) gcaudiosink = get_audiosink(audiosink=self.options['audiosink'], name='sink-audio-'+self.options['name']) aux = (pipestr.replace('gc-vsink', gcvideosink) .replace('gc-blackmagic-conn', self.options['input']) .replace('gc-blackmagic-mode', self.options['input-mode']) .replace('gc-blackmagic-subd', self.options['subdevice']) .replace('gc-blackmagic-enc', self.options['videoencoder']) .replace('gc-blackmagic-muxer', self.options['muxer']+" name=gc-blackmagic-muxer") ) if self.options['framerate'] == "auto": aux = aux.replace('gc-blackmagic-capsfilter', "video/x-raw") else: aux = aux.replace('gc-blackmagic-capsfilter', "video/x-raw,framerate={0}".format(self.options['framerate'])) if self.options["audio-input"] == "none": self.has_audio = False else: self.has_audio = True aux += audiostr aux = aux.replace('gc-asink', gcaudiosink) aux = aux.replace('gc-blackmagic-audioenc', self.options['audioencoder']) aux = aux.replace('gc-blackmagic-audioconn', self.options['audio-input']) aux = aux.replace('gc-blackmagic-audiosubd', str(self.options['subdevice'])) if self.options["deinterlace"]: aux = aux.replace("deinterlace !","deinterlace mode="+self.options["deinterlace"]+" !") else: aux = aux.replace("deinterlace !","") if self.options["caps-preview"]: aux = aux.replace("caps-preview !","videoscale ! videorate ! "+self.options["caps-preview"]+" !") else: aux = aux.replace("caps-preview !","") #bin = Gst.parse_bin_from_description(aux, False) bin = Gst.parse_launch("( {} )".format(aux)) self.add(bin) sink = self.get_by_name('gc-blackmagic-sink') sink.set_property('location', path.join(self.options['path'], self.options['file'])) # Video cropping for pos in ['right','left','top','bottom']: element = self.get_by_name('gc-blackmagic-crop') element.set_property(pos, int(self.options['videocrop-' + pos])) # Audio properties if self.has_audio: if "player" in self.options and self.options["player"] == False: self.mute = True element = self.get_by_name("gc-blackmagic-volume") element.set_property("mute", True) else: self.mute = False if "vumeter" in self.options: level = self.get_by_name("gc-blackmagic-level") if self.options["vumeter"] == False: level.set_property("message", False) if "amplification" in self.options: ampli = self.get_by_name("gc-blackmagic-amplify") ampli.set_property("amplification", float(self.options["amplification"]))