2.2.2.6 StreamFragmentElement

The StreamFragmentElement field and related fields are used to specify metadata for one set of related fragments in a stream. The order of repeated StreamFragmentElement fields in a containing StreamElement field is significant for the correct function of the Smooth Streaming Transport Protocol. To this end, the following elements make use of the terms "preceding" and "subsequent" StreamFragmentElement in reference to the order of these fields.

StreamFragmentElement (variable): An XML element that encapsulates metadata for a set of related fragments. Attributes can appear in any order. However, either one or both of the following fields are required and MUST be present in StreamFragmentAttributes: FragmentDuration and FragmentTime. Additionally, a contiguous sequence of fragments MUST be represented using one of the following schemes. A sequence of fragments is termed contiguous if, with the exception of the first fragment, the StreamFragmentElement's FragmentTime field of any fragment in the sequence is equal to the sum of the StreamFragmentElement's FragmentTime field and the FragmentDuration field of the preceding fragment.

§ Start-time coding – Each fragment in the sequence has an explicit value for the StreamFragmentElement's FragmentTime field and an implicit value for the StreamFragmentElement's FragmentDuration field, except the last fragment, for which the value of the StreamFragmentElement's FragmentDuration field is explicit.

§ Duration coding – Each fragment in the sequence has an explicit value for the StreamFragmentElement's FragmentDuration field and an implicit value for the StreamFragmentElement's FragmentTime field, except the first fragment, whose start-time is explicit unless the implicit value of zero is desired.

FragmentNumber (variable): The ordinal of the StreamFragmentElement field in the stream. If FragmentNumber is specified, its value MUST monotonically increase with the value of the FragmentTime field.

FragmentDuration (variable): The duration of the fragment, specified as a number of increments defined by the implicit or explicit value of the containing StreamElement's StreamTimeScale field. If the FragmentDuration field is omitted, its implicit value MUST be computed by the client by subtracting the value of the preceding StreamFragmentElement's FragmentTime field from the value of this StreamFragmentElement's FragmentTime field. If no preceding StreamFragmentElement exists, the implicit value of the FragmentDuration field MUST be computed by the client by subtracting the value of this StreamFragmentElement FragmentTime field from the subsequent StreamFragmentElement's FragmentTime field.

If no preceding or subsequent StreamFragmentElement field exists, the implicit value of the FragmentDuration field is the value of the SmoothStreamingMedia's Duration field.

FragmentTime (variable): The time of the fragment, specified as a number of increments defined by the implicit or explicit value of the containing StreamElement's StreamTimeScale field. If the FragmentTime field is omitted, its implicit value MUST be computed by the client by adding the value of the preceding StreamFragmentElement's FragmentTime field to the value of the preceding StreamFragmentElement's FragmentDuration field. If no preceding StreamFragmentElement exists, the implicit value of the FragmentTime field is 0.

FragmentRepeat (variable): The repeat count of the fragment, specified as the number of contiguous fragments with the same duration defined by the StreamFragmentElement's FragmentTime field. This value is one-based. (A value of 2 means two fragments in the contiguous series). The SmoothStreamingMedia's MajorVersion and MinorVersion fields MUST both be set to 2.

The syntax of the fields that are defined in this section, specified in ABNF [RFC5234], is as follows.

  
 StreamFragmentElement = "<" StreamFragmentElementName S
                         StreamFragmentAttributes S ">"
                         S StreamFragmentContent *1S
                         "</" StreamFragmentElementName ">"
 StreamFragmentElementName = "c"
 StreamFragmentAttributes = *( 
                               FragmentNumberAttribute 
                               / FragmentDurationAttribute
                               / FragmentTimeAttribute
                             )
 FragmentNumberAttribute = S FragmentNumberAttributeName S Eq S 
                           (DQ FragmentNumber DQ) / (SQ FragmentNumber SQ) *1S
 FragmentNumberAttributeName = "n"
 FragmentNumber = STRING-UINT32
 FragmentDurationAttribute = S FragmentDurationAttributeName S Eq S 
                         (DQ FragmentDuration DQ) / (SQ FragmentDuration SQ) *1S
 FragmentDurationAttributeName = "d"
 FragmentDuration = STRING-UINT64
 FragmentTimeAttribute = S FragmentTimeAttributeName S Eq S 
                      (DQ FragmentTime DQ) / (SQ FragmentTime SQ) *1S
 FragmentTimeAttributeName = "t"
 FragmentTime = STRING-UINT64
 FragmentRepeatAttribute = S FragmentRepeatAttributeName S Eq *1S
                         (DQ FragmentRepeat DQ) / (SQ FragmentRepeat SQ) *1S
 FragmentRepeatAttributeName = "r"
 FragmentRepeat = STRING-UINT64
 StreamFragmentContent = *( TrackFragment S )
 TrackFragment = "<" TrackFragmentElementName S
                 TrackFragmentAttributes S ">"
                 S 1*(TrackFragmentContent *1S) 
                 "</" TrackFragmentElementName ">"
 TrackFragmentAttributes = *( 
                               TrackFragmentIndexAttribute 
                               / VendorExtensionAttribute
                             )
 TrackFragmentIndexAttribute = S TrackFragmentIndexAttributeName S Eq S 
                              (DQ TrackFragmentIndex DQ) 
                              / (SQ TrackFragmentIndex SQ) *1S
 TrackFragmentIndexAttributeName = "i"
 TrackFragmentIndex = STRING-UINT32
 TrackFragmentContent = VendorExtensionTrackData
 VendorExtensionTrackData = XML-CHARDATA