C# Класс HCS_Encoder.Utilities.EncoderController

This class provides a simplified way to start and stop an encode process, using a configuration file for the details.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
ClearBuffers ( ) : void

Clear all captured frames from all attached buffers. Buffers will refill if capture devices are running.

ContinueCapture ( ) : void

Resumes capture devices after a call to 'PauseCapture()'

ContinueOutput ( int MinimumChunkIndex ) : void

Resumes output sending (if 'EnableOutput' is false). Any chunks with an index below 'MiniumumChunkIndex' will be dropped.

Dispose ( ) : void
EncoderController ( Configuration Config ) : System

Create and initialise a new encoder job with the given config

ForceInsertFrame ( System VideoFrame, double SimulatedCaptureTime ) : void

Force a timed frame into the encoder's buffers. May cause unexpected operation. Use with caution!

ForceInsertFrame ( TimedSample AudioFrame ) : void

Force a timed frame into the encoder's buffers. May cause unexpected operation. Use with caution!

PauseCapture ( ) : void

Pauses all capture devices, but allows the encoder loop to continue (will sleep while buffers are empty)

RegisterPlugin ( IAudioProcessor PlugIn ) : void

Add a plug-in to the audio buffer's plug-in list

RegisterPlugin ( IVideoProcessor PlugIn ) : void

Add a plug-in to the video buffer's plug-in list

Start ( ) : void

Start the encoding process. This will start to over-write any existing encodes made with the configuration being used.

Stop ( ) : void

Stop the encoding process

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

Метод Описание
AdjustFrameSleep ( ) : void

Work out a resonable sleep duration (over which we'd expect a new frame in at least one buffer)

BuffersEmpty ( ) : bool

Returns true if any of the active capture buffers are below their encoding theshold.

CalculateScales ( int Width, int Height, List ScaleFactors ) : List

Given a set of linear scale factors, create a set of scaled (w*h) sizes.

Scaling the height and width directly will result in pixel count being reduced by the square of the scale factor, so instead we apply a rough factor to get a linear scaled pixel count.

CaptureSetup ( ) : void

Initialise capture devices and connect the appropriate buffers

ConnectPackageToBuffers ( EncoderPackage Package, PackageSpec Spec ) : void

Create encoder buffers for each package, and add to capture buffer lists.

EncoderCoreLoop ( object Package ) : void

This loop does the actual work of reading caches into the encoder and firing actions. This loop controls Multiple-bit-rate encoding

EncoderSetup ( ) : void

Initialise an encoder job based on previously setup capture devices. Need to have one job per 'ReductionFactor' in the config.

Halt ( ) : void

Stop the encode process, from within the core loop

InitAudioCapture ( ) : void
InitVideoCapture ( ) : void
InnerStartup ( ) : void

Start encoder threads & capture devices for each job.

ListRequiredPackages ( ) : List

Creates a list of encoder packages requires to fulfill the configured job.

NewEncoderThread ( EncoderPackage pkg ) : Thread

Create, start and return a new core encoder thread.

WaitAndCompensateCaptureTimes ( ) : void

Wait for first frames in buffer, and use those to compensate timecodes.

WaitForSyncFlag ( ) : void

Wait for the sync flag to be set by WaitAndCompensateCaptureTimes()

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

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

Clear all captured frames from all attached buffers. Buffers will refill if capture devices are running.
public ClearBuffers ( ) : void
Результат void

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

Resumes capture devices after a call to 'PauseCapture()'
public ContinueCapture ( ) : void
Результат void

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

Resumes output sending (if 'EnableOutput' is false). Any chunks with an index below 'MiniumumChunkIndex' will be dropped.
public ContinueOutput ( int MinimumChunkIndex ) : void
MinimumChunkIndex int
Результат void

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

public Dispose ( ) : void
Результат void

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

Create and initialise a new encoder job with the given config
public EncoderController ( Configuration Config ) : System
Config EncoderConfiguration.Configuration
Результат System

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

Force a timed frame into the encoder's buffers. May cause unexpected operation. Use with caution!
public ForceInsertFrame ( System VideoFrame, double SimulatedCaptureTime ) : void
VideoFrame System
SimulatedCaptureTime double
Результат void

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

Force a timed frame into the encoder's buffers. May cause unexpected operation. Use with caution!
public ForceInsertFrame ( TimedSample AudioFrame ) : void
AudioFrame HCS_Encoder.Inputs.Buffers.TimedSample
Результат void

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

Pauses all capture devices, but allows the encoder loop to continue (will sleep while buffers are empty)
public PauseCapture ( ) : void
Результат void

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

Add a plug-in to the audio buffer's plug-in list
public RegisterPlugin ( IAudioProcessor PlugIn ) : void
PlugIn IAudioProcessor
Результат void

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

Add a plug-in to the video buffer's plug-in list
public RegisterPlugin ( IVideoProcessor PlugIn ) : void
PlugIn IVideoProcessor
Результат void

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

Start the encoding process. This will start to over-write any existing encodes made with the configuration being used.
public Start ( ) : void
Результат void

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

Stop the encoding process
public Stop ( ) : void
Результат void