Esempio n. 1
0
        /// <summary>
        /// Get the video details.
        /// </summary>
        /// <param name="section">The config section group and section name.</param>
        /// <returns>The video details.</returns>
        public VideoDetails GetVideo(string section = "NequeoMediaGroup/MediaSection")
        {
            VideoDetails videoDetails = new VideoDetails();

            try
            {
                // Refreshes the named section so the next time that it is retrieved it will be re-read from disk.
                System.Configuration.ConfigurationManager.RefreshSection(section);

                // Create a new default host type
                // an load the values from the configuration
                // file into the default host type.
                MediaSection mediaSection =
                    (MediaSection)System.Configuration.ConfigurationManager.GetSection(section);

                // Make sure the section is defined.
                if (mediaSection == null)
                {
                    throw new Exception("Configuration section has not been defined.");
                }

                // Get the video element.
                VideoElement videoElement = mediaSection.VideoSection;
                if (videoElement == null)
                {
                    throw new Exception("Configuration element Video has not been defined.");
                }

                // Assign the audio.
                videoDetails.FrameRate       = videoElement.FrameRate;
                videoDetails.FrameSizeHeight = videoElement.FrameSizeHeight;
                videoDetails.FrameSizeWidth  = videoElement.FrameSizeWidth;
                videoDetails.UseDefault      = videoElement.UseDefault;
            }
            catch (Exception)
            {
                throw;
            }

            // Return the details.
            return(videoDetails);
        }
Esempio n. 2
0
        /// <summary>
        /// Get the audio details.
        /// </summary>
        /// <param name="section">The config section group and section name.</param>
        /// <returns>The audio details.</returns>
        public AudioDetails GetAudio(string section = "NequeoMediaGroup/MediaSection")
        {
            AudioDetails audioDetails = new AudioDetails();

            try
            {
                // Refreshes the named section so the next time that it is retrieved it will be re-read from disk.
                System.Configuration.ConfigurationManager.RefreshSection(section);

                // Create a new default host type
                // an load the values from the configuration
                // file into the default host type.
                MediaSection mediaSection =
                    (MediaSection)System.Configuration.ConfigurationManager.GetSection(section);

                // Make sure the section is defined.
                if (mediaSection == null)
                {
                    throw new Exception("Configuration section has not been defined.");
                }

                // Get the audio element.
                AudioElement audioElement = mediaSection.AudioSection;
                if (audioElement == null)
                {
                    throw new Exception("Configuration element Audio has not been defined.");
                }

                // Assign the audio.
                audioDetails.Channels     = audioElement.Channels;
                audioDetails.SampleSize   = audioElement.SampleSize;
                audioDetails.SamplingRate = audioElement.SamplingRate;
                audioDetails.UseDefault   = audioElement.UseDefault;
            }
            catch (Exception)
            {
                throw;
            }

            // Return the details.
            return(audioDetails);
        }