C# Класс HCS_Encoder.ImageToYUV_Buffer

Converts System.Drawing images to scaled YUV420p buffers at 8bpp/planar
Показать файл Открыть проект

Открытые методы

Метод Описание
HandleCapturedFrame ( object sender, VideoDataEventArgs e ) : void

Respond to capture event. This should return as fast as possible.

ImageToYUV_Buffer ( int Width, int Height ) : System

Prepare a set of buffers to accept the images. Incoming frames will be scaled to match the given width and height. For best results, capture and buffer sizes should match. Rescaling does not preserve aspect ratio.

LoadToFrame ( MediaFrame &Frame ) : void

Load the buffer into a MediaFrame for the encoder. IMPORTANT: You must call UnloadFrame after this method is called. For efficiency, unload as soon as possible.

SelectiveDequeue ( double OffsetSeconds ) : void

Remove un-needed frames when encoding by a reference clock.

SelectiveLoadFrame ( MediaFrame &Frame, double OffsetSeconds ) : void

Load the closest matching frame by offset time. Fills the encoder-ready frame, with given time-code. WARNING: use this *OR* 'LoadToFrame', but not both!

UnloadFrame ( MediaFrame &Frame ) : void

Release memory previously locked by LoadToFrame()

Приватные методы

Метод Описание
FirstFrameMatchingTime ( double OffsetSeconds ) : int

Used by SelectiveLoadFrame() to pick a frame from the waiting frames buffer.

ResampleBuffer ( Bitmap img, byte &Luma, byte &Cr, byte &Cb, int width, int height ) : void

Resample an image into a set of YUV420 buffers.

This is done seperately from frame encoding the improve multi-processor performance

WipeBuffer ( ) : void

Emergeny clear-out. Drop all queued frames

WipeBufferUntil ( double AbandonTime ) : void

Remove all frames captured before the given capture time. They will not be encoded.

Описание методов

HandleCapturedFrame() публичный Метод

Respond to capture event. This should return as fast as possible.
public HandleCapturedFrame ( object sender, VideoDataEventArgs e ) : void
sender object
e VideoDataEventArgs
Результат void

ImageToYUV_Buffer() публичный Метод

Prepare a set of buffers to accept the images. Incoming frames will be scaled to match the given width and height. For best results, capture and buffer sizes should match. Rescaling does not preserve aspect ratio.
public ImageToYUV_Buffer ( int Width, int Height ) : System
Width int
Height int
Результат System

LoadToFrame() публичный Метод

Load the buffer into a MediaFrame for the encoder. IMPORTANT: You must call UnloadFrame after this method is called. For efficiency, unload as soon as possible.
public LoadToFrame ( MediaFrame &Frame ) : void
Frame MediaFrame
Результат void

SelectiveDequeue() публичный Метод

Remove un-needed frames when encoding by a reference clock.
public SelectiveDequeue ( double OffsetSeconds ) : void
OffsetSeconds double
Результат void

SelectiveLoadFrame() публичный Метод

Load the closest matching frame by offset time. Fills the encoder-ready frame, with given time-code. WARNING: use this *OR* 'LoadToFrame', but not both!
public SelectiveLoadFrame ( MediaFrame &Frame, double OffsetSeconds ) : void
Frame MediaFrame
OffsetSeconds double
Результат void

UnloadFrame() публичный Метод

Release memory previously locked by LoadToFrame()
public UnloadFrame ( MediaFrame &Frame ) : void
Frame MediaFrame
Результат void