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.

644 lines
21KB

  1. /*
  2. * Copyright (c) 2008 Vitor Sessak
  3. * Copyright (c) 2010 S.N. Hemanth Meenakshisundaram
  4. * Copyright (c) 2011 Mina Nagy Zaki
  5. *
  6. * This file is part of FFmpeg.
  7. *
  8. * FFmpeg is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * FFmpeg is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with FFmpeg; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. /**
  23. * @file
  24. * memory buffer source filter
  25. */
  26. #include "avfilter.h"
  27. #include "internal.h"
  28. #include "avcodec.h"
  29. #include "buffersrc.h"
  30. #include "vsrc_buffer.h"
  31. #include "asrc_abuffer.h"
  32. #include "libavutil/audioconvert.h"
  33. #include "libavutil/avstring.h"
  34. #include "libavutil/fifo.h"
  35. #include "libavutil/imgutils.h"
  36. typedef struct {
  37. AVFifoBuffer *fifo;
  38. AVRational time_base; ///< time_base to set in the output link
  39. int eof;
  40. unsigned nb_failed_requests;
  41. /* Video only */
  42. AVFilterContext *scale;
  43. int h, w;
  44. enum PixelFormat pix_fmt;
  45. AVRational sample_aspect_ratio;
  46. char sws_param[256];
  47. /* Audio only */
  48. // Audio format of incoming buffers
  49. int sample_rate;
  50. unsigned int sample_format;
  51. int64_t channel_layout;
  52. int packing_format;
  53. // Normalization filters
  54. AVFilterContext *aconvert;
  55. AVFilterContext *aresample;
  56. } BufferSourceContext;
  57. #define FIFO_SIZE 8
  58. #define CHECK_PARAM_CHANGE(s, c, width, height, format)\
  59. if (c->w != width || c->h != height || c->pix_fmt != format) {\
  60. av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\
  61. return AVERROR(EINVAL);\
  62. }
  63. static int check_format_change_video(AVFilterContext *buffer_filter,
  64. AVFilterBufferRef *picref)
  65. {
  66. BufferSourceContext *c = buffer_filter->priv;
  67. int ret;
  68. if (picref->video->w != c->w || picref->video->h != c->h || picref->format != c->pix_fmt) {
  69. AVFilterContext *scale = buffer_filter->outputs[0]->dst;
  70. AVFilterLink *link;
  71. char scale_param[1024];
  72. av_log(buffer_filter, AV_LOG_INFO,
  73. "Buffer video input changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
  74. c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name,
  75. picref->video->w, picref->video->h, av_pix_fmt_descriptors[picref->format].name);
  76. if (!scale || strcmp(scale->filter->name, "scale")) {
  77. AVFilter *f = avfilter_get_by_name("scale");
  78. av_log(buffer_filter, AV_LOG_INFO, "Inserting scaler filter\n");
  79. if ((ret = avfilter_open(&scale, f, "Input equalizer")) < 0)
  80. return ret;
  81. c->scale = scale;
  82. snprintf(scale_param, sizeof(scale_param)-1, "%d:%d:%s", c->w, c->h, c->sws_param);
  83. if ((ret = avfilter_init_filter(scale, scale_param, NULL)) < 0) {
  84. return ret;
  85. }
  86. if ((ret = avfilter_insert_filter(buffer_filter->outputs[0], scale, 0, 0)) < 0) {
  87. return ret;
  88. }
  89. scale->outputs[0]->time_base = scale->inputs[0]->time_base;
  90. scale->outputs[0]->format= c->pix_fmt;
  91. } else if (!strcmp(scale->filter->name, "scale")) {
  92. snprintf(scale_param, sizeof(scale_param)-1, "%d:%d:%s",
  93. scale->outputs[0]->w, scale->outputs[0]->h, c->sws_param);
  94. scale->filter->init(scale, scale_param, NULL);
  95. }
  96. c->pix_fmt = scale->inputs[0]->format = picref->format;
  97. c->w = scale->inputs[0]->w = picref->video->w;
  98. c->h = scale->inputs[0]->h = picref->video->h;
  99. link = scale->outputs[0];
  100. if ((ret = link->srcpad->config_props(link)) < 0)
  101. return ret;
  102. }
  103. return 0;
  104. }
  105. static int check_format_change(AVFilterContext *buffer_filter,
  106. AVFilterBufferRef *picref)
  107. {
  108. switch (buffer_filter->outputs[0]->type) {
  109. case AVMEDIA_TYPE_VIDEO:
  110. return check_format_change_video(buffer_filter, picref);
  111. default:
  112. return AVERROR(ENOSYS);
  113. }
  114. }
  115. int av_buffersrc_add_ref(AVFilterContext *buffer_filter,
  116. AVFilterBufferRef *picref, int flags)
  117. {
  118. BufferSourceContext *c = buffer_filter->priv;
  119. AVFilterLink *outlink = buffer_filter->outputs[0];
  120. AVFilterBufferRef *buf;
  121. int ret;
  122. if (!picref) {
  123. c->eof = 1;
  124. return 0;
  125. } else if (c->eof)
  126. return AVERROR(EINVAL);
  127. if (!av_fifo_space(c->fifo) &&
  128. (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) +
  129. sizeof(buf))) < 0)
  130. return ret;
  131. if (!(flags & AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT)) {
  132. ret = check_format_change(buffer_filter, picref);
  133. if (ret < 0)
  134. return ret;
  135. }
  136. if (flags & AV_BUFFERSRC_FLAG_NO_COPY) {
  137. buf = picref;
  138. } else {
  139. buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
  140. picref->video->w, picref->video->h);
  141. av_image_copy(buf->data, buf->linesize,
  142. (void*)picref->data, picref->linesize,
  143. picref->format, picref->video->w, picref->video->h);
  144. avfilter_copy_buffer_ref_props(buf, picref);
  145. }
  146. if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) {
  147. if (buf != picref)
  148. avfilter_unref_buffer(buf);
  149. return ret;
  150. }
  151. c->nb_failed_requests = 0;
  152. return 0;
  153. }
  154. int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_filter,
  155. AVFilterBufferRef *picref, int flags)
  156. {
  157. return av_buffersrc_add_ref(buffer_filter, picref, 0);
  158. }
  159. int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf)
  160. {
  161. return av_buffersrc_add_ref(s, buf, AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT |
  162. AV_BUFFERSRC_FLAG_NO_COPY);
  163. }
  164. #if CONFIG_AVCODEC
  165. #include "avcodec.h"
  166. int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src,
  167. const AVFrame *frame, int flags)
  168. {
  169. BufferSourceContext *c = buffer_src->priv;
  170. AVFilterBufferRef *picref;
  171. int ret;
  172. if (!frame) {
  173. c->eof = 1;
  174. return 0;
  175. } else if (c->eof)
  176. return AVERROR(EINVAL);
  177. picref = avfilter_get_video_buffer_ref_from_frame(frame, AV_PERM_WRITE);
  178. if (!picref)
  179. return AVERROR(ENOMEM);
  180. ret = av_vsrc_buffer_add_video_buffer_ref(buffer_src, picref, flags);
  181. picref->buf->data[0] = NULL;
  182. avfilter_unref_buffer(picref);
  183. return ret;
  184. }
  185. #endif
  186. unsigned av_vsrc_buffer_get_nb_failed_requests(AVFilterContext *buffer_src)
  187. {
  188. return ((BufferSourceContext *)buffer_src->priv)->nb_failed_requests;
  189. }
  190. static av_cold int init_video(AVFilterContext *ctx, const char *args, void *opaque)
  191. {
  192. BufferSourceContext *c = ctx->priv;
  193. char pix_fmt_str[128];
  194. int ret, n = 0;
  195. *c->sws_param = 0;
  196. if (!args ||
  197. (n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d:%255c", &c->w, &c->h, pix_fmt_str,
  198. &c->time_base.num, &c->time_base.den,
  199. &c->sample_aspect_ratio.num, &c->sample_aspect_ratio.den, c->sws_param)) < 7) {
  200. av_log(ctx, AV_LOG_ERROR, "Expected at least 7 arguments, but only %d found in '%s'\n", n, args);
  201. return AVERROR(EINVAL);
  202. }
  203. if ((ret = ff_parse_pixel_format(&c->pix_fmt, pix_fmt_str, ctx)) < 0)
  204. return ret;
  205. if (!(c->fifo = av_fifo_alloc(sizeof(AVFilterBufferRef*))))
  206. return AVERROR(ENOMEM);
  207. av_log(ctx, AV_LOG_INFO, "w:%d h:%d pixfmt:%s tb:%d/%d sar:%d/%d sws_param:%s\n",
  208. c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name,
  209. c->time_base.num, c->time_base.den,
  210. c->sample_aspect_ratio.num, c->sample_aspect_ratio.den, c->sws_param);
  211. return 0;
  212. }
  213. static av_cold int init_audio(AVFilterContext *ctx, const char *args0, void *opaque)
  214. {
  215. BufferSourceContext *abuffer = ctx->priv;
  216. char *arg = NULL, *ptr, chlayout_str[16];
  217. char *args = av_strdup(args0);
  218. int ret;
  219. arg = av_strtok(args, ":", &ptr);
  220. #define ADD_FORMAT(fmt_name) \
  221. if (!arg) \
  222. goto arg_fail; \
  223. if ((ret = ff_parse_##fmt_name(&abuffer->fmt_name, arg, ctx)) < 0) { \
  224. av_freep(&args); \
  225. return ret; \
  226. } \
  227. if (*args) \
  228. arg = av_strtok(NULL, ":", &ptr)
  229. ADD_FORMAT(sample_rate);
  230. ADD_FORMAT(sample_format);
  231. ADD_FORMAT(channel_layout);
  232. ADD_FORMAT(packing_format);
  233. abuffer->fifo = av_fifo_alloc(FIFO_SIZE*sizeof(AVFilterBufferRef*));
  234. if (!abuffer->fifo) {
  235. av_log(ctx, AV_LOG_ERROR, "Failed to allocate fifo, filter init failed.\n");
  236. return AVERROR(ENOMEM);
  237. }
  238. av_get_channel_layout_string(chlayout_str, sizeof(chlayout_str),
  239. -1, abuffer->channel_layout);
  240. av_log(ctx, AV_LOG_INFO, "format:%s layout:%s rate:%d\n",
  241. av_get_sample_fmt_name(abuffer->sample_format), chlayout_str,
  242. abuffer->sample_rate);
  243. av_freep(&args);
  244. return 0;
  245. arg_fail:
  246. av_log(ctx, AV_LOG_ERROR, "Invalid arguments, must be of the form "
  247. "sample_rate:sample_fmt:channel_layout:packing\n");
  248. av_freep(&args);
  249. return AVERROR(EINVAL);
  250. }
  251. static av_cold void uninit(AVFilterContext *ctx)
  252. {
  253. BufferSourceContext *s = ctx->priv;
  254. while (s->fifo && av_fifo_size(s->fifo)) {
  255. AVFilterBufferRef *buf;
  256. av_fifo_generic_read(s->fifo, &buf, sizeof(buf), NULL);
  257. avfilter_unref_buffer(buf);
  258. }
  259. av_fifo_free(s->fifo);
  260. s->fifo = NULL;
  261. avfilter_free(s->scale);
  262. s->scale = NULL;
  263. }
  264. static int query_formats_video(AVFilterContext *ctx)
  265. {
  266. BufferSourceContext *c = ctx->priv;
  267. enum PixelFormat pix_fmts[] = { c->pix_fmt, PIX_FMT_NONE };
  268. avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
  269. return 0;
  270. }
  271. static int query_formats_audio(AVFilterContext *ctx)
  272. {
  273. BufferSourceContext *abuffer = ctx->priv;
  274. AVFilterFormats *formats;
  275. formats = NULL;
  276. avfilter_add_format(&formats, abuffer->sample_format);
  277. avfilter_set_common_sample_formats(ctx, formats);
  278. formats = NULL;
  279. avfilter_add_format(&formats, abuffer->channel_layout);
  280. avfilter_set_common_channel_layouts(ctx, formats);
  281. formats = NULL;
  282. avfilter_add_format(&formats, abuffer->packing_format);
  283. avfilter_set_common_packing_formats(ctx, formats);
  284. return 0;
  285. }
  286. static int config_output_video(AVFilterLink *link)
  287. {
  288. BufferSourceContext *c = link->src->priv;
  289. link->w = c->w;
  290. link->h = c->h;
  291. link->sample_aspect_ratio = c->sample_aspect_ratio;
  292. link->time_base = c->time_base;
  293. return 0;
  294. }
  295. static int config_output_audio(AVFilterLink *outlink)
  296. {
  297. BufferSourceContext *abuffer = outlink->src->priv;
  298. outlink->sample_rate = abuffer->sample_rate;
  299. return 0;
  300. }
  301. static int request_frame(AVFilterLink *link)
  302. {
  303. BufferSourceContext *c = link->src->priv;
  304. AVFilterBufferRef *buf;
  305. if (!av_fifo_size(c->fifo)) {
  306. if (c->eof)
  307. return AVERROR_EOF;
  308. c->nb_failed_requests++;
  309. return AVERROR(EAGAIN);
  310. }
  311. av_fifo_generic_read(c->fifo, &buf, sizeof(buf), NULL);
  312. switch (link->type) {
  313. case AVMEDIA_TYPE_VIDEO:
  314. /* TODO reindent */
  315. avfilter_start_frame(link, avfilter_ref_buffer(buf, ~0));
  316. avfilter_draw_slice(link, 0, link->h, 1);
  317. avfilter_end_frame(link);
  318. avfilter_unref_buffer(buf);
  319. break;
  320. case AVMEDIA_TYPE_AUDIO:
  321. avfilter_filter_samples(link, avfilter_ref_buffer(buf, ~0));
  322. avfilter_unref_buffer(buf);
  323. break;
  324. default:
  325. return AVERROR(ENOSYS);
  326. }
  327. return 0;
  328. }
  329. static int poll_frame(AVFilterLink *link)
  330. {
  331. BufferSourceContext *c = link->src->priv;
  332. int size = av_fifo_size(c->fifo);
  333. if (!size && c->eof)
  334. return AVERROR_EOF;
  335. return size/sizeof(AVFilterBufferRef*);
  336. }
  337. static void buf_free(AVFilterBuffer *ptr)
  338. {
  339. av_free(ptr);
  340. return;
  341. }
  342. static void set_link_source(AVFilterContext *src, AVFilterLink *link)
  343. {
  344. link->src = src;
  345. link->srcpad = &(src->output_pads[0]);
  346. src->outputs[0] = link;
  347. }
  348. static int reconfigure_filter(BufferSourceContext *abuffer, AVFilterContext *filt_ctx)
  349. {
  350. int ret;
  351. AVFilterLink * const inlink = filt_ctx->inputs[0];
  352. AVFilterLink * const outlink = filt_ctx->outputs[0];
  353. inlink->format = abuffer->sample_format;
  354. inlink->channel_layout = abuffer->channel_layout;
  355. inlink->planar = abuffer->packing_format;
  356. inlink->sample_rate = abuffer->sample_rate;
  357. filt_ctx->filter->uninit(filt_ctx);
  358. memset(filt_ctx->priv, 0, filt_ctx->filter->priv_size);
  359. if ((ret = filt_ctx->filter->init(filt_ctx, NULL , NULL)) < 0)
  360. return ret;
  361. if ((ret = inlink->srcpad->config_props(inlink)) < 0)
  362. return ret;
  363. return outlink->srcpad->config_props(outlink);
  364. }
  365. static int insert_filter(BufferSourceContext *abuffer,
  366. AVFilterLink *link, AVFilterContext **filt_ctx,
  367. const char *filt_name)
  368. {
  369. int ret;
  370. if ((ret = avfilter_open(filt_ctx, avfilter_get_by_name(filt_name), NULL)) < 0)
  371. return ret;
  372. link->src->outputs[0] = NULL;
  373. if ((ret = avfilter_link(link->src, 0, *filt_ctx, 0)) < 0) {
  374. link->src->outputs[0] = link;
  375. return ret;
  376. }
  377. set_link_source(*filt_ctx, link);
  378. if ((ret = reconfigure_filter(abuffer, *filt_ctx)) < 0) {
  379. avfilter_free(*filt_ctx);
  380. return ret;
  381. }
  382. return 0;
  383. }
  384. static void remove_filter(AVFilterContext **filt_ctx)
  385. {
  386. AVFilterLink *outlink = (*filt_ctx)->outputs[0];
  387. AVFilterContext *src = (*filt_ctx)->inputs[0]->src;
  388. (*filt_ctx)->outputs[0] = NULL;
  389. avfilter_free(*filt_ctx);
  390. *filt_ctx = NULL;
  391. set_link_source(src, outlink);
  392. }
  393. static inline void log_input_change(void *ctx, AVFilterLink *link, AVFilterBufferRef *ref)
  394. {
  395. char old_layout_str[16], new_layout_str[16];
  396. av_get_channel_layout_string(old_layout_str, sizeof(old_layout_str),
  397. -1, link->channel_layout);
  398. av_get_channel_layout_string(new_layout_str, sizeof(new_layout_str),
  399. -1, ref->audio->channel_layout);
  400. av_log(ctx, AV_LOG_INFO,
  401. "Audio input format changed: "
  402. "%s:%s:%d -> %s:%s:%d, normalizing\n",
  403. av_get_sample_fmt_name(link->format),
  404. old_layout_str, (int)link->sample_rate,
  405. av_get_sample_fmt_name(ref->format),
  406. new_layout_str, ref->audio->sample_rate);
  407. }
  408. int av_asrc_buffer_add_audio_buffer_ref(AVFilterContext *ctx,
  409. AVFilterBufferRef *samplesref,
  410. int av_unused flags)
  411. {
  412. BufferSourceContext *abuffer = ctx->priv;
  413. AVFilterLink *link;
  414. int ret, logged = 0;
  415. if (av_fifo_space(abuffer->fifo) < sizeof(samplesref)) {
  416. av_log(ctx, AV_LOG_ERROR,
  417. "Buffering limit reached. Please consume some available frames "
  418. "before adding new ones.\n");
  419. return AVERROR(EINVAL);
  420. }
  421. // Normalize input
  422. link = ctx->outputs[0];
  423. if (samplesref->audio->sample_rate != link->sample_rate) {
  424. log_input_change(ctx, link, samplesref);
  425. logged = 1;
  426. abuffer->sample_rate = samplesref->audio->sample_rate;
  427. if (!abuffer->aresample) {
  428. ret = insert_filter(abuffer, link, &abuffer->aresample, "aresample");
  429. if (ret < 0) return ret;
  430. } else {
  431. link = abuffer->aresample->outputs[0];
  432. if (samplesref->audio->sample_rate == link->sample_rate)
  433. remove_filter(&abuffer->aresample);
  434. else
  435. if ((ret = reconfigure_filter(abuffer, abuffer->aresample)) < 0)
  436. return ret;
  437. }
  438. }
  439. link = ctx->outputs[0];
  440. if (samplesref->format != link->format ||
  441. samplesref->audio->channel_layout != link->channel_layout ||
  442. samplesref->audio->planar != link->planar) {
  443. if (!logged) log_input_change(ctx, link, samplesref);
  444. abuffer->sample_format = samplesref->format;
  445. abuffer->channel_layout = samplesref->audio->channel_layout;
  446. abuffer->packing_format = samplesref->audio->planar;
  447. if (!abuffer->aconvert) {
  448. ret = insert_filter(abuffer, link, &abuffer->aconvert, "aconvert");
  449. if (ret < 0) return ret;
  450. } else {
  451. link = abuffer->aconvert->outputs[0];
  452. if (samplesref->format == link->format &&
  453. samplesref->audio->channel_layout == link->channel_layout &&
  454. samplesref->audio->planar == link->planar
  455. )
  456. remove_filter(&abuffer->aconvert);
  457. else
  458. if ((ret = reconfigure_filter(abuffer, abuffer->aconvert)) < 0)
  459. return ret;
  460. }
  461. }
  462. if (sizeof(samplesref) != av_fifo_generic_write(abuffer->fifo, &samplesref,
  463. sizeof(samplesref), NULL)) {
  464. av_log(ctx, AV_LOG_ERROR, "Error while writing to FIFO\n");
  465. return AVERROR(EINVAL);
  466. }
  467. return 0;
  468. }
  469. int av_asrc_buffer_add_samples(AVFilterContext *ctx,
  470. uint8_t *data[8], int linesize[8],
  471. int nb_samples, int sample_rate,
  472. int sample_fmt, int64_t channel_layout, int planar,
  473. int64_t pts, int av_unused flags)
  474. {
  475. AVFilterBufferRef *samplesref;
  476. samplesref = avfilter_get_audio_buffer_ref_from_arrays(
  477. data, linesize, AV_PERM_WRITE,
  478. nb_samples,
  479. sample_fmt, channel_layout, planar);
  480. if (!samplesref)
  481. return AVERROR(ENOMEM);
  482. samplesref->buf->free = buf_free;
  483. samplesref->pts = pts;
  484. samplesref->audio->sample_rate = sample_rate;
  485. return av_asrc_buffer_add_audio_buffer_ref(ctx, samplesref, 0);
  486. }
  487. int av_asrc_buffer_add_buffer(AVFilterContext *ctx,
  488. uint8_t *buf, int buf_size, int sample_rate,
  489. int sample_fmt, int64_t channel_layout, int planar,
  490. int64_t pts, int av_unused flags)
  491. {
  492. uint8_t *data[8] = {0};
  493. int linesize[8];
  494. int nb_channels = av_get_channel_layout_nb_channels(channel_layout),
  495. nb_samples = buf_size / nb_channels / av_get_bytes_per_sample(sample_fmt);
  496. av_samples_fill_arrays(data, linesize,
  497. buf, nb_channels, nb_samples,
  498. sample_fmt, 16);
  499. return av_asrc_buffer_add_samples(ctx,
  500. data, linesize, nb_samples,
  501. sample_rate,
  502. sample_fmt, channel_layout, planar,
  503. pts, flags);
  504. }
  505. AVFilter avfilter_vsrc_buffer = {
  506. .name = "buffer",
  507. .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them accessible to the filterchain."),
  508. .priv_size = sizeof(BufferSourceContext),
  509. .query_formats = query_formats_video,
  510. .init = init_video,
  511. .uninit = uninit,
  512. .inputs = (const AVFilterPad[]) {{ .name = NULL }},
  513. .outputs = (const AVFilterPad[]) {{ .name = "default",
  514. .type = AVMEDIA_TYPE_VIDEO,
  515. .request_frame = request_frame,
  516. .poll_frame = poll_frame,
  517. .config_props = config_output_video, },
  518. { .name = NULL}},
  519. };
  520. #ifdef CONFIG_ABUFFER_FILTER
  521. AVFilter avfilter_asrc_abuffer = {
  522. .name = "abuffer",
  523. .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them accessible to the filterchain."),
  524. .priv_size = sizeof(BufferSourceContext),
  525. .query_formats = query_formats_audio,
  526. .init = init_audio,
  527. .uninit = uninit,
  528. .inputs = (const AVFilterPad[]) {{ .name = NULL }},
  529. .outputs = (const AVFilterPad[]) {{ .name = "default",
  530. .type = AVMEDIA_TYPE_AUDIO,
  531. .request_frame = request_frame,
  532. .poll_frame = poll_frame,
  533. .config_props = config_output_audio, },
  534. { .name = NULL}},
  535. };
  536. #endif