Splicing

The playlist can be used to splice content with other content following a media in the playlist.  
A source item is declared as main media in a splice operation if and only if it has an `out` directive set (possibly empty).  
Directive can be used for the main media except concatenation directives.  
  
The splicing operations do not alter media frames and do not perform uncompressed domain operations such as cross-fade or mixing.  
  
The `out` (resp. `in`) directive specifies the media splice start (resp. end) time. The value can be formatted as follows:  

- empty: the time is not yet assigned  
- `now`: the time is resolved to the next SAP point in the media  
- integer, float or fraction: set time in seconds  
- `+VAL`: used for `in` only, specify the end point as delta in seconds from the start point (`VAL` can be integer, float or fraction)  
- DATE: set splice time according to wall clock `DATE`, formatted as an `XSD dateTime`  

The splice times (except wall clock) are expressed in the source (main media) timing, not the reconstructed output timeline.  
  
When a splice begins (`out` time reached), the source items following the main media are played until the end of the splice or the end of the main media.  
Sources used during the splice period can use directives such as `start`, `dur` or `repeat`.  
  
Once a splice is done (`in` time reached), the main media `out` splice time is reset to undefined.  
  
When the main media has undefined `out` or `in` splice times, the playlist is reloaded at each new main media packet to check for resolved values.  

- `out` can only be modified when no splice is active, otherwise it is ignored. If modified, it resets the next source to play to be the one following the modified main media.  
- `in` can only be modified when a splice is active with an undefined end time, otherwise it is ignored.  

  
When the main media is over:  

- if `repeat` directive is set, the main media is repeated, `in` and `out` set to their initial values and the next splicing content is the one following the main content,  
- otherwise, the next source queued is the one following the last source played during the last splice period.  

  
It is allowed to defined several main media in the playlist, but a main media is not allowed as media for a splice period.  
  
The filter will look for the property `Period` on the output PIDs of the main media for multi-period DASH.  
If found, `_N` is appended to the period ID, with `N` starting from 1 and increased at each main media resume.  
If no `Period` property is set on main or spliced media, period switch can still be forced using [-pswitch](dasher/#pswitch) DASH option.  
  
If `mark` directive is set for a main media, no content replacement is done and the splice boundaries will be signaled in the main media.  
If `keep` directive is set for a main media, the main media is forwarded along with the replacement content.  
When `mark` or `keep` directives are set, it is possible to alter the PID properties of the main media using `sprops` directive.  
  
Example
```
#out=2 in=4 mark sprops=#xlink=http://foo.bar/  
src:#Period=main
```
  
This will inject property xlink on the output PIDs in the splice zone (corresponding to period `main_2`) but not in the rest of the main media.  
  
Directives `mark`, `keep` and `sprops` are reset at the end of the splice period.