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.

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