vsrc_testsrc.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. /*
  2. * Copyright (c) 2007 Nicolas George <nicolas.george@normalesup.org>
  3. * Copyright (c) 2011 Stefano Sabatini
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg 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. * FFmpeg 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 FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * Misc test sources.
  24. *
  25. * testsrc is based on the test pattern generator demuxer by Nicolas George:
  26. * http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2007-October/037845.html
  27. *
  28. * rgbtestsrc is ported from MPlayer libmpcodecs/vf_rgbtest.c by
  29. * Michael Niedermayer.
  30. */
  31. #include <float.h>
  32. #include "libavutil/opt.h"
  33. #include "libavutil/intreadwrite.h"
  34. #include "libavutil/parseutils.h"
  35. #include "avfilter.h"
  36. typedef struct {
  37. const AVClass *class;
  38. int h, w;
  39. unsigned int nb_frame;
  40. AVRational time_base;
  41. int64_t pts, max_pts;
  42. char *size; ///< video frame size
  43. char *rate; ///< video frame rate
  44. char *duration; ///< total duration of the generated video
  45. AVRational sar; ///< sample aspect ratio
  46. void (* fill_picture_fn)(AVFilterContext *ctx, AVFilterBufferRef *picref);
  47. /* only used by rgbtest */
  48. int rgba_map[4];
  49. } TestSourceContext;
  50. #define OFFSET(x) offsetof(TestSourceContext, x)
  51. static const AVOption testsrc_options[]= {
  52. { "size", "set video size", OFFSET(size), AV_OPT_TYPE_STRING, {.str = "320x240"}, 0, 0 },
  53. { "s", "set video size", OFFSET(size), AV_OPT_TYPE_STRING, {.str = "320x240"}, 0, 0 },
  54. { "rate", "set video rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0 },
  55. { "r", "set video rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0 },
  56. { "duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0 },
  57. { "sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl= 1}, 0, INT_MAX },
  58. { NULL },
  59. };
  60. static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
  61. {
  62. TestSourceContext *test = ctx->priv;
  63. AVRational frame_rate_q;
  64. int64_t duration = -1;
  65. int ret = 0;
  66. av_opt_set_defaults(test);
  67. if ((ret = (av_set_options_string(test, args, "=", ":"))) < 0) {
  68. av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args);
  69. return ret;
  70. }
  71. if ((ret = av_parse_video_size(&test->w, &test->h, test->size)) < 0) {
  72. av_log(ctx, AV_LOG_ERROR, "Invalid frame size: '%s'\n", test->size);
  73. return ret;
  74. }
  75. if ((ret = av_parse_video_rate(&frame_rate_q, test->rate)) < 0 ||
  76. frame_rate_q.den <= 0 || frame_rate_q.num <= 0) {
  77. av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", test->rate);
  78. return ret;
  79. }
  80. if ((test->duration) && (ret = av_parse_time(&duration, test->duration, 1)) < 0) {
  81. av_log(ctx, AV_LOG_ERROR, "Invalid duration: '%s'\n", test->duration);
  82. return ret;
  83. }
  84. test->time_base.num = frame_rate_q.den;
  85. test->time_base.den = frame_rate_q.num;
  86. test->max_pts = duration >= 0 ?
  87. av_rescale_q(duration, AV_TIME_BASE_Q, test->time_base) : -1;
  88. test->nb_frame = 0;
  89. test->pts = 0;
  90. av_log(ctx, AV_LOG_INFO, "size:%dx%d rate:%d/%d duration:%f sar:%d/%d\n",
  91. test->w, test->h, frame_rate_q.num, frame_rate_q.den,
  92. duration < 0 ? -1 : test->max_pts * av_q2d(test->time_base),
  93. test->sar.num, test->sar.den);
  94. return 0;
  95. }
  96. static int config_props(AVFilterLink *outlink)
  97. {
  98. TestSourceContext *test = outlink->src->priv;
  99. outlink->w = test->w;
  100. outlink->h = test->h;
  101. outlink->sample_aspect_ratio = test->sar;
  102. outlink->time_base = test->time_base;
  103. return 0;
  104. }
  105. static int request_frame(AVFilterLink *outlink)
  106. {
  107. TestSourceContext *test = outlink->src->priv;
  108. AVFilterBufferRef *picref;
  109. if (test->max_pts >= 0 && test->pts >= test->max_pts)
  110. return AVERROR_EOF;
  111. picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
  112. test->w, test->h);
  113. picref->pts = test->pts++;
  114. picref->pos = -1;
  115. picref->video->key_frame = 1;
  116. picref->video->interlaced = 0;
  117. picref->video->pict_type = AV_PICTURE_TYPE_I;
  118. picref->video->sample_aspect_ratio = test->sar;
  119. test->fill_picture_fn(outlink->src, picref);
  120. test->nb_frame++;
  121. avfilter_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
  122. avfilter_draw_slice(outlink, 0, picref->video->h, 1);
  123. avfilter_end_frame(outlink);
  124. avfilter_unref_buffer(picref);
  125. return 0;
  126. }
  127. #if CONFIG_NULLSRC_FILTER
  128. static const char *nullsrc_get_name(void *ctx)
  129. {
  130. return "nullsrc";
  131. }
  132. static const AVClass nullsrc_class = {
  133. .class_name = "NullSourceContext",
  134. .item_name = nullsrc_get_name,
  135. .option = testsrc_options,
  136. };
  137. static void nullsrc_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref) { }
  138. static av_cold int nullsrc_init(AVFilterContext *ctx, const char *args, void *opaque)
  139. {
  140. TestSourceContext *test = ctx->priv;
  141. test->class = &nullsrc_class;
  142. test->fill_picture_fn = nullsrc_fill_picture;
  143. return init(ctx, args, opaque);
  144. }
  145. AVFilter avfilter_vsrc_nullsrc = {
  146. .name = "nullsrc",
  147. .description = NULL_IF_CONFIG_SMALL("Null video source, return unprocessed video frames."),
  148. .init = nullsrc_init,
  149. .priv_size = sizeof(TestSourceContext),
  150. .inputs = (const AVFilterPad[]) {{ .name = NULL}},
  151. .outputs = (const AVFilterPad[]) {{ .name = "default",
  152. .type = AVMEDIA_TYPE_VIDEO,
  153. .request_frame = request_frame,
  154. .config_props = config_props, },
  155. { .name = NULL}},
  156. };
  157. #endif /* CONFIG_NULLSRC_FILTER */
  158. #if CONFIG_TESTSRC_FILTER
  159. static const char *testsrc_get_name(void *ctx)
  160. {
  161. return "testsrc";
  162. }
  163. static const AVClass testsrc_class = {
  164. .class_name = "TestSourceContext",
  165. .item_name = testsrc_get_name,
  166. .option = testsrc_options,
  167. };
  168. /**
  169. * Fill a rectangle with value val.
  170. *
  171. * @param val the RGB value to set
  172. * @param dst pointer to the destination buffer to fill
  173. * @param dst_linesize linesize of destination
  174. * @param segment_width width of the segment
  175. * @param x horizontal coordinate where to draw the rectangle in the destination buffer
  176. * @param y horizontal coordinate where to draw the rectangle in the destination buffer
  177. * @param w width of the rectangle to draw, expressed as a number of segment_width units
  178. * @param h height of the rectangle to draw, expressed as a number of segment_width units
  179. */
  180. static void draw_rectangle(unsigned val, uint8_t *dst, int dst_linesize, unsigned segment_width,
  181. unsigned x, unsigned y, unsigned w, unsigned h)
  182. {
  183. int i;
  184. int step = 3;
  185. dst += segment_width * (step * x + y * dst_linesize);
  186. w *= segment_width * step;
  187. h *= segment_width;
  188. for (i = 0; i < h; i++) {
  189. memset(dst, val, w);
  190. dst += dst_linesize;
  191. }
  192. }
  193. static void draw_digit(int digit, uint8_t *dst, unsigned dst_linesize,
  194. unsigned segment_width)
  195. {
  196. #define TOP_HBAR 1
  197. #define MID_HBAR 2
  198. #define BOT_HBAR 4
  199. #define LEFT_TOP_VBAR 8
  200. #define LEFT_BOT_VBAR 16
  201. #define RIGHT_TOP_VBAR 32
  202. #define RIGHT_BOT_VBAR 64
  203. struct {
  204. int x, y, w, h;
  205. } segments[] = {
  206. { 1, 0, 5, 1 }, /* TOP_HBAR */
  207. { 1, 6, 5, 1 }, /* MID_HBAR */
  208. { 1, 12, 5, 1 }, /* BOT_HBAR */
  209. { 0, 1, 1, 5 }, /* LEFT_TOP_VBAR */
  210. { 0, 7, 1, 5 }, /* LEFT_BOT_VBAR */
  211. { 6, 1, 1, 5 }, /* RIGHT_TOP_VBAR */
  212. { 6, 7, 1, 5 } /* RIGHT_BOT_VBAR */
  213. };
  214. static const unsigned char masks[10] = {
  215. /* 0 */ TOP_HBAR |BOT_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
  216. /* 1 */ RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
  217. /* 2 */ TOP_HBAR|MID_HBAR|BOT_HBAR|LEFT_BOT_VBAR |RIGHT_TOP_VBAR,
  218. /* 3 */ TOP_HBAR|MID_HBAR|BOT_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
  219. /* 4 */ MID_HBAR |LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
  220. /* 5 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_BOT_VBAR,
  221. /* 6 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR |RIGHT_BOT_VBAR,
  222. /* 7 */ TOP_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
  223. /* 8 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
  224. /* 9 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
  225. };
  226. unsigned mask = masks[digit];
  227. int i;
  228. draw_rectangle(0, dst, dst_linesize, segment_width, 0, 0, 8, 13);
  229. for (i = 0; i < FF_ARRAY_ELEMS(segments); i++)
  230. if (mask & (1<<i))
  231. draw_rectangle(255, dst, dst_linesize, segment_width,
  232. segments[i].x, segments[i].y, segments[i].w, segments[i].h);
  233. }
  234. #define GRADIENT_SIZE (6 * 256)
  235. static void test_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref)
  236. {
  237. TestSourceContext *test = ctx->priv;
  238. uint8_t *p, *p0;
  239. int x, y;
  240. int color, color_rest;
  241. int icolor;
  242. int radius;
  243. int quad0, quad;
  244. int dquad_x, dquad_y;
  245. int grad, dgrad, rgrad, drgrad;
  246. int seg_size;
  247. int second;
  248. int i;
  249. uint8_t *data = picref->data[0];
  250. int width = picref->video->w;
  251. int height = picref->video->h;
  252. /* draw colored bars and circle */
  253. radius = (width + height) / 4;
  254. quad0 = width * width / 4 + height * height / 4 - radius * radius;
  255. dquad_y = 1 - height;
  256. p0 = data;
  257. for (y = 0; y < height; y++) {
  258. p = p0;
  259. color = 0;
  260. color_rest = 0;
  261. quad = quad0;
  262. dquad_x = 1 - width;
  263. for (x = 0; x < width; x++) {
  264. icolor = color;
  265. if (quad < 0)
  266. icolor ^= 7;
  267. quad += dquad_x;
  268. dquad_x += 2;
  269. *(p++) = icolor & 1 ? 255 : 0;
  270. *(p++) = icolor & 2 ? 255 : 0;
  271. *(p++) = icolor & 4 ? 255 : 0;
  272. color_rest += 8;
  273. if (color_rest >= width) {
  274. color_rest -= width;
  275. color++;
  276. }
  277. }
  278. quad0 += dquad_y;
  279. dquad_y += 2;
  280. p0 += picref->linesize[0];
  281. }
  282. /* draw sliding color line */
  283. p0 = p = data + picref->linesize[0] * height * 3/4;
  284. grad = (256 * test->nb_frame * test->time_base.num / test->time_base.den) %
  285. GRADIENT_SIZE;
  286. rgrad = 0;
  287. dgrad = GRADIENT_SIZE / width;
  288. drgrad = GRADIENT_SIZE % width;
  289. for (x = 0; x < width; x++) {
  290. *(p++) =
  291. grad < 256 || grad >= 5 * 256 ? 255 :
  292. grad >= 2 * 256 && grad < 4 * 256 ? 0 :
  293. grad < 2 * 256 ? 2 * 256 - 1 - grad : grad - 4 * 256;
  294. *(p++) =
  295. grad >= 4 * 256 ? 0 :
  296. grad >= 1 * 256 && grad < 3 * 256 ? 255 :
  297. grad < 1 * 256 ? grad : 4 * 256 - 1 - grad;
  298. *(p++) =
  299. grad < 2 * 256 ? 0 :
  300. grad >= 3 * 256 && grad < 5 * 256 ? 255 :
  301. grad < 3 * 256 ? grad - 2 * 256 : 6 * 256 - 1 - grad;
  302. grad += dgrad;
  303. rgrad += drgrad;
  304. if (rgrad >= GRADIENT_SIZE) {
  305. grad++;
  306. rgrad -= GRADIENT_SIZE;
  307. }
  308. if (grad >= GRADIENT_SIZE)
  309. grad -= GRADIENT_SIZE;
  310. }
  311. p = p0;
  312. for (y = height / 8; y > 0; y--) {
  313. memcpy(p+picref->linesize[0], p, 3 * width);
  314. p += picref->linesize[0];
  315. }
  316. /* draw digits */
  317. seg_size = width / 80;
  318. if (seg_size >= 1 && height >= 13 * seg_size) {
  319. second = test->nb_frame * test->time_base.num / test->time_base.den;
  320. x = width - (width - seg_size * 64) / 2;
  321. y = (height - seg_size * 13) / 2;
  322. p = data + (x*3 + y * picref->linesize[0]);
  323. for (i = 0; i < 8; i++) {
  324. p -= 3 * 8 * seg_size;
  325. draw_digit(second % 10, p, picref->linesize[0], seg_size);
  326. second /= 10;
  327. if (second == 0)
  328. break;
  329. }
  330. }
  331. }
  332. static av_cold int test_init(AVFilterContext *ctx, const char *args, void *opaque)
  333. {
  334. TestSourceContext *test = ctx->priv;
  335. test->class = &testsrc_class;
  336. test->fill_picture_fn = test_fill_picture;
  337. return init(ctx, args, opaque);
  338. }
  339. static int test_query_formats(AVFilterContext *ctx)
  340. {
  341. static const enum PixelFormat pix_fmts[] = {
  342. PIX_FMT_RGB24, PIX_FMT_NONE
  343. };
  344. avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
  345. return 0;
  346. }
  347. AVFilter avfilter_vsrc_testsrc = {
  348. .name = "testsrc",
  349. .description = NULL_IF_CONFIG_SMALL("Generate test pattern."),
  350. .priv_size = sizeof(TestSourceContext),
  351. .init = test_init,
  352. .query_formats = test_query_formats,
  353. .inputs = (const AVFilterPad[]) {{ .name = NULL}},
  354. .outputs = (const AVFilterPad[]) {{ .name = "default",
  355. .type = AVMEDIA_TYPE_VIDEO,
  356. .request_frame = request_frame,
  357. .config_props = config_props, },
  358. { .name = NULL }},
  359. };
  360. #endif /* CONFIG_TESTSRC_FILTER */
  361. #if CONFIG_RGBTESTSRC_FILTER
  362. static const char *rgbtestsrc_get_name(void *ctx)
  363. {
  364. return "rgbtestsrc";
  365. }
  366. static const AVClass rgbtestsrc_class = {
  367. .class_name = "RGBTestSourceContext",
  368. .item_name = rgbtestsrc_get_name,
  369. .option = testsrc_options,
  370. };
  371. #define R 0
  372. #define G 1
  373. #define B 2
  374. #define A 3
  375. static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize,
  376. int x, int y, int r, int g, int b, enum PixelFormat fmt,
  377. int rgba_map[4])
  378. {
  379. int32_t v;
  380. uint8_t *p;
  381. switch (fmt) {
  382. case PIX_FMT_BGR444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4); break;
  383. case PIX_FMT_RGB444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b >> 4) << 8) | ((g >> 4) << 4) | (r >> 4); break;
  384. case PIX_FMT_BGR555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<10) | ((g>>3)<<5) | (b>>3); break;
  385. case PIX_FMT_RGB555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<10) | ((g>>3)<<5) | (r>>3); break;
  386. case PIX_FMT_BGR565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<11) | ((g>>2)<<5) | (b>>3); break;
  387. case PIX_FMT_RGB565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<11) | ((g>>2)<<5) | (r>>3); break;
  388. case PIX_FMT_RGB24:
  389. case PIX_FMT_BGR24:
  390. v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8));
  391. p = dst + 3*x + y*dst_linesize;
  392. AV_WL24(p, v);
  393. break;
  394. case PIX_FMT_RGBA:
  395. case PIX_FMT_BGRA:
  396. case PIX_FMT_ARGB:
  397. case PIX_FMT_ABGR:
  398. v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8));
  399. p = dst + 4*x + y*dst_linesize;
  400. AV_WL32(p, v);
  401. break;
  402. }
  403. }
  404. static void rgbtest_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref)
  405. {
  406. TestSourceContext *test = ctx->priv;
  407. int x, y, w = picref->video->w, h = picref->video->h;
  408. for (y = 0; y < h; y++) {
  409. for (x = 0; x < picref->video->w; x++) {
  410. int c = 256*x/w;
  411. int r = 0, g = 0, b = 0;
  412. if (3*y < h ) r = c;
  413. else if (3*y < 2*h) g = c;
  414. else b = c;
  415. rgbtest_put_pixel(picref->data[0], picref->linesize[0], x, y, r, g, b,
  416. ctx->outputs[0]->format, test->rgba_map);
  417. }
  418. }
  419. }
  420. static av_cold int rgbtest_init(AVFilterContext *ctx, const char *args, void *opaque)
  421. {
  422. TestSourceContext *test = ctx->priv;
  423. test->class = &rgbtestsrc_class;
  424. test->fill_picture_fn = rgbtest_fill_picture;
  425. return init(ctx, args, opaque);
  426. }
  427. static int rgbtest_query_formats(AVFilterContext *ctx)
  428. {
  429. static const enum PixelFormat pix_fmts[] = {
  430. PIX_FMT_RGBA, PIX_FMT_ARGB, PIX_FMT_BGRA, PIX_FMT_ABGR,
  431. PIX_FMT_BGR24, PIX_FMT_RGB24,
  432. PIX_FMT_RGB444, PIX_FMT_BGR444,
  433. PIX_FMT_RGB565, PIX_FMT_BGR565,
  434. PIX_FMT_RGB555, PIX_FMT_BGR555,
  435. PIX_FMT_NONE
  436. };
  437. avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
  438. return 0;
  439. }
  440. static int rgbtest_config_props(AVFilterLink *outlink)
  441. {
  442. TestSourceContext *test = outlink->src->priv;
  443. switch (outlink->format) {
  444. case PIX_FMT_ARGB: test->rgba_map[A] = 0; test->rgba_map[R] = 1; test->rgba_map[G] = 2; test->rgba_map[B] = 3; break;
  445. case PIX_FMT_ABGR: test->rgba_map[A] = 0; test->rgba_map[B] = 1; test->rgba_map[G] = 2; test->rgba_map[R] = 3; break;
  446. case PIX_FMT_RGBA:
  447. case PIX_FMT_RGB24: test->rgba_map[R] = 0; test->rgba_map[G] = 1; test->rgba_map[B] = 2; test->rgba_map[A] = 3; break;
  448. case PIX_FMT_BGRA:
  449. case PIX_FMT_BGR24: test->rgba_map[B] = 0; test->rgba_map[G] = 1; test->rgba_map[R] = 2; test->rgba_map[A] = 3; break;
  450. }
  451. return config_props(outlink);
  452. }
  453. AVFilter avfilter_vsrc_rgbtestsrc = {
  454. .name = "rgbtestsrc",
  455. .description = NULL_IF_CONFIG_SMALL("Generate RGB test pattern."),
  456. .priv_size = sizeof(TestSourceContext),
  457. .init = rgbtest_init,
  458. .query_formats = rgbtest_query_formats,
  459. .inputs = (const AVFilterPad[]) {{ .name = NULL}},
  460. .outputs = (const AVFilterPad[]) {{ .name = "default",
  461. .type = AVMEDIA_TYPE_VIDEO,
  462. .request_frame = request_frame,
  463. .config_props = rgbtest_config_props, },
  464. { .name = NULL }},
  465. };
  466. #endif /* CONFIG_RGBTESTSRC_FILTER */