ttmlparse: fix issues in aggregation of input TTML
The last commit to ttmlparse (!848 (merged)) broke the handling of TTML that is delivered as DASH segments. This can be demonstrated with the following command:
GST_TTML_AUTOPLUG=1 gst-play-1.0 http://rdmedia.bbc.co.uk/dash/ondemand/elephants_dream/1/client_manifest-one_representation_per_component.mpd
The reason is that the TTML documents within the ISOBMFF segments contain a linefeed (0xA) after the closing </tt>
tag. !848 (merged) searches for this closing tag to find whether a complete TTML file has been received and where it ends in the input; however, any trailing whitespace is then added to the start of the next TTML file to be parsed, which causes libxml2 to fail (it expects files to start with an XML declaration).
Additionally, the code in !848 (merged) searches the aggregated input for the last </tt>
tag. It should be looking for the first </tt>
tag, as there may be multiple complete TTML documents in the aggregated input, and the parser can handle only one TTML document at a time.
The commits in this MR fix these issues.