Go to the documentation of this file.
68 if (
s->fillcolor_enable) {
80 if (!strcmp(
ctx->filter->name,
"vstack"))
83 if (!strcmp(
ctx->filter->name,
"hstack"))
94 if (!strcmp(
ctx->filter->name,
"xstack")) {
95 if (strcmp(
s->fillcolor_str,
"none") &&
97 s->fillcolor_enable = 1;
99 s->fillcolor_enable = 0;
102 if (
s->nb_inputs == 2) {
113 for (
i = 0;
i <
s->nb_inputs;
i++) {
133 const int start = (
s->nb_inputs * job ) / nb_jobs;
134 const int end = (
s->nb_inputs * (job+1)) / nb_jobs;
136 for (
int i = start;
i < end;
i++) {
139 for (
int p = 0; p <
s->nb_planes; p++) {
160 for (
i = 0;
i <
s->nb_inputs;
i++) {
171 if (
s->fillcolor_enable)
173 0, 0, outlink->
w, outlink->
h);
196 if (
s->is_vertical) {
197 for (
i = 0;
i <
s->nb_inputs;
i++) {
220 }
else if (
s->is_horizontal) {
221 for (
i = 0;
i <
s->nb_inputs;
i++) {
246 char *
arg, *p =
s->layout, *saveptr =
NULL;
247 char *arg2, *p2, *saveptr2 =
NULL;
248 char *arg3, *p3, *saveptr3 =
NULL;
251 if (
s->fillcolor_enable) {
256 for (
i = 0;
i <
s->nb_inputs;
i++) {
275 for (
int j = 0; j < 2; j++) {
276 if (!(arg2 =
av_strtok(p2,
"_", &saveptr2)))
281 while ((arg3 =
av_strtok(p3,
"+", &saveptr3))) {
283 if (sscanf(arg3,
"w%d", &
size) == 1) {
284 if (
size ==
i || size < 0 || size >=
s->nb_inputs)
291 }
else if (sscanf(arg3,
"h%d", &
size) == 1) {
292 if (
size ==
i || size < 0 || size >=
s->nb_inputs)
299 }
else if (sscanf(arg3,
"%d", &
size) == 1) {
318 item->
y[0] = item->
y[3] = inh;
332 for (
i = 1;
i <
s->nb_inputs;
i++) {
337 "Video inputs have different frame rates, output will be VFR\n");
350 for (
i = 0;
i <
s->nb_inputs;
i++) {
380 #define OFFSET(x) offsetof(StackContext, x)
381 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
384 {
"shortest",
"force termination when the shortest input terminates",
OFFSET(shortest),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags =
FLAGS },
398 #if CONFIG_HSTACK_FILTER
403 .priv_class = &stack_class,
415 #if CONFIG_VSTACK_FILTER
420 .priv_class = &stack_class,
432 #if CONFIG_XSTACK_FILTER
434 static const AVOption xstack_options[] = {
437 {
"shortest",
"force termination when the shortest input terminates",
OFFSET(shortest),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags =
FLAGS },
448 .priv_class = &xstack_class,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
AVRational time_base
Time base for the incoming frames.
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx)
Put the RGBA values that correspond to color_string in rgba_color.
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an input.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
char * av_asprintf(const char *fmt,...)
AVFILTER_DEFINE_CLASS_EXT(stack, "(h|v)stack", stack_options)
This structure describes decoded (raw) audio or video data.
static int query_formats(AVFilterContext *ctx)
#define FILTER_QUERY_FUNC(func)
#define AV_LOG_VERBOSE
Detailed information.
const char * name
Filter name.
@ EXT_INFINITY
Extend the frame to infinity.
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
static av_cold void uninit(AVFilterContext *ctx)
@ EXT_STOP
Completely stop all streams with this one.
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
static const AVFilterPad outputs[]
static int activate(AVFilterContext *ctx)
unsigned sync
Synchronization level: frames on input at the highest sync level will generate output frame events.
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
A filter pad used for either input or output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int init(AVFilterContext *ctx)
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
#define AV_CEIL_RSHIFT(a, b)
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
static int process_frame(FFFrameSync *fs)
static int config_output(AVFilterLink *outlink)
Describe the class of an AVClass context structure.
#define fs(width, name, subs,...)
Rational number (pair of numerator and denominator).
int ff_append_inpad_free_name(AVFilterContext *f, AVFilterPad *p)
const AVFilter ff_vf_hstack
const AVFilter ff_vf_vstack
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int format
agreed upon media format
static AVRational av_make_q(int num, int den)
Create an AVRational.
void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_x, int dst_y, int w, int h)
Fill a rectangle with an uniform color.
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
AVFilterContext * src
source filter
#define AVFILTER_DEFINE_CLASS(fname)
const AVPixFmtDescriptor * desc
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
#define i(width, name, range_min, range_max)
int w
agreed upon image width
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
const char * name
Pad name.
void * av_calloc(size_t nmemb, size_t size)
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
enum AVMediaType type
AVFilterPad type.
const AVFilter ff_vf_xstack
int ff_framesync_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in)
Initialize a frame sync structure.
enum FFFrameSyncExtMode before
Extrapolation mode for timestamps before the first frame.
int h
agreed upon image height
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
char * av_strdup(const char *s)
Duplicate a string.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define FILTER_OUTPUTS(array)
static int process_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
enum FFFrameSyncExtMode after
Extrapolation mode for timestamps after the last frame.
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
static const AVOption stack_options[]