mirror of
https://github.com/rutgersc/m3u8-rs.git
synced 2025-01-10 22:55:25 +00:00
Derive some more traits for the public types where it makes sense
This makes them easier to use.
This commit is contained in:
parent
836ef1caaf
commit
1bfad5df01
1 changed files with 14 additions and 14 deletions
|
@ -68,7 +68,7 @@ impl Playlist {
|
|||
/// A [Master Playlist](https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.4)
|
||||
/// provides a set of Variant Streams, each of which
|
||||
/// describes a different version of the same content.
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone)]
|
||||
pub struct MasterPlaylist {
|
||||
pub version: usize,
|
||||
pub variants: Vec<VariantStream>,
|
||||
|
@ -129,7 +129,7 @@ impl MasterPlaylist {
|
|||
/// Clients should switch between different Variant Streams to adapt to
|
||||
/// network conditions. Clients should choose Renditions based on user
|
||||
/// preferences.
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone)]
|
||||
pub struct VariantStream {
|
||||
pub is_i_frame: bool,
|
||||
pub uri: String,
|
||||
|
@ -201,7 +201,7 @@ impl VariantStream {
|
|||
/// Media Playlists that contain English, French and Spanish Renditions
|
||||
/// of the same presentation. Or two EXT-X-MEDIA tags can be used to
|
||||
/// identify video-only Media Playlists that show two different camera angles.
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone)]
|
||||
pub struct AlternativeMedia {
|
||||
// <attribute-list>
|
||||
pub media_type: AlternativeMediaType,
|
||||
|
@ -263,7 +263,7 @@ impl AlternativeMedia {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
|
||||
pub enum AlternativeMediaType {
|
||||
Audio,
|
||||
Video,
|
||||
|
@ -313,7 +313,7 @@ impl fmt::Display for AlternativeMediaType {
|
|||
/// The EXT-X-SESSION-KEY tag allows encryption keys from Media Playlists
|
||||
/// to be specified in a Master Playlist. This allows the client to
|
||||
/// preload these keys without having to read the Media Playlist(s) first.
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone)]
|
||||
pub struct SessionKey(pub Key);
|
||||
|
||||
impl SessionKey {
|
||||
|
@ -324,7 +324,7 @@ impl SessionKey {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub enum SessionDataField {
|
||||
Value(String),
|
||||
Uri(String),
|
||||
|
@ -333,7 +333,7 @@ pub enum SessionDataField {
|
|||
/// [`#EXT-X-SESSION-DATA:<attribute-list>`](https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.4.4)
|
||||
/// The EXT-X-SESSION-DATA tag allows arbitrary session data to be carried
|
||||
/// in a Master Playlist.
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub struct SessionData {
|
||||
pub data_id: String,
|
||||
pub field: SessionDataField,
|
||||
|
@ -456,7 +456,7 @@ impl MediaPlaylist {
|
|||
}
|
||||
|
||||
/// [`#EXT-X-PLAYLIST-TYPE:<EVENT|VOD>`](https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.3.5)
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
|
||||
pub enum MediaPlaylistType {
|
||||
Event,
|
||||
Vod,
|
||||
|
@ -576,7 +576,7 @@ impl MediaSegment {
|
|||
/// KEYFORMAT attribute (or the end of the Playlist file). Two or more
|
||||
/// EXT-X-KEY tags with different KEYFORMAT attributes MAY apply to the
|
||||
/// same Media Segment if they ultimately produce the same decryption key.
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone)]
|
||||
pub struct Key {
|
||||
pub method: String,
|
||||
pub uri: Option<String>,
|
||||
|
@ -613,7 +613,7 @@ impl Key {
|
|||
/// It applies to every Media Segment that appears after it in the
|
||||
/// Playlist until the next EXT-X-MAP tag or until the end of the
|
||||
/// playlist.
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone)]
|
||||
pub struct Map {
|
||||
pub uri: String,
|
||||
pub byte_range: Option<ByteRange>,
|
||||
|
@ -635,7 +635,7 @@ impl Map {
|
|||
/// The EXT-X-BYTERANGE tag indicates that a Media Segment is a sub-range
|
||||
/// of the resource identified by its URI. It applies only to the next
|
||||
/// URI line that follows it in the Playlist.
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone)]
|
||||
pub struct ByteRange {
|
||||
pub length: i32,
|
||||
pub offset: Option<i32>,
|
||||
|
@ -656,7 +656,7 @@ impl ByteRange {
|
|||
/// The EXT-X-DATERANGE tag associates a Date Range (i.e. a range of time
|
||||
/// defined by a starting and ending date) with a set of attribute /
|
||||
/// value pairs.
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone)]
|
||||
pub struct DateRange {
|
||||
pub id: String,
|
||||
pub class: Option<String>,
|
||||
|
@ -677,7 +677,7 @@ pub struct DateRange {
|
|||
/// The EXT-X-START tag indicates a preferred point at which to start
|
||||
/// playing a Playlist. By default, clients SHOULD start playback at
|
||||
/// this point when beginning a playback session.
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone)]
|
||||
pub struct Start {
|
||||
pub time_offset: String,
|
||||
pub precise: Option<String>,
|
||||
|
@ -699,7 +699,7 @@ impl Start {
|
|||
}
|
||||
|
||||
/// A simple `#EXT-` tag
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone)]
|
||||
pub struct ExtTag {
|
||||
pub tag: String,
|
||||
pub rest: Option<String>,
|
||||
|
|
Loading…
Reference in a new issue