You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

557 lines
19KB

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