The mov muxer already supports picking up extradata that wasn't
present during the avformat_write_header call - we just need to
propagate it. Since the dash muxer uses delay_moov, we have time
up until the first segment is written to get extradata filled in.
Also update the codec description string when the extradata becomes
available.
Signed-off-by: Martin Storsjö <martin@martin.st>
It is used in adx_read_packet, which currently depends on the
decoder/parser setting this value between reading the file header and
demuxing the first packet.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
The chunk size is limited to UINT16_MAX (written by avio_wb16), so make
sure that the packet size is not too large.
Such large frames need to be split into slices smaller than 64 kB, but
that is currently supported neither by the rv10/rv20 encoders nor the rm
muxer.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
The original flags variable contains rtpdec flags, while the
rmflags variable contains RM flag bits which have a completely
different definition.
Signed-off-by: Martin Storsjö <martin@martin.st>
The only case where RTP_FLAG_KEY actually is needed is
in RDT, where such a flag needs to be passed via the
rtpdec parse function's flags parameter.
Signed-off-by: Martin Storsjö <martin@martin.st>
Nothing in the framework nor in the rest of the depacketizer actually
uses this flag - the chained demuxer sets the keyframe flag properly on
demuxed packets already.
Signed-off-by: Martin Storsjö <martin@martin.st>
This fixes an oversight in 96084251, in a refactoring done on top
of Gilles' original patch.
Pointed out by Gilles Chanteperdrix.
Signed-off-by: Martin Storsjö <martin@martin.st>
Similarly to what has been done for MOV, display XMP metadata only when
users explicitly require it.
The Extensible Metadata Platform tag can contain various kind of data
which are not strictly related to the video file, such as history of
edits and saves from the project file.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
This reverts commit 4abfa387b8.
This commit broke playback of fragmented mp4 files with b-frames.
While investigating this, it turned out that the general framework
isn't ready for a PTS-based index yet. Revert this change until
a better thought out solution is in place.
Signed-off-by: Martin Storsjö <martin@martin.st>
Instead check the timestamps while muxing, to avoid buffering a
too long timestamp range into one single packet.
This makes the AMR and AAC packetization slightly less efficient,
since we set a possibly unnecessarily high max_frames_per_packet.
(These packetizers end up doing a memmove of the TOC bytes if
sending a packet before max_frames_per_packet is achieved, and
we end up setting max_frames_per_packet to a value that should
be high enough for most uses.)
All packetizers that use max_frames_per_packet now set it either
to a default value, or to a value calculated based on other
parameters, so none of them rely on the previous default setting.
For iLBC, copy one frame at a time, to allow checking the timestamp
range for each of them - basically doing potentially multiple
loops to simplify the code instead of trying to calculate the
number of frames to buffer while honoring s1->max_delay.
This is in preparation for reducing the coupling between libavformat
and libavcodec, by not having the muxers use the encoder field
frame_size (which may not be available during e.g. stream copy).
Signed-off-by: Martin Storsjö <martin@martin.st>
Factorize out the s->num_frames check at the start of the if statements,
simplifying adding more alternative causes for sending the buffered
frames.
Signed-off-by: Martin Storsjö <martin@martin.st>
This avoids having to jump to the defaultcase in the switch. Manually
override the stream time base back to 90 kHz for the few audio codecs
that don't use the sample rate as time base (mp2, mp3).
Signed-off-by: Martin Storsjö <martin@martin.st>
This doesn't fix any bug, but makes the code simpler for later
patches, and more straightforward to read as is.
Signed-off-by: Martin Storsjö <martin@martin.st>
After sending a fragmented frame, len (s->buf_ptr - s->buf) isn't
zero, while s->num_frames is zero as intended. Using s->num_frames
makes it work as intended, and is less convoluted than keeping track
of (resetting) s->buf_ptr.
This avoids sending stray data after sending a fragmented aac packet.
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
Don't prefix them ffio_url, which is misleading, sounding too
much like the urlprotocol layer (like ffurl_*).
Signed-off-by: Martin Storsjö <martin@martin.st>
Many of these functions were named foo_free_context, and since
the functions no longer should free the context itself, only
allocated elements within it, the previous naming was slightly
misleading.
Signed-off-by: Martin Storsjö <martin@martin.st>
This is different from how it is handled in codecs/demuxers/muxers
though (where the close function isn't called if the open function
failed), but since the number of depacketizers that have an .init
function is quite limited, this is easy to change.
The main point is that if the init function failed, we shouldn't
try to use that depacketizer at all - this makes sure that the
parse function doesn't need to check for the things that were
initialized in the init function.
Signed-off-by: Martin Storsjö <martin@martin.st>
This makes it more consistent with depacketizers that don't have any
.free function at all, where the payload context is freed by the
surrounding framework. Always free the context in the surrounding
framework, having the individual depacketizers only free any data
they've specifically allocated themselves.
This is similar to how this works for demuxer/muxers/codecs - a
component shouldn't free the priv_data that the framework has
allocated for it.
Signed-off-by: Martin Storsjö <martin@martin.st>
They share a great deal of common structure; only a few minor
bits in the headers differ.
This also fixes an off-by-one in sending of the last fragment
of large HEVC nals (where it previously sent len+2 bytes, even
if it should have been len+RTP_HEVC_HEADERS_SIZE aka len+3).
Signed-off-by: Martin Storsjö <martin@martin.st>