def __init__(self): AGService.__init__(self) self.capabilities = [Capability(Capability.PRODUCER, Capability.VIDEO)] if IsWindows(): vic = "smash-5.2.exe" else: vic = "smash-5.2" self.executable = os.path.join(os.getcwd(), vic) self.sysConf = SystemConfig.instance() # Set configuration parameters # note: the datatype of the port parameter changes when a resource is set! self.streamname = TextParameter("streamname", "Video") self.port = TextParameter("port", "") self.encoding = OptionSetParameter("encoding", "h261", VideoProducerService.encodings) self.standard = OptionSetParameter("standard", "NTSC", VideoProducerService.standards) self.bandwidth = RangeParameter("bandwidth", 800, 0, 3072) self.framerate = RangeParameter("framerate", 24, 1, 30) self.quality = RangeParameter("quality", 75, 1, 100) self.configuration.append(self.streamname) self.configuration.append(self.port) self.configuration.append(self.encoding) self.configuration.append(self.standard) self.configuration.append(self.bandwidth) self.configuration.append(self.framerate) self.configuration.append(self.quality) self.profile = None
def __init__(self): AGService.__init__(self) self.capabilities = [Capability(Capability.PRODUCER, Capability.VIDEO)] self.executable = os.path.join(os.getcwd(), 'qtStream.app/Contents/MacOS/qtStream') self.sysConf = SystemConfig.instance() # Set configuration parameters # note: the datatype of the port parameter changes when a resource is set! self.streamname = TextParameter("streamname", "Video") self.port = TextParameter("port", "") self.encoding = OptionSetParameter("encoding", "h261", MacVideoProducerService.encodings) self.bandwidth = RangeParameter("bandwidth", 1200, 0, 3072) self.framerate = RangeParameter("framerate", 15, 1, 30) self.quality = RangeParameter("quality", 90, 1, 100) self.transmitOnStart = OptionSetParameter( "transmitonstartup", "On", MacVideoProducerService.onOffOptions) self.configuration.append(self.streamname) self.configuration.append(self.port) self.configuration.append(self.encoding) self.configuration.append(self.bandwidth) self.configuration.append(self.framerate) self.configuration.append(self.quality) self.configuration.append(self.transmitOnStart) self.profile = None
def SetResource(self, resource): """Set the resource used by this service""" self.log.info("VideoProducerService.SetResource : %s" % resource.resource) self.resource = resource if "portTypes" in self.resource.__dict__.keys(): # Find the config element that refers to "port" try: index = self.configuration.index(self.port) found = 1 except ValueError: found = 0 # Create the port parameter as an option set parameter, now # that we have multiple possible values for "port" if ( isinstance(self.port, TextParameter) or isinstance(self.port, ValueParameter) ) and self.port.value != "" and self.port.value in self.resource.portTypes: self.port = OptionSetParameter("port", self.port.value, self.resource.portTypes) else: self.port = OptionSetParameter("port", self.resource.portTypes[0], self.resource.portTypes) # Replace or append the "port" element if found: self.configuration[index] = self.port else: self.configuration.append(self.port)
def __init__(self): AGService.__init__(self) self.log.debug("DebugService.__init__: Init Service") self.id = str(GUID()) # Set capabilities self.capabilities = [ Capability(Capability.CONSUMER, Capability.AUDIO), Capability(Capability.CONSUMER, Capability.VIDEO), Capability(Capability.PRODUCER, "debug") ] # Set executable self.executable = None # Set configuration parameters self.param1 = OptionSetParameter("Configuration Parameter 1: ", "On", ["On", "Off"]) self.param2 = RangeParameter("Configuration Parameter 2: ", 0, 0, 100) self.param3 = TextParameter("Configuration Parameter 3: ", "DebugService") self.param4 = ValueParameter("Configuration Parameter 4: ", 25) # Append parameters to the configuration list self.configuration.append(self.param1) self.configuration.append(self.param2) self.configuration.append(self.param3) self.configuration.append(self.param4)
def SetResource(self, resource): """Set the resource used by this service""" self.log.info("VideoProducerService.SetResource : %s" % resource.name) for r in self.resources: if r[0].strip() == resource.name: self.resource = r # Find the config element that refers to "port" try: index = self.configuration.index(self.port) found = 1 except ValueError: found = 0 # Create the port parameter as an option set parameter, now # that we have multiple possible values for "port" # If self.port is valid, keep it instead of setting the default value. if ((isinstance(self.port, TextParameter) or isinstance(self.port, ValueParameter)) and self.port.value != "" and self.port.value in self.resource[1]): self.port = OptionSetParameter("Port", self.port.value, self.resource[1]) else: self.port = OptionSetParameter("Port", self.resource[1][0], self.resource[1]) self.log.info('port = %s', self.port.value) # Replace or append the "port" element if found: self.configuration[index] = self.port else: self.configuration.append(self.port) # If the stream name has not been set, set it to the resource name if not self.streamname.value: self.streamname.value = resource.name
def __init__(self): AGService.__init__(self) self.thepath = os.getcwd() self.windowGeometry = None self.capabilities = [ Capability(Capability.CONSUMER, Capability.AUDIO, "L16", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "L16", 8000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "L8", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "L8", 8000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "PCMU", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "PCMU", 8000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "GSM", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "GSM", 8000, self.id), Capability(Capability.PRODUCER, Capability.AUDIO, "L16", 16000, self.id) ] if Platform.IsWindows(): rat = "rat.exe" ratmedia = "ratmedia.exe" ratui = "rat-ui.exe" ratkill = "rat-kill.exe" else: rat = "rat" ratmedia = "ratmedia" ratui = "rat-ui" ratkill = "rat-kill" self.executable = os.path.join(os.getcwd(), rat) self.rat_media = os.path.join(os.getcwd(), ratmedia) self.rat_ui = os.path.join(os.getcwd(), ratui) self.rat_kill = os.path.join(os.getcwd(), ratkill) if not os.path.isfile(self.executable): self.executable = rat self.rat_media = ratmedia self.rat_ui = ratui self.rat_kill = ratkill # For some reason, a full path is need for ratkill for dir in os.getenv("PATH").split(":"): ratkill_fullpath = os.path.join(dir, ratkill) if os.access(ratkill_fullpath, os.X_OK): self.rat_kill = ratkill_fullpath break self.sysConf = SystemConfig.instance() # Set configuration parameters self.talk = OptionSetParameter("Talk", "Off", ["On", "Off"]) self.inputGain = RangeParameter("Input Gain", 50, 0, 100) if Platform.isOSX(): self.outputGain = RangeParameter("Output Gain", 4, 0, 100) else: self.outputGain = RangeParameter("Output Gain", 50, 0, 100) self.silenceSuppression = OptionSetParameter( "Silence Suppression", "Off", ["Off", "Automatic", "Manual"]) self.positionWindow = OptionSetParameter( 'Position Window', 'Off', ['Off', 'Justify Left', 'Justify Right']) self.configuration.append(self.talk) self.configuration.append(self.inputGain) self.configuration.append(self.outputGain) self.configuration.append(self.silenceSuppression) self.configuration.append(self.positionWindow) if Platform.isLinux() or Platform.isFreeBSD(): # note: the forceOSSAC97 attribute will only exist for the above platforms self.forceOSSAC97 = OptionSetParameter("Force AC97", "False", ["True", "False"]) self.configuration.append(self.forceOSSAC97) self.useSiteId = OptionSetParameter("Use site id", "On", ["On", "Off"]) self.configuration.append(self.useSiteId) self.profile = None
def __init__(self): AGService.__init__(self) self.thepath = os.getcwd() if IsWindows(): vic = "vic.exe" else: vic = "vic" self.executable = os.path.join(os.getcwd(), vic) if not os.path.isfile(self.executable): self.executable = vic proc = subprocess.Popen([self.executable, '-Q'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) self.deviceDOM = xml.dom.minidom.parse(proc.stdout) self.encodingOptions = [] self.capabilities = [] codecs = self.deviceDOM.getElementsByTagName("codec") for codec in codecs: if codec.childNodes[0].nodeType == xml.dom.minidom.Node.TEXT_NODE: if codec.childNodes[0].data in ['h263', 'h263+', 'raw', 'pvh']: continue self.encodingOptions.append(codec.childNodes[0].data) self.capabilities.append( Capability(Capability.CONSUMER, Capability.VIDEO, codec.childNodes[0].data.upper(), 90000, self.id)) self.capabilities.append( Capability(Capability.PRODUCER, Capability.VIDEO, codec.childNodes[0].data.upper(), 90000, self.id)) self.sysConf = SystemConfig.instance() self.profile = None self.windowGeometry = None self.startPriority = '7' self.startPriorityOption.value = self.startPriority self.id = str(GUID()) self.resolution = None # Set configuration parameters # note: the datatype of the port, standard and inputsize parameters change when a resource is set! self.streamname = TextParameter("Stream Name", "") self.port = TextParameter("port", "") self.encoding = OptionSetParameter("Encoding", "mpeg4", self.encodingOptions) self.standard = TextParameter("standard", "") self.tiles = OptionSetParameter("Thumbnail Columns", "4", VideoServiceH264.tileOptions) self.bandwidth = RangeParameter("Bandwidth", 2500, 0, 10240) self.framerate = RangeParameter("Frame Rate", 24, 1, 30) self.quality = RangeParameter("Quality", 75, 1, 100) self.transmitOnStart = OptionSetParameter( "Transmit on Startup", "On", VideoServiceH264.onOffOptions) self.muteSources = OptionSetParameter("Mute Sources", "Off", VideoServiceH264.onOffOptions) self.inputsize = TextParameter("inputsize", "") self.positionWindow = OptionSetParameter( 'Position Window', 'Justify Left', ['Off', 'Justify Left', 'Justify Right']) self.encodingDeinterlacer = OptionSetParameter( "Encoding Deinterlacer", "Off", VideoServiceH264.onOffOptions) self.configuration.append(self.streamname) self.configuration.append(self.port) self.configuration.append(self.encoding) self.configuration.append(self.standard) self.configuration.append(self.tiles) self.configuration.append(self.bandwidth) self.configuration.append(self.framerate) self.configuration.append(self.quality) self.configuration.append(self.transmitOnStart) self.configuration.append(self.muteSources) self.configuration.append(self.inputsize) self.configuration.append(self.positionWindow) self.configuration.append(self.encodingDeinterlacer) if IsWindows(): try: import win32api # get number of processors systemInfo = win32api.GetSystemInfo() numprocs = systemInfo[5] self.allProcsMask = 2**numprocs - 1 self.procOptions = ['All'] for i in range(numprocs): self.procOptions.append(str(i + 1)) self.processorUsage = OptionSetParameter( "Processor usage", self.procOptions[0], self.procOptions) self.configuration.append(self.processorUsage) except: self.log.exception( 'Error initializing processor usage options') self.__GetResources() self.deviceDOM.unlink()
def SetResource(self, resource): """ Set the resource used by this service """ self.log.info("VideoServiceH264.SetResource : %s" % resource.name) for r in self.resources: if r[0].strip() == resource.name: self.resource = r # Find the config element that refers to "port" try: index = self.configuration.index(self.port) found = 1 except ValueError: found = 0 # Create the port parameter as an option set parameter, now # that we have multiple possible values for "port" # If self.port is valid, keep it instead of setting the default value. if ((isinstance(self.port, TextParameter) or isinstance(self.port, ValueParameter)) and self.port.value != "" and self.port.value in self.resource[1]): self.port = OptionSetParameter("Port", self.port.value, self.resource[1]) else: self.port = OptionSetParameter("Port", self.resource[1][0], self.resource[1]) self.log.info('port = %s', self.port.value) # Replace or append the "port" element if found: self.configuration[index] = self.port else: self.configuration.append(self.port) # Find the config element that refers to "standard" try: index = self.configuration.index(self.standard) found = 1 except ValueError: found = 0 # Create the standard parameter as an option set parameter, now # that we have multiple possible values for "standard" # If self.standard is valid, keep it instead of setting the default value. if ((isinstance(self.standard, TextParameter) or isinstance(self.standard, ValueParameter)) and self.standard.value != "" and self.standard.value in self.resource[2]): self.standard = OptionSetParameter("Standard", self.standard.value, self.resource[2]) else: if (IsWindows() and "PAL" in self.resource[2]): self.standard = OptionSetParameter("Standard", "PAL", self.resource[2]) else: self.standard = OptionSetParameter("Standard", self.resource[2][0], self.resource[2]) self.log.info('standard = %s', self.standard.value) # Replace or append the "standard" element if found: self.configuration[index] = self.standard else: self.configuration.append(self.standard) # Find the config element that refers to "inputsize" try: index = self.configuration.index(self.inputsize) found = 1 except ValueError: found = 0 # Create the inputsize parameter as an option set parameter, now # that we have multiple possible values for "inputsize" # If self.inputsize is valid, keep it instead of setting the default value. if ((isinstance(self.inputsize, TextParameter) or isinstance(self.inputsize, ValueParameter)) and self.inputsize.value != "" and self.inputsize.value in self.resource[3]): self.inputsize = OptionSetParameter("Capture Size", self.inputsize.value, self.resource[3]) else: if ("Medium" in self.resource[3]): self.inputsize = OptionSetParameter("Capture Size", "Medium", self.resource[3]) else: self.inputsize = OptionSetParameter("Capture Size", self.resource[3][0], self.resource[3]) self.log.info('inputsize = %s', self.inputsize.value) # Replace or append the "inputsize" element if found: self.configuration[index] = self.inputsize else: self.configuration.append(self.inputsize) if len(self.resource[4]) > 0: # Find the config element that refers to "resolution" try: index = self.configuration.index(self.resolution) found = 1 except ValueError: found = 0 except AttributeError: found = 0 # Create the resolution parameter as an option set parameter, now # that we have multiple possible values for "resolution" # If self.resolution is valid, keep it instead of setting the default value. if ((isinstance(self.resolution, TextParameter) or isinstance(self.resolution, ValueParameter)) and self.resolution.value != "" and self.resolution.value in self.resource[4]): self.resolution = OptionSetParameter( "Large Size/Scaler Resolution", self.resolution.value, self.resource[4]) else: self.resolution = OptionSetParameter( "Large Size/Scaler Resolution", self.resource[4][0], self.resource[4]) self.log.info('resolution = %s', self.resolution.value) # Replace or append the "resolution" element if found: self.configuration[index] = self.resolution else: self.configuration.append(self.resolution) # If the stream name has not been set, set it to the resource name if not self.streamname.value: self.streamname.value = resource.name
def __init__( self ): AGService.__init__( self ) if IsWindows(): vic = "vic.exe" else: vic = "vic" self.executable = os.path.join(os.getcwd(),vic) if not os.path.isfile(self.executable): self.executable = vic proc = subprocess.Popen([self.executable, '-Q'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) deviceDOM = xml.dom.minidom.parse(proc.stdout) self.capabilities = [] codecs = deviceDOM.getElementsByTagName("codec") for codec in codecs: if codec.childNodes[0].nodeType == xml.dom.minidom.Node.TEXT_NODE: if codec.childNodes[0].data in ['h263', 'h263+', 'raw', 'pvh']: continue self.capabilities.append(Capability( Capability.CONSUMER, Capability.VIDEO, codec.childNodes[0].data.upper(), 90000, self.id)) deviceDOM.unlink() self.sysConf = SystemConfig.instance() self.profile = None self.windowGeometry = None self.startPriority = '7' self.startPriorityOption.value = self.startPriority # Set configuration parameters self.tiles = OptionSetParameter( "Thumbnail Columns", "4", VideoConsumerServiceH264.tileOptions ) self.positionWindow = OptionSetParameter( 'Position Window', 'Justify Left', ['Off', 'Justify Left', 'Justify Right']) self.configuration.append( self.tiles ) self.configuration.append( self.positionWindow) if IsWindows(): try: import win32api # get number of processors systemInfo = win32api.GetSystemInfo() numprocs = systemInfo[5] self.allProcsMask = 2**numprocs-1 self.procOptions = ['All'] for i in range(numprocs): self.procOptions.append(str(i+1)) self.processorUsage = OptionSetParameter( "Processor usage", self.procOptions[0], self.procOptions ) self.configuration.append( self.processorUsage ) except: self.log.exception('Error initializing processor usage options')
def __init__(self): AGService.__init__(self) self.capabilities = [ Capability(Capability.PRODUCER, Capability.VIDEO, "H261", 90000, self.id) ] if IsWindows(): vic = "vic.exe" else: vic = "vic" self.executable = os.path.join(os.getcwd(), vic) if not os.path.isfile(self.executable): self.executable = vic self.sysConf = SystemConfig.instance() self.startPriority = '5' self.startPriorityOption.value = self.startPriority self.id = str(GUID()) # Set configuration parameters # note: the datatype of the port parameter changes when a resource is set! self.streamname = TextParameter("Stream Name", "") self.port = TextParameter("Port", "") self.encoding = OptionSetParameter("Encoding", "h261", VideoProducerService.encodings) if IsWindows(): standard = "PAL" else: standard = "NTSC" self.standard = OptionSetParameter("Standard", standard, VideoProducerService.standards) self.bandwidth = RangeParameter("Bandwidth", 800, 0, 3072) self.framerate = RangeParameter("Frame Rate", 24, 1, 30) self.quality = RangeParameter("Quality", 75, 1, 100) self.configuration.append(self.streamname) self.configuration.append(self.port) self.configuration.append(self.encoding) self.configuration.append(self.standard) self.configuration.append(self.bandwidth) self.configuration.append(self.framerate) self.configuration.append(self.quality) if IsWindows(): try: import win32api # get number of processors systemInfo = win32api.GetSystemInfo() numprocs = systemInfo[5] self.allProcsMask = 2**numprocs - 1 self.procOptions = ['All'] for i in range(numprocs): self.procOptions.append(str(i + 1)) self.processorUsage = OptionSetParameter( "Processor usage", self.procOptions[0], self.procOptions) self.configuration.append(self.processorUsage) except: self.log.exception( 'Error initializing processor usage options') self.profile = None self.resource = '' self.__GetResources()
def __init__( self ): AGService.__init__( self ) self.thepath = os.getcwd() self.capabilities = [ Capability( Capability.CONSUMER, Capability.VIDEO, "H261", 90000, self.id), Capability( Capability.PRODUCER, Capability.VIDEO, "H261", 90000, self.id)] if IsWindows(): vic = "vic.exe" else: vic = "vic" self.executable = os.path.join(os.getcwd(),vic) if not os.path.isfile(self.executable): self.executable = vic self.sysConf = SystemConfig.instance() self.profile = None self.windowGeometry = None self.startPriority = '7' self.startPriorityOption.value = self.startPriority self.id = str(GUID()) # Set configuration parameters # note: the datatype of the port parameter changes when a resource is set! self.streamname = TextParameter( "Stream Name", "" ) self.port = TextParameter( "port", "" ) self.encoding = OptionSetParameter( "Encoding", "h261", VideoService.encodingOptions ) if IsWindows(): standard = "PAL" else: standard = "NTSC" self.standard = OptionSetParameter( "Standard", standard, VideoService.standardOptions ) self.tiles = OptionSetParameter( "Thumbnail Columns", "4", VideoService.tileOptions ) self.bandwidth = RangeParameter( "Bandwidth", 800, 0, 3072 ) self.framerate = RangeParameter( "Frame Rate", 24, 1, 30 ) self.quality = RangeParameter( "Quality", 75, 1, 100 ) self.transmitOnStart = OptionSetParameter( "Transmit on Startup", "On", VideoService.onOffOptions ) self.muteSources = OptionSetParameter( "Mute Sources", "Off", VideoService.onOffOptions ) self.positionWindow = OptionSetParameter( 'Position Window', 'Justify Left', ['Off', 'Justify Left', 'Justify Right']) self.configuration.append( self.streamname ) self.configuration.append( self.port ) self.configuration.append( self.encoding ) self.configuration.append( self.standard ) self.configuration.append( self.tiles ) self.configuration.append( self.bandwidth ) self.configuration.append( self.framerate ) self.configuration.append (self.quality ) self.configuration.append (self.transmitOnStart ) self.configuration.append (self.muteSources ) self.configuration.append (self.positionWindow ) if IsWindows(): try: import win32api # get number of processors systemInfo = win32api.GetSystemInfo() numprocs = systemInfo[5] self.allProcsMask = 2**numprocs-1 self.procOptions = ['All'] for i in range(numprocs): self.procOptions.append(str(i+1)) self.processorUsage = OptionSetParameter( "Processor usage", self.procOptions[0], self.procOptions ) self.configuration.append( self.processorUsage ) except: self.log.exception('Error initializing processor usage options') self.__GetResources()