Struct hls_m3u8::types::StreamData [−][src]
pub struct StreamData<'a> { /* fields omitted */ }
Expand description
The StreamData
struct contains the data that is shared between both
variants of the VariantStream
.
Implementations
The peak segment bitrate of the VariantStream
in bits per second.
If all the MediaSegment
s 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 MediaSegment
s 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 peak segment bitrate of the VariantStream
in bits per second.
If all the MediaSegment
s 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 MediaSegment
s 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 MediaSegment
s 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 MediaSegment
s 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.
The average bandwidth of the stream in bits per second.
It represents the average segment bitrate of the VariantStream
. If
all the MediaSegment
s 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 MediaSegment
s 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.
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.
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.
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.
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.
Returns a builder for StreamData
.
Example
use hls_m3u8::types::{HdcpLevel, StreamData}; StreamData::builder() .bandwidth(200) .average_bandwidth(15) .codecs(&["mp4a.40.2", "avc1.4d401e"]) .resolution((1920, 1080)) .hdcp_level(HdcpLevel::Type0) .video("video_01") .build()?;
Trait Implementations
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
Auto Trait Implementations
impl<'a> RefUnwindSafe for StreamData<'a>
impl<'a> Send for StreamData<'a>
impl<'a> Sync for StreamData<'a>
impl<'a> Unpin for StreamData<'a>
impl<'a> UnwindSafe for StreamData<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more