53 #define OFFSET(x) offsetof(ConcatContext, x) 54 #define A AV_OPT_FLAG_AUDIO_PARAM 55 #define F AV_OPT_FLAG_FILTERING_PARAM 56 #define V AV_OPT_FLAG_VIDEO_PARAM 61 {
"v",
"specify the number of video streams",
64 {
"a",
"specify the number of audio streams",
67 {
"unsafe",
"enable unsafe mode",
78 unsigned type, nb_str, idx0 = 0, idx,
str, seg;
83 for (type = 0; type <
TYPE_ALL; type++) {
85 for (str = 0; str < nb_str; str++) {
125 unsigned in_no = out_no, seg;
130 outlink->
w = inlink->
w;
131 outlink->
h = inlink->
h;
141 "Video inputs have different frame rates, output will be VFR\n");
152 if (outlink->
w != inlink->
w ||
153 outlink->
h != inlink->
h ||
158 "(size %dx%d, SAR %d:%d) do not match the corresponding " 159 "output link %s parameters (%dx%d, SAR %d:%d)\n",
180 struct concat_in *
in = &cat->
in[in_no];
191 else if (in->nb_frames >= 2)
193 in->pts =
av_rescale(in->pts, in->nb_frames, in->nb_frames - 1);
221 cat->
in[in_no].
eof = 1;
234 pts = cat->
in[i++].
pts;
235 for (; i < imax; i++)
248 int frame_nb_samples, ret;
256 frame_nb_samples =
FFMAX(9600, rate_tb.
den / 5);
258 frame_nb_samples =
FFMIN(frame_nb_samples, nb_samples);
268 sent += frame_nb_samples;
269 nb_samples -= frame_nb_samples;
278 unsigned str, str_max;
291 for (; str < str_max; str++) {
309 for (type = 0; type <
TYPE_ALL; type++) {
325 for (type = 0; type <
TYPE_ALL; type++) {
372 if (!cat->
in[j].
eof) {
434 char *res,
int res_len,
int flags)
438 if (!strcmp(cmd,
"next")) {
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
static AVFrame * get_audio_buffer(AVFilterLink *inlink, int nb_samples)
static int flush_segment(AVFilterContext *ctx)
static int send_silence(AVFilterContext *ctx, unsigned in_no, unsigned out_no, int64_t seg_delta)
This structure describes decoded (raw) audio or video data.
static av_cold int init(AVFilterContext *ctx)
unsigned nb_streams[TYPE_ALL]
number of out streams of each type
Main libavfilter public API header.
int h
agreed upon image height
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
#define FFERROR_NOT_READY
Filters implementation helper functions.
enum AVMediaType type
AVFilterPad type.
#define FF_OUTLINK_IDX(link)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
struct AVFilterChannelLayouts * in_channel_layouts
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
static int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
static av_cold void uninit(AVFilterContext *ctx)
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
AVFilterPad * output_pads
array of output pads
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
static int push_frame(AVFilterContext *ctx, unsigned in_no, AVFrame *buf)
#define AV_LOG_VERBOSE
Detailed information.
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
static int activate(AVFilterContext *ctx)
AVFilterPad * input_pads
array of input pads
#define i(width, name, range_min, range_max)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Fill an audio buffer with silence.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0, will be automatically copied from the first input of the source filter if it exists.
int sample_rate
samples per second
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
unsigned nb_outputs
number of output pads
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
simple assert() macros that are a bit more flexible than ISO C assert().
struct AVFilterChannelLayouts * out_channel_layouts
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
int w
agreed upon image width
char * av_asprintf(const char *fmt,...)
int64_t delta_ts
timestamp to add to produce output timestamps
audio channel layout utility functions
unsigned nb_inputs
number of input pads
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
static void close_input(AVFilterContext *ctx, unsigned in_no)
static void find_next_delta_ts(AVFilterContext *ctx, int64_t *seg_delta)
static const AVClass concat_class
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
AVFilterFormats * out_samplerates
static const AVFilterPad outputs[]
int format
agreed upon media format
A list of supported channel layouts.
AVFilterFormats * in_samplerates
Lists of channel layouts and sample rates used for automatic negotiation.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
static AVRational av_make_q(int num, int den)
Create an AVRational.
unsigned cur_idx
index of the first input of current segment
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Describe the class of an AVClass context structure.
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
Rational number (pair of numerator and denominator).
unsigned nb_in_active
number of active inputs in current segment
void ff_inlink_set_status(AVFilterLink *link, int status)
Set the status on an input link.
const char * name
Filter name.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
#define flags(name, subs,...)
#define FF_INLINK_IDX(link)
Find the index of a link.
static int query_formats(AVFilterContext *ctx)
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
int channels
Number of channels.
static int config_output(AVFilterLink *outlink)
AVFilterContext * dst
dest filter
struct ConcatContext::concat_in * in
AVFILTER_DEFINE_CLASS(concat)
static const AVOption concat_options[]
uint8_t ** extended_data
pointers to the data planes/channels.
static int ff_insert_outpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new output pad for the filter.
int nb_samples
number of audio samples (per channel) described by this frame
AVFilterFormats * out_formats
static int ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter.