Skip to main content

MediaInfoBuilder

Struct MediaInfoBuilder 

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

Builder for constructing MediaInfo.

§Examples

use ff_format::media::MediaInfo;
use std::time::Duration;

let info = MediaInfo::builder()
    .path("/path/to/video.mp4")
    .format("mp4")
    .format_long_name("QuickTime / MOV")
    .duration(Duration::from_secs(120))
    .file_size(1_000_000)
    .bitrate(8_000_000)
    .metadata("title", "Sample Video")
    .build();

Implementations§

Source§

impl MediaInfoBuilder

Source

pub fn path(self, path: impl Into<PathBuf>) -> Self

Sets the file path.

Source

pub fn format(self, format: impl Into<String>) -> Self

Sets the container format name.

Source

pub fn format_long_name(self, name: impl Into<String>) -> Self

Sets the long format name.

Source

pub fn duration(self, duration: Duration) -> Self

Sets the total duration.

Source

pub fn file_size(self, size: u64) -> Self

Sets the file size in bytes.

Source

pub fn bitrate(self, bitrate: u64) -> Self

Sets the overall bitrate in bits per second.

Source

pub fn video_stream(self, stream: VideoStreamInfo) -> Self

Adds a video stream.

Source

pub fn video_streams(self, streams: Vec<VideoStreamInfo>) -> Self

Sets all video streams at once, replacing any existing streams.

Source

pub fn audio_stream(self, stream: AudioStreamInfo) -> Self

Adds an audio stream.

Source

pub fn audio_streams(self, streams: Vec<AudioStreamInfo>) -> Self

Sets all audio streams at once, replacing any existing streams.

Source

pub fn subtitle_stream(self, stream: SubtitleStreamInfo) -> Self

Adds a subtitle stream.

Source

pub fn subtitle_streams(self, streams: Vec<SubtitleStreamInfo>) -> Self

Sets all subtitle streams at once, replacing any existing streams.

Source

pub fn chapter(self, chapter: ChapterInfo) -> Self

Adds a chapter.

Source

pub fn chapters(self, chapters: Vec<ChapterInfo>) -> Self

Sets all chapters at once, replacing any existing chapters.

Source

pub fn metadata(self, key: impl Into<String>, value: impl Into<String>) -> Self

Adds a metadata key-value pair.

Source

pub fn metadata_map(self, metadata: HashMap<String, String>) -> Self

Sets all metadata at once, replacing any existing metadata.

Source

pub fn build(self) -> MediaInfo

Builds the MediaInfo.

Trait Implementations§

Source§

impl Clone for MediaInfoBuilder

Source§

fn clone(&self) -> MediaInfoBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for MediaInfoBuilder

Source§

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

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

impl Default for MediaInfoBuilder

Source§

fn default() -> MediaInfoBuilder

Returns the “default value” for a type. Read more

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> 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.