Esempio n. 1
0
        private void cmbVideoCodec_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbVideoResolution.Items.Clear();
            txtVideoBitrate.Text   = null;
            txtVideoFramerate.Text = null;
            VideoCodecWrapper encoder = cmbVideoCodec.SelectedItem as VideoCodecWrapper;

            if (encoder != null)
            {
                Media.VideoResolution[] resolutions = encoder.GetResolutions();
                if (resolutions != null)
                {
                    foreach (Media.VideoResolution resolution in resolutions)
                    {
                        cmbVideoResolution.Items.Add(new VideoResolutionWrapper {
                            Resolution = resolution
                        });
                    }
                }
                Media.IntRange framerate = encoder.GetFrameLimit();
                if (framerate != null)
                {
                    txtVideoFramerate.Text = framerate.Min.ToString();
                }
            }
            if (cmbVideoResolution.Items.Count > 0)
            {
                cmbVideoResolution.SelectedIndex = 0;
            }
        }
Esempio n. 2
0
 private void txtVideoFramerate_Validating(object sender, CancelEventArgs e)
 {
     if (!string.IsNullOrEmpty(txtVideoFramerate.Text))
     {
         int               value;
         Media.IntRange    range = null;
         bool              valid = int.TryParse(txtVideoFramerate.Text, out value);
         VideoCodecWrapper codec = cmbVideoCodec.SelectedItem as VideoCodecWrapper;
         if (codec != null)
         {
             range = codec.GetFrameLimit();
             if ((range != null) && (valid))
             {
                 valid = (value >= range.Min) && (value <= range.Max);
             }
         }
         if (!valid)
         {
             string message = "Please enter integer value";
             if (range != null)
             {
                 message += string.Format(" between {0} and {1}", range.Min, range.Max);
             }
             MessageBox.Show(this, message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             e.Cancel = true;
         }
     }
 }
Esempio n. 3
0
 public Media.IntRange GetFrameLimit()
 {
     Media.IntRange limit = null;
     if (H264 != null)
     {
         limit = H264.FrameRateRange;
     }
     else if (Jpeg != null)
     {
         limit = Jpeg.FrameRateRange;
     }
     else if (Mpeg4 != null)
     {
         limit = Mpeg4.FrameRateRange;
     }
     return(limit);
 }