This further ensures the caller sees the DAV1D_EVENT_FLAG_NEW_SEQUENCE flag in
the first output frame after a new sequence header is parsed even if the first
coded frame is not meant to be output.
There's no reason to be so strict by ensuring the tool only works with a
library built from the exact same git snapshot, when the only thing that
matters is API availability and ABI compatibility.
Signed-off-by: James Almer <jamrial@gmail.com>
Don't just check that we don't overrun at a byte aligned offset. Also make sure
that the parsing was correct and no valid bits are left in the OBU.
Signed-off-by: James Almer <jamrial@gmail.com>
Callers using custom picture allocators may ignore the data pointers in the
output pictures, resulting in planes for the wrong frames being displayed.
This reverts commits 98b0c96d21 and 92d8b81542, and fixes#426.
Signed-off-by: James Almer <jamrial@gmail.com>
Nothing in the spec prevents a Temporal Unit from having more than one Metadata
OBU of type ITU-T T.35, so export them as an array instead of only exporting
the last one we parse.
This is backwards compatible with the previous implementation, as users unaware
of this change can ignore the n_itut_t35 field and still access the first (or
only) entry in the array as they have been doing until now.
Dav1dRef is an opaque struct to the API user, and they have no business
with these fields at all, so move them to the internal picture struct.
Signed-off-by: James Almer <jamrial@gmail.com>
Nothing in the spec prevents a Temporal Unit from having more than one Metadata
OBU of type ITU-T T.35, so export them as an array instead of only exporting
the last one we parse.
This is backwards compatible with the previous implementation, as users unaware
of this change can ignore the n_itut_t35 field and still access the first (or
only) entry in the array as they have been doing until now.
Signed-off-by: James Almer <jamrial@gmail.com>
If a Metadata OBU appeared right before a Frame Header OBU with
show_existing_picture = 1, it was not being attached to it but to the next
assembled picture, which was in the following TU.
Signed-off-by: James Almer <jamrial@gmail.com>
From section 6.8.2 in the AV1 spec:
"It is a requirement of bitstream conformance that when show_existing_frame is
used to show a previous frame with RefFrameType[ frame_to_show_map_idx ] equal
to KEY_FRAME, that the frame is output via the show_existing_frame mechanism at
most once."
From section 6.8.2 in the AV1 spec:
"It is a requirement of bitstream conformance that when show_existing_frame
is used to show a previous frame, that the value of showable_frame for the
previous frame was equal to 1."
From section 6.8.2 in the AV1 spec:
"If frame_type is equal to INTRA_ONLY_FRAME, it is a requirement of bitstream
conformance that refresh_frame_flags is not equal to 0xff."
Make this a soft requirement by checking that strict standard complaince is
enabled.
If the first picture in coding order after a new sequence header is parsed is
not visible, the first picture output by dav1d after the fact (which is coded
after the aforementioned invisible picture) would not trigger the new seq
header event flag as expected, despite being the first containing a reference
to a new sequence header.
Assuming the invisible picture is ever output, the result of this change will
be two pictures signaling a new sequence header was seen despite there being
only one new sequence header.
This clears stale values from the context in the scenario where you first parse
a svc sequence, and then a sequence header with the reduced still picture
header flag being true immediately after it.
Prevents dav1d_get_picture() from returning EAGAIN when no frame delay was
requested (threads=1, or threads > 1 and max_frame_delay=1).
Signed-off-by: James Almer <jamrial@gmail.com>
Helps differentiating actual errors in the buffer data or passed-in arguments
with scenarios like empty buffers or containing OBUs other than Sequence
Header.
And a function to fetch them. Should be useful to signal changes in the
bitstream the user may want to know about.
Starting with two flags, DAV1D_EVENT_FLAG_NEW_SEQUENCE and
DAV1D_EVENT_FLAG_NEW_OP_PARAMS_INFO, which signal the presence of an updated
sequence header in the last returned (or to be returned) picture.
Ensure both the allocator and release callbacks are pointing to the default
functions, and that no cookie was provided.
This prevents the user from configuring a mix of custom and default callbacks.
Process input data as soon as it's fed to dav1d_send_data() instead of storing
a single packet and expecting the user to call dav1d_get_picture() in order to
trigger the decoding process before they are allowed to feed more data.
The spec states that a decoder should instead ignore them. Otherwise, streams
compliant with an hypothetical future revision of the spec may be rejected when
backwards compatibility is expected.
They were meant to be freed by the call to dav1d_flush() at the beginning,
but before the previous commit that wasn't the case when decoding with one
frame thread.
This ensures they are explicity freed here and not depend on other functions
behaving correctly.
It's called from a single function in the entire codebase, so no point
passing so many individual arguments to it when almost all of them are
derived from a single struct.
The function uses a Dav1dContext internally, so the caller can't disable
logging or use a custom logger. Play it safe and disable logging altogether
to avoid spamming stderr.