1
0
Fork 0
mirror of https://github.com/sile/hls_m3u8.git synced 2024-06-02 13:39:27 +00:00

improve documentation of EncryptionMethod

This commit is contained in:
Luro02 2020-02-24 14:28:14 +01:00
parent c7419c864f
commit 11ac527fca
No known key found for this signature in database
GPG key ID: B66FD4F74501A9CF

View file

@ -1,43 +1,46 @@
use strum::{Display, EnumString}; use strum::{Display, EnumString};
/// Encryption method. /// The encryption method.
///
/// See: [4.3.2.4. EXT-X-KEY]
///
/// [4.3.2.4. EXT-X-KEY]: https://tools.ietf.org/html/rfc8216#section-4.3.2.4
#[non_exhaustive] #[non_exhaustive]
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive(Ord, PartialOrd, Debug, Clone, Copy, PartialEq, Eq, Hash, Display, EnumString)] #[derive(Ord, PartialOrd, Debug, Clone, Copy, PartialEq, Eq, Hash, Display, EnumString)]
#[strum(serialize_all = "SCREAMING-KEBAB-CASE")] #[strum(serialize_all = "SCREAMING-KEBAB-CASE")]
pub enum EncryptionMethod { pub enum EncryptionMethod {
/// `None` means that the [`MediaSegment`]s are not encrypted. /// The [`MediaSegment`]s are not encrypted.
/// ///
/// [`MediaSegment`]: crate::MediaSegment /// [`MediaSegment`]: crate::MediaSegment
None, None,
/// `Aes128` signals that the [`MediaSegment`]s are completely encrypted /// The [`MediaSegment`]s are completely encrypted using the Advanced
/// using the Advanced Encryption Standard ([AES-128]) with a 128-bit /// Encryption Standard ([AES-128]) with a 128-bit key, Cipher Block
/// key, Cipher Block Chaining (CBC), and /// Chaining (CBC), and [Public-Key Cryptography Standards #7 (PKCS7)]
/// [Public-Key Cryptography Standards #7 (PKCS7)] padding. /// padding.
/// ///
/// CBC is restarted on each segment boundary, using either the /// CBC is restarted on each segment boundary, using either the
/// Initialization Vector (IV) attribute value or the Media Sequence /// Initialization Vector (IV) or the Media Sequence Number as the IV
/// Number as the IV. ///
/// ```
/// # let media_sequence_number = 5;
/// # assert_eq!(
/// format!("0x{:032x}", media_sequence_number)
/// # , "00000000000000000000000000000005".to_string());
/// ```
/// ///
/// [`MediaSegment`]: crate::MediaSegment /// [`MediaSegment`]: crate::MediaSegment
/// [AES-128]: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.197.pdf /// [AES-128]: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.197.pdf
/// [Public-Key Cryptography Standards #7 (PKCS7)]: https://tools.ietf.org/html/rfc5652 /// [Public-Key Cryptography Standards #7 (PKCS7)]: https://tools.ietf.org/html/rfc5652
#[strum(serialize = "AES-128")] #[strum(serialize = "AES-128")]
Aes128, Aes128,
/// `SampleAes` means that the [`MediaSegment`]s /// The [`MediaSegment`]s contain media samples, such as audio or video,
/// contain media samples, such as audio or video, that are encrypted /// that are encrypted using the Advanced Encryption Standard ([`AES-128`]).
/// using the Advanced Encryption Standard ([`AES-128`]). How these media ///
/// streams are encrypted and encapsulated in a segment depends on the /// How these media streams are encrypted and encapsulated in a segment
/// media encoding and the media format of the segment. fMP4 Media /// depends on the media encoding and the media format of the segment.
/// Segments are encrypted using the 'cbcs' scheme of ///
/// [Common Encryption]. Encryption of other Media Segment /// `fMP4` [`MediaSegment`]s are encrypted using the `cbcs` scheme of
/// formats containing [H.264], [AAC], [AC-3], /// [Common Encryption].
/// and Enhanced [AC-3] media streams is described in the HTTP /// Encryption of other [`MediaSegment`] formats containing [H.264], [AAC],
/// Live Streaming (HLS) [SampleEncryption specification]. /// [AC-3], and Enhanced [AC-3] media streams is described in the
/// [HTTP Live Streaming (HLS) SampleEncryption specification].
/// ///
/// [`MediaSegment`]: crate::MediaSegment /// [`MediaSegment`]: crate::MediaSegment
/// [`AES-128`]: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.197.pdf /// [`AES-128`]: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.197.pdf
@ -45,7 +48,8 @@ pub enum EncryptionMethod {
/// [H.264]: https://tools.ietf.org/html/rfc8216#ref-H_264 /// [H.264]: https://tools.ietf.org/html/rfc8216#ref-H_264
/// [AAC]: https://tools.ietf.org/html/rfc8216#ref-ISO_14496 /// [AAC]: https://tools.ietf.org/html/rfc8216#ref-ISO_14496
/// [AC-3]: https://tools.ietf.org/html/rfc8216#ref-AC_3 /// [AC-3]: https://tools.ietf.org/html/rfc8216#ref-AC_3
/// [SampleEncryption specification]: https://tools.ietf.org/html/rfc8216#ref-SampleEnc /// [HTTP Live Streaming (HLS) SampleEncryption specification]:
/// https://tools.ietf.org/html/rfc8216#ref-SampleEnc
SampleAes, SampleAes,
} }