From 3c8368f9a37e4d60ed4079e5fb8da58ea491f493 Mon Sep 17 00:00:00 2001 From: Vadim Getmanshchuk Date: Thu, 7 Apr 2022 13:35:02 -0700 Subject: [PATCH] A fix for `CLOSED-CAPTIONS=NONE` case and a few minor fixes The PR includes * a hotfix for issue #44. I'm not entirely sure and it's possible to * `#EXT-X-ENDLIST` is moved to be the last part of the media manifest. Theoretically it can appear anywhere in manifest, so the current placement is not breaking the standard, but not usually is what found in the wild and I believe will help with readability. As any placement is possible, the placement at the end is completely legal. * minor `cargo clippy` suggestions --- src/playlist.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/playlist.rs b/src/playlist.rs index 14f0999..2d72fcd 100644 --- a/src/playlist.rs +++ b/src/playlist.rs @@ -176,7 +176,12 @@ impl VariantStream { self.write_stream_inf_common_attributes(w)?; write_some_attribute_quoted!(w, ",AUDIO", &self.audio)?; write_some_attribute_quoted!(w, ",SUBTITLES", &self.subtitles)?; - write_some_attribute_quoted!(w, ",CLOSED-CAPTIONS", &self.closed_captions)?; + // handle `CLOSED-CAPTIONS=NONE` case + if self.closed_captions.as_deref().eq(&Some("NONE")) { + write_some_attribute!(w, ",CLOSED-CAPTIONS", &self.closed_captions)?; + } else { + write_some_attribute_quoted!(w, ",CLOSED-CAPTIONS", &self.closed_captions)?; + } writeln!(w)?; writeln!(w, "{}", self.uri) }