Libav
vsrc_testsrc.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 Nicolas George <nicolas.george@normalesup.org>
3  * Copyright (c) 2011 Stefano Sabatini
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
33 #include <float.h>
34 
35 #include "libavutil/common.h"
36 #include "libavutil/mathematics.h"
37 #include "libavutil/opt.h"
38 #include "libavutil/intreadwrite.h"
39 #include "libavutil/parseutils.h"
40 #include "avfilter.h"
41 #include "formats.h"
42 #include "internal.h"
43 #include "video.h"
44 
45 typedef struct TestSourceContext {
46  const AVClass *class;
47  int h, w;
48  unsigned int nb_frame;
50  int64_t pts, max_pts;
51  char *size;
52  char *rate;
53  char *duration;
55 
57 
58  /* only used by rgbtest */
59  int rgba_map[4];
61 
62 #define OFFSET(x) offsetof(TestSourceContext, x)
63 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM
64 
65 static const AVOption testsrc_options[] = {
66  { "size", "set video size", OFFSET(size), AV_OPT_TYPE_STRING, {.str = "320x240"}, .flags = FLAGS },
67  { "s", "set video size", OFFSET(size), AV_OPT_TYPE_STRING, {.str = "320x240"}, .flags = FLAGS },
68  { "rate", "set video rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str = "25"}, .flags = FLAGS },
69  { "r", "set video rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str = "25"}, .flags = FLAGS },
70  { "duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
71  { "sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl = 1}, 0, INT_MAX, FLAGS },
72  { NULL },
73 };
74 
76 {
77  TestSourceContext *test = ctx->priv;
78  int64_t duration = -1;
79  int ret = 0;
80 
81  if ((ret = av_parse_video_size(&test->w, &test->h, test->size)) < 0) {
82  av_log(ctx, AV_LOG_ERROR, "Invalid frame size: '%s'\n", test->size);
83  return ret;
84  }
85 
86  if ((ret = av_parse_video_rate(&test->frame_rate, test->rate)) < 0) {
87  av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", test->rate);
88  return ret;
89  }
90 
91  if ((test->duration) && (ret = av_parse_time(&duration, test->duration, 1)) < 0) {
92  av_log(ctx, AV_LOG_ERROR, "Invalid duration: '%s'\n", test->duration);
93  return ret;
94  }
95 
96  test->time_base = av_inv_q(test->frame_rate);
97  test->max_pts = duration >= 0 ?
98  av_rescale_q(duration, AV_TIME_BASE_Q, test->time_base) : -1;
99  test->nb_frame = 0;
100  test->pts = 0;
101 
102  av_log(ctx, AV_LOG_DEBUG, "size:%dx%d rate:%d/%d duration:%f sar:%d/%d\n",
103  test->w, test->h, test->frame_rate.num, test->frame_rate.den,
104  duration < 0 ? -1 : test->max_pts * av_q2d(test->time_base),
105  test->sar.num, test->sar.den);
106  return 0;
107 }
108 
109 static int config_props(AVFilterLink *outlink)
110 {
111  TestSourceContext *test = outlink->src->priv;
112 
113  outlink->w = test->w;
114  outlink->h = test->h;
115  outlink->sample_aspect_ratio = test->sar;
116  outlink->frame_rate = test->frame_rate;
117  outlink->time_base = test->time_base;
118 
119  return 0;
120 }
121 
122 static int request_frame(AVFilterLink *outlink)
123 {
124  TestSourceContext *test = outlink->src->priv;
125  AVFrame *frame;
126 
127  if (test->max_pts >= 0 && test->pts > test->max_pts)
128  return AVERROR_EOF;
129  frame = ff_get_video_buffer(outlink, test->w, test->h);
130  if (!frame)
131  return AVERROR(ENOMEM);
132 
133  frame->pts = test->pts++;
134  frame->key_frame = 1;
135  frame->interlaced_frame = 0;
136  frame->pict_type = AV_PICTURE_TYPE_I;
137  frame->sample_aspect_ratio = test->sar;
138  test->nb_frame++;
139  test->fill_picture_fn(outlink->src, frame);
140 
141  return ff_filter_frame(outlink, frame);
142 }
143 
144 #if CONFIG_TESTSRC_FILTER
145 
146 static const char *testsrc_get_name(void *ctx)
147 {
148  return "testsrc";
149 }
150 
151 static const AVClass testsrc_class = {
152  .class_name = "TestSourceContext",
153  .item_name = testsrc_get_name,
154  .option = testsrc_options,
155 };
156 
169 static void draw_rectangle(unsigned val, uint8_t *dst, int dst_linesize, unsigned segment_width,
170  unsigned x, unsigned y, unsigned w, unsigned h)
171 {
172  int i;
173  int step = 3;
174 
175  dst += segment_width * (step * x + y * dst_linesize);
176  w *= segment_width * step;
177  h *= segment_width;
178  for (i = 0; i < h; i++) {
179  memset(dst, val, w);
180  dst += dst_linesize;
181  }
182 }
183 
184 static void draw_digit(int digit, uint8_t *dst, unsigned dst_linesize,
185  unsigned segment_width)
186 {
187 #define TOP_HBAR 1
188 #define MID_HBAR 2
189 #define BOT_HBAR 4
190 #define LEFT_TOP_VBAR 8
191 #define LEFT_BOT_VBAR 16
192 #define RIGHT_TOP_VBAR 32
193 #define RIGHT_BOT_VBAR 64
194  struct segments {
195  int x, y, w, h;
196  } segments[] = {
197  { 1, 0, 5, 1 }, /* TOP_HBAR */
198  { 1, 6, 5, 1 }, /* MID_HBAR */
199  { 1, 12, 5, 1 }, /* BOT_HBAR */
200  { 0, 1, 1, 5 }, /* LEFT_TOP_VBAR */
201  { 0, 7, 1, 5 }, /* LEFT_BOT_VBAR */
202  { 6, 1, 1, 5 }, /* RIGHT_TOP_VBAR */
203  { 6, 7, 1, 5 } /* RIGHT_BOT_VBAR */
204  };
205  static const unsigned char masks[10] = {
206  /* 0 */ TOP_HBAR |BOT_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
207  /* 1 */ RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
208  /* 2 */ TOP_HBAR|MID_HBAR|BOT_HBAR|LEFT_BOT_VBAR |RIGHT_TOP_VBAR,
209  /* 3 */ TOP_HBAR|MID_HBAR|BOT_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
210  /* 4 */ MID_HBAR |LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
211  /* 5 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_BOT_VBAR,
212  /* 6 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR |RIGHT_BOT_VBAR,
213  /* 7 */ TOP_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
214  /* 8 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
215  /* 9 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
216  };
217  unsigned mask = masks[digit];
218  int i;
219 
220  draw_rectangle(0, dst, dst_linesize, segment_width, 0, 0, 8, 13);
221  for (i = 0; i < FF_ARRAY_ELEMS(segments); i++)
222  if (mask & (1<<i))
223  draw_rectangle(255, dst, dst_linesize, segment_width,
224  segments[i].x, segments[i].y, segments[i].w, segments[i].h);
225 }
226 
227 #define GRADIENT_SIZE (6 * 256)
228 
229 static void test_fill_picture(AVFilterContext *ctx, AVFrame *frame)
230 {
231  TestSourceContext *test = ctx->priv;
232  uint8_t *p, *p0;
233  int x, y;
234  int color, color_rest;
235  int icolor;
236  int radius;
237  int quad0, quad;
238  int dquad_x, dquad_y;
239  int grad, dgrad, rgrad, drgrad;
240  int seg_size;
241  int second;
242  int i;
243  uint8_t *data = frame->data[0];
244  int width = frame->width;
245  int height = frame->height;
246 
247  /* draw colored bars and circle */
248  radius = (width + height) / 4;
249  quad0 = width * width / 4 + height * height / 4 - radius * radius;
250  dquad_y = 1 - height;
251  p0 = data;
252  for (y = 0; y < height; y++) {
253  p = p0;
254  color = 0;
255  color_rest = 0;
256  quad = quad0;
257  dquad_x = 1 - width;
258  for (x = 0; x < width; x++) {
259  icolor = color;
260  if (quad < 0)
261  icolor ^= 7;
262  quad += dquad_x;
263  dquad_x += 2;
264  *(p++) = icolor & 1 ? 255 : 0;
265  *(p++) = icolor & 2 ? 255 : 0;
266  *(p++) = icolor & 4 ? 255 : 0;
267  color_rest += 8;
268  if (color_rest >= width) {
269  color_rest -= width;
270  color++;
271  }
272  }
273  quad0 += dquad_y;
274  dquad_y += 2;
275  p0 += frame->linesize[0];
276  }
277 
278  /* draw sliding color line */
279  p = data + frame->linesize[0] * height * 3/4;
280  grad = (256 * test->nb_frame * test->time_base.num / test->time_base.den) %
281  GRADIENT_SIZE;
282  rgrad = 0;
283  dgrad = GRADIENT_SIZE / width;
284  drgrad = GRADIENT_SIZE % width;
285  for (x = 0; x < width; x++) {
286  *(p++) =
287  grad < 256 || grad >= 5 * 256 ? 255 :
288  grad >= 2 * 256 && grad < 4 * 256 ? 0 :
289  grad < 2 * 256 ? 2 * 256 - 1 - grad : grad - 4 * 256;
290  *(p++) =
291  grad >= 4 * 256 ? 0 :
292  grad >= 1 * 256 && grad < 3 * 256 ? 255 :
293  grad < 1 * 256 ? grad : 4 * 256 - 1 - grad;
294  *(p++) =
295  grad < 2 * 256 ? 0 :
296  grad >= 3 * 256 && grad < 5 * 256 ? 255 :
297  grad < 3 * 256 ? grad - 2 * 256 : 6 * 256 - 1 - grad;
298  grad += dgrad;
299  rgrad += drgrad;
300  if (rgrad >= GRADIENT_SIZE) {
301  grad++;
302  rgrad -= GRADIENT_SIZE;
303  }
304  if (grad >= GRADIENT_SIZE)
305  grad -= GRADIENT_SIZE;
306  }
307  for (y = height / 8; y > 0; y--) {
308  memcpy(p, p - frame->linesize[0], 3 * width);
309  p += frame->linesize[0];
310  }
311 
312  /* draw digits */
313  seg_size = width / 80;
314  if (seg_size >= 1 && height >= 13 * seg_size) {
315  second = test->nb_frame * test->time_base.num / test->time_base.den;
316  x = width - (width - seg_size * 64) / 2;
317  y = (height - seg_size * 13) / 2;
318  p = data + (x*3 + y * frame->linesize[0]);
319  for (i = 0; i < 8; i++) {
320  p -= 3 * 8 * seg_size;
321  draw_digit(second % 10, p, frame->linesize[0], seg_size);
322  second /= 10;
323  if (second == 0)
324  break;
325  }
326  }
327 }
328 
329 static av_cold int test_init(AVFilterContext *ctx)
330 {
331  TestSourceContext *test = ctx->priv;
332 
333  test->fill_picture_fn = test_fill_picture;
334  return init_common(ctx);
335 }
336 
337 static int test_query_formats(AVFilterContext *ctx)
338 {
339  static const enum AVPixelFormat pix_fmts[] = {
341  };
343  return 0;
344 }
345 
346 static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = {
347  {
348  .name = "default",
349  .type = AVMEDIA_TYPE_VIDEO,
350  .request_frame = request_frame,
351  .config_props = config_props,
352  },
353  { NULL }
354 };
355 
356 AVFilter ff_vsrc_testsrc = {
357  .name = "testsrc",
358  .description = NULL_IF_CONFIG_SMALL("Generate test pattern."),
359  .priv_size = sizeof(TestSourceContext),
360  .priv_class = &testsrc_class,
361  .init = test_init,
362 
363  .query_formats = test_query_formats,
364 
365  .inputs = NULL,
366 
367  .outputs = avfilter_vsrc_testsrc_outputs,
368 };
369 
370 #endif /* CONFIG_TESTSRC_FILTER */
371 
372 #if CONFIG_RGBTESTSRC_FILTER
373 
374 static const char *rgbtestsrc_get_name(void *ctx)
375 {
376  return "rgbtestsrc";
377 }
378 
379 static const AVClass rgbtestsrc_class = {
380  .class_name = "RGBTestSourceContext",
381  .item_name = rgbtestsrc_get_name,
382  .option = testsrc_options,
383 };
384 
385 #define R 0
386 #define G 1
387 #define B 2
388 #define A 3
389 
390 static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize,
391  int x, int y, int r, int g, int b, enum AVPixelFormat fmt,
392  int rgba_map[4])
393 {
394  int32_t v;
395  uint8_t *p;
396 
397  switch (fmt) {
398  case AV_PIX_FMT_BGR444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4); break;
399  case AV_PIX_FMT_RGB444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b >> 4) << 8) | ((g >> 4) << 4) | (r >> 4); break;
400  case AV_PIX_FMT_BGR555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<10) | ((g>>3)<<5) | (b>>3); break;
401  case AV_PIX_FMT_RGB555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<10) | ((g>>3)<<5) | (r>>3); break;
402  case AV_PIX_FMT_BGR565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<11) | ((g>>2)<<5) | (b>>3); break;
403  case AV_PIX_FMT_RGB565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<11) | ((g>>2)<<5) | (r>>3); break;
404  case AV_PIX_FMT_RGB24:
405  case AV_PIX_FMT_BGR24:
406  v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8));
407  p = dst + 3*x + y*dst_linesize;
408  AV_WL24(p, v);
409  break;
410  case AV_PIX_FMT_RGBA:
411  case AV_PIX_FMT_BGRA:
412  case AV_PIX_FMT_ARGB:
413  case AV_PIX_FMT_ABGR:
414  v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8));
415  p = dst + 4*x + y*dst_linesize;
416  AV_WL32(p, v);
417  break;
418  }
419 }
420 
421 static void rgbtest_fill_picture(AVFilterContext *ctx, AVFrame *frame)
422 {
423  TestSourceContext *test = ctx->priv;
424  int x, y, w = frame->width, h = frame->height;
425 
426  for (y = 0; y < h; y++) {
427  for (x = 0; x < w; x++) {
428  int c = 256*x/w;
429  int r = 0, g = 0, b = 0;
430 
431  if (3*y < h ) r = c;
432  else if (3*y < 2*h) g = c;
433  else b = c;
434 
435  rgbtest_put_pixel(frame->data[0], frame->linesize[0], x, y, r, g, b,
436  ctx->outputs[0]->format, test->rgba_map);
437  }
438  }
439 }
440 
441 static av_cold int rgbtest_init(AVFilterContext *ctx)
442 {
443  TestSourceContext *test = ctx->priv;
444 
445  test->fill_picture_fn = rgbtest_fill_picture;
446  return init_common(ctx);
447 }
448 
449 static int rgbtest_query_formats(AVFilterContext *ctx)
450 {
451  static const enum AVPixelFormat pix_fmts[] = {
458  };
460  return 0;
461 }
462 
463 static int rgbtest_config_props(AVFilterLink *outlink)
464 {
465  TestSourceContext *test = outlink->src->priv;
466 
467  switch (outlink->format) {
468  case AV_PIX_FMT_ARGB: test->rgba_map[A] = 0; test->rgba_map[R] = 1; test->rgba_map[G] = 2; test->rgba_map[B] = 3; break;
469  case AV_PIX_FMT_ABGR: test->rgba_map[A] = 0; test->rgba_map[B] = 1; test->rgba_map[G] = 2; test->rgba_map[R] = 3; break;
470  case AV_PIX_FMT_RGBA:
471  case AV_PIX_FMT_RGB24: test->rgba_map[R] = 0; test->rgba_map[G] = 1; test->rgba_map[B] = 2; test->rgba_map[A] = 3; break;
472  case AV_PIX_FMT_BGRA:
473  case AV_PIX_FMT_BGR24: test->rgba_map[B] = 0; test->rgba_map[G] = 1; test->rgba_map[R] = 2; test->rgba_map[A] = 3; break;
474  }
475 
476  return config_props(outlink);
477 }
478 
479 static const AVFilterPad avfilter_vsrc_rgbtestsrc_outputs[] = {
480  {
481  .name = "default",
482  .type = AVMEDIA_TYPE_VIDEO,
483  .request_frame = request_frame,
484  .config_props = rgbtest_config_props,
485  },
486  { NULL }
487 };
488 
489 AVFilter ff_vsrc_rgbtestsrc = {
490  .name = "rgbtestsrc",
491  .description = NULL_IF_CONFIG_SMALL("Generate RGB test pattern."),
492  .priv_size = sizeof(TestSourceContext),
493  .priv_class = &rgbtestsrc_class,
494  .init = rgbtest_init,
495 
496  .query_formats = rgbtest_query_formats,
497 
498  .inputs = NULL,
499 
500  .outputs = avfilter_vsrc_rgbtestsrc_outputs,
501 };
502 
503 #endif /* CONFIG_RGBTESTSRC_FILTER */
#define G
Definition: huffyuv.h:50
This structure describes decoded (raw) audio or video data.
Definition: frame.h:140
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
Definition: parseutils.c:127
AVOption.
Definition: opt.h:234
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
Parse str and put in width_ptr and height_ptr the detected values.
Definition: parseutils.c:100
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:259
Main libavfilter public API header.
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:61
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
Definition: parseutils.c:495
#define R
Definition: huffyuv.h:51
static void draw_rectangle(AVFormatContext *s)
Definition: xcbgrab.c:559
int num
numerator
Definition: rational.h:44
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
static int query_formats(AVFilterContext *ctx)
Definition: af_aformat.c:112
#define FF_ARRAY_ELEMS(a)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:57
#define AV_PIX_FMT_RGB444
Definition: pixfmt.h:252
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:165
const char * name
Pad name.
Definition: internal.h:41
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:39
#define AV_WL24(p, d)
Definition: intreadwrite.h:437
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:747
uint8_t
#define av_cold
Definition: attributes.h:66
AVOptions.
Definition: vf_drawbox.c:37
#define b
Definition: input.c:52
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:211
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:91
const char data[16]
Definition: mxf.c:70
static double av_q2d(AVRational a)
Convert rational to double.
Definition: rational.h:69
static int request_frame(AVFilterLink *outlink)
Definition: vsrc_testsrc.c:122
static const AVOption testsrc_options[]
Definition: vsrc_testsrc.c:65
#define AVERROR_EOF
End of file.
Definition: error.h:51
int interlaced_frame
The content of the picture is interlaced.
Definition: frame.h:263
void 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:389
#define B
Definition: huffyuv.h:49
#define r
Definition: input.c:51
A filter pad used for either input or output.
Definition: internal.h:35
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:99
int width
width and height of the video frame
Definition: frame.h:179
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:124
static const uint16_t mask[17]
Definition: lzw.c:38
#define AVERROR(e)
Definition: error.h:43
static av_cold int init_common(AVFilterContext *ctx)
Definition: vsrc_testsrc.c:75
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:148
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:92
g
Definition: yuv2rgb.c:546
void * priv
private data for use by the filter
Definition: avfilter.h:277
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:145
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:89
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:90
AVRational sar
sample aspect ratio
Definition: vsrc_testsrc.c:54
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:201
static int config_props(AVFilterLink *outlink)
Definition: vsrc_testsrc.c:109
int32_t
AVFormatContext * ctx
Definition: movenc.c:48
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:62
#define FLAGS
Definition: vsrc_testsrc.c:63
char * rate
video frame rate
Definition: vsrc_testsrc.c:52
#define AV_PIX_FMT_BGR555
Definition: pixfmt.h:256
NULL
Definition: eval.c:55
static int width
Definition: utils.c:156
void(* fill_picture_fn)(AVFilterContext *ctx, AVFrame *frame)
Definition: vsrc_testsrc.c:56
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:247
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:158
static void test(const char *pattern, const char *host)
Definition: noproxy.c:23
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
Definition: frame.h:206
AVRational frame_rate
Definition: vsrc_testsrc.c:49
Describe the class of an AVClass context structure.
Definition: log.h:34
Filter definition.
Definition: avfilter.h:120
static const AVFilterPad inputs[]
Definition: af_ashowinfo.c:248
static const uint8_t color[NB_LEVELS]
Definition: log.c:62
rational number numerator/denominator
Definition: rational.h:43
const char * name
Filter name.
Definition: avfilter.h:124
static int step
Definition: avplay.c:247
char * duration
total duration of the generated video
Definition: vsrc_testsrc.c:53
misc parsing utilities
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:274
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:257
#define AV_PIX_FMT_BGR565
Definition: pixfmt.h:255
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:122
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:146
AVRational time_base
Definition: vsrc_testsrc.c:49
int height
Definition: gxfenc.c:72
common internal and external API header
unsigned int nb_frame
Definition: vsrc_testsrc.c:48
char * size
video frame size
Definition: vsrc_testsrc.c:51
#define AV_PIX_FMT_BGR444
Definition: pixfmt.h:257
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:251
int den
denominator
Definition: rational.h:45
static av_cold int init(AVCodecParserContext *s)
Definition: h264_parser.c:582
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:196
#define OFFSET(x)
Definition: vsrc_testsrc.c:62
#define AV_PIX_FMT_RGB565
Definition: pixfmt.h:250
An instance of a filter.
Definition: avfilter.h:262
#define AV_WL32(p, val)
Definition: intreadwrite.h:263
int height
Definition: frame.h:179
internal API functions
AVPixelFormat
Pixel format.
Definition: pixfmt.h:57