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.

653 lines
20KB

  1. /*
  2. * filter layer
  3. * Copyright (c) 2007 Bobby Bingham
  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. #include "libavutil/avassert.h"
  22. #include "libavutil/avstring.h"
  23. #include "libavutil/channel_layout.h"
  24. #include "libavutil/common.h"
  25. #include "libavutil/imgutils.h"
  26. #include "libavutil/pixdesc.h"
  27. #include "libavutil/rational.h"
  28. #include "libavutil/samplefmt.h"
  29. #include "audio.h"
  30. #include "avfilter.h"
  31. #include "formats.h"
  32. #include "internal.h"
  33. #include "audio.h"
  34. char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
  35. {
  36. snprintf(buf, buf_size, "%s%s%s%s%s%s",
  37. perms & AV_PERM_READ ? "r" : "",
  38. perms & AV_PERM_WRITE ? "w" : "",
  39. perms & AV_PERM_PRESERVE ? "p" : "",
  40. perms & AV_PERM_REUSE ? "u" : "",
  41. perms & AV_PERM_REUSE2 ? "U" : "",
  42. perms & AV_PERM_NEG_LINESIZES ? "n" : "");
  43. return buf;
  44. }
  45. void ff_tlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
  46. {
  47. av_unused char buf[16];
  48. ff_tlog(ctx,
  49. "ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64,
  50. ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, sizeof(buf), ref->perms), ref->data[0],
  51. ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3],
  52. ref->pts, ref->pos);
  53. if (ref->video) {
  54. ff_tlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
  55. ref->video->sample_aspect_ratio.num, ref->video->sample_aspect_ratio.den,
  56. ref->video->w, ref->video->h,
  57. !ref->video->interlaced ? 'P' : /* Progressive */
  58. ref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */
  59. ref->video->key_frame,
  60. av_get_picture_type_char(ref->video->pict_type));
  61. }
  62. if (ref->audio) {
  63. ff_tlog(ctx, " cl:%"PRId64"d n:%d r:%d",
  64. ref->audio->channel_layout,
  65. ref->audio->nb_samples,
  66. ref->audio->sample_rate);
  67. }
  68. ff_tlog(ctx, "]%s", end ? "\n" : "");
  69. }
  70. unsigned avfilter_version(void) {
  71. av_assert0(LIBAVFILTER_VERSION_MICRO >= 100);
  72. return LIBAVFILTER_VERSION_INT;
  73. }
  74. const char *avfilter_configuration(void)
  75. {
  76. return FFMPEG_CONFIGURATION;
  77. }
  78. const char *avfilter_license(void)
  79. {
  80. #define LICENSE_PREFIX "libavfilter license: "
  81. return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
  82. }
  83. void ff_command_queue_pop(AVFilterContext *filter)
  84. {
  85. AVFilterCommand *c= filter->command_queue;
  86. av_freep(&c->arg);
  87. av_freep(&c->command);
  88. filter->command_queue= c->next;
  89. av_free(c);
  90. }
  91. void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
  92. AVFilterPad **pads, AVFilterLink ***links,
  93. AVFilterPad *newpad)
  94. {
  95. unsigned i;
  96. idx = FFMIN(idx, *count);
  97. *pads = av_realloc(*pads, sizeof(AVFilterPad) * (*count + 1));
  98. *links = av_realloc(*links, sizeof(AVFilterLink*) * (*count + 1));
  99. memmove(*pads +idx+1, *pads +idx, sizeof(AVFilterPad) * (*count-idx));
  100. memmove(*links+idx+1, *links+idx, sizeof(AVFilterLink*) * (*count-idx));
  101. memcpy(*pads+idx, newpad, sizeof(AVFilterPad));
  102. (*links)[idx] = NULL;
  103. (*count)++;
  104. for (i = idx+1; i < *count; i++)
  105. if (*links[i])
  106. (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++;
  107. }
  108. int avfilter_link(AVFilterContext *src, unsigned srcpad,
  109. AVFilterContext *dst, unsigned dstpad)
  110. {
  111. AVFilterLink *link;
  112. if (src->nb_outputs <= srcpad || dst->nb_inputs <= dstpad ||
  113. src->outputs[srcpad] || dst->inputs[dstpad])
  114. return -1;
  115. if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) {
  116. av_log(src, AV_LOG_ERROR,
  117. "Media type mismatch between the '%s' filter output pad %d (%s) and the '%s' filter input pad %d (%s)\n",
  118. src->name, srcpad, (char *)av_x_if_null(av_get_media_type_string(src->output_pads[srcpad].type), "?"),
  119. dst->name, dstpad, (char *)av_x_if_null(av_get_media_type_string(dst-> input_pads[dstpad].type), "?"));
  120. return AVERROR(EINVAL);
  121. }
  122. src->outputs[srcpad] =
  123. dst-> inputs[dstpad] = link = av_mallocz(sizeof(AVFilterLink));
  124. link->src = src;
  125. link->dst = dst;
  126. link->srcpad = &src->output_pads[srcpad];
  127. link->dstpad = &dst->input_pads[dstpad];
  128. link->type = src->output_pads[srcpad].type;
  129. av_assert0(AV_PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1);
  130. link->format = -1;
  131. return 0;
  132. }
  133. void avfilter_link_free(AVFilterLink **link)
  134. {
  135. if (!*link)
  136. return;
  137. if ((*link)->pool)
  138. ff_free_pool((*link)->pool);
  139. avfilter_unref_bufferp(&(*link)->partial_buf);
  140. av_freep(link);
  141. }
  142. int avfilter_link_get_channels(AVFilterLink *link)
  143. {
  144. return link->channels;
  145. }
  146. void avfilter_link_set_closed(AVFilterLink *link, int closed)
  147. {
  148. link->closed = closed;
  149. }
  150. int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
  151. unsigned filt_srcpad_idx, unsigned filt_dstpad_idx)
  152. {
  153. int ret;
  154. unsigned dstpad_idx = link->dstpad - link->dst->input_pads;
  155. av_log(link->dst, AV_LOG_VERBOSE, "auto-inserting filter '%s' "
  156. "between the filter '%s' and the filter '%s'\n",
  157. filt->name, link->src->name, link->dst->name);
  158. link->dst->inputs[dstpad_idx] = NULL;
  159. if ((ret = avfilter_link(filt, filt_dstpad_idx, link->dst, dstpad_idx)) < 0) {
  160. /* failed to link output filter to new filter */
  161. link->dst->inputs[dstpad_idx] = link;
  162. return ret;
  163. }
  164. /* re-hookup the link to the new destination filter we inserted */
  165. link->dst = filt;
  166. link->dstpad = &filt->input_pads[filt_srcpad_idx];
  167. filt->inputs[filt_srcpad_idx] = link;
  168. /* if any information on supported media formats already exists on the
  169. * link, we need to preserve that */
  170. if (link->out_formats)
  171. ff_formats_changeref(&link->out_formats,
  172. &filt->outputs[filt_dstpad_idx]->out_formats);
  173. if (link->out_samplerates)
  174. ff_formats_changeref(&link->out_samplerates,
  175. &filt->outputs[filt_dstpad_idx]->out_samplerates);
  176. if (link->out_channel_layouts)
  177. ff_channel_layouts_changeref(&link->out_channel_layouts,
  178. &filt->outputs[filt_dstpad_idx]->out_channel_layouts);
  179. return 0;
  180. }
  181. int avfilter_config_links(AVFilterContext *filter)
  182. {
  183. int (*config_link)(AVFilterLink *);
  184. unsigned i;
  185. int ret;
  186. for (i = 0; i < filter->nb_inputs; i ++) {
  187. AVFilterLink *link = filter->inputs[i];
  188. AVFilterLink *inlink = link->src->nb_inputs ?
  189. link->src->inputs[0] : NULL;
  190. if (!link) continue;
  191. link->current_pts = AV_NOPTS_VALUE;
  192. switch (link->init_state) {
  193. case AVLINK_INIT:
  194. continue;
  195. case AVLINK_STARTINIT:
  196. av_log(filter, AV_LOG_INFO, "circular filter chain detected\n");
  197. return 0;
  198. case AVLINK_UNINIT:
  199. link->init_state = AVLINK_STARTINIT;
  200. if ((ret = avfilter_config_links(link->src)) < 0)
  201. return ret;
  202. if (!(config_link = link->srcpad->config_props)) {
  203. if (link->src->nb_inputs != 1) {
  204. av_log(link->src, AV_LOG_ERROR, "Source filters and filters "
  205. "with more than one input "
  206. "must set config_props() "
  207. "callbacks on all outputs\n");
  208. return AVERROR(EINVAL);
  209. }
  210. } else if ((ret = config_link(link)) < 0) {
  211. av_log(link->src, AV_LOG_ERROR,
  212. "Failed to configure output pad on %s\n",
  213. link->src->name);
  214. return ret;
  215. }
  216. switch (link->type) {
  217. case AVMEDIA_TYPE_VIDEO:
  218. if (!link->time_base.num && !link->time_base.den)
  219. link->time_base = inlink ? inlink->time_base : AV_TIME_BASE_Q;
  220. if (!link->sample_aspect_ratio.num && !link->sample_aspect_ratio.den)
  221. link->sample_aspect_ratio = inlink ?
  222. inlink->sample_aspect_ratio : (AVRational){1,1};
  223. if (inlink && !link->frame_rate.num && !link->frame_rate.den)
  224. link->frame_rate = inlink->frame_rate;
  225. if (inlink) {
  226. if (!link->w)
  227. link->w = inlink->w;
  228. if (!link->h)
  229. link->h = inlink->h;
  230. } else if (!link->w || !link->h) {
  231. av_log(link->src, AV_LOG_ERROR,
  232. "Video source filters must set their output link's "
  233. "width and height\n");
  234. return AVERROR(EINVAL);
  235. }
  236. break;
  237. case AVMEDIA_TYPE_AUDIO:
  238. if (inlink) {
  239. if (!link->time_base.num && !link->time_base.den)
  240. link->time_base = inlink->time_base;
  241. }
  242. if (!link->time_base.num && !link->time_base.den)
  243. link->time_base = (AVRational) {1, link->sample_rate};
  244. }
  245. if ((config_link = link->dstpad->config_props))
  246. if ((ret = config_link(link)) < 0) {
  247. av_log(link->src, AV_LOG_ERROR,
  248. "Failed to configure input pad on %s\n",
  249. link->dst->name);
  250. return ret;
  251. }
  252. link->init_state = AVLINK_INIT;
  253. }
  254. }
  255. return 0;
  256. }
  257. void ff_tlog_link(void *ctx, AVFilterLink *link, int end)
  258. {
  259. if (link->type == AVMEDIA_TYPE_VIDEO) {
  260. ff_tlog(ctx,
  261. "link[%p s:%dx%d fmt:%s %s->%s]%s",
  262. link, link->w, link->h,
  263. av_get_pix_fmt_name(link->format),
  264. link->src ? link->src->filter->name : "",
  265. link->dst ? link->dst->filter->name : "",
  266. end ? "\n" : "");
  267. } else {
  268. char buf[128];
  269. av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
  270. ff_tlog(ctx,
  271. "link[%p r:%d cl:%s fmt:%s %s->%s]%s",
  272. link, (int)link->sample_rate, buf,
  273. av_get_sample_fmt_name(link->format),
  274. link->src ? link->src->filter->name : "",
  275. link->dst ? link->dst->filter->name : "",
  276. end ? "\n" : "");
  277. }
  278. }
  279. int ff_request_frame(AVFilterLink *link)
  280. {
  281. int ret = -1;
  282. FF_TPRINTF_START(NULL, request_frame); ff_tlog_link(NULL, link, 1);
  283. if (link->closed)
  284. return AVERROR_EOF;
  285. if (link->srcpad->request_frame)
  286. ret = link->srcpad->request_frame(link);
  287. else if (link->src->inputs[0])
  288. ret = ff_request_frame(link->src->inputs[0]);
  289. if (ret == AVERROR_EOF && link->partial_buf) {
  290. AVFilterBufferRef *pbuf = link->partial_buf;
  291. link->partial_buf = NULL;
  292. ff_filter_samples_framed(link, pbuf);
  293. return 0;
  294. }
  295. if (ret == AVERROR_EOF)
  296. link->closed = 1;
  297. return ret;
  298. }
  299. int ff_poll_frame(AVFilterLink *link)
  300. {
  301. int i, min = INT_MAX;
  302. if (link->srcpad->poll_frame)
  303. return link->srcpad->poll_frame(link);
  304. for (i = 0; i < link->src->nb_inputs; i++) {
  305. int val;
  306. if (!link->src->inputs[i])
  307. return -1;
  308. val = ff_poll_frame(link->src->inputs[i]);
  309. min = FFMIN(min, val);
  310. }
  311. return min;
  312. }
  313. void ff_update_link_current_pts(AVFilterLink *link, int64_t pts)
  314. {
  315. if (pts == AV_NOPTS_VALUE)
  316. return;
  317. link->current_pts = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q);
  318. /* TODO use duration */
  319. if (link->graph && link->age_index >= 0)
  320. ff_avfilter_graph_update_heap(link->graph, link);
  321. }
  322. int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
  323. {
  324. if(!strcmp(cmd, "ping")){
  325. av_strlcatf(res, res_len, "pong from:%s %s\n", filter->filter->name, filter->name);
  326. return 0;
  327. }else if(filter->filter->process_command) {
  328. return filter->filter->process_command(filter, cmd, arg, res, res_len, flags);
  329. }
  330. return AVERROR(ENOSYS);
  331. }
  332. #define MAX_REGISTERED_AVFILTERS_NB 128
  333. static AVFilter *registered_avfilters[MAX_REGISTERED_AVFILTERS_NB + 1];
  334. static int next_registered_avfilter_idx = 0;
  335. AVFilter *avfilter_get_by_name(const char *name)
  336. {
  337. int i;
  338. for (i = 0; registered_avfilters[i]; i++)
  339. if (!strcmp(registered_avfilters[i]->name, name))
  340. return registered_avfilters[i];
  341. return NULL;
  342. }
  343. int avfilter_register(AVFilter *filter)
  344. {
  345. int i;
  346. if (next_registered_avfilter_idx == MAX_REGISTERED_AVFILTERS_NB) {
  347. av_log(NULL, AV_LOG_ERROR,
  348. "Maximum number of registered filters %d reached, "
  349. "impossible to register filter with name '%s'\n",
  350. MAX_REGISTERED_AVFILTERS_NB, filter->name);
  351. return AVERROR(ENOMEM);
  352. }
  353. for(i=0; filter->inputs && filter->inputs[i].name; i++) {
  354. const AVFilterPad *input = &filter->inputs[i];
  355. av_assert0( !input->filter_frame
  356. || (!input->start_frame && !input->end_frame && !input->draw_slice));
  357. }
  358. registered_avfilters[next_registered_avfilter_idx++] = filter;
  359. return 0;
  360. }
  361. AVFilter **av_filter_next(AVFilter **filter)
  362. {
  363. return filter ? ++filter : &registered_avfilters[0];
  364. }
  365. void avfilter_uninit(void)
  366. {
  367. memset(registered_avfilters, 0, sizeof(registered_avfilters));
  368. next_registered_avfilter_idx = 0;
  369. }
  370. static int pad_count(const AVFilterPad *pads)
  371. {
  372. int count;
  373. if (!pads)
  374. return 0;
  375. for(count = 0; pads->name; count ++) pads ++;
  376. return count;
  377. }
  378. static const char *default_filter_name(void *filter_ctx)
  379. {
  380. AVFilterContext *ctx = filter_ctx;
  381. return ctx->name ? ctx->name : ctx->filter->name;
  382. }
  383. static void *filter_child_next(void *obj, void *prev)
  384. {
  385. AVFilterContext *ctx = obj;
  386. if (!prev && ctx->filter && ctx->filter->priv_class)
  387. return ctx->priv;
  388. return NULL;
  389. }
  390. static const AVClass *filter_child_class_next(const AVClass *prev)
  391. {
  392. AVFilter **filter_ptr = NULL;
  393. /* find the filter that corresponds to prev */
  394. while (prev && *(filter_ptr = av_filter_next(filter_ptr)))
  395. if ((*filter_ptr)->priv_class == prev)
  396. break;
  397. /* could not find filter corresponding to prev */
  398. if (prev && !(*filter_ptr))
  399. return NULL;
  400. /* find next filter with specific options */
  401. while (*(filter_ptr = av_filter_next(filter_ptr)))
  402. if ((*filter_ptr)->priv_class)
  403. return (*filter_ptr)->priv_class;
  404. return NULL;
  405. }
  406. static const AVClass avfilter_class = {
  407. .class_name = "AVFilter",
  408. .item_name = default_filter_name,
  409. .version = LIBAVUTIL_VERSION_INT,
  410. .category = AV_CLASS_CATEGORY_FILTER,
  411. .child_next = filter_child_next,
  412. .child_class_next = filter_child_class_next,
  413. };
  414. const AVClass *avfilter_get_class(void)
  415. {
  416. return &avfilter_class;
  417. }
  418. int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name)
  419. {
  420. AVFilterContext *ret;
  421. *filter_ctx = NULL;
  422. if (!filter)
  423. return AVERROR(EINVAL);
  424. ret = av_mallocz(sizeof(AVFilterContext));
  425. if (!ret)
  426. return AVERROR(ENOMEM);
  427. ret->av_class = &avfilter_class;
  428. ret->filter = filter;
  429. ret->name = inst_name ? av_strdup(inst_name) : NULL;
  430. if (filter->priv_size) {
  431. ret->priv = av_mallocz(filter->priv_size);
  432. if (!ret->priv)
  433. goto err;
  434. }
  435. ret->nb_inputs = pad_count(filter->inputs);
  436. if (ret->nb_inputs ) {
  437. ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_inputs);
  438. if (!ret->input_pads)
  439. goto err;
  440. memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs);
  441. ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_inputs);
  442. if (!ret->inputs)
  443. goto err;
  444. }
  445. ret->nb_outputs = pad_count(filter->outputs);
  446. if (ret->nb_outputs) {
  447. ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_outputs);
  448. if (!ret->output_pads)
  449. goto err;
  450. memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs);
  451. ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_outputs);
  452. if (!ret->outputs)
  453. goto err;
  454. }
  455. #if FF_API_FOO_COUNT
  456. ret->output_count = ret->nb_outputs;
  457. ret->input_count = ret->nb_inputs;
  458. #endif
  459. *filter_ctx = ret;
  460. return 0;
  461. err:
  462. av_freep(&ret->inputs);
  463. av_freep(&ret->input_pads);
  464. ret->nb_inputs = 0;
  465. av_freep(&ret->outputs);
  466. av_freep(&ret->output_pads);
  467. ret->nb_outputs = 0;
  468. av_freep(&ret->priv);
  469. av_free(ret);
  470. return AVERROR(ENOMEM);
  471. }
  472. void avfilter_free(AVFilterContext *filter)
  473. {
  474. int i;
  475. AVFilterLink *link;
  476. if (!filter)
  477. return;
  478. if (filter->filter->uninit)
  479. filter->filter->uninit(filter);
  480. for (i = 0; i < filter->nb_inputs; i++) {
  481. if ((link = filter->inputs[i])) {
  482. if (link->src)
  483. link->src->outputs[link->srcpad - link->src->output_pads] = NULL;
  484. ff_formats_unref(&link->in_formats);
  485. ff_formats_unref(&link->out_formats);
  486. ff_formats_unref(&link->in_samplerates);
  487. ff_formats_unref(&link->out_samplerates);
  488. ff_channel_layouts_unref(&link->in_channel_layouts);
  489. ff_channel_layouts_unref(&link->out_channel_layouts);
  490. }
  491. avfilter_link_free(&link);
  492. }
  493. for (i = 0; i < filter->nb_outputs; i++) {
  494. if ((link = filter->outputs[i])) {
  495. if (link->dst)
  496. link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL;
  497. ff_formats_unref(&link->in_formats);
  498. ff_formats_unref(&link->out_formats);
  499. ff_formats_unref(&link->in_samplerates);
  500. ff_formats_unref(&link->out_samplerates);
  501. ff_channel_layouts_unref(&link->in_channel_layouts);
  502. ff_channel_layouts_unref(&link->out_channel_layouts);
  503. }
  504. avfilter_link_free(&link);
  505. }
  506. av_freep(&filter->name);
  507. av_freep(&filter->input_pads);
  508. av_freep(&filter->output_pads);
  509. av_freep(&filter->inputs);
  510. av_freep(&filter->outputs);
  511. av_freep(&filter->priv);
  512. while(filter->command_queue){
  513. ff_command_queue_pop(filter);
  514. }
  515. av_free(filter);
  516. }
  517. int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque)
  518. {
  519. int ret=0;
  520. if (filter->filter->init_opaque)
  521. ret = filter->filter->init_opaque(filter, args, opaque);
  522. else if (filter->filter->init)
  523. ret = filter->filter->init(filter, args);
  524. return ret;
  525. }
  526. const char *avfilter_pad_get_name(AVFilterPad *pads, int pad_idx)
  527. {
  528. return pads[pad_idx].name;
  529. }
  530. enum AVMediaType avfilter_pad_get_type(AVFilterPad *pads, int pad_idx)
  531. {
  532. return pads[pad_idx].type;
  533. }
  534. int ff_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
  535. {
  536. int ret;
  537. FF_TPRINTF_START(NULL, filter_frame); ff_tlog_link(NULL, link, 1); ff_tlog(NULL, " "); ff_tlog_ref(NULL, frame, 1);
  538. switch (link->type) {
  539. case AVMEDIA_TYPE_VIDEO:
  540. if((ret = ff_start_frame(link, frame)) < 0)
  541. return ret;
  542. if((ret = ff_draw_slice(link, 0, frame->video->h, 1)) < 0)
  543. return ret;
  544. if((ret = ff_end_frame(link)) < 0)
  545. return ret;
  546. return ret;
  547. case AVMEDIA_TYPE_AUDIO:
  548. return ff_filter_samples(link, frame);
  549. default: return AVERROR(EINVAL);
  550. }
  551. }