﻿playlist                      = EXTM3U EOL *(line) <EOF>
tag                           = EXT-X-VERSION
                              / EXTINF
                              / EXT-X-BYTERANGE
                              / EXT-X-DISCONTINUITY
                              / EXT-X-KEY
                              / EXT-X-MAP
                              / EXT-X-PROGRAM-DATE-TIME
                              / EXT-X-DATERANGE
                              / EXT-X-TARGETDURATION
                              / EXT-X-MEDIA-SEQUENCE
                              / EXT-X-DISCONTINUITY-SEQUENCE
                              / EXT-X-ENDLIST
                              / EXT-X-PLAYLIST-TYPE
                              / EXT-X-I-FRAMES-ONLY
                              / EXT-X-MEDIA
                              / EXT-X-STREAM-INF
                              / EXT-X-I-FRAME-STREAM-INF
                              / EXT-X-SESSION-DATA
                              / EXT-X-SESSION-KEY
                              / EXT-X-INDEPENDENT-SEGMENTS
                              / EXT-X-START
                              / ignored-tag
                              ; tag-name MUST be upper case
EXTM3U                        = "#EXTM3U"
                              ; EXTM3U MUST be upper case
EXT-X-VERSION                 = "#EXT-X-VERSION:" decimal-integer
EXTINF                        = "#EXTINF:" duration "," [title]
title                         = 1*(VCHAR / WSP)
                              ; TODO: support UTF-8 titles
duration                      = decimal-floating-point / decimal-integer
EXT-X-BYTERANGE               = <TODO>
EXT-X-DISCONTINUITY           = "#EXT-X-DISCONTINUITY"
EXT-X-KEY                     = "#EXT-X-KEY:" attribute-list
EXT-X-MAP                     = <TODO>
EXT-X-PROGRAM-DATE-TIME       = <TODO>
EXT-X-DATERANGE               = <TODO>
EXT-X-TARGETDURATION          = "#EXT-X-TARGETDURATION:" decimal-integer
EXT-X-MEDIA-SEQUENCE          = "#EXT-X-MEDIA-SEQUENCE:" decimal-integer
EXT-X-DISCONTINUITY-SEQUENCE  = "#EXT-X-DISCONTINUITY-SEQUENCE:" decimal-integer
EXT-X-ENDLIST                 = "#EXT-X-ENDLIST"
EXT-X-PLAYLIST-TYPE           = <TODO>
EXT-X-I-FRAMES-ONLY           = <TODO>
EXT-X-MEDIA                   = "#EXT-X-MEDIA:" attribute-list
EXT-X-STREAM-INF              = "#EXT-X-STREAM-INF:" attribute-list EOL URI-reference
                              ; URI-reference: see rfc3986
EXT-X-I-FRAME-STREAM-INF      = "#EXT-X-I-FRAME-STREAM-INF" attribute-list
EXT-X-SESSION-DATA            = <TODO>
EXT-X-SESSION-KEY             = <TODO>
EXT-X-INDEPENDENT-SEGMENTS    = <TODO>
EXT-X-START                   = <TODO>
ignored-tag                   = "#EXT" *(VCHAR / WSP)
line                          = (tag / comment / empty / URI-reference) EOL
                              ; URI-reference: see rfc3986
comment                       = "#" [(%x45.58 (%x21-53 / %x55-7E / WSP) / %x45 (%x21-57 / %x59-7E / WSP) / (%x21-44 / %x46-7E / WSP)) *(VCHAR / WSP)]
                              ; Any string that doesn't start with "EXT"
empty                         = ""
EOL                           = LF / CRLF
attribute-list                = attribute *("," attribute)
attribute                     = attribute-name "=" attribute-value
attribute-name                = 1*(%x41-5A / DIGIT / "-")
attribute-value               = hexadecimal-sequence
                              / decimal-resolution
                              / decimal-floating-point
                              / signed-decimal-floating-point
                              / decimal-integer
                              / quoted-string
                              / enumerated-string
decimal-integer               = 1*20(DIGIT)
                              ; from 0 to 2^64-1 (18446744073709551615)
hexadecimal-sequence          = "0x" 1*(HEXDIG)
signed-decimal-floating-point = ["-"] decimal-floating-point
decimal-floating-point        = *(DIGIT) "." 1*(DIGIT)
quoted-string                 = DQUOTE *(%x20-21 / %x23-7E) DQUOTE
                              ; The double quote (0x22) character MUST NOT appear in a quoted-string: 
enumerated-string             = *(%x21 / %x23-2B / %x2D-7E)
                              ; The following characters will never appear in an enumerated-string: 
                              ; double quote (0x22)
                              ; comma (0x2C)
decimal-resolution            = decimal-integer %x78 decimal-integer