Merge pull request #3 from gurry/master

Implemented Clone on all structs
This commit is contained in:
rutgersc 2018-11-29 19:06:59 +01:00 committed by GitHub
commit 3c8268eace
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,7 @@ macro_rules! bool_default_false {
/// identify Media Segments. A Playlist is a Master Playlist if all URI /// identify Media Segments. A Playlist is a Master Playlist if all URI
/// lines in the Playlist identify Media Playlists. A Playlist MUST be /// lines in the Playlist identify Media Playlists. A Playlist MUST be
/// either a Media Playlist or a Master Playlist; all other Playlists are invalid. /// either a Media Playlist or a Master Playlist; all other Playlists are invalid.
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Clone)]
pub enum Playlist { pub enum Playlist {
MasterPlaylist(MasterPlaylist), MasterPlaylist(MasterPlaylist),
MediaPlaylist(MediaPlaylist), MediaPlaylist(MediaPlaylist),
@ -61,7 +61,7 @@ impl Playlist {
/// (https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.4) /// (https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.4)
/// provides a set of Variant Streams, each of which /// provides a set of Variant Streams, each of which
/// describes a different version of the same content. /// describes a different version of the same content.
#[derive(Debug, Default, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct MasterPlaylist { pub struct MasterPlaylist {
pub version: usize, pub version: usize,
pub variants: Vec<VariantStream>, pub variants: Vec<VariantStream>,
@ -163,7 +163,7 @@ impl MasterPlaylist {
/// Clients should switch between different Variant Streams to adapt to /// Clients should switch between different Variant Streams to adapt to
/// network conditions. Clients should choose Renditions based on user /// network conditions. Clients should choose Renditions based on user
/// preferences. /// preferences.
#[derive(Debug, Default, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct VariantStream { pub struct VariantStream {
pub is_i_frame: bool, pub is_i_frame: bool,
pub uri: String, pub uri: String,
@ -242,7 +242,7 @@ impl VariantStream {
/// Media Playlists that contain English, French and Spanish Renditions /// Media Playlists that contain English, French and Spanish Renditions
/// of the same presentation. Or two EXT-X-MEDIA tags can be used to /// 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. /// identify video-only Media Playlists that show two different camera angles.
#[derive(Debug, Default, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct AlternativeMedia { pub struct AlternativeMedia {
// <attribute-list> // <attribute-list>
pub media_type: AlternativeMediaType, pub media_type: AlternativeMediaType,
@ -295,7 +295,7 @@ impl AlternativeMedia {
} }
} }
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Clone)]
pub enum AlternativeMediaType { pub enum AlternativeMediaType {
Audio, Audio,
Video, Video,
@ -337,7 +337,7 @@ impl fmt::Display for AlternativeMediaType {
/// [`#EXT-X-SESSION-KEY:<attribute-list>`] /// [`#EXT-X-SESSION-KEY:<attribute-list>`]
/// (https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.4.5) /// (https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.4.5)
#[derive(Debug, Default, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct SessionKey(pub Key); pub struct SessionKey(pub Key);
impl SessionKey { impl SessionKey {
@ -353,7 +353,7 @@ impl SessionKey {
/// The EXT-X-SESSION-KEY tag allows encryption keys from Media Playlists /// The EXT-X-SESSION-KEY tag allows encryption keys from Media Playlists
/// to be specified in a Master Playlist. This allows the client to /// to be specified in a Master Playlist. This allows the client to
/// preload these keys without having to read the Media Playlist(s) first. /// preload these keys without having to read the Media Playlist(s) first.
#[derive(Debug, Default, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct SessionData { pub struct SessionData {
pub data_id: String, pub data_id: String,
pub value: String, pub value: String,
@ -389,7 +389,7 @@ impl SessionData {
/// (https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.3) /// (https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.3)
/// contains a list of Media Segments, which when played /// contains a list of Media Segments, which when played
/// sequentially will play the multimedia presentation. /// sequentially will play the multimedia presentation.
#[derive(Debug, Default, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct MediaPlaylist { pub struct MediaPlaylist {
pub version: usize, pub version: usize,
/// `#EXT-X-TARGETDURATION:<s>` /// `#EXT-X-TARGETDURATION:<s>`
@ -525,7 +525,7 @@ impl MediaPlaylist {
/// [`#EXT-X-PLAYLIST-TYPE:<EVENT|VOD>`] /// [`#EXT-X-PLAYLIST-TYPE:<EVENT|VOD>`]
/// (https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.3.5) /// (https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.3.5)
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Clone)]
pub enum MediaPlaylistType { pub enum MediaPlaylistType {
Event, Event,
Vod, Vod,
@ -564,7 +564,7 @@ impl Default for MediaPlaylistType {
/// A [Media Segment](https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-3) /// A [Media Segment](https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-3)
/// is specified by a URI and optionally a byte range. /// is specified by a URI and optionally a byte range.
#[derive(Debug, Default, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct MediaSegment { pub struct MediaSegment {
pub uri: String, pub uri: String,
/// `#EXTINF:<duration>,[<title>]` /// `#EXTINF:<duration>,[<title>]`
@ -636,7 +636,7 @@ impl MediaSegment {
/// KEYFORMAT attribute (or the end of the Playlist file). Two or more /// KEYFORMAT attribute (or the end of the Playlist file). Two or more
/// EXT-X-KEY tags with different KEYFORMAT attributes MAY apply to the /// EXT-X-KEY tags with different KEYFORMAT attributes MAY apply to the
/// same Media Segment if they ultimately produce the same decryption key. /// same Media Segment if they ultimately produce the same decryption key.
#[derive(Debug, Default, Clone, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct Key { pub struct Key {
pub method: String, pub method: String,
pub uri: Option<String>, pub uri: Option<String>,
@ -675,7 +675,7 @@ impl Key {
/// It applies to every Media Segment that appears after it in the /// 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 until the next EXT-X-MAP tag or until the end of the
/// playlist. /// playlist.
#[derive(Debug, Default, Clone, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct Map { pub struct Map {
pub uri: String, pub uri: String,
pub byte_range: Option<ByteRange>, pub byte_range: Option<ByteRange>,
@ -706,7 +706,7 @@ impl Map {
/// The EXT-X-BYTERANGE tag indicates that a Media Segment is a sub-range /// 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 /// of the resource identified by its URI. It applies only to the next
/// URI line that follows it in the Playlist. /// URI line that follows it in the Playlist.
#[derive(Debug, Default, Clone, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct ByteRange { pub struct ByteRange {
pub length: i32, pub length: i32,
pub offset: Option<i32>, pub offset: Option<i32>,
@ -745,7 +745,7 @@ impl<'a> From<&'a str> for ByteRange {
/// The EXT-X-DATERANGE tag associates a Date Range (i.e. a range of time /// 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 / /// defined by a starting and ending date) with a set of attribute /
/// value pairs. /// value pairs.
#[derive(Debug, Default, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct DateRange { pub struct DateRange {
pub id: String, pub id: String,
pub class: Option<String>, pub class: Option<String>,
@ -767,7 +767,7 @@ pub struct DateRange {
/// The EXT-X-START tag indicates a preferred point at which to start /// The EXT-X-START tag indicates a preferred point at which to start
/// playing a Playlist. By default, clients SHOULD start playback at /// playing a Playlist. By default, clients SHOULD start playback at
/// this point when beginning a playback session. /// this point when beginning a playback session.
#[derive(Debug, Default, PartialEq)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct Start { pub struct Start {
pub time_offset: String, pub time_offset: String,
pub precise: Option<String>, pub precise: Option<String>,
@ -789,7 +789,7 @@ impl Start {
} }
/// A simple `#EXT-` tag /// A simple `#EXT-` tag
#[derive(Debug, Default)] #[derive(Debug, Default, Clone)]
pub struct ExtTag { pub struct ExtTag {
pub tag: String, pub tag: String,
pub rest: String, pub rest: String,