Skip to main content

FfprobeCommandMediaStreamClassifier

Struct FfprobeCommandMediaStreamClassifier 

Source
pub struct FfprobeCommandMediaStreamClassifier { /* private fields */ }
Expand description

Media stream classifier backed by the ffprobe command.

Implementations§

Source§

impl FfprobeCommandMediaStreamClassifier

Source

pub const COMMAND: &'static str = "ffprobe"

FFprobe executable name.

Source

pub const VIDEO_STREAM: &'static str = "video"

FFprobe stream name for video streams.

Source

pub const AUDIO_STREAM: &'static str = "audio"

FFprobe stream name for audio streams.

Source

pub fn new() -> Self

Creates a FFprobe-backed classifier.

§Returns

A classifier using the current process working directory.

Source

pub fn command_runner(&self) -> &CommandRunner

Gets the command runner used by this classifier.

§Returns

Runner used for ffprobe command executions.

Source

pub fn set_command_runner(&mut self, command_runner: CommandRunner)

Replaces the command runner used by this classifier.

§Parameters
  • command_runner: New runner configuration.
Source

pub fn with_command_runner(self, command_runner: CommandRunner) -> Self

Replaces the command runner and returns the updated classifier.

§Parameters
  • command_runner: New runner configuration.
§Returns

The updated classifier.

Source

pub fn set_working_directory(&mut self, working_directory: Option<String>)

Sets the working directory used to execute FFprobe.

§Parameters
  • working_directory: Optional working directory path.
Source

pub fn working_directory(&self) -> Option<&str>

Gets the configured working directory.

§Returns

Stored working directory, or None.

Source

pub fn classify_stream_listing(output: &str) -> MediaStreamType

Classifies FFprobe codec_type output.

§Parameters
  • output: Lines printed by ffprobe -show_entries stream=codec_type.
§Returns

Media stream classification.

Source

pub fn is_available() -> bool

Checks whether the ffprobe command is available.

Availability is checked by executing ffprobe -version with the default quiet command runner. The result only describes whether the command can be started successfully; a particular media file may still be unreadable or unsupported.

§Returns

true when ffprobe -version executes successfully.

Trait Implementations§

Source§

impl Clone for FfprobeCommandMediaStreamClassifier

Source§

fn clone(&self) -> FfprobeCommandMediaStreamClassifier

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FfprobeCommandMediaStreamClassifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FfprobeCommandMediaStreamClassifier

Source§

fn default() -> Self

Creates the default classifier.

Source§

impl FileBasedMediaStreamClassifier for FfprobeCommandMediaStreamClassifier

Source§

fn classify_by_local_file(&self, file: &Path) -> MimeResult<MediaStreamType>

Classifies a readable local media file using FFprobe.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, D> IntoConfigDefault<T> for D
where D: IntoValueDefault<T>,

Source§

fn into_config_default(self) -> T

Converts this fallback value into T.
Source§

impl<T> IntoValueDefault<T> for T

Source§

fn into_value_default(self) -> T

Converts this argument into the default value.
Source§

impl<T> MediaStreamClassifier for T

Source§

fn classify_file(&self, file: &Path) -> Result<MediaStreamType, MimeError>

Validates the local file and delegates to the backend hook.

Source§

fn classify_reader( &self, reader: &mut dyn Read, ) -> Result<MediaStreamType, MimeError>

Delegates stream classification to the backend hook.

Source§

fn classify_content(&self, content: &[u8]) -> MimeResult<MediaStreamType>

Classifies an in-memory media payload. Read more
Source§

impl<T> MediaStreamClassifierBackend for T

Source§

fn classify_by_local_file( &self, file: &Path, ) -> Result<MediaStreamType, MimeError>

Delegates local-file classification to the file-based hook.

Source§

fn classify_by_content( &self, reader: &mut dyn Read, ) -> Result<MediaStreamType, MimeError>

Stages stream content to a temporary local file before classification.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.