C# Class HCS_Encoder.ImageToYUV_Buffer

Converts System.Drawing images to scaled YUV420p buffers at 8bpp/planar
Afficher le fichier Open project: i-e-b/HLS---Smooth-Encoder

Méthodes publiques

Méthode Description
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()

Private Methods

Méthode Description
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.

Method Details

HandleCapturedFrame() public méthode

Respond to capture event. This should return as fast as possible.
public HandleCapturedFrame ( object sender, VideoDataEventArgs e ) : void
sender object
e VideoDataEventArgs
Résultat void

ImageToYUV_Buffer() public méthode

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
Résultat System

LoadToFrame() public méthode

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
Résultat void

SelectiveDequeue() public méthode

Remove un-needed frames when encoding by a reference clock.
public SelectiveDequeue ( double OffsetSeconds ) : void
OffsetSeconds double
Résultat void

SelectiveLoadFrame() public méthode

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
Résultat void

UnloadFrame() public méthode

Release memory previously locked by LoadToFrame()
public UnloadFrame ( MediaFrame &Frame ) : void
Frame MediaFrame
Résultat void