buffersrc.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. /*
  2. * Copyright (c) 2008 Vitor Sessak
  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. * memory buffer source filter
  23. */
  24. #include <float.h>
  25. #include "libavutil/channel_layout.h"
  26. #include "libavutil/common.h"
  27. #include "libavutil/fifo.h"
  28. #include "libavutil/frame.h"
  29. #include "libavutil/imgutils.h"
  30. #include "libavutil/internal.h"
  31. #include "libavutil/opt.h"
  32. #include "libavutil/samplefmt.h"
  33. #include "audio.h"
  34. #include "avfilter.h"
  35. #include "buffersrc.h"
  36. #include "formats.h"
  37. #include "internal.h"
  38. #include "video.h"
  39. #include "avcodec.h"
  40. typedef struct {
  41. const AVClass *class;
  42. AVFifoBuffer *fifo;
  43. AVRational time_base; ///< time_base to set in the output link
  44. AVRational frame_rate; ///< frame_rate to set in the output link
  45. unsigned nb_failed_requests;
  46. unsigned warning_limit;
  47. /* video only */
  48. int w, h;
  49. enum AVPixelFormat pix_fmt;
  50. AVRational pixel_aspect;
  51. char *sws_param;
  52. /* audio only */
  53. int sample_rate;
  54. enum AVSampleFormat sample_fmt;
  55. int channels;
  56. uint64_t channel_layout;
  57. char *channel_layout_str;
  58. int eof;
  59. } BufferSourceContext;
  60. #define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format)\
  61. if (c->w != width || c->h != height || c->pix_fmt != format) {\
  62. av_log(s, AV_LOG_INFO, "Changing frame properties on the fly is not supported by all filters.\n");\
  63. }
  64. #define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, ch_layout, ch_count, format)\
  65. if (c->sample_fmt != format || c->sample_rate != srate ||\
  66. c->channel_layout != ch_layout || c->channels != ch_count) {\
  67. av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\
  68. return AVERROR(EINVAL);\
  69. }
  70. int attribute_align_arg av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame)
  71. {
  72. return av_buffersrc_add_frame_flags(ctx, (AVFrame *)frame,
  73. AV_BUFFERSRC_FLAG_KEEP_REF);
  74. }
  75. int attribute_align_arg av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame)
  76. {
  77. return av_buffersrc_add_frame_flags(ctx, frame, 0);
  78. }
  79. static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
  80. AVFrame *frame, int flags);
  81. int attribute_align_arg av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)
  82. {
  83. AVFrame *copy = NULL;
  84. int ret = 0;
  85. if (frame && frame->channel_layout &&
  86. av_get_channel_layout_nb_channels(frame->channel_layout) != av_frame_get_channels(frame)) {
  87. av_log(0, AV_LOG_ERROR, "Layout indicates a different number of channels than actually present\n");
  88. return AVERROR(EINVAL);
  89. }
  90. if (!(flags & AV_BUFFERSRC_FLAG_KEEP_REF) || !frame)
  91. return av_buffersrc_add_frame_internal(ctx, frame, flags);
  92. if (!(copy = av_frame_alloc()))
  93. return AVERROR(ENOMEM);
  94. ret = av_frame_ref(copy, frame);
  95. if (ret >= 0)
  96. ret = av_buffersrc_add_frame_internal(ctx, copy, flags);
  97. av_frame_free(&copy);
  98. return ret;
  99. }
  100. static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
  101. AVFrame *frame, int flags)
  102. {
  103. BufferSourceContext *s = ctx->priv;
  104. AVFrame *copy;
  105. int refcounted, ret;
  106. s->nb_failed_requests = 0;
  107. if (!frame) {
  108. s->eof = 1;
  109. return 0;
  110. } else if (s->eof)
  111. return AVERROR(EINVAL);
  112. refcounted = !!frame->buf[0];
  113. if (!(flags & AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT)) {
  114. switch (ctx->outputs[0]->type) {
  115. case AVMEDIA_TYPE_VIDEO:
  116. CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height,
  117. frame->format);
  118. break;
  119. case AVMEDIA_TYPE_AUDIO:
  120. /* For layouts unknown on input but known on link after negotiation. */
  121. if (!frame->channel_layout)
  122. frame->channel_layout = s->channel_layout;
  123. CHECK_AUDIO_PARAM_CHANGE(ctx, s, frame->sample_rate, frame->channel_layout,
  124. av_frame_get_channels(frame), frame->format);
  125. break;
  126. default:
  127. return AVERROR(EINVAL);
  128. }
  129. }
  130. if (!av_fifo_space(s->fifo) &&
  131. (ret = av_fifo_realloc2(s->fifo, av_fifo_size(s->fifo) +
  132. sizeof(copy))) < 0)
  133. return ret;
  134. if (!(copy = av_frame_alloc()))
  135. return AVERROR(ENOMEM);
  136. if (refcounted) {
  137. av_frame_move_ref(copy, frame);
  138. } else {
  139. ret = av_frame_ref(copy, frame);
  140. if (ret < 0) {
  141. av_frame_free(&copy);
  142. return ret;
  143. }
  144. }
  145. if ((ret = av_fifo_generic_write(s->fifo, &copy, sizeof(copy), NULL)) < 0) {
  146. if (refcounted)
  147. av_frame_move_ref(frame, copy);
  148. av_frame_free(&copy);
  149. return ret;
  150. }
  151. if ((flags & AV_BUFFERSRC_FLAG_PUSH))
  152. if ((ret = ctx->output_pads[0].request_frame(ctx->outputs[0])) < 0)
  153. return ret;
  154. return 0;
  155. }
  156. #if FF_API_AVFILTERBUFFER
  157. FF_DISABLE_DEPRECATION_WARNINGS
  158. static void compat_free_buffer(void *opaque, uint8_t *data)
  159. {
  160. AVFilterBufferRef *buf = opaque;
  161. AV_NOWARN_DEPRECATED(
  162. avfilter_unref_buffer(buf);
  163. )
  164. }
  165. static void compat_unref_buffer(void *opaque, uint8_t *data)
  166. {
  167. AVBufferRef *buf = opaque;
  168. AV_NOWARN_DEPRECATED(
  169. av_buffer_unref(&buf);
  170. )
  171. }
  172. int av_buffersrc_add_ref(AVFilterContext *ctx, AVFilterBufferRef *buf,
  173. int flags)
  174. {
  175. BufferSourceContext *s = ctx->priv;
  176. AVFrame *frame = NULL;
  177. AVBufferRef *dummy_buf = NULL;
  178. int ret = 0, planes, i;
  179. if (!buf) {
  180. s->eof = 1;
  181. return 0;
  182. } else if (s->eof)
  183. return AVERROR(EINVAL);
  184. frame = av_frame_alloc();
  185. if (!frame)
  186. return AVERROR(ENOMEM);
  187. dummy_buf = av_buffer_create(NULL, 0, compat_free_buffer, buf,
  188. (buf->perms & AV_PERM_WRITE) ? 0 : AV_BUFFER_FLAG_READONLY);
  189. if (!dummy_buf) {
  190. ret = AVERROR(ENOMEM);
  191. goto fail;
  192. }
  193. AV_NOWARN_DEPRECATED(
  194. if ((ret = avfilter_copy_buf_props(frame, buf)) < 0)
  195. goto fail;
  196. )
  197. #define WRAP_PLANE(ref_out, data, data_size) \
  198. do { \
  199. AVBufferRef *dummy_ref = av_buffer_ref(dummy_buf); \
  200. if (!dummy_ref) { \
  201. ret = AVERROR(ENOMEM); \
  202. goto fail; \
  203. } \
  204. ref_out = av_buffer_create(data, data_size, compat_unref_buffer, \
  205. dummy_ref, (buf->perms & AV_PERM_WRITE) ? 0 : AV_BUFFER_FLAG_READONLY); \
  206. if (!ref_out) { \
  207. av_frame_unref(frame); \
  208. ret = AVERROR(ENOMEM); \
  209. goto fail; \
  210. } \
  211. } while (0)
  212. if (ctx->outputs[0]->type == AVMEDIA_TYPE_VIDEO) {
  213. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
  214. planes = av_pix_fmt_count_planes(frame->format);
  215. if (!desc || planes <= 0) {
  216. ret = AVERROR(EINVAL);
  217. goto fail;
  218. }
  219. for (i = 0; i < planes; i++) {
  220. int v_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
  221. int plane_size = (frame->height >> v_shift) * frame->linesize[i];
  222. WRAP_PLANE(frame->buf[i], frame->data[i], plane_size);
  223. }
  224. } else {
  225. int planar = av_sample_fmt_is_planar(frame->format);
  226. int channels = av_get_channel_layout_nb_channels(frame->channel_layout);
  227. planes = planar ? channels : 1;
  228. if (planes > FF_ARRAY_ELEMS(frame->buf)) {
  229. frame->nb_extended_buf = planes - FF_ARRAY_ELEMS(frame->buf);
  230. frame->extended_buf = av_mallocz(sizeof(*frame->extended_buf) *
  231. frame->nb_extended_buf);
  232. if (!frame->extended_buf) {
  233. ret = AVERROR(ENOMEM);
  234. goto fail;
  235. }
  236. }
  237. for (i = 0; i < FFMIN(planes, FF_ARRAY_ELEMS(frame->buf)); i++)
  238. WRAP_PLANE(frame->buf[i], frame->extended_data[i], frame->linesize[0]);
  239. for (i = 0; i < planes - FF_ARRAY_ELEMS(frame->buf); i++)
  240. WRAP_PLANE(frame->extended_buf[i],
  241. frame->extended_data[i + FF_ARRAY_ELEMS(frame->buf)],
  242. frame->linesize[0]);
  243. }
  244. ret = av_buffersrc_add_frame_flags(ctx, frame, flags);
  245. fail:
  246. av_buffer_unref(&dummy_buf);
  247. av_frame_free(&frame);
  248. return ret;
  249. }
  250. FF_ENABLE_DEPRECATION_WARNINGS
  251. int av_buffersrc_buffer(AVFilterContext *ctx, AVFilterBufferRef *buf)
  252. {
  253. return av_buffersrc_add_ref(ctx, buf, 0);
  254. }
  255. #endif
  256. static av_cold int init_video(AVFilterContext *ctx)
  257. {
  258. BufferSourceContext *c = ctx->priv;
  259. if (c->pix_fmt == AV_PIX_FMT_NONE || !c->w || !c->h || av_q2d(c->time_base) <= 0) {
  260. av_log(ctx, AV_LOG_ERROR, "Invalid parameters provided.\n");
  261. return AVERROR(EINVAL);
  262. }
  263. if (!(c->fifo = av_fifo_alloc(sizeof(AVFrame*))))
  264. return AVERROR(ENOMEM);
  265. av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d pixfmt:%s tb:%d/%d fr:%d/%d sar:%d/%d sws_param:%s\n",
  266. c->w, c->h, av_get_pix_fmt_name(c->pix_fmt),
  267. c->time_base.num, c->time_base.den, c->frame_rate.num, c->frame_rate.den,
  268. c->pixel_aspect.num, c->pixel_aspect.den, (char *)av_x_if_null(c->sws_param, ""));
  269. c->warning_limit = 100;
  270. return 0;
  271. }
  272. unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src)
  273. {
  274. return ((BufferSourceContext *)buffer_src->priv)->nb_failed_requests;
  275. }
  276. #define OFFSET(x) offsetof(BufferSourceContext, x)
  277. #define A AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
  278. #define V AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
  279. static const AVOption buffer_options[] = {
  280. { "width", NULL, OFFSET(w), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
  281. { "video_size", NULL, OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, .flags = V },
  282. { "height", NULL, OFFSET(h), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
  283. { "pix_fmt", NULL, OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, { .i64 = AV_PIX_FMT_NONE }, .min = AV_PIX_FMT_NONE, .max = INT_MAX, .flags = V },
  284. #if FF_API_OLD_FILTER_OPTS
  285. /* those 4 are for compatibility with the old option passing system where each filter
  286. * did its own parsing */
  287. { "time_base_num", "deprecated, do not use", OFFSET(time_base.num), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
  288. { "time_base_den", "deprecated, do not use", OFFSET(time_base.den), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
  289. { "sar_num", "deprecated, do not use", OFFSET(pixel_aspect.num), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
  290. { "sar_den", "deprecated, do not use", OFFSET(pixel_aspect.den), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
  291. #endif
  292. { "sar", "sample aspect ratio", OFFSET(pixel_aspect), AV_OPT_TYPE_RATIONAL, { .dbl = 1 }, 0, DBL_MAX, V },
  293. { "pixel_aspect", "sample aspect ratio", OFFSET(pixel_aspect), AV_OPT_TYPE_RATIONAL, { .dbl = 1 }, 0, DBL_MAX, V },
  294. { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
  295. { "frame_rate", NULL, OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
  296. { "sws_param", NULL, OFFSET(sws_param), AV_OPT_TYPE_STRING, .flags = V },
  297. { NULL },
  298. };
  299. AVFILTER_DEFINE_CLASS(buffer);
  300. static const AVOption abuffer_options[] = {
  301. { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, A },
  302. { "sample_rate", NULL, OFFSET(sample_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A },
  303. { "sample_fmt", NULL, OFFSET(sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, { .i64 = AV_SAMPLE_FMT_NONE }, .min = AV_SAMPLE_FMT_NONE, .max = INT_MAX, .flags = A },
  304. { "channel_layout", NULL, OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, .flags = A },
  305. { "channels", NULL, OFFSET(channels), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A },
  306. { NULL },
  307. };
  308. AVFILTER_DEFINE_CLASS(abuffer);
  309. static av_cold int init_audio(AVFilterContext *ctx)
  310. {
  311. BufferSourceContext *s = ctx->priv;
  312. int ret = 0;
  313. if (s->sample_fmt == AV_SAMPLE_FMT_NONE) {
  314. av_log(ctx, AV_LOG_ERROR, "Sample format was not set or was invalid\n");
  315. return AVERROR(EINVAL);
  316. }
  317. if (s->channel_layout_str) {
  318. int n;
  319. /* TODO reindent */
  320. s->channel_layout = av_get_channel_layout(s->channel_layout_str);
  321. if (!s->channel_layout) {
  322. av_log(ctx, AV_LOG_ERROR, "Invalid channel layout %s.\n",
  323. s->channel_layout_str);
  324. return AVERROR(EINVAL);
  325. }
  326. n = av_get_channel_layout_nb_channels(s->channel_layout);
  327. if (s->channels) {
  328. if (n != s->channels) {
  329. av_log(ctx, AV_LOG_ERROR,
  330. "Mismatching channel count %d and layout '%s' "
  331. "(%d channels)\n",
  332. s->channels, s->channel_layout_str, n);
  333. return AVERROR(EINVAL);
  334. }
  335. }
  336. s->channels = n;
  337. } else if (!s->channels) {
  338. av_log(ctx, AV_LOG_ERROR, "Neither number of channels nor "
  339. "channel layout specified\n");
  340. return AVERROR(EINVAL);
  341. }
  342. if (!(s->fifo = av_fifo_alloc(sizeof(AVFrame*))))
  343. return AVERROR(ENOMEM);
  344. if (!s->time_base.num)
  345. s->time_base = (AVRational){1, s->sample_rate};
  346. av_log(ctx, AV_LOG_VERBOSE,
  347. "tb:%d/%d samplefmt:%s samplerate:%d chlayout:%s\n",
  348. s->time_base.num, s->time_base.den, av_get_sample_fmt_name(s->sample_fmt),
  349. s->sample_rate, s->channel_layout_str);
  350. s->warning_limit = 100;
  351. return ret;
  352. }
  353. static av_cold void uninit(AVFilterContext *ctx)
  354. {
  355. BufferSourceContext *s = ctx->priv;
  356. while (s->fifo && av_fifo_size(s->fifo)) {
  357. AVFrame *frame;
  358. av_fifo_generic_read(s->fifo, &frame, sizeof(frame), NULL);
  359. av_frame_free(&frame);
  360. }
  361. av_fifo_free(s->fifo);
  362. s->fifo = NULL;
  363. }
  364. static int query_formats(AVFilterContext *ctx)
  365. {
  366. BufferSourceContext *c = ctx->priv;
  367. AVFilterChannelLayouts *channel_layouts = NULL;
  368. AVFilterFormats *formats = NULL;
  369. AVFilterFormats *samplerates = NULL;
  370. switch (ctx->outputs[0]->type) {
  371. case AVMEDIA_TYPE_VIDEO:
  372. ff_add_format(&formats, c->pix_fmt);
  373. ff_set_common_formats(ctx, formats);
  374. break;
  375. case AVMEDIA_TYPE_AUDIO:
  376. ff_add_format(&formats, c->sample_fmt);
  377. ff_set_common_formats(ctx, formats);
  378. ff_add_format(&samplerates, c->sample_rate);
  379. ff_set_common_samplerates(ctx, samplerates);
  380. ff_add_channel_layout(&channel_layouts,
  381. c->channel_layout ? c->channel_layout :
  382. FF_COUNT2LAYOUT(c->channels));
  383. ff_set_common_channel_layouts(ctx, channel_layouts);
  384. break;
  385. default:
  386. return AVERROR(EINVAL);
  387. }
  388. return 0;
  389. }
  390. static int config_props(AVFilterLink *link)
  391. {
  392. BufferSourceContext *c = link->src->priv;
  393. switch (link->type) {
  394. case AVMEDIA_TYPE_VIDEO:
  395. link->w = c->w;
  396. link->h = c->h;
  397. link->sample_aspect_ratio = c->pixel_aspect;
  398. break;
  399. case AVMEDIA_TYPE_AUDIO:
  400. if (!c->channel_layout)
  401. c->channel_layout = link->channel_layout;
  402. break;
  403. default:
  404. return AVERROR(EINVAL);
  405. }
  406. link->time_base = c->time_base;
  407. link->frame_rate = c->frame_rate;
  408. return 0;
  409. }
  410. static int request_frame(AVFilterLink *link)
  411. {
  412. BufferSourceContext *c = link->src->priv;
  413. AVFrame *frame;
  414. if (!av_fifo_size(c->fifo)) {
  415. if (c->eof)
  416. return AVERROR_EOF;
  417. c->nb_failed_requests++;
  418. return AVERROR(EAGAIN);
  419. }
  420. av_fifo_generic_read(c->fifo, &frame, sizeof(frame), NULL);
  421. return ff_filter_frame(link, frame);
  422. }
  423. static int poll_frame(AVFilterLink *link)
  424. {
  425. BufferSourceContext *c = link->src->priv;
  426. int size = av_fifo_size(c->fifo);
  427. if (!size && c->eof)
  428. return AVERROR_EOF;
  429. return size/sizeof(AVFrame*);
  430. }
  431. static const AVFilterPad avfilter_vsrc_buffer_outputs[] = {
  432. {
  433. .name = "default",
  434. .type = AVMEDIA_TYPE_VIDEO,
  435. .request_frame = request_frame,
  436. .poll_frame = poll_frame,
  437. .config_props = config_props,
  438. },
  439. { NULL }
  440. };
  441. AVFilter ff_vsrc_buffer = {
  442. .name = "buffer",
  443. .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them accessible to the filterchain."),
  444. .priv_size = sizeof(BufferSourceContext),
  445. .query_formats = query_formats,
  446. .init = init_video,
  447. .uninit = uninit,
  448. .inputs = NULL,
  449. .outputs = avfilter_vsrc_buffer_outputs,
  450. .priv_class = &buffer_class,
  451. };
  452. static const AVFilterPad avfilter_asrc_abuffer_outputs[] = {
  453. {
  454. .name = "default",
  455. .type = AVMEDIA_TYPE_AUDIO,
  456. .request_frame = request_frame,
  457. .poll_frame = poll_frame,
  458. .config_props = config_props,
  459. },
  460. { NULL }
  461. };
  462. AVFilter ff_asrc_abuffer = {
  463. .name = "abuffer",
  464. .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them accessible to the filterchain."),
  465. .priv_size = sizeof(BufferSourceContext),
  466. .query_formats = query_formats,
  467. .init = init_audio,
  468. .uninit = uninit,
  469. .inputs = NULL,
  470. .outputs = avfilter_asrc_abuffer_outputs,
  471. .priv_class = &abuffer_class,
  472. };