Adds support for detecting and playing chained asfs
in push mode. asfdemux tries to detect a new asf start
by identifying the header object guid in a input buffer.
When it finds it, it resets its state, removing its pads
and creates new ones for the new file.
When receiving bogus data, we have to avoid subtracting a value
larger than 'size' from 'size' variable, resulting in a wrap
that would make 'size' a really large bogus value.
Fixes#599333
Fixes#598761
This removes a good 50% of processing time for parsing a buffer.
We do this by simply... getting the nicks that we already have handy
instead of going through the expensive glib system.
Previously, we could get false sync relatively easily - it sometimes happened
on real files. This cleans the code up a fair bit, and makes it require more
confirmation that we've found valid sync before continuing.
Metadata provided seek tables are consistent with metadata's view of
total size, which typically matches real size, but need not do so
(e.g. a truncated file). Fixes seeking and position reporting
in such truncated files (although duration based on metadata may then
still be incorrect).
asf packets in rtp packets should come with their padding fields
set to 0 and the depayload must update them to the correct
value before pushing downstream
This also fixes a bug by which the first buffer (in a multi-packet mode)
passed to asf_demux_parse_packet() would have a GST_BUFFER_SIZE of the
full incoming buffer and not just of the single asf packet.
Fixes corrupted frames introduced by latest commit.
We now have a chance for packets to be collected before we send out the
newsegment. If we're not in accurate seeking (keyunit) it will set
the segment start/time to the keyframe's timestamp.
We now *always* seek to the keyframe just before our requested position.
When we encounter the first keyframe and we were not accurate (therefore doing
keyframe seeking), we update the segment start position to the keyframe timestamp.
This will still cause some timestamp jitter, but giving a hint as to the duration
rather than nothing seems to be a better idea.
Also, this allows some scenarios (like remuxing with asfmux) to estimate the total
duration using the accumulated packet duration (which will be correct).
The simple index entries also contain the number of packets one needs
to retrieve at a given position to get a full keyframe. We therefore
use that information to retrieve all those packets in one buffer when
working in pull-mode.
In gst_asf_demux_chain_headers, when 'goto wrong_type' was called
asfdemux tried to free a const pointer that had been cast to a
normal pointer variable.
We weren't taking the preroll into account previously, meaning that we
were always seeking preroll nanoseconds too early... resulting in a lot
of dropped packets (which are before the start time).
This brings quit a bit closer to as-fast-as-possible seeking in asf files.
Post global tags only after we've added our source pads, so that
tag events get sent downstream in addition to tag messages posted
on the bus. This makes sure tags can be picked up automatically
when transcoding, but also by tagreadbin/playbin2. Fixes#519721.
While we're at it, also add a container-format tag.