Currently, the url_interrupt_cb callback will abort all IO
after the first received signal. This makes the output files
from e.g. the mov muxer to be unreadable if the transcode is
aborted with ctrl+c.
After this patch, the first signal cleanly breaks out of
the transcoding loop, but won't forcibly abort all IO.
After the second signal is received, the url_interrupt_cb
callback will abort all IO.
Signed-off-by: Martin Storsjö <martin@martin.st>
The new function accepts a slightly more intuitive order of paramters,
and returns an error code, thus allowing applications to report a
meaningful error message.
The new function is a wrapper around
av_vsrc_buffer_add_video_buffer_ref(), and allows to simplify the act
of pushing AVFrame data to the source buffer.
Rename av_vsrc_buffer_add_frame to
av_vsrc_buffer_add_video_buffer_ref(), and change its inteface to make
it accept in input an AVFilterBufferRef rather than an AVFrame.
This way the interface can be used without requiring the
inclusion/installation of libavcodec headers.
Redesign the way -aspect option is handled. This is done by making
ffmpeg read the sample aspect ratio set in the corresponding input
stream by default, and overriding it using the value specified by
-aspect.
If the output display aspect ratio is specified with -aspect, it is
set at the end of the filterchain, thus overriding the value set by
filters in the filterchain.
This implementation is more robust, since does not modify the
filterchain description (which was creating potential syntax errors).
(Cherry-pick abf8342aa9)
Another aspect ratio fix try. This leaves the setdar addition at the end
(preferred by people).
(Cherry-pick e7c7b0d000)
This fixes several bugs like multiple outputs and -aspect mixed with -vf
(cherry picked from commit 1762d9ced7)
(cherry picked from commit 5c20c81bfa)
(cherry picked from commit a7844c580d)
Iam not sure this is the best way to implement it, but its the simplest
and keeps the code seperate from the application. Keeping ffmpeg.c
simple and not requireing user apps to duplicate this code.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Prefer parse_number_or_die() over atoi()/atol() parsing for the options:
-pass, -top, -vc, and -qscale.
Improve input validation.
Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Calculate quality value once per stream in print_report().
Also fix segfault, as coded_frame can be NULL.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Adding _POSIX_C_SOURCE to CPPFLAGS globally produces all sorts of problems
since it causes certain system functions to be hidden on some (BSD) systems.
The solution is to only add the flag on systems that really require it, i.e.
glibc-based ones.
This change makes BSD systems compile out-of-the-box without the need for
adding specific flags manually. It also allows dropping a number of flags
set manually on a file-per-file basis, but were only present to work around
breakage introduced by the presence of _POSIX_C_SOURCE.
Also add _XOPEN_SOURCE to CPPFLAGS for glibc systems. We use XSI extensions
in several places already, so it is preferable to define it globally instead
of littering source files with individual #defines only needed for glibc.
In output_packet(), move the pre_process_video_frame() call inside the
if (ist->decoding_needed) { } block. This way
pre_process_video_frame() is not called when stream-copy has been
selected.
Also simplify.
Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Use av_log() rather than fprintf(stderr, ...), and show information
related to the previous size/pixel format configuration.
Consistent with the corresponding message issued in case of audio
configuration change.
Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Mostly useful for the audio-filters branch, to make more apparent the
distinction between configure_audio_filters() and
configure_video_filters().
Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
The function was only used in opt_sample_fmt() for listing the sample
formats. Move list_fmts() functionality directly into
opt_sample_fmt().
Also fix the warning:
ffmpeg.c: In function ‘opt_audio_sample_fmt’:
ffmpeg.c:2877: warning: passing argument 1 of ‘list_fmts’ from incompatible pointer type
cmdutils.h:163: note: expected ‘void (*)(char *, int, int)’ but argument is of type ‘char * (*)(char *, int, enum AVSampleFormat)’
Signed-off-by: Anton Khirnov <anton@khirnov.net>
The check and the corresponding message in do_video_out() are
unnecessary in the libavfilter path, as a similar check and message
are performed within the buffer source.
Implement lazy initialization of the image resample context, so that
the initialization code does not need to be duplicated.
Also manage the case in which resample/size change mid-stream. For
each packet the code computes if resampling is needed.
Previously the resample check was done only at the initialization, in
case size/format changed and no resample was detected at the init
stage ffmpeg was silently exiting.
avfilter_copy_frame_props() avoids code duplication and increases
robustness.
The added files libavfilter/avcodec.[ch] are used for containing
utilities useful for gluing togheter libavfilter and libavcodec.