示例#1
0
        private Slice slice; // TODO only one slice for now

        #endregion Fields

        #region Constructors

        protected Picture(VideoSequence videoSequence, int pictureNumber, int lastIdr)
        {
            number = pictureNumber;
            idrFlag = (pictureNumber == lastIdr);
            frameNum = idrFlag ? 0 : pictureNumber - lastIdr;
            qp = 28; // TODO QPISlice QP for I Slices must come from Control
            picSizeInMbs = videoSequence.FrameSizeInMbs; // frame picture
            width = videoSequence.FrameSize.Width;
            height = videoSequence.FrameSize.Height;
            type = SliceType.Slice; // TODO always set to Intra
            InitFrame();
        }
        public void ShouldAbleToConvertRgbToH264()
        {
            var image = (Bitmap)Image.FromFile("Test.jpg");
            var image1 = (Bitmap)ImageHelper.Resize(image, new Size(352, 288));
            var finalImage = ImageHelper.Clone(image1, PixelFormat.Format24bppRgb);
            var rgbFrame = RgbFrameFactory.CreateFrame(finalImage);
            var converter = new RGB24ToYUV420Converter();
            var yuvFrame = (YuvFrame)converter.Process(rgbFrame);

            var vs = new VideoSequence(YuvFormatType.Yuv420, new Size(yuvFrame.Width, yuvFrame.Height));
            vs.Encode(yuvFrame.Data);
        }