FFmpeg
vf_stack.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Paul B. Mahol
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "config_components.h"
22 
23 #include "libavutil/avstring.h"
24 #include "libavutil/imgutils.h"
25 #include "libavutil/opt.h"
26 #include "libavutil/parseutils.h"
27 #include "libavutil/pixdesc.h"
28 
29 #include "avfilter.h"
30 #include "drawutils.h"
31 #include "formats.h"
32 #include "internal.h"
33 #include "framesync.h"
34 #include "video.h"
35 
36 typedef struct StackItem {
37  int x[4], y[4];
38  int linesize[4];
39  int height[4];
40 } StackItem;
41 
42 typedef struct StackContext {
43  const AVClass *class;
45  int nb_inputs;
46  char *layout;
47  int shortest;
50  int nb_planes;
51  uint8_t fillcolor[4];
54 
57 
61 } StackContext;
62 
64 {
65  StackContext *s = ctx->priv;
66  int reject_flags = AV_PIX_FMT_FLAG_BITSTREAM |
69 
70  if (s->fillcolor_enable) {
72  }
73 
74  return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags));
75 }
76 
78 {
79  StackContext *s = ctx->priv;
80  int i, ret;
81 
82  if (!strcmp(ctx->filter->name, "vstack"))
83  s->is_vertical = 1;
84 
85  if (!strcmp(ctx->filter->name, "hstack"))
86  s->is_horizontal = 1;
87 
88  s->frames = av_calloc(s->nb_inputs, sizeof(*s->frames));
89  if (!s->frames)
90  return AVERROR(ENOMEM);
91 
92  s->items = av_calloc(s->nb_inputs, sizeof(*s->items));
93  if (!s->items)
94  return AVERROR(ENOMEM);
95 
96  if (!strcmp(ctx->filter->name, "xstack")) {
97  if (strcmp(s->fillcolor_str, "none") &&
98  av_parse_color(s->fillcolor, s->fillcolor_str, -1, ctx) >= 0) {
99  s->fillcolor_enable = 1;
100  } else {
101  s->fillcolor_enable = 0;
102  }
103  if (!s->layout) {
104  if (s->nb_inputs == 2) {
105  s->layout = av_strdup("0_0|w0_0");
106  if (!s->layout)
107  return AVERROR(ENOMEM);
108  } else {
109  av_log(ctx, AV_LOG_ERROR, "No layout specified.\n");
110  return AVERROR(EINVAL);
111  }
112  }
113  }
114 
115  for (i = 0; i < s->nb_inputs; i++) {
116  AVFilterPad pad = { 0 };
117 
118  pad.type = AVMEDIA_TYPE_VIDEO;
119  pad.name = av_asprintf("input%d", i);
120  if (!pad.name)
121  return AVERROR(ENOMEM);
122 
123  if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0)
124  return ret;
125  }
126 
127  return 0;
128 }
129 
130 static int process_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
131 {
132  StackContext *s = ctx->priv;
133  AVFrame *out = arg;
134  AVFrame **in = s->frames;
135  const int start = (s->nb_inputs * job ) / nb_jobs;
136  const int end = (s->nb_inputs * (job+1)) / nb_jobs;
137 
138  for (int i = start; i < end; i++) {
139  StackItem *item = &s->items[i];
140 
141  for (int p = 0; p < s->nb_planes; p++) {
142  av_image_copy_plane(out->data[p] + out->linesize[p] * item->y[p] + item->x[p],
143  out->linesize[p],
144  in[i]->data[p],
145  in[i]->linesize[p],
146  item->linesize[p], item->height[p]);
147  }
148  }
149 
150  return 0;
151 }
152 
154 {
155  AVFilterContext *ctx = fs->parent;
156  AVFilterLink *outlink = ctx->outputs[0];
157  StackContext *s = fs->opaque;
158  AVFrame **in = s->frames;
159  AVFrame *out;
160  int i, ret;
161 
162  for (i = 0; i < s->nb_inputs; i++) {
163  if ((ret = ff_framesync_get_frame(&s->fs, i, &in[i], 0)) < 0)
164  return ret;
165  }
166 
167  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
168  if (!out)
169  return AVERROR(ENOMEM);
170  out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base);
171  out->sample_aspect_ratio = outlink->sample_aspect_ratio;
172 
173  if (s->fillcolor_enable)
174  ff_fill_rectangle(&s->draw, &s->color, out->data, out->linesize,
175  0, 0, outlink->w, outlink->h);
176 
178  FFMIN(s->nb_inputs, ff_filter_get_nb_threads(ctx)));
179 
180  return ff_filter_frame(outlink, out);
181 }
182 
183 static int config_output(AVFilterLink *outlink)
184 {
185  AVFilterContext *ctx = outlink->src;
186  StackContext *s = ctx->priv;
187  AVRational frame_rate = ctx->inputs[0]->frame_rate;
188  AVRational sar = ctx->inputs[0]->sample_aspect_ratio;
189  int height = ctx->inputs[0]->h;
190  int width = ctx->inputs[0]->w;
191  FFFrameSyncIn *in;
192  int i, ret;
193 
194  s->desc = av_pix_fmt_desc_get(outlink->format);
195  if (!s->desc)
196  return AVERROR_BUG;
197 
198  if (s->is_vertical) {
199  for (i = 0; i < s->nb_inputs; i++) {
200  AVFilterLink *inlink = ctx->inputs[i];
201  StackItem *item = &s->items[i];
202 
203  if (ctx->inputs[i]->w != width) {
204  av_log(ctx, AV_LOG_ERROR, "Input %d width %d does not match input %d width %d.\n", i, ctx->inputs[i]->w, 0, width);
205  return AVERROR(EINVAL);
206  }
207 
208  if ((ret = av_image_fill_linesizes(item->linesize, inlink->format, inlink->w)) < 0) {
209  return ret;
210  }
211 
212  item->height[1] = item->height[2] = AV_CEIL_RSHIFT(inlink->h, s->desc->log2_chroma_h);
213  item->height[0] = item->height[3] = inlink->h;
214 
215  if (i) {
216  item->y[1] = item->y[2] = AV_CEIL_RSHIFT(height, s->desc->log2_chroma_h);
217  item->y[0] = item->y[3] = height;
218 
219  height += ctx->inputs[i]->h;
220  }
221  }
222  } else if (s->is_horizontal) {
223  for (i = 0; i < s->nb_inputs; i++) {
224  AVFilterLink *inlink = ctx->inputs[i];
225  StackItem *item = &s->items[i];
226 
227  if (ctx->inputs[i]->h != height) {
228  av_log(ctx, AV_LOG_ERROR, "Input %d height %d does not match input %d height %d.\n", i, ctx->inputs[i]->h, 0, height);
229  return AVERROR(EINVAL);
230  }
231 
232  if ((ret = av_image_fill_linesizes(item->linesize, inlink->format, inlink->w)) < 0) {
233  return ret;
234  }
235 
236  item->height[1] = item->height[2] = AV_CEIL_RSHIFT(inlink->h, s->desc->log2_chroma_h);
237  item->height[0] = item->height[3] = inlink->h;
238 
239  if (i) {
240  if ((ret = av_image_fill_linesizes(item->x, inlink->format, width)) < 0) {
241  return ret;
242  }
243 
244  width += ctx->inputs[i]->w;
245  }
246  }
247  } else {
248  char *arg, *p = s->layout, *saveptr = NULL;
249  char *arg2, *p2, *saveptr2 = NULL;
250  char *arg3, *p3, *saveptr3 = NULL;
251  int inw, inh, size;
252 
253  if (s->fillcolor_enable) {
254  ff_draw_init(&s->draw, ctx->inputs[0]->format, 0);
255  ff_draw_color(&s->draw, &s->color, s->fillcolor);
256  }
257 
258  for (i = 0; i < s->nb_inputs; i++) {
259  AVFilterLink *inlink = ctx->inputs[i];
260  StackItem *item = &s->items[i];
261 
262  if (!(arg = av_strtok(p, "|", &saveptr)))
263  return AVERROR(EINVAL);
264 
265  p = NULL;
266 
267  if ((ret = av_image_fill_linesizes(item->linesize, inlink->format, inlink->w)) < 0) {
268  return ret;
269  }
270 
271  item->height[1] = item->height[2] = AV_CEIL_RSHIFT(inlink->h, s->desc->log2_chroma_h);
272  item->height[0] = item->height[3] = inlink->h;
273 
274  p2 = arg;
275  inw = inh = 0;
276 
277  for (int j = 0; j < 2; j++) {
278  if (!(arg2 = av_strtok(p2, "_", &saveptr2)))
279  return AVERROR(EINVAL);
280 
281  p2 = NULL;
282  p3 = arg2;
283  while ((arg3 = av_strtok(p3, "+", &saveptr3))) {
284  p3 = NULL;
285  if (sscanf(arg3, "w%d", &size) == 1) {
286  if (size == i || size < 0 || size >= s->nb_inputs)
287  return AVERROR(EINVAL);
288 
289  if (!j)
290  inw += ctx->inputs[size]->w;
291  else
292  inh += ctx->inputs[size]->w;
293  } else if (sscanf(arg3, "h%d", &size) == 1) {
294  if (size == i || size < 0 || size >= s->nb_inputs)
295  return AVERROR(EINVAL);
296 
297  if (!j)
298  inw += ctx->inputs[size]->h;
299  else
300  inh += ctx->inputs[size]->h;
301  } else if (sscanf(arg3, "%d", &size) == 1) {
302  if (size < 0)
303  return AVERROR(EINVAL);
304 
305  if (!j)
306  inw += size;
307  else
308  inh += size;
309  } else {
310  return AVERROR(EINVAL);
311  }
312  }
313  }
314 
315  if ((ret = av_image_fill_linesizes(item->x, inlink->format, inw)) < 0) {
316  return ret;
317  }
318 
319  item->y[1] = item->y[2] = AV_CEIL_RSHIFT(inh, s->desc->log2_chroma_h);
320  item->y[0] = item->y[3] = inh;
321 
322  width = FFMAX(width, inlink->w + inw);
323  height = FFMAX(height, inlink->h + inh);
324  }
325  }
326 
327  s->nb_planes = av_pix_fmt_count_planes(outlink->format);
328 
329  outlink->w = width;
330  outlink->h = height;
331  outlink->frame_rate = frame_rate;
332  outlink->sample_aspect_ratio = sar;
333 
334  for (i = 1; i < s->nb_inputs; i++) {
335  AVFilterLink *inlink = ctx->inputs[i];
336  if (outlink->frame_rate.num != inlink->frame_rate.num ||
337  outlink->frame_rate.den != inlink->frame_rate.den) {
339  "Video inputs have different frame rates, output will be VFR\n");
340  outlink->frame_rate = av_make_q(1, 0);
341  break;
342  }
343  }
344 
345  if ((ret = ff_framesync_init(&s->fs, ctx, s->nb_inputs)) < 0)
346  return ret;
347 
348  in = s->fs.in;
349  s->fs.opaque = s;
350  s->fs.on_event = process_frame;
351 
352  for (i = 0; i < s->nb_inputs; i++) {
353  AVFilterLink *inlink = ctx->inputs[i];
354 
355  in[i].time_base = inlink->time_base;
356  in[i].sync = 1;
357  in[i].before = EXT_STOP;
358  in[i].after = s->shortest ? EXT_STOP : EXT_INFINITY;
359  }
360 
361  ret = ff_framesync_configure(&s->fs);
362  outlink->time_base = s->fs.time_base;
363 
364  return ret;
365 }
366 
368 {
369  StackContext *s = ctx->priv;
370 
371  ff_framesync_uninit(&s->fs);
372  av_freep(&s->frames);
373  av_freep(&s->items);
374 }
375 
377 {
378  StackContext *s = ctx->priv;
379  return ff_framesync_activate(&s->fs);
380 }
381 
382 #define OFFSET(x) offsetof(StackContext, x)
383 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
384 static const AVOption stack_options[] = {
385  { "inputs", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=2}, 2, INT_MAX, .flags = FLAGS },
386  { "shortest", "force termination when the shortest input terminates", OFFSET(shortest), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = FLAGS },
387  { NULL },
388 };
389 
390 AVFILTER_DEFINE_CLASS_EXT(stack, "(h|v)stack", stack_options);
391 
392 static const AVFilterPad outputs[] = {
393  {
394  .name = "default",
395  .type = AVMEDIA_TYPE_VIDEO,
396  .config_props = config_output,
397  },
398 };
399 
400 #if CONFIG_HSTACK_FILTER
401 
402 const AVFilter ff_vf_hstack = {
403  .name = "hstack",
404  .description = NULL_IF_CONFIG_SMALL("Stack video inputs horizontally."),
405  .priv_class = &stack_class,
406  .priv_size = sizeof(StackContext),
409  .init = init,
410  .uninit = uninit,
411  .activate = activate,
413 };
414 
415 #endif /* CONFIG_HSTACK_FILTER */
416 
417 #if CONFIG_VSTACK_FILTER
418 
419 const AVFilter ff_vf_vstack = {
420  .name = "vstack",
421  .description = NULL_IF_CONFIG_SMALL("Stack video inputs vertically."),
422  .priv_class = &stack_class,
423  .priv_size = sizeof(StackContext),
426  .init = init,
427  .uninit = uninit,
428  .activate = activate,
430 };
431 
432 #endif /* CONFIG_VSTACK_FILTER */
433 
434 #if CONFIG_XSTACK_FILTER
435 
436 static const AVOption xstack_options[] = {
437  { "inputs", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=2}, 2, INT_MAX, .flags = FLAGS },
438  { "layout", "set custom layout", OFFSET(layout), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, .flags = FLAGS },
439  { "shortest", "force termination when the shortest input terminates", OFFSET(shortest), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = FLAGS },
440  { "fill", "set the color for unused pixels", OFFSET(fillcolor_str), AV_OPT_TYPE_STRING, {.str = "none"}, .flags = FLAGS },
441  { NULL },
442 };
443 
444 AVFILTER_DEFINE_CLASS(xstack);
445 
446 const AVFilter ff_vf_xstack = {
447  .name = "xstack",
448  .description = NULL_IF_CONFIG_SMALL("Stack video inputs into custom layout."),
449  .priv_size = sizeof(StackContext),
450  .priv_class = &xstack_class,
453  .init = init,
454  .uninit = uninit,
455  .activate = activate,
457 };
458 
459 #endif /* CONFIG_XSTACK_FILTER */
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:101
StackItem::x
int x[4]
Definition: vf_stack.c:37
FFFrameSyncIn::time_base
AVRational time_base
Time base for the incoming frames.
Definition: framesync.h:96
ff_framesync_configure
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
Definition: framesync.c:119
StackContext::fillcolor
uint8_t fillcolor[4]
Definition: vf_stack.c:51
FFDrawColor
Definition: drawutils.h:48
AVERROR
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
opt.h
StackContext::fillcolor_str
char * fillcolor_str
Definition: vf_stack.c:52
ff_framesync_uninit
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
Definition: framesync.c:285
out
FILE * out
Definition: movenc.c:54
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:999
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2662
av_parse_color
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.
Definition: parseutils.c:356
ff_framesync_get_frame
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an input.
Definition: framesync.c:248
StackContext::fs
FFFrameSync fs
Definition: vf_stack.c:60
inlink
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
Definition: filter_design.txt:212
av_asprintf
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:116
AVFILTER_DEFINE_CLASS_EXT
AVFILTER_DEFINE_CLASS_EXT(stack, "(h|v)stack", stack_options)
StackContext::color
FFDrawColor color
Definition: vf_stack.c:56
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:325
pixdesc.h
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_stack.c:63
AVOption
AVOption.
Definition: opt.h:251
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:167
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:175
FFFrameSync
Frame sync structure.
Definition: framesync.h:146
EXT_INFINITY
@ EXT_INFINITY
Extend the frame to infinity.
Definition: framesync.h:75
video.h
StackContext::shortest
int shortest
Definition: vf_stack.c:47
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:346
av_image_copy_plane
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.
Definition: imgutils.c:374
OFFSET
#define OFFSET(x)
Definition: vf_stack.c:382
formats.h
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2702
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_stack.c:367
EXT_STOP
@ EXT_STOP
Completely stop all streams with this one.
Definition: framesync.h:65
AV_PIX_FMT_FLAG_HWACCEL
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
Definition: pixdesc.h:128
FFFrameSyncIn
Input stream structure.
Definition: framesync.h:81
outputs
static const AVFilterPad outputs[]
Definition: vf_stack.c:392
activate
static int activate(AVFilterContext *ctx)
Definition: vf_stack.c:376
StackContext::nb_planes
int nb_planes
Definition: vf_stack.c:50
FFFrameSyncIn::sync
unsigned sync
Synchronization level: frames on input at the highest sync level will generate output frame events.
Definition: framesync.h:139
AVFILTER_FLAG_DYNAMIC_INPUTS
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
Definition: avfilter.h:116
AVRational::num
int num
Numerator.
Definition: rational.h:59
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:49
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_stack.c:77
av_cold
#define av_cold
Definition: attributes.h:90
ff_set_common_formats
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:749
width
#define width
av_image_fill_linesizes
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.
Definition: imgutils.c:89
s
#define s(width, name)
Definition: cbs_vp9.c:256
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:50
StackItem::height
int height[4]
Definition: vf_stack.c:39
av_strtok
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().
Definition: avstring.c:189
StackContext::is_vertical
int is_vertical
Definition: vf_stack.c:48
ctx
AVFormatContext * ctx
Definition: movenc.c:48
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
ff_draw_init
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
Definition: drawutils.c:79
process_frame
static int process_frame(FFFrameSync *fs)
Definition: vf_stack.c:153
arg
const char * arg
Definition: jacosubdec.c:67
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_stack.c:183
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
fs
#define fs(width, name, subs,...)
Definition: cbs_vp9.c:258
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
ff_append_inpad_free_name
int ff_append_inpad_free_name(AVFilterContext *f, AVFilterPad *p)
Definition: avfilter.c:123
parseutils.h
ff_vf_hstack
const AVFilter ff_vf_hstack
ff_vf_vstack
const AVFilter ff_vf_vstack
StackContext::items
StackItem * items
Definition: vf_stack.c:58
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:116
size
int size
Definition: twinvq_data.h:10344
av_make_q
static AVRational av_make_q(int num, int den)
Create an AVRational.
Definition: rational.h:71
ff_fill_rectangle
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.
Definition: drawutils.c:214
AV_PIX_FMT_FLAG_BITSTREAM
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
Definition: pixdesc.h:124
StackContext::is_horizontal
int is_horizontal
Definition: vf_stack.c:49
StackContext::draw
FFDrawContext draw
Definition: vf_stack.c:55
height
#define height
internal.h
AVFILTER_DEFINE_CLASS
#define AVFILTER_DEFINE_CLASS(fname)
Definition: internal.h:325
StackContext::desc
const AVPixFmtDescriptor * desc
Definition: vf_stack.c:44
layout
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
Definition: filter_design.txt:18
ff_formats_pixdesc_filter
AVFilterFormats * ff_formats_pixdesc_filter(unsigned want, unsigned rej)
Construct a formats list containing all pixel formats with certain properties.
Definition: formats.c:498
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
FLAGS
#define FLAGS
Definition: vf_stack.c:383
ff_draw_supported_pixel_formats
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
Definition: drawutils.c:630
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:783
StackContext::layout
char * layout
Definition: vf_stack.c:46
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
FFDrawContext
Definition: drawutils.h:35
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:55
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:272
ff_draw_color
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
Definition: drawutils.c:141
AVFilter
Filter definition.
Definition: avfilter.h:171
ret
ret
Definition: filter_design.txt:187
AVFilterPad::type
enum AVMediaType type
AVFilterPad type.
Definition: internal.h:60
ff_vf_xstack
const AVFilter ff_vf_xstack
ff_framesync_init
int ff_framesync_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in)
Initialize a frame sync structure.
Definition: framesync.c:79
FFFrameSyncIn::before
enum FFFrameSyncExtMode before
Extrapolation mode for timestamps before the first frame.
Definition: framesync.h:86
StackItem::y
int y[4]
Definition: vf_stack.c:37
framesync.h
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
avfilter.h
StackItem::linesize
int linesize[4]
Definition: vf_stack.c:38
AVFilterContext
An instance of a filter.
Definition: avfilter.h:408
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:127
av_strdup
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:280
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
StackContext::fillcolor_enable
int fillcolor_enable
Definition: vf_stack.c:53
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
StackItem
Definition: vf_stack.c:36
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
process_slice
static int process_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
Definition: vf_stack.c:130
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
StackContext
Definition: vf_stack.c:42
imgutils.h
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:370
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
FFFrameSyncIn::after
enum FFFrameSyncExtMode after
Extrapolation mode for timestamps after the last frame.
Definition: framesync.h:91
ff_framesync_activate
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
Definition: framesync.c:336
avstring.h
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
drawutils.h
ff_filter_execute
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: internal.h:142
AV_PIX_FMT_FLAG_PAL
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Definition: pixdesc.h:120
stack_options
static const AVOption stack_options[]
Definition: vf_stack.c:384
StackContext::nb_inputs
int nb_inputs
Definition: vf_stack.c:45
StackContext::frames
AVFrame ** frames
Definition: vf_stack.c:59