Beispiel #1
0
 private void SetMPEG4Configuration(
     Media.VideoEncoderConfiguration config,
     Media.Mpeg4Options options,
     Media.VideoResolution resolution,
     int?framerate,
     int?bitrate)
 {
     config.Encoding        = Media.VideoEncoding.MPEG4;
     config.MPEG4           = new Media.Mpeg4Configuration();
     config.MPEG4.GovLength = options.GovLengthRange.Max < 30 ? options.GovLengthRange.Max : 30;
     if (config.MPEG4.GovLength < options.GovLengthRange.Min)
     {
         config.MPEG4.GovLength = options.GovLengthRange.Min;
     }
     if (options.Mpeg4ProfilesSupported.Length > 0)
     {
         config.MPEG4.Mpeg4Profile = options.Mpeg4ProfilesSupported[0];
     }
     if ((config.RateControl == null) && (framerate.HasValue || bitrate.HasValue))
     {
         config.RateControl = new Media.VideoRateControl();
     }
     if (config.RateControl != null)
     {
         config.RateControl.FrameRateLimit   = framerate.HasValue ? framerate.Value : options.FrameRateRange.Max;
         config.RateControl.EncodingInterval = options.EncodingIntervalRange.Min;
         if (bitrate.HasValue)
         {
             config.RateControl.BitrateLimit = bitrate.Value;
         }
     }
     config.Resolution = resolution;
 }
Beispiel #2
0
 public void ShowVideo(Media.MediaUri uri, Media.VideoEncoderConfiguration encoder)
 {
     try
     {
         _videoWindow = new VideoContainer();
         DeviceEnvironment environment = ContextController.GetDeviceEnvironment();
         int messageTimeout            = environment.Timeouts.Message;
         VideoUtils.AdjustVideo(
             _videoWindow,
             environment.Credentials.UserName,
             environment.Credentials.Password,
             messageTimeout,
             Media.TransportProtocol.UDP,
             Media.StreamType.RTPUnicast,
             uri,
             encoder);
         _videoWindow.KEEPALIVE = true;
         _videoWindow.OpenWindow(false);
         Invoke(new Action(() => { btnVideo.Text = "Stop Video"; }));
     }
     catch
     {
         _videoWindow = null;
         throw;
     }
 }
        /// <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(
            Media.Profile profile,
            Media.VideoSourceConfiguration videoSourceConfig,
            Media.VideoEncoderConfiguration videoEncoderConfig,
            Media.AudioSourceConfiguration audioSourceConfig,
            Media.AudioEncoderConfiguration audioEncoderConfig,
            Media.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 #4
0
 private void SetJPEGConfiguration(
     Media.VideoEncoderConfiguration config,
     Media.JpegOptions options,
     Media.VideoResolution resolution,
     int?framerate,
     int?bitrate)
 {
     config.Encoding = Media.VideoEncoding.JPEG;
     if ((config.RateControl == null) && (framerate.HasValue || bitrate.HasValue))
     {
         config.RateControl = new Media.VideoRateControl();
     }
     if (config.RateControl != null)
     {
         config.RateControl.FrameRateLimit   = framerate.HasValue ? framerate.Value : options.FrameRateRange.Max;
         config.RateControl.EncodingInterval = options.EncodingIntervalRange.Min;
         if (bitrate.HasValue)
         {
             config.RateControl.BitrateLimit = bitrate.Value;
         }
     }
     config.Resolution = resolution;
 }
 /// <summary>
 /// Handles media uri received event
 /// </summary>
 protected void OnMediaUriReceived(Media.MediaUri uri, Media.VideoEncoderConfiguration encoder, Media.AudioEncoderConfiguration audio)
 {
     View.ShowVideo(uri, encoder, audio);
 }