pub struct Config {
pub(crate) enc: EncoderConfig,
pub(crate) rate_control: RateControlConfig,
pub(crate) threads: usize,
pub(crate) pool: Option<Arc<ThreadPool>>,
}
Expand description
Contains the encoder configuration.
Fields§
§enc: EncoderConfig
Settings which impact the produced bitstream.
rate_control: RateControlConfig
Rate control configuration
threads: usize
The number of threads in the threadpool.
pool: Option<Arc<ThreadPool>>
Shared thread pool
Implementations§
Source§impl Config
impl Config
Sourcepub fn with_encoder_config(self, enc: EncoderConfig) -> Self
pub fn with_encoder_config(self, enc: EncoderConfig) -> Self
Set the encoder configuration
EncoderConfig
contains the settings impacting the
codec features used in the produced bitstream.
Sourcepub const fn with_threads(self, threads: usize) -> Self
pub const fn with_threads(self, threads: usize) -> Self
Set the number of workers in the threadpool
The threadpool is shared across all the different parallel components in the encoder.
If it is left unset, the encoder will use the default global threadpool provided by Rayon instead.
Sourcepub const fn with_rate_control(self, rate_control: RateControlConfig) -> Self
pub const fn with_rate_control(self, rate_control: RateControlConfig) -> Self
Set the rate control configuration
The default configuration is single pass
Source§impl Config
impl Config
pub(crate) fn new_inner<T: Pixel>( &self, ) -> Result<ContextInner<T>, InvalidConfig>
Sourcepub(crate) fn new_thread_pool(&self) -> Option<Arc<ThreadPool>>
pub(crate) fn new_thread_pool(&self) -> Option<Arc<ThreadPool>>
Create a new threadpool with this configuration if set,
or return None
if global threadpool should be used instead.
Sourcepub fn new_context<T: Pixel>(&self) -> Result<Context<T>, InvalidConfig>
pub fn new_context<T: Pixel>(&self) -> Result<Context<T>, InvalidConfig>
Sourcepub fn validate(&self) -> Result<(), InvalidConfig>
pub fn validate(&self) -> Result<(), InvalidConfig>
Sourcepub fn tiling_info(&self) -> Result<TilingInfo, InvalidConfig>
pub fn tiling_info(&self) -> Result<TilingInfo, InvalidConfig>
Provide the tiling information for the current Config
Useful for reporting and debugging.
§Errors
- Returns
InvalidConfig
if the tiling config is invalid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl !RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl !UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more