This fixes the build on compilers that interpreted the earlier
code as a variable length array (which we intentionally disallow).
Signed-off-by: Martin Storsjö <martin@martin.st>
This allows one to specify templated segment names for init-segments,
media-segments, and for the base-url in the case of single-file.
Signed-off-by: Martin Storsjö <martin@martin.st>
Currently, when streaming to an RTMP server, any time a packet of type
RTMP_PT_NOTIFY is encountered, the packet is prepended with @setDataFrame
before it gets sent to the server. This is incorrect; only packets for
onMetaData and |RtmpSampleAccess should invoke @setDataFrame on the RTMP
server. Specifically, the current bug manifests itself when trying to
stream onTextData or onCuePoint invocations.
This fix addresses that problem and ensures that the @setDataFrame is
only prepended for onMetaData and |RtmpSampleAccess.
Since data is fed to the rtmp_write function in smaller pieces (depending
on the calling IO buffer size), we can't generally assume that the
whole packet (or even the whole command string) is available at once,
therefore we can only check the command string once the full packet
has been transferred to us for sending.
Based on a patch by Jeffrey Wescott.
Signed-off-by: Martin Storsjö <martin@martin.st>
We try to avoid mixing av_malloc with av_realloc, since av_malloc
may be implemented with functions that can't (formally) be mixed
with the functions used in av_realloc.
Signed-off-by: Martin Storsjö <martin@martin.st>
ffmenc will store recommended encoder configuration if present.
This will allow the user to base on local defaults and
apply only explicitly set options.
If recommended encoder configuration is not present, then
non-default context's options are stored.
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
By appending `?dscp=26` to the URL, IP packets will be classified as
AF31 (assured forwarding for multimedia flows with low probability of
loss). On congested network, this allows a user to assign priorities to
flows.
Signed-off-by: Vincent Bernat <vincent@bernat.im>
By appending `?dscp=26` to the URL, IP packets will be classified as
AF31 (assured forwarding for multimedia flows with low probability of
loss). On congested network, this allows a user to assign priorities to
flows.
Signed-off-by: Vincent Bernat <vincent@bernat.im>
Ensures that the header include order is such that winsock2.h is always
included before windows.h or that windows.h does not include winsock.h.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This reverts commit b9d08c77a4.
After taking MoveFileEx into use, we can replace files with renames
on windows as well.
Signed-off-by: Martin Storsjö <martin@martin.st>
This allows getting the normal unix semantics, where a rename
allows replacing an existing file.
Based on a suggestion by Reimar Döffinger.
Signed-off-by: Martin Storsjö <martin@martin.st>
This doesn't add any dependency on library internals, since this
only is a static inline function that gets built into each of the
calling functions - this is only to reduce the code duplication.
Signed-off-by: Martin Storsjö <martin@martin.st>
Also see [FFmpeg-devel] [PATCH] avformat/mov: strengthen some table allocations
which contains more fixes but is unfinished
Fixes: signal_sigabrt_7ffff6ac7bb9_3484_cov_1830000177_starfox2.mov
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This allows setting the right fragment number if doing
random-access writing of fragments, and also allows reading the
current sequence number.
Signed-off-by: Martin Storsjö <martin@martin.st>
This allows creating a later mp4 fragment without sequentially
writing the earlier ones before (when called from a segmenter).
Normally when writing a fragmented mp4 file sequentially, the
first timestamps of a fragment are adjusted to match the
end of the previous fragment, to make sure the timestamp is the
same, even if it is calculated as the sum of previous fragment
durations. (And for the first packet in a file, the offset of
the first packet is written using an edit list.)
When writing an individual mp4 fragment discontinuously like this
(with potentially writing the earlier fragments separately later),
there's a risk of getting a gap in the timeline if the duration
field of the last packet in the previous fragment doesn't match up
with the start time of the next fragment.
Using this requires setting -avoid_negative_ts make_non_negative
(or -avoid_negative_ts 0).
Signed-off-by: Martin Storsjö <martin@martin.st>
Based on discussion and patch from
"[FFmpeg-devel] [PATCH]Do not ask for mxf samples with unknown field dominance"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
When the dimensions are the entire frame ones, and the dispose operation
is to reset to background, or the new frame overwrites the new one, then
consider the frame as a key one.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This makes sure that the internal utf8 path names are handled
properly - the normal file handling functions assume path names
are in the native codepage, which isn't utf8.
This assumes that the tools outside of lavf don't use the mkdir
definition. (The tools don't do the same reading of command line
parameters as wchar either - they probably won't handle all possible
unicode file parameters properly, but at least work more predictably
if no utf8/wchar conversion is involved.)
This is moved further down in os_support.h, since windows.h shouldn't
be included before winsock2.h, while io.h needs to be included before
the manual defines for lseek functions.
Signed-off-by: Martin Storsjö <martin@martin.st>
On windows, rename(2) will fail if the target file exists. On
unix this trick is used to make sure that people reading the file
either will get the full previous file, or the full new version
of the file, but no intermediate version.
Signed-off-by: Martin Storsjö <martin@martin.st>
In order to support multiple IDAT of fdAT chunks following an fcTL one,
transmit all the chunks between two fcTL ones (or between fcTL and IEND
one).
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This makes sure that segments actually start at a keyframe (and
makes sure we don't split segments twice in a row, with one segment
consisting of only a handful of packets), when one stream uses b-frames
while another one doesn't.
Signed-off-by: Martin Storsjö <martin@martin.st>
In current versions of ffmpeg, when streaming to an RTMP server, anytime a packet of type
RTMP_PT_NOTIFY is encountered, the packet is prepended with @setDataFrame before it gets sent
to the server. This is incorrect; only packets for onMetaData and |RtmpSampleAccess should
invoke @setDataFrame on the RTMP server. Specifically, the current bug manifests
itself when trying to stream onTextData or onCuePoint invocations.
This fix addresses that problem and ensures that the @setDataFrame is only prepended
for onMetaData and |RtmpSampleAccess.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Don't write any bitrate attribute if it isn't known. As long as one
doesn't want automatic bitrate switching, playback can work just
fine even if it isn't set.
If strict standard compliance is requested, this is still considered
an error, since the attribute is mandatory according to the spec.
Based on a patch by Rodger Combs.
Signed-off-by: Martin Storsjö <martin@martin.st>