Beispiel #1
0
 private void SetAudioConfiguration(
     Media.AudioEncoderConfiguration config,
     Media.AudioEncoderConfigurationOption options)
 {
     config.Encoding = options.Encoding;
     if (cmbAudioBitrate.SelectedItem != null)
     {
         config.Bitrate = (int)cmbAudioBitrate.SelectedItem;
     }
     else if ((options.BitrateList != null) && (options.BitrateList.Length > 0))
     {
         config.Bitrate = options.BitrateList[0];
     }
     if ((options.SampleRateList != null) && (options.SampleRateList.Length > 0))
     {
         config.SampleRate = options.SampleRateList[0];
     }
 }
Beispiel #2
0
        /// <summary>
        /// Get stream uri with specified configurations
        /// </summary>
        /// <param name="profile"></param>
        /// <param name="videoSourceConfig">Video source configuration</param>
        /// <param name="videoEncoderConfig">Video encoder configuration</param>
        /// <param name="audioSourceConfig">Audio source configuration</param>
        /// <param name="audioEncoderConfig">Audio encoder configuration</param>
        /// <param name="protocol"></param>
        public void GetMediaUri(
            Onvif.Profile profile,
            Onvif.VideoSourceConfiguration videoSourceConfig,
            Onvif.VideoEncoderConfiguration videoEncoderConfig,
            Onvif.AudioSourceConfiguration audioSourceConfig,
            Onvif.AudioEncoderConfiguration audioEncoderConfig,
            Onvif.TransportProtocol protocol)
        {
            if ((videoEncoderConfig == null) || (videoSourceConfig == null))
            {
                throw new ArgumentNullException();
            }
            string address = View.MediaAddress;

            _mediaClientWorking = true;
            InitializeMediaClient(address);
            _mediaClient.GetMediaUri(profile, videoSourceConfig, videoEncoderConfig, audioSourceConfig, audioEncoderConfig, protocol);
        }
Beispiel #3
0
        public void ShowVideo(Media.MediaUri uri, Media.VideoEncoderConfiguration encoder, Media.AudioEncoderConfiguration audio)
        {
            try
            {
                _videoWindow = new VideoContainer();
                DeviceEnvironment environment    = ContextController.GetDeviceEnvironment();
                int messageTimeout               = environment.Timeouts.Message;
                Media.TransportProtocol protocol = GetTransportProtocol();
                VideoUtils.AdjustVideo(
                    _videoWindow,
                    environment.Credentials.UserName,
                    environment.Credentials.Password,
                    messageTimeout,
                    protocol,
                    Media.StreamType.RTPUnicast,
                    uri,
                    encoder);
                _videoWindow.KEEPALIVE = true;
                _videoWindow.DebugPage = true;
                _videoWindow.OpenWindow(audio != null);

                Invoke(new Action(() => { btnGetStreams.Text = "Stop Video"; }));
            }
            catch
            {
                _videoWindow.DebugPage = false;
                _videoWindow           = null;
                throw;
            }
        }
Beispiel #4
0
 /// <summary>
 /// Handles media uri received event
 /// </summary>
 protected void OnMediaUriReceived(Onvif.MediaUri uri, Onvif.VideoEncoderConfiguration encoder, Onvif.AudioEncoderConfiguration audio)
 {
     View.ShowVideo(uri, encoder, audio);
 }