Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Organize all media types into a nice hierarchy.
        /// </summary>
        public void Organize(Dictionary <int, MediaType> mediaTypes, Dictionary <int, List <float> > framerates)
        {
            foreach (var pair in mediaTypes)
            {
                if (!framerates.ContainsKey(pair.Key))
                {
                    continue;
                }

                foreach (float rate in framerates[pair.Key])
                {
                    MediaType          mt         = pair.Value;
                    MediaTypeSelection selectable = new MediaTypeSelection(mt, rate);

                    Import(mt, rate, selectable);
                }
            }
        }
Ejemplo n.º 3
0
        private void cmbFramerate_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!canStreamConfig)
            {
                return;
            }

            MediaTypeSelection selectable = cmbFramerate.SelectedItem as MediaTypeSelection;

            if (selectable == null)
            {
                return;
            }

            selectedMediaTypeIndex = selectable.MediaType.MediaTypeIndex;
            selectedFramerate      = selectable.Framerate;

            if (streamConfigInitialized)
            {
                specificChanged   = true;
                needsReconnection = true;
            }
        }