/// <summary> /// Adds a frame to the video. /// </summary> /// <remarks> /// <para> /// The implementation makes a copy of the frame or encodes it immediately so that /// the caller can reuse the same frame buffers for subsequent frames. /// </para> /// <para> /// The frame dimensions have already been checked by the caller. /// </para> /// </remarks> /// <param name="frame">The video frame to add, not null.</param> protected abstract void AddFrameImpl(VideoFrame frame);
private void LoadCurrentFramePixels(VideoFrame frame) { frame.CopyPixels(new Rectangle(0, 0, width, height), currentFramePixels, 0, width); }
/// <summary> /// Adds a frame to the video. /// </summary> /// <remarks> /// <para> /// The implementation makes a copy of the frame or encodes it immediately so that /// the caller can reuse the same frame buffers for subsequent frames. /// </para> /// </remarks> /// <param name="frame">The video frame to add.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="frame"/> is null.</exception> /// <exception cref="ArgumentException">Thrown if the <paramref name="frame"/> dimensions are not /// exactly equal to those of the video.</exception> public void AddFrame(VideoFrame frame) { if (frame == null) throw new ArgumentNullException("frame"); if (frame.Width != parameters.Width || frame.Height != parameters.Height) throw new ArgumentException("The frame dimensions must exactly equal those of the video.", "frame"); AddFrameImpl(frame); }
/// <inheritdoc /> protected override void AddFrameImpl(VideoFrame frame) { WritePendingFrame(false); SwitchFramePixels(); LoadCurrentFramePixels(frame); framePending = true; }