Logo Search packages:      
Sourcecode: scenic version File versions  Download package

def scenic::streamer::StreamerManager::_gather_config_to_stream (   self,
  addr 
) [private]
Gathers all settings in a big dict.

Useful for feedback to the user.

Definition at line 90 of file streamer.py.

                                            :
        """
        Gathers all settings in a big dict.
        
        Useful for feedback to the user.
        """
        contact_name = addr
        contact = self.app._get_contact_by_addr(addr)
        if contact is not None:
            contact_name = contact["name"]
        
        remote_config = self.app.remote_config # FIXME: should the remote config be passed as a param to this method?
        send_width, send_height = self.app.config.video_capture_size.split("x")
        receive_width, receive_height = remote_config["video"]["capture_size"].split("x")
        
        # MIDI
        midi_send_enabled = self.app.config.midi_send_enabled and remote_config["midi"]["recv_enabled"]
        midi_recv_enabled = self.app.config.midi_recv_enabled and remote_config["midi"]["send_enabled"]
        midi_input_device = self.app.config.midi_input_device
        midi_output_device = self.app.config.midi_output_device
        
        audio_jitterbuffer = self.app.config.audio_jitterbuffer
        if self.app.config.audio_video_synchronized and self.app.config.video_recv_enabled:
            audio_jitterbuffer = self.app.config.video_jitterbuffer
        
        log.debug("remote_config: %s" % (remote_config))
        
        self.session_details = {
            "peer": {
                "address": addr,
                "name": contact_name,
                },
            # ----------------- send ---------------
            "send": {
                "video": {
                    # Decided by both:
                    "enabled": self.app.config.video_send_enabled and remote_config["video"]["recv_enabled"],
                    
                    # Decided locally:
                    "source": self.app.config.video_source,
                    "device": self.app.config.video_device,
                    "width": int(send_width), # int
                    "height": int(send_height), # int
                    "aspect-ratio": self.app.config.video_aspect_ratio,
                    
                    # Decided by remote peer:
                    "port": remote_config["video"]["port"], 
                    "bitrate": remote_config["video"]["bitrate"], 
                    "codec": remote_config["video"]["codec"], 
                },
                
                "audio": {
                    # Decided by both:
                    "enabled": self.app.config.audio_send_enabled and remote_config["audio"]["recv_enabled"],

                    # Decided locally:
                    "source": self.app.config.audio_source,
                    "vumeter-id": self.app.gui.audio_levels_input_socket_id,
                    "buffer": self.app.config.audio_input_buffer,
                    "jack_autoconnect": self.app.config.audio_jack_enable_autoconnect,

                    # Decided by remote peer:
                    "numchannels": remote_config["audio"]["numchannels"],
                    "codec": remote_config["audio"]["codec"],
                    "port": remote_config["audio"]["port"], 
                    "synchronized": remote_config["audio"]["synchronized"],
                }, 
                "midi": {
                    "enabled": midi_send_enabled,
                    "input_device": midi_input_device,
                    "port": remote_config["midi"]["port"]
                }
            },
            # -------------------- recv ------------
            "receive": {
                "video": {
                    # Decided by both:
                    "enabled": self.app.config.video_recv_enabled and remote_config["video"]["send_enabled"],

                    # decided locally:
                    "sink": self.app.config.video_sink,
                    "port": str(self.app.recv_video_port), #decided by the app
                    "codec": self.app.config.video_codec,
                    "deinterlace": self.app.config.video_deinterlace, # bool
                    "window-title": "\"From %s\"" % (contact_name), #TODO: i18n
                    "jitterbuffer": self.app.config.video_jitterbuffer, 
                    "fullscreen": self.app.config.video_fullscreen, # bool
                    "display": self.app.config.video_display,
                    "bitrate": self.app.config.video_bitrate, # float
                    
                    # Decided by remote peer:
                    "aspect-ratio": remote_config["video"]["aspect_ratio"],
                    "width": int(receive_width), # int
                    "height": int(receive_height), # int
                },
                "audio": {
                    # Decided by both:
                    "enabled": self.app.config.audio_recv_enabled and remote_config["audio"]["send_enabled"],
                    
                    # decided locally:
                    "numchannels": self.app.config.audio_channels, # int
                    "vumeter-id": self.app.gui.audio_levels_output_socket_id,
                    "codec": self.app.config.audio_codec, 
                    "port": self.app.recv_audio_port,
                    "sink": self.app.config.audio_sink,
                    "buffer": self.app.config.audio_output_buffer,
                    "synchronized": self.app.config.audio_video_synchronized,
                    "jitterbuffer": audio_jitterbuffer,
                    "jack_autoconnect": self.app.config.audio_jack_enable_autoconnect,
                },
                "midi": {
                    "enabled": midi_recv_enabled,
                    "jitterbuffer": self.app.config.midi_jitterbuffer,
                    "output_device": midi_output_device,
                    "port": str(self.app.recv_midi_port),
                }
            }
        }
        if self.session_details["send"]["video"]["source"] != "v4l2src":
            self.session_details["send"]["video"]["device"] = None
        if self.session_details["send"]["video"]["codec"] == "theora":
            self.session_details["send"]["video"]["bitrate"] = None
        
        # limit to max numchannels if in raw
        # ...according to remote's max
        if self.session_details["receive"]["audio"]["codec"] == "raw":
            if self.session_details["receive"]["audio"]["numchannels"] > remote_config["audio"]["max_channels_in_raw"]:
                num =  remote_config["audio"]["max_channels_in_raw"]
                self.session_details["receive"]["audio"]["numchannels"] = num
                msg = _("Limiting the number of audio channels being received to %(number)d since the remote peer only supports up to that many.\nDecrease it to get rid of this message.") % {"number": num}
                log.warning(msg)
                self.app.gui.show_error_dialog(msg)
        # ...according to local's max
        if self.session_details["send"]["audio"]["codec"] == "raw":
            if self.session_details["send"]["audio"]["numchannels"] > self.app.max_channels_in_raw:
                num = self.app.max_channels_in_raw
                self.session_details["send"]["audio"]["numchannels"] = num
                msg = _("Limiting the number of audio channels being sent to %(number)d since we only support up to that many.\nDecrease it to get rid of this message.") % {"number": num}
                details = _("Update your jackaudiosrc Gstreamer element.")
                log.warning(msg)
                log.warning(details)
                self.app.gui.show_error_dialog(msg, details=details)
        
        log.debug(str(self.session_details))


Generated by  Doxygen 1.6.0   Back to index