コード例 #1
0
        /// <summary>
        /// Initializes static members of the <see cref="Utilities"/> class.
        /// Initializes the <see cref="Utilities"/> class.
        /// </summary>
        static Utilities()
        {
            H264Frames = new ConcurrentDictionary <int, List <H264Frame> >();
            foreach (var videoFormatEntry in Service.Instance.Configuration.H264FileLocations)
            {
                var videoFormat = videoFormatEntry.Value;
                var fileReader  = new H264FileReader(
                    videoFormatEntry.Key,
                    (uint)videoFormat.Width,
                    (uint)videoFormat.Height,
                    videoFormat.FrameRate);

                var listOfFrames        = new List <H264Frame>();
                var totalNumberOfFrames = fileReader.GetTotalNumberOfFrames();
                Trace.TraceInformation($"Found the fileReader for the format with id: {videoFormat.GetId()} and number of frames {totalNumberOfFrames}");

                for (int i = 0; i < totalNumberOfFrames; i++)
                {
                    H264Frame frame = new H264Frame();
                    fileReader.GetNextFrame(frame);
                    listOfFrames.Add(frame);
                }

                H264Frames.TryAdd(videoFormat.GetId(), listOfFrames);
            }
        }
コード例 #2
0
ファイル: Utilities.cs プロジェクト: rahul24/CritiqueForTeams
        /// <summary>
        /// Initializes static members of the <see cref="Utilities"/> class.
        /// Initializes the <see cref="Utilities"/> class.
        /// </summary>
        static Utilities()
        {
            H264Frames = new ConcurrentDictionary <int, List <H264Frame> >();
            IDictionary <string, VideoFormat> H264FileLocations = new Dictionary <string, VideoFormat>();

            H264FileLocations = new Dictionary <string, VideoFormat>();
            H264FileLocations.Add("output720p.264", VideoFormat.H264_1280x720_30Fps);
            H264FileLocations.Add("output180p.264", VideoFormat.H264_320x180_15Fps);
            H264FileLocations.Add("output360p.264", VideoFormat.H264_640x360_30Fps);
            H264FileLocations.Add("mle1080p15vbss_2500Kbps.264", VideoFormat.H264_1920x1080_15Fps);

            foreach (var videoFormatEntry in H264FileLocations)
            {
                var videoFormat = videoFormatEntry.Value;
                var fileReader  = new H264FileReader(
                    videoFormatEntry.Key,
                    (uint)videoFormat.Width,
                    (uint)videoFormat.Height,
                    videoFormat.FrameRate);

                var listOfFrames        = new List <H264Frame>();
                var totalNumberOfFrames = fileReader.GetTotalNumberOfFrames();
                Trace.TraceInformation($"Found the fileReader for the format with id: {videoFormat.GetId()} and number of frames {totalNumberOfFrames}");

                for (int i = 0; i < totalNumberOfFrames; i++)
                {
                    H264Frame frame = new H264Frame();
                    fileReader.GetNextFrame(frame);
                    listOfFrames.Add(frame);
                }

                H264Frames.TryAdd(videoFormat.GetId(), listOfFrames);
            }
        }