Struct hls_m3u8::builder::types::StreamDataBuilder[][src]

pub struct StreamDataBuilder<'a> { /* fields omitted */ }
Expand description

Builder for StreamData.

Implementations

The peak segment bitrate of the VariantStream in bits per second.

If all the MediaSegments in a VariantStream have already been created, the bandwidth value must be the largest sum of peak segment bitrates that is produced by any playable combination of renditions.

(For a VariantStream with a single MediaPlaylist, this is just the peak segment bit rate of that MediaPlaylist.)

An inaccurate value can cause playback stalls or prevent clients from playing the variant. If the MasterPlaylist is to be made available before all MediaSegments in the presentation have been encoded, the bandwidth value should be the bandwidth value of a representative period of similar content, encoded using the same settings.

Example

let mut stream = StreamData::new(20);

stream.set_bandwidth(5);
assert_eq!(stream.bandwidth(), 5);

Note

This field is required.

The average bandwidth of the stream in bits per second.

It represents the average segment bitrate of the VariantStream. If all the MediaSegments in a VariantStream have already been created, the average bandwidth must be the largest sum of average segment bitrates that is produced by any playable combination of renditions.

(For a VariantStream with a single MediaPlaylist, this is just the average segment bitrate of that MediaPlaylist.)

An inaccurate value can cause playback stalls or prevent clients from playing the variant. If the MasterPlaylist is to be made available before all MediaSegments in the presentation have been encoded, the average bandwidth should be the average bandwidth of a representative period of similar content, encoded using the same settings.

Example

let mut stream = StreamData::new(20);

stream.set_average_bandwidth(Some(300));
assert_eq!(stream.average_bandwidth(), Some(300));

Note

This field is optional.

A list of formats, where each format specifies a media sample type that is present in one or more renditions specified by the VariantStream.

Valid format identifiers are those in the ISO Base Media File Format Name Space defined by “The ‘Codecs’ and ‘Profiles’ Parameters for “Bucket” Media Types“ (RFC6381).

For example, a stream containing AAC low complexity (AAC-LC) audio and H.264 Main Profile Level 3.0 video would be

let codecs = Codecs::from(&["mp4a.40.2", "avc1.4d401e"]);

Example

use hls_m3u8::types::Codecs;

let mut stream = StreamData::new(20);

stream.set_codecs(Some(&["mp4a.40.2", "avc1.4d401e"]));
assert_eq!(
    stream.codecs(),
    Some(&Codecs::from(&["mp4a.40.2", "avc1.4d401e"]))
);

Note

This field is optional, but every instance of VariantStream::ExtXStreamInf should include a codecs attribute.

The resolution of the stream.

Example

use hls_m3u8::types::Resolution;

let mut stream = StreamData::new(20);

stream.set_resolution(Some((1920, 1080)));
assert_eq!(stream.resolution(), Some(Resolution::new(1920, 1080)));

Note

This field is optional, but it is recommended if the VariantStream includes video.

High-bandwidth Digital Content Protection level of the VariantStream.

Example

use hls_m3u8::types::HdcpLevel;
let mut stream = StreamData::new(20);

stream.set_hdcp_level(Some(HdcpLevel::None));
assert_eq!(stream.hdcp_level(), Some(HdcpLevel::None));

Note

This field is optional.

It indicates the set of video renditions, that should be used when playing the presentation.

It must match the value of the ExtXMedia::group_id attribute ExtXMedia tag elsewhere in the MasterPlaylist whose ExtXMedia::media_type attribute is video. It indicates the set of video renditions that should be used when playing the presentation.

Example

let mut stream = StreamData::new(20);

stream.set_video(Some("video_01"));
assert_eq!(stream.video(), Some(&"video_01".into()));

Note

This field is optional.

Builds a new StreamData.

Errors

If a required field has not been initialized.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.