globocom / m3u8

Python m3u8 Parser for HTTP Live Streaming (HLS) Transmissions
Other
2.03k stars 471 forks source link

Add Segment.media_Sequence #310

Closed bbayles closed 1 year ago

bbayles commented 1 year ago

Re: Issue 308, this PR adds a media_sequence attribute to Segment objects.

From RFC 8216:

Each segment in a Media Playlist has a unique integer Media Sequence
   Number.  The Media Sequence Number of the first segment in the Media
   Playlist is either 0 or declared in the Playlist ([Section 4.4.3.2](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.3.2)).
   The Media Sequence Number of every other segment is equal to the
   Media Sequence Number of the segment that precedes it plus one.

It's useful to have access to the Media Sequence number on the Segment object because this value can be used for the initialization vector (section 5.2). It's also useful for tracking changes between requests of live playlists.

mauricioabreu commented 1 year ago

Thank you @bbayles amazing work! Do you mind rebasing your PR? I'm ready to merge it.

bbayles commented 1 year ago

OK, this is rebased. Thanks!

mauricioabreu commented 1 year ago

Thank you, @bbayles merged.