예제 #1
0
        void StartEncoder()
        {
            if (!videoEncoder.IsEmpty)
            {
                videoEncoder.Dispose();
            }

            videoEncoder = new VideoEncoder(this);
            videoEncoder.HandleVideoFrame      += HandleEncoderFrame;
            videoEncoder.HandleEncode          += OnEncodeDone;
            videoEncoder.HandleBitstreamBuffer += HandleBitstreamBuffer;

            frameTimeStampQueue.Clear();

            videoEncoder.HandleInitialize += OnInitializedEncoder;
            var error = videoEncoder.Initialize(
                frameFormat, frameSize, videoProfile, 2000000,
                HardwareAcceleration.Withfallback);

            if (error != PPError.OkCompletionpending)
            {
                LogError(error, "Cannot initialize encoder");
                return;
            }
        }