C# Class HandBrake.Interop.HandBrakeInstance

A wrapper for a HandBrake instance.
Inheritance: IHandBrakeInstance, IDisposable
显示文件 Open project: golgol7777/HandBrakeWinSource Class Usage Examples

Public Methods

Method Description
CalculateBitrate ( HandBrake.Interop.Model.EncodeJob job, int sizeMB, double overallSelectedLengthSeconds ) : int

Calculates the video bitrate for the given job and target size.

CalculateFileSize ( HandBrake.Interop.Model.EncodeJob job, int videoBitrate ) : double

Gives estimated file size (in MB) of the given job and video bitrate.

Dispose ( ) : void

Frees any resources associated with this object.

DisposeGlobal ( ) : void

Call before app shutdown. Performs global cleanup.

GetPreview ( HandBrake.Interop.Model.EncodeJob job, int previewNumber ) : BitmapImage

Gets an image for the given job and preview

Only incorporates sizing and aspect ratio into preview image.

GetSize ( HandBrake.Interop.Model.EncodeJob job, int &width, int &height, int &parWidth, int &parHeight ) : void

Gets the final size for a given encode job.

Initialize ( int verbosity ) : void

Initializes this instance.

PauseEncode ( ) : void

Pauses the current encode.

ResumeEncode ( ) : void

Resumes a paused encode.

StartEncode ( HandBrake.Interop.Model.EncodeJob jobToStart ) : void

Starts an encode with the given job.

StartEncode ( HandBrake.Interop.Model.EncodeJob job, bool preview, int previewNumber, int previewSeconds, double overallSelectedLengthSeconds ) : void

Starts an encode with the given job.

StartScan ( string path, int previewCount ) : void

Starts scanning the given path.

StartScan ( string path, int previewCount, int titleIndex ) : void

Starts a scan of the given path.

StopEncode ( ) : void

Stops the current encode.

StopScan ( ) : void

Stops an ongoing scan.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Frees any resources associated with this object.

Private Methods

Method Description
AddFilter ( List filterList, int filterType, string settings, List allocatedMemory ) : void

Adds a filter to the given filter list.

ApplyJob ( hb_job_s &nativeJob, HandBrake.Interop.Model.EncodeJob job ) : List

Applies the encoding job to the native memory structure and returns a list of memory locations allocated during this.

ApplyJob ( hb_job_s &nativeJob, HandBrake.Interop.Model.EncodeJob job, bool preview, int previewNumber, int previewSeconds, double overallSelectedLengthSeconds ) : List

Applies the encoding job to the native memory structure and returns a list of memory locations allocated during this.

CalculateNonAnamorphicOutput ( HandBrake.Interop.Model.Encoding.EncodingProfile profile, HandBrake.Interop.SourceData.Title title ) : HandBrake.Interop.Model.Size

Calculates the output size for a non-anamorphic job.

ConvertAudioBack ( AudioEncoding encoding, hb_audio_s baseStruct, int outputTrack, List allocatedMemory ) : hb_audio_s

Applies an audio encoding to a native audio encoding base structure.

ConvertTitle ( hb_title_s title ) : HandBrake.Interop.SourceData.Title

Converts a native title to a Title object.

GetNearestValue ( int number, int modulus ) : int

Gets the closest value to the given number divisible by the given modulus.

GetOriginalTitle ( int titleIndex ) : hb_title_s

Gets the native title object from the title index.

GetOutputTracks ( HandBrake.Interop.Model.EncodeJob job, HandBrake.Interop.SourceData.Title title ) : int>>.List

Gets a list of encodings and target track indices (1-based).

GetTitle ( int titleIndex ) : HandBrake.Interop.SourceData.Title

Gets the title, given the 1-based index.

PollEncodeProgress ( ) : void

Checks the status of the ongoing encode.

PollScanProgress ( ) : void

Checks the status of the ongoing scan.

Method Details

CalculateBitrate() public method

Calculates the video bitrate for the given job and target size.
public CalculateBitrate ( HandBrake.Interop.Model.EncodeJob job, int sizeMB, double overallSelectedLengthSeconds ) : int
job HandBrake.Interop.Model.EncodeJob The encode job.
sizeMB int The target size in MB.
overallSelectedLengthSeconds double The currently selected encode length. Used in preview /// for calculating bitrate when the target size would be wrong.
return int

CalculateFileSize() public method

Gives estimated file size (in MB) of the given job and video bitrate.
public CalculateFileSize ( HandBrake.Interop.Model.EncodeJob job, int videoBitrate ) : double
job HandBrake.Interop.Model.EncodeJob The encode job.
videoBitrate int The video bitrate to be used (kbps).
return double

Dispose() public method

Frees any resources associated with this object.
public Dispose ( ) : void
return void

Dispose() protected method

Frees any resources associated with this object.
protected Dispose ( bool disposing ) : void
disposing bool True if managed objects as well as unmanaged should be disposed.
return void

DisposeGlobal() public static method

Call before app shutdown. Performs global cleanup.
public static DisposeGlobal ( ) : void
return void

GetPreview() public method

Gets an image for the given job and preview
Only incorporates sizing and aspect ratio into preview image.
public GetPreview ( HandBrake.Interop.Model.EncodeJob job, int previewNumber ) : BitmapImage
job HandBrake.Interop.Model.EncodeJob The encode job to preview.
previewNumber int The index of the preview to get (0-based).
return System.Windows.Media.Imaging.BitmapImage

GetSize() public method

Gets the final size for a given encode job.
public GetSize ( HandBrake.Interop.Model.EncodeJob job, int &width, int &height, int &parWidth, int &parHeight ) : void
job HandBrake.Interop.Model.EncodeJob The encode job to use.
width int The storage width.
height int The storage height.
parWidth int The pixel aspect X number.
parHeight int The pixel aspect Y number.
return void

Initialize() public method

Initializes this instance.
public Initialize ( int verbosity ) : void
verbosity int The code for the logging verbosity to use.
return void

PauseEncode() public method

Pauses the current encode.
public PauseEncode ( ) : void
return void

ResumeEncode() public method

Resumes a paused encode.
public ResumeEncode ( ) : void
return void

StartEncode() public method

Starts an encode with the given job.
public StartEncode ( HandBrake.Interop.Model.EncodeJob jobToStart ) : void
jobToStart HandBrake.Interop.Model.EncodeJob The job to start.
return void

StartEncode() public method

Starts an encode with the given job.
public StartEncode ( HandBrake.Interop.Model.EncodeJob job, bool preview, int previewNumber, int previewSeconds, double overallSelectedLengthSeconds ) : void
job HandBrake.Interop.Model.EncodeJob The job to start.
preview bool True if this is a preview encode.
previewNumber int The preview number to start the encode at (0-based).
previewSeconds int The number of seconds in the preview.
overallSelectedLengthSeconds double The currently selected encode length. Used in preview /// for calculating bitrate when the target size would be wrong.
return void

StartScan() public method

Starts scanning the given path.
public StartScan ( string path, int previewCount ) : void
path string The path to the video to scan.
previewCount int The number of preview images to make.
return void

StartScan() public method

Starts a scan of the given path.
public StartScan ( string path, int previewCount, int titleIndex ) : void
path string The path of the video to scan.
previewCount int The number of previews to make on each title.
titleIndex int The title index to scan (1-based, 0 for all titles).
return void

StopEncode() public method

Stops the current encode.
public StopEncode ( ) : void
return void

StopScan() public method

Stops an ongoing scan.
public StopScan ( ) : void
return void