mirror of
https://github.com/v0l/m3u8-rs.git
synced 2025-06-21 10:50:44 +00:00
Back ported 1.0.6 release
This commit is contained in:

committed by
GitHub

parent
b9d377bfa4
commit
e4e1717b0a
@ -78,7 +78,6 @@ impl MasterPlaylist {
|
|||||||
let mut alternatives = vec![];
|
let mut alternatives = vec![];
|
||||||
|
|
||||||
while let Some(tag) = tags.pop() {
|
while let Some(tag) = tags.pop() {
|
||||||
|
|
||||||
match tag {
|
match tag {
|
||||||
MasterPlaylistTag::Version(v) => {
|
MasterPlaylistTag::Version(v) => {
|
||||||
master_playlist.version = v;
|
master_playlist.version = v;
|
||||||
@ -171,7 +170,7 @@ pub struct VariantStream {
|
|||||||
// <attribute-list>
|
// <attribute-list>
|
||||||
pub bandwidth: String,
|
pub bandwidth: String,
|
||||||
pub average_bandwidth: Option<String>,
|
pub average_bandwidth: Option<String>,
|
||||||
pub codecs: String,
|
pub codecs: Option<String>,
|
||||||
pub resolution: Option<String>,
|
pub resolution: Option<String>,
|
||||||
pub frame_rate: Option<String>,
|
pub frame_rate: Option<String>,
|
||||||
pub audio: Option<String>,
|
pub audio: Option<String>,
|
||||||
@ -190,7 +189,7 @@ impl VariantStream {
|
|||||||
uri: attrs.remove("URI").unwrap_or_else(String::new),
|
uri: attrs.remove("URI").unwrap_or_else(String::new),
|
||||||
bandwidth: attrs.remove("BANDWIDTH").unwrap_or_else(String::new),
|
bandwidth: attrs.remove("BANDWIDTH").unwrap_or_else(String::new),
|
||||||
average_bandwidth: attrs.remove("AVERAGE-BANDWIDTH"),
|
average_bandwidth: attrs.remove("AVERAGE-BANDWIDTH"),
|
||||||
codecs: attrs.remove("CODECS").unwrap_or_else(String::new),
|
codecs: attrs.remove("CODECS"),
|
||||||
resolution: attrs.remove("RESOLUTION"),
|
resolution: attrs.remove("RESOLUTION"),
|
||||||
frame_rate: attrs.remove("FRAME-RATE"),
|
frame_rate: attrs.remove("FRAME-RATE"),
|
||||||
audio: attrs.remove("AUDIO"),
|
audio: attrs.remove("AUDIO"),
|
||||||
@ -204,7 +203,7 @@ impl VariantStream {
|
|||||||
pub fn write_to<T: Write>(&self, w: &mut T) -> std::io::Result<()> {
|
pub fn write_to<T: Write>(&self, w: &mut T) -> std::io::Result<()> {
|
||||||
|
|
||||||
for alternative in &self.alternatives {
|
for alternative in &self.alternatives {
|
||||||
alternative.write_to(w)?;
|
alternative.write_to(w)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.is_i_frame {
|
if self.is_i_frame {
|
||||||
@ -226,7 +225,7 @@ impl VariantStream {
|
|||||||
fn write_stream_inf_common_attributes<T: Write>(&self, w: &mut T) -> std::io::Result<()> {
|
fn write_stream_inf_common_attributes<T: Write>(&self, w: &mut T) -> std::io::Result<()> {
|
||||||
write!(w, "BANDWIDTH={}", &self.bandwidth)?;
|
write!(w, "BANDWIDTH={}", &self.bandwidth)?;
|
||||||
write_some_attribute!(w, ",AVERAGE-BANDWIDTH", &self.average_bandwidth)?;
|
write_some_attribute!(w, ",AVERAGE-BANDWIDTH", &self.average_bandwidth)?;
|
||||||
write!(w, ",CODECS=\"{}\"", &self.codecs)?;
|
write_some_attribute_quoted!(w, ",CODECS", &self.codecs)?;
|
||||||
write_some_attribute!(w, ",RESOLUTION", &self.resolution)?;
|
write_some_attribute!(w, ",RESOLUTION", &self.resolution)?;
|
||||||
write_some_attribute!(w, ",FRAME-RATE", &self.frame_rate)?;
|
write_some_attribute!(w, ",FRAME-RATE", &self.frame_rate)?;
|
||||||
write_some_attribute_quoted!(w, ",VIDEO", &self.video)
|
write_some_attribute_quoted!(w, ",VIDEO", &self.video)
|
||||||
@ -600,7 +599,7 @@ impl MediaSegment {
|
|||||||
write!(w, "\n")?;
|
write!(w, "\n")?;
|
||||||
}
|
}
|
||||||
if self.discontinuity {
|
if self.discontinuity {
|
||||||
writeln!(w, "{}", "#EXT-X-DISCONTINUITY")?;
|
writeln!(w, "{}", "#EXT-X-DISCONTINUITY")?;
|
||||||
}
|
}
|
||||||
if let Some(ref key) = self.key {
|
if let Some(ref key) = self.key {
|
||||||
write!(w, "#EXT-X-KEY:")?;
|
write!(w, "#EXT-X-KEY:")?;
|
||||||
|
Reference in New Issue
Block a user