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.

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