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.

611 lines
19KB

  1. /*
  2. * Copyright (c) 2011 Stefano Sabatini
  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. * @file
  22. * buffer sink
  23. */
  24. #include "libavutil/audio_fifo.h"
  25. #include "libavutil/avassert.h"
  26. #include "libavutil/channel_layout.h"
  27. #include "libavutil/common.h"
  28. #include "libavutil/internal.h"
  29. #include "libavutil/mathematics.h"
  30. #include "libavutil/opt.h"
  31. #include "audio.h"
  32. #include "avfilter.h"
  33. #include "buffersink.h"
  34. #include "internal.h"
  35. typedef struct BufferSinkContext {
  36. const AVClass *class;
  37. AVFifoBuffer *fifo; ///< FIFO buffer of video frame references
  38. unsigned warning_limit;
  39. /* only used for video */
  40. enum AVPixelFormat *pixel_fmts; ///< list of accepted pixel formats, must be terminated with -1
  41. int pixel_fmts_size;
  42. /* only used for audio */
  43. enum AVSampleFormat *sample_fmts; ///< list of accepted sample formats, terminated by AV_SAMPLE_FMT_NONE
  44. int sample_fmts_size;
  45. int64_t *channel_layouts; ///< list of accepted channel layouts, terminated by -1
  46. int channel_layouts_size;
  47. int *channel_counts; ///< list of accepted channel counts, terminated by -1
  48. int channel_counts_size;
  49. int all_channel_counts;
  50. int *sample_rates; ///< list of accepted sample rates, terminated by -1
  51. int sample_rates_size;
  52. /* only used for compat API */
  53. AVAudioFifo *audio_fifo; ///< FIFO for audio samples
  54. int64_t next_pts; ///< interpolating audio pts
  55. } BufferSinkContext;
  56. #define NB_ITEMS(list) (list ## _size / sizeof(*list))
  57. static av_cold void uninit(AVFilterContext *ctx)
  58. {
  59. BufferSinkContext *sink = ctx->priv;
  60. AVFrame *frame;
  61. if (sink->audio_fifo)
  62. av_audio_fifo_free(sink->audio_fifo);
  63. if (sink->fifo) {
  64. while (av_fifo_size(sink->fifo) >= sizeof(AVFilterBufferRef *)) {
  65. av_fifo_generic_read(sink->fifo, &frame, sizeof(frame), NULL);
  66. av_frame_free(&frame);
  67. }
  68. av_fifo_freep(&sink->fifo);
  69. }
  70. }
  71. static int add_buffer_ref(AVFilterContext *ctx, AVFrame *ref)
  72. {
  73. BufferSinkContext *buf = ctx->priv;
  74. if (av_fifo_space(buf->fifo) < sizeof(AVFilterBufferRef *)) {
  75. /* realloc fifo size */
  76. if (av_fifo_realloc2(buf->fifo, av_fifo_size(buf->fifo) * 2) < 0) {
  77. av_log(ctx, AV_LOG_ERROR,
  78. "Cannot buffer more frames. Consume some available frames "
  79. "before adding new ones.\n");
  80. return AVERROR(ENOMEM);
  81. }
  82. }
  83. /* cache frame */
  84. av_fifo_generic_write(buf->fifo, &ref, sizeof(AVFilterBufferRef *), NULL);
  85. return 0;
  86. }
  87. static int filter_frame(AVFilterLink *link, AVFrame *frame)
  88. {
  89. AVFilterContext *ctx = link->dst;
  90. BufferSinkContext *buf = link->dst->priv;
  91. int ret;
  92. if ((ret = add_buffer_ref(ctx, frame)) < 0)
  93. return ret;
  94. if (buf->warning_limit &&
  95. av_fifo_size(buf->fifo) / sizeof(AVFilterBufferRef *) >= buf->warning_limit) {
  96. av_log(ctx, AV_LOG_WARNING,
  97. "%d buffers queued in %s, something may be wrong.\n",
  98. buf->warning_limit,
  99. (char *)av_x_if_null(ctx->name, ctx->filter->name));
  100. buf->warning_limit *= 10;
  101. }
  102. return 0;
  103. }
  104. int attribute_align_arg av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame)
  105. {
  106. return av_buffersink_get_frame_flags(ctx, frame, 0);
  107. }
  108. int attribute_align_arg av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)
  109. {
  110. BufferSinkContext *buf = ctx->priv;
  111. AVFilterLink *inlink = ctx->inputs[0];
  112. int ret;
  113. AVFrame *cur_frame;
  114. /* no picref available, fetch it from the filterchain */
  115. if (!av_fifo_size(buf->fifo)) {
  116. if (inlink->closed)
  117. return AVERROR_EOF;
  118. if (flags & AV_BUFFERSINK_FLAG_NO_REQUEST)
  119. return AVERROR(EAGAIN);
  120. if ((ret = ff_request_frame(inlink)) < 0)
  121. return ret;
  122. }
  123. if (!av_fifo_size(buf->fifo))
  124. return AVERROR(EINVAL);
  125. if (flags & AV_BUFFERSINK_FLAG_PEEK) {
  126. cur_frame = *((AVFrame **)av_fifo_peek2(buf->fifo, 0));
  127. if ((ret = av_frame_ref(frame, cur_frame)) < 0)
  128. return ret;
  129. } else {
  130. av_fifo_generic_read(buf->fifo, &cur_frame, sizeof(cur_frame), NULL);
  131. av_frame_move_ref(frame, cur_frame);
  132. av_frame_free(&cur_frame);
  133. }
  134. return 0;
  135. }
  136. static int read_from_fifo(AVFilterContext *ctx, AVFrame *frame,
  137. int nb_samples)
  138. {
  139. BufferSinkContext *s = ctx->priv;
  140. AVFilterLink *link = ctx->inputs[0];
  141. AVFrame *tmp;
  142. if (!(tmp = ff_get_audio_buffer(link, nb_samples)))
  143. return AVERROR(ENOMEM);
  144. av_audio_fifo_read(s->audio_fifo, (void**)tmp->extended_data, nb_samples);
  145. tmp->pts = s->next_pts;
  146. if (s->next_pts != AV_NOPTS_VALUE)
  147. s->next_pts += av_rescale_q(nb_samples, (AVRational){1, link->sample_rate},
  148. link->time_base);
  149. av_frame_move_ref(frame, tmp);
  150. av_frame_free(&tmp);
  151. return 0;
  152. }
  153. int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx,
  154. AVFrame *frame, int nb_samples)
  155. {
  156. BufferSinkContext *s = ctx->priv;
  157. AVFilterLink *link = ctx->inputs[0];
  158. AVFrame *cur_frame;
  159. int ret = 0;
  160. if (!s->audio_fifo) {
  161. int nb_channels = link->channels;
  162. if (!(s->audio_fifo = av_audio_fifo_alloc(link->format, nb_channels, nb_samples)))
  163. return AVERROR(ENOMEM);
  164. }
  165. while (ret >= 0) {
  166. if (av_audio_fifo_size(s->audio_fifo) >= nb_samples)
  167. return read_from_fifo(ctx, frame, nb_samples);
  168. if (!(cur_frame = av_frame_alloc()))
  169. return AVERROR(ENOMEM);
  170. ret = av_buffersink_get_frame_flags(ctx, cur_frame, 0);
  171. if (ret == AVERROR_EOF && av_audio_fifo_size(s->audio_fifo)) {
  172. av_frame_free(&cur_frame);
  173. return read_from_fifo(ctx, frame, av_audio_fifo_size(s->audio_fifo));
  174. } else if (ret < 0) {
  175. av_frame_free(&cur_frame);
  176. return ret;
  177. }
  178. if (cur_frame->pts != AV_NOPTS_VALUE) {
  179. s->next_pts = cur_frame->pts -
  180. av_rescale_q(av_audio_fifo_size(s->audio_fifo),
  181. (AVRational){ 1, link->sample_rate },
  182. link->time_base);
  183. }
  184. ret = av_audio_fifo_write(s->audio_fifo, (void**)cur_frame->extended_data,
  185. cur_frame->nb_samples);
  186. av_frame_free(&cur_frame);
  187. }
  188. return ret;
  189. }
  190. AVBufferSinkParams *av_buffersink_params_alloc(void)
  191. {
  192. static const int pixel_fmts[] = { AV_PIX_FMT_NONE };
  193. AVBufferSinkParams *params = av_malloc(sizeof(AVBufferSinkParams));
  194. if (!params)
  195. return NULL;
  196. params->pixel_fmts = pixel_fmts;
  197. return params;
  198. }
  199. AVABufferSinkParams *av_abuffersink_params_alloc(void)
  200. {
  201. AVABufferSinkParams *params = av_mallocz(sizeof(AVABufferSinkParams));
  202. if (!params)
  203. return NULL;
  204. return params;
  205. }
  206. #define FIFO_INIT_SIZE 8
  207. static av_cold int common_init(AVFilterContext *ctx)
  208. {
  209. BufferSinkContext *buf = ctx->priv;
  210. buf->fifo = av_fifo_alloc_array(FIFO_INIT_SIZE, sizeof(AVFilterBufferRef *));
  211. if (!buf->fifo) {
  212. av_log(ctx, AV_LOG_ERROR, "Failed to allocate fifo\n");
  213. return AVERROR(ENOMEM);
  214. }
  215. buf->warning_limit = 100;
  216. buf->next_pts = AV_NOPTS_VALUE;
  217. return 0;
  218. }
  219. void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size)
  220. {
  221. AVFilterLink *inlink = ctx->inputs[0];
  222. inlink->min_samples = inlink->max_samples =
  223. inlink->partial_buf_size = frame_size;
  224. }
  225. #if FF_API_AVFILTERBUFFER
  226. FF_DISABLE_DEPRECATION_WARNINGS
  227. static void compat_free_buffer(AVFilterBuffer *buf)
  228. {
  229. AVFrame *frame = buf->priv;
  230. av_frame_free(&frame);
  231. av_free(buf);
  232. }
  233. static int compat_read(AVFilterContext *ctx,
  234. AVFilterBufferRef **pbuf, int nb_samples, int flags)
  235. {
  236. AVFilterBufferRef *buf;
  237. AVFrame *frame;
  238. int ret;
  239. if (!pbuf)
  240. return ff_poll_frame(ctx->inputs[0]);
  241. frame = av_frame_alloc();
  242. if (!frame)
  243. return AVERROR(ENOMEM);
  244. if (!nb_samples)
  245. ret = av_buffersink_get_frame_flags(ctx, frame, flags);
  246. else
  247. ret = av_buffersink_get_samples(ctx, frame, nb_samples);
  248. if (ret < 0)
  249. goto fail;
  250. AV_NOWARN_DEPRECATED(
  251. if (ctx->inputs[0]->type == AVMEDIA_TYPE_VIDEO) {
  252. buf = avfilter_get_video_buffer_ref_from_arrays(frame->data, frame->linesize,
  253. AV_PERM_READ,
  254. frame->width, frame->height,
  255. frame->format);
  256. } else {
  257. buf = avfilter_get_audio_buffer_ref_from_arrays(frame->extended_data,
  258. frame->linesize[0], AV_PERM_READ,
  259. frame->nb_samples,
  260. frame->format,
  261. frame->channel_layout);
  262. }
  263. if (!buf) {
  264. ret = AVERROR(ENOMEM);
  265. goto fail;
  266. }
  267. avfilter_copy_frame_props(buf, frame);
  268. )
  269. buf->buf->priv = frame;
  270. buf->buf->free = compat_free_buffer;
  271. *pbuf = buf;
  272. return 0;
  273. fail:
  274. av_frame_free(&frame);
  275. return ret;
  276. }
  277. int attribute_align_arg av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf)
  278. {
  279. return compat_read(ctx, buf, 0, 0);
  280. }
  281. int attribute_align_arg av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **buf,
  282. int nb_samples)
  283. {
  284. return compat_read(ctx, buf, nb_samples, 0);
  285. }
  286. int attribute_align_arg av_buffersink_get_buffer_ref(AVFilterContext *ctx,
  287. AVFilterBufferRef **bufref, int flags)
  288. {
  289. *bufref = NULL;
  290. av_assert0( !strcmp(ctx->filter->name, "buffersink")
  291. || !strcmp(ctx->filter->name, "abuffersink")
  292. || !strcmp(ctx->filter->name, "ffbuffersink")
  293. || !strcmp(ctx->filter->name, "ffabuffersink"));
  294. return compat_read(ctx, bufref, 0, flags);
  295. }
  296. FF_ENABLE_DEPRECATION_WARNINGS
  297. #endif
  298. AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx)
  299. {
  300. av_assert0( !strcmp(ctx->filter->name, "buffersink")
  301. || !strcmp(ctx->filter->name, "ffbuffersink"));
  302. return ctx->inputs[0]->frame_rate;
  303. }
  304. int attribute_align_arg av_buffersink_poll_frame(AVFilterContext *ctx)
  305. {
  306. BufferSinkContext *buf = ctx->priv;
  307. AVFilterLink *inlink = ctx->inputs[0];
  308. av_assert0( !strcmp(ctx->filter->name, "buffersink")
  309. || !strcmp(ctx->filter->name, "abuffersink")
  310. || !strcmp(ctx->filter->name, "ffbuffersink")
  311. || !strcmp(ctx->filter->name, "ffabuffersink"));
  312. return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + ff_poll_frame(inlink);
  313. }
  314. static av_cold int vsink_init(AVFilterContext *ctx, void *opaque)
  315. {
  316. BufferSinkContext *buf = ctx->priv;
  317. AVBufferSinkParams *params = opaque;
  318. int ret;
  319. if (params) {
  320. if ((ret = av_opt_set_int_list(buf, "pix_fmts", params->pixel_fmts, AV_PIX_FMT_NONE, 0)) < 0)
  321. return ret;
  322. }
  323. return common_init(ctx);
  324. }
  325. #define CHECK_LIST_SIZE(field) \
  326. if (buf->field ## _size % sizeof(*buf->field)) { \
  327. av_log(ctx, AV_LOG_ERROR, "Invalid size for " #field ": %d, " \
  328. "should be multiple of %d\n", \
  329. buf->field ## _size, (int)sizeof(*buf->field)); \
  330. return AVERROR(EINVAL); \
  331. }
  332. static int vsink_query_formats(AVFilterContext *ctx)
  333. {
  334. BufferSinkContext *buf = ctx->priv;
  335. AVFilterFormats *formats = NULL;
  336. unsigned i;
  337. int ret;
  338. CHECK_LIST_SIZE(pixel_fmts)
  339. if (buf->pixel_fmts_size) {
  340. for (i = 0; i < NB_ITEMS(buf->pixel_fmts); i++)
  341. if ((ret = ff_add_format(&formats, buf->pixel_fmts[i])) < 0) {
  342. ff_formats_unref(&formats);
  343. return ret;
  344. }
  345. ff_set_common_formats(ctx, formats);
  346. } else {
  347. ff_default_query_formats(ctx);
  348. }
  349. return 0;
  350. }
  351. static av_cold int asink_init(AVFilterContext *ctx, void *opaque)
  352. {
  353. BufferSinkContext *buf = ctx->priv;
  354. AVABufferSinkParams *params = opaque;
  355. int ret;
  356. if (params) {
  357. if ((ret = av_opt_set_int_list(buf, "sample_fmts", params->sample_fmts, AV_SAMPLE_FMT_NONE, 0)) < 0 ||
  358. (ret = av_opt_set_int_list(buf, "sample_rates", params->sample_rates, -1, 0)) < 0 ||
  359. (ret = av_opt_set_int_list(buf, "channel_layouts", params->channel_layouts, -1, 0)) < 0 ||
  360. (ret = av_opt_set_int_list(buf, "channel_counts", params->channel_counts, -1, 0)) < 0 ||
  361. (ret = av_opt_set_int(buf, "all_channel_counts", params->all_channel_counts, 0)) < 0)
  362. return ret;
  363. }
  364. return common_init(ctx);
  365. }
  366. static int asink_query_formats(AVFilterContext *ctx)
  367. {
  368. BufferSinkContext *buf = ctx->priv;
  369. AVFilterFormats *formats = NULL;
  370. AVFilterChannelLayouts *layouts = NULL;
  371. unsigned i;
  372. int ret;
  373. CHECK_LIST_SIZE(sample_fmts)
  374. CHECK_LIST_SIZE(sample_rates)
  375. CHECK_LIST_SIZE(channel_layouts)
  376. CHECK_LIST_SIZE(channel_counts)
  377. if (buf->sample_fmts_size) {
  378. for (i = 0; i < NB_ITEMS(buf->sample_fmts); i++)
  379. if ((ret = ff_add_format(&formats, buf->sample_fmts[i])) < 0) {
  380. ff_formats_unref(&formats);
  381. return ret;
  382. }
  383. ff_set_common_formats(ctx, formats);
  384. }
  385. if (buf->channel_layouts_size || buf->channel_counts_size ||
  386. buf->all_channel_counts) {
  387. for (i = 0; i < NB_ITEMS(buf->channel_layouts); i++)
  388. if ((ret = ff_add_channel_layout(&layouts, buf->channel_layouts[i])) < 0) {
  389. ff_channel_layouts_unref(&layouts);
  390. return ret;
  391. }
  392. for (i = 0; i < NB_ITEMS(buf->channel_counts); i++)
  393. if ((ret = ff_add_channel_layout(&layouts, FF_COUNT2LAYOUT(buf->channel_counts[i]))) < 0) {
  394. ff_channel_layouts_unref(&layouts);
  395. return ret;
  396. }
  397. if (buf->all_channel_counts) {
  398. if (layouts)
  399. av_log(ctx, AV_LOG_WARNING,
  400. "Conflicting all_channel_counts and list in options\n");
  401. else if (!(layouts = ff_all_channel_counts()))
  402. return AVERROR(ENOMEM);
  403. }
  404. ff_set_common_channel_layouts(ctx, layouts);
  405. }
  406. if (buf->sample_rates_size) {
  407. formats = NULL;
  408. for (i = 0; i < NB_ITEMS(buf->sample_rates); i++)
  409. if ((ret = ff_add_format(&formats, buf->sample_rates[i])) < 0) {
  410. ff_formats_unref(&formats);
  411. return ret;
  412. }
  413. ff_set_common_samplerates(ctx, formats);
  414. }
  415. return 0;
  416. }
  417. #define OFFSET(x) offsetof(BufferSinkContext, x)
  418. #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
  419. static const AVOption buffersink_options[] = {
  420. { "pix_fmts", "set the supported pixel formats", OFFSET(pixel_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
  421. { NULL },
  422. };
  423. #undef FLAGS
  424. #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
  425. static const AVOption abuffersink_options[] = {
  426. { "sample_fmts", "set the supported sample formats", OFFSET(sample_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
  427. { "sample_rates", "set the supported sample rates", OFFSET(sample_rates), AV_OPT_TYPE_BINARY, .flags = FLAGS },
  428. { "channel_layouts", "set the supported channel layouts", OFFSET(channel_layouts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
  429. { "channel_counts", "set the supported channel counts", OFFSET(channel_counts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
  430. { "all_channel_counts", "accept all channel counts", OFFSET(all_channel_counts), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS },
  431. { NULL },
  432. };
  433. #undef FLAGS
  434. AVFILTER_DEFINE_CLASS(buffersink);
  435. AVFILTER_DEFINE_CLASS(abuffersink);
  436. #if FF_API_AVFILTERBUFFER
  437. #define ffbuffersink_options buffersink_options
  438. #define ffabuffersink_options abuffersink_options
  439. AVFILTER_DEFINE_CLASS(ffbuffersink);
  440. AVFILTER_DEFINE_CLASS(ffabuffersink);
  441. static const AVFilterPad ffbuffersink_inputs[] = {
  442. {
  443. .name = "default",
  444. .type = AVMEDIA_TYPE_VIDEO,
  445. .filter_frame = filter_frame,
  446. },
  447. { NULL },
  448. };
  449. AVFilter ff_vsink_ffbuffersink = {
  450. .name = "ffbuffersink",
  451. .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
  452. .priv_size = sizeof(BufferSinkContext),
  453. .priv_class = &ffbuffersink_class,
  454. .init_opaque = vsink_init,
  455. .uninit = uninit,
  456. .query_formats = vsink_query_formats,
  457. .inputs = ffbuffersink_inputs,
  458. .outputs = NULL,
  459. };
  460. static const AVFilterPad ffabuffersink_inputs[] = {
  461. {
  462. .name = "default",
  463. .type = AVMEDIA_TYPE_AUDIO,
  464. .filter_frame = filter_frame,
  465. },
  466. { NULL },
  467. };
  468. AVFilter ff_asink_ffabuffersink = {
  469. .name = "ffabuffersink",
  470. .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
  471. .init_opaque = asink_init,
  472. .uninit = uninit,
  473. .priv_size = sizeof(BufferSinkContext),
  474. .priv_class = &ffabuffersink_class,
  475. .query_formats = asink_query_formats,
  476. .inputs = ffabuffersink_inputs,
  477. .outputs = NULL,
  478. };
  479. #endif /* FF_API_AVFILTERBUFFER */
  480. static const AVFilterPad avfilter_vsink_buffer_inputs[] = {
  481. {
  482. .name = "default",
  483. .type = AVMEDIA_TYPE_VIDEO,
  484. .filter_frame = filter_frame,
  485. },
  486. { NULL }
  487. };
  488. AVFilter ff_vsink_buffer = {
  489. .name = "buffersink",
  490. .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
  491. .priv_size = sizeof(BufferSinkContext),
  492. .priv_class = &buffersink_class,
  493. .init_opaque = vsink_init,
  494. .uninit = uninit,
  495. .query_formats = vsink_query_formats,
  496. .inputs = avfilter_vsink_buffer_inputs,
  497. .outputs = NULL,
  498. };
  499. static const AVFilterPad avfilter_asink_abuffer_inputs[] = {
  500. {
  501. .name = "default",
  502. .type = AVMEDIA_TYPE_AUDIO,
  503. .filter_frame = filter_frame,
  504. },
  505. { NULL }
  506. };
  507. AVFilter ff_asink_abuffer = {
  508. .name = "abuffersink",
  509. .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
  510. .priv_class = &abuffersink_class,
  511. .priv_size = sizeof(BufferSinkContext),
  512. .init_opaque = asink_init,
  513. .uninit = uninit,
  514. .query_formats = asink_query_formats,
  515. .inputs = avfilter_asink_abuffer_inputs,
  516. .outputs = NULL,
  517. };