/// <summary>
        /// Add the selectable to the hierarchy, creating parents as needed.
        /// </summary>
        private void Import(MediaType mt, float rate, MediaTypeSelection selectable)
        {
            if (rate <= 0)
            {
                return;
            }

            string formatKey = mt.Compression;

            if (!formatGroups.ContainsKey(formatKey))
            {
                formatGroups.Add(formatKey, new SizeGroup(mt.Compression));
            }

            SizeGroup sizeGroup = formatGroups[mt.Compression];
            string    sizeKey   = string.Format("{0}×{1}", mt.FrameSize.Width, mt.FrameSize.Height);

            if (!sizeGroup.FramerateGroups.ContainsKey(sizeKey))
            {
                sizeGroup.FramerateGroups.Add(sizeKey, new FramerateGroup(mt.FrameSize));
            }

            FramerateGroup framerateGroup = sizeGroup.FramerateGroups[sizeKey];

            if (framerateGroup.Framerates.ContainsKey(rate))
            {
                // Duplicate {format, size, framerate} triplet.
                return;
            }

            framerateGroup.Framerates.Add(rate, selectable);
        }
Exemple #2
0
        private void PopulateFrameSizes(SizeGroup sizeGroup)
        {
            // Populate the list of frame sizes with media types that use the current compression.
            // Select the best match according to the current selection.

            cmbImageSize.Items.Clear();

            int match = -1;

            foreach (FramerateGroup framerateGroup in sizeGroup.FramerateGroups.Values)
            {
                cmbImageSize.Items.Add(framerateGroup);

                if (framerateGroup.Size == mediaTypes[selectedMediaTypeIndex].FrameSize)
                {
                    match = cmbImageSize.Items.Count - 1;
                }
            }

            if (match != -1)
            {
                cmbImageSize.SelectedIndex = match;
            }
            else if (cmbImageSize.Items.Count > 0)
            {
                cmbImageSize.SelectedIndex = 0;
            }
        }
Exemple #3
0
        private void cmbFormat_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!canStreamConfig)
            {
                return;
            }

            SizeGroup sizeGroup = cmbFormat.SelectedItem as SizeGroup;

            if (sizeGroup == null)
            {
                return;
            }

            PopulateFrameSizes(sizeGroup);
        }