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.

626 lines
21KB

  1. /*
  2. * Copyright (c) 2010 Stefano Sabatini
  3. * Copyright (c) 2008 Victor Paesa
  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. /**
  22. * @file
  23. * movie video source
  24. *
  25. * @todo use direct rendering (no allocation of a new frame)
  26. * @todo support a PTS correction mechanism
  27. */
  28. /* #define DEBUG */
  29. #include <float.h>
  30. #include "libavutil/avstring.h"
  31. #include "libavutil/avassert.h"
  32. #include "libavutil/opt.h"
  33. #include "libavutil/imgutils.h"
  34. #include "libavutil/timestamp.h"
  35. #include "libavformat/avformat.h"
  36. #include "audio.h"
  37. #include "avcodec.h"
  38. #include "avfilter.h"
  39. #include "formats.h"
  40. #include "internal.h"
  41. #include "video.h"
  42. typedef struct {
  43. AVStream *st;
  44. int done;
  45. } MovieStream;
  46. typedef struct {
  47. /* common A/V fields */
  48. const AVClass *class;
  49. int64_t seek_point; ///< seekpoint in microseconds
  50. double seek_point_d;
  51. char *format_name;
  52. char *file_name;
  53. char *stream_specs; /**< user-provided list of streams, separated by + */
  54. int stream_index; /**< for compatibility */
  55. int loop_count;
  56. AVFormatContext *format_ctx;
  57. int eof;
  58. AVPacket pkt, pkt0;
  59. AVFrame *frame; ///< video frame to store the decoded images in
  60. int max_stream_index; /**< max stream # actually used for output */
  61. MovieStream *st; /**< array of all streams, one per output */
  62. int *out_index; /**< stream number -> output number map, or -1 */
  63. } MovieContext;
  64. #define OFFSET(x) offsetof(MovieContext, x)
  65. static const AVOption movie_options[]= {
  66. {"format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX },
  67. {"f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX },
  68. {"streams", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX },
  69. {"s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX },
  70. {"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX },
  71. {"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX },
  72. {"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 },
  73. {"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 },
  74. {"loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.dbl = 1}, 0, INT_MAX },
  75. {NULL},
  76. };
  77. AVFILTER_DEFINE_CLASS(movie);
  78. static int movie_config_output_props(AVFilterLink *outlink);
  79. static int movie_request_frame(AVFilterLink *outlink);
  80. static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
  81. {
  82. int i, ret, already = 0, stream_id = -1;
  83. char type_char, dummy;
  84. AVStream *found = NULL;
  85. enum AVMediaType type;
  86. ret = sscanf(spec, "d%[av]%d%c", &type_char, &stream_id, &dummy);
  87. if (ret >= 1 && ret <= 2) {
  88. type = type_char == 'v' ? AVMEDIA_TYPE_VIDEO : AVMEDIA_TYPE_AUDIO;
  89. ret = av_find_best_stream(avf, type, stream_id, -1, NULL, 0);
  90. if (ret < 0) {
  91. av_log(log, AV_LOG_ERROR, "No %s stream with index '%d' found\n",
  92. av_get_media_type_string(type), stream_id);
  93. return NULL;
  94. }
  95. return avf->streams[ret];
  96. }
  97. for (i = 0; i < avf->nb_streams; i++) {
  98. ret = avformat_match_stream_specifier(avf, avf->streams[i], spec);
  99. if (ret < 0) {
  100. av_log(log, AV_LOG_ERROR,
  101. "Invalid stream specifier \"%s\"\n", spec);
  102. return NULL;
  103. }
  104. if (!ret)
  105. continue;
  106. if (avf->streams[i]->discard != AVDISCARD_ALL) {
  107. already++;
  108. continue;
  109. }
  110. if (found) {
  111. av_log(log, AV_LOG_WARNING,
  112. "Ambiguous stream specifier \"%s\", using #%d\n", spec, i);
  113. break;
  114. }
  115. found = avf->streams[i];
  116. }
  117. if (!found) {
  118. av_log(log, AV_LOG_WARNING, "Stream specifier \"%s\" %s\n", spec,
  119. already ? "matched only already used streams" :
  120. "did not match any stream");
  121. return NULL;
  122. }
  123. if (found->codec->codec_type != AVMEDIA_TYPE_VIDEO &&
  124. found->codec->codec_type != AVMEDIA_TYPE_AUDIO) {
  125. av_log(log, AV_LOG_ERROR, "Stream specifier \"%s\" matched a %s stream,"
  126. "currently unsupported by libavfilter\n", spec,
  127. av_get_media_type_string(found->codec->codec_type));
  128. return NULL;
  129. }
  130. return found;
  131. }
  132. static int open_stream(void *log, MovieStream *st)
  133. {
  134. AVCodec *codec;
  135. int ret;
  136. codec = avcodec_find_decoder(st->st->codec->codec_id);
  137. if (!codec) {
  138. av_log(log, AV_LOG_ERROR, "Failed to find any codec\n");
  139. return AVERROR(EINVAL);
  140. }
  141. if ((ret = avcodec_open2(st->st->codec, codec, NULL)) < 0) {
  142. av_log(log, AV_LOG_ERROR, "Failed to open codec\n");
  143. return ret;
  144. }
  145. return 0;
  146. }
  147. static int guess_channel_layout(MovieStream *st, int st_index, void *log_ctx)
  148. {
  149. AVCodecContext *dec_ctx = st->st->codec;
  150. char buf[256];
  151. int64_t chl = av_get_default_channel_layout(dec_ctx->channels);
  152. if (!chl) {
  153. av_log(log_ctx, AV_LOG_ERROR,
  154. "Channel layout is not set in stream %d, and could not "
  155. "be guessed from the number of channels (%d)\n",
  156. st_index, dec_ctx->channels);
  157. return AVERROR(EINVAL);
  158. }
  159. av_get_channel_layout_string(buf, sizeof(buf), dec_ctx->channels, chl);
  160. av_log(log_ctx, AV_LOG_WARNING,
  161. "Channel layout is not set in output stream %d, "
  162. "guessed channel layout is '%s'\n",
  163. st_index, buf);
  164. dec_ctx->channel_layout = chl;
  165. return 0;
  166. }
  167. static av_cold int movie_init(AVFilterContext *ctx, const char *args)
  168. {
  169. MovieContext *movie = ctx->priv;
  170. AVInputFormat *iformat = NULL;
  171. int64_t timestamp;
  172. int nb_streams, ret, i;
  173. char default_streams[16], *stream_specs, *spec, *cursor;
  174. char name[16];
  175. AVStream *st;
  176. movie->class = &movie_class;
  177. av_opt_set_defaults(movie);
  178. if (args)
  179. movie->file_name = av_get_token(&args, ":");
  180. if (!movie->file_name || !*movie->file_name) {
  181. av_log(ctx, AV_LOG_ERROR, "No filename provided!\n");
  182. return AVERROR(EINVAL);
  183. }
  184. if (*args++ == ':' && (ret = av_set_options_string(movie, args, "=", ":")) < 0) {
  185. av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args);
  186. return ret;
  187. }
  188. movie->seek_point = movie->seek_point_d * 1000000 + 0.5;
  189. stream_specs = movie->stream_specs;
  190. if (!stream_specs) {
  191. snprintf(default_streams, sizeof(default_streams), "d%c%d",
  192. !strcmp(ctx->filter->name, "amovie") ? 'a' : 'v',
  193. movie->stream_index);
  194. stream_specs = default_streams;
  195. }
  196. for (cursor = stream_specs, nb_streams = 1; *cursor; cursor++)
  197. if (*cursor == '+')
  198. nb_streams++;
  199. if (movie->loop_count != 1 && nb_streams != 1) {
  200. av_log(ctx, AV_LOG_ERROR,
  201. "Loop with several streams is currently unsupported\n");
  202. return AVERROR_PATCHWELCOME;
  203. }
  204. av_register_all();
  205. // Try to find the movie format (container)
  206. iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL;
  207. movie->format_ctx = NULL;
  208. if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, iformat, NULL)) < 0) {
  209. av_log(ctx, AV_LOG_ERROR,
  210. "Failed to avformat_open_input '%s'\n", movie->file_name);
  211. return ret;
  212. }
  213. if ((ret = avformat_find_stream_info(movie->format_ctx, NULL)) < 0)
  214. av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n");
  215. // if seeking requested, we execute it
  216. if (movie->seek_point > 0) {
  217. timestamp = movie->seek_point;
  218. // add the stream start time, should it exist
  219. if (movie->format_ctx->start_time != AV_NOPTS_VALUE) {
  220. if (timestamp > INT64_MAX - movie->format_ctx->start_time) {
  221. av_log(ctx, AV_LOG_ERROR,
  222. "%s: seek value overflow with start_time:%"PRId64" seek_point:%"PRId64"\n",
  223. movie->file_name, movie->format_ctx->start_time, movie->seek_point);
  224. return AVERROR(EINVAL);
  225. }
  226. timestamp += movie->format_ctx->start_time;
  227. }
  228. if ((ret = av_seek_frame(movie->format_ctx, -1, timestamp, AVSEEK_FLAG_BACKWARD)) < 0) {
  229. av_log(ctx, AV_LOG_ERROR, "%s: could not seek to position %"PRId64"\n",
  230. movie->file_name, timestamp);
  231. return ret;
  232. }
  233. }
  234. for (i = 0; i < movie->format_ctx->nb_streams; i++)
  235. movie->format_ctx->streams[i]->discard = AVDISCARD_ALL;
  236. movie->st = av_calloc(nb_streams, sizeof(*movie->st));
  237. if (!movie->st)
  238. return AVERROR(ENOMEM);
  239. for (i = 0; i < nb_streams; i++) {
  240. spec = av_strtok(stream_specs, "+", &cursor);
  241. if (!spec)
  242. return AVERROR_BUG;
  243. stream_specs = NULL; /* for next strtok */
  244. st = find_stream(ctx, movie->format_ctx, spec);
  245. if (!st)
  246. return AVERROR(EINVAL);
  247. st->discard = AVDISCARD_DEFAULT;
  248. movie->st[i].st = st;
  249. movie->max_stream_index = FFMAX(movie->max_stream_index, st->index);
  250. }
  251. if (av_strtok(NULL, "+", &cursor))
  252. return AVERROR_BUG;
  253. movie->out_index = av_calloc(movie->max_stream_index + 1,
  254. sizeof(*movie->out_index));
  255. if (!movie->out_index)
  256. return AVERROR(ENOMEM);
  257. for (i = 0; i <= movie->max_stream_index; i++)
  258. movie->out_index[i] = -1;
  259. for (i = 0; i < nb_streams; i++)
  260. movie->out_index[movie->st[i].st->index] = i;
  261. for (i = 0; i < nb_streams; i++) {
  262. AVFilterPad pad = { 0 };
  263. snprintf(name, sizeof(name), "out%d", i);
  264. pad.type = movie->st[i].st->codec->codec_type;
  265. pad.name = av_strdup(name);
  266. pad.config_props = movie_config_output_props;
  267. pad.request_frame = movie_request_frame;
  268. ff_insert_outpad(ctx, i, &pad);
  269. ret = open_stream(ctx, &movie->st[i]);
  270. if (ret < 0)
  271. return ret;
  272. if ( movie->st[i].st->codec->codec->type == AVMEDIA_TYPE_AUDIO &&
  273. !movie->st[i].st->codec->channel_layout) {
  274. ret = guess_channel_layout(&movie->st[i], i, ctx);
  275. if (ret < 0)
  276. return ret;
  277. }
  278. }
  279. if (!(movie->frame = avcodec_alloc_frame()) ) {
  280. av_log(log, AV_LOG_ERROR, "Failed to alloc frame\n");
  281. return AVERROR(ENOMEM);
  282. }
  283. av_log(ctx, AV_LOG_VERBOSE, "seek_point:%"PRIi64" format_name:%s file_name:%s stream_index:%d\n",
  284. movie->seek_point, movie->format_name, movie->file_name,
  285. movie->stream_index);
  286. return 0;
  287. }
  288. static av_cold void movie_uninit(AVFilterContext *ctx)
  289. {
  290. MovieContext *movie = ctx->priv;
  291. int i;
  292. for (i = 0; i < ctx->nb_outputs; i++) {
  293. av_freep(&ctx->output_pads[i].name);
  294. if (movie->st[i].st)
  295. avcodec_close(movie->st[i].st->codec);
  296. }
  297. av_opt_free(movie);
  298. av_freep(&movie->file_name);
  299. av_freep(&movie->st);
  300. av_freep(&movie->out_index);
  301. av_freep(&movie->frame);
  302. if (movie->format_ctx)
  303. avformat_close_input(&movie->format_ctx);
  304. }
  305. static int movie_query_formats(AVFilterContext *ctx)
  306. {
  307. MovieContext *movie = ctx->priv;
  308. int list[] = { 0, -1 };
  309. int64_t list64[] = { 0, -1 };
  310. int i;
  311. for (i = 0; i < ctx->nb_outputs; i++) {
  312. MovieStream *st = &movie->st[i];
  313. AVCodecContext *c = st->st->codec;
  314. AVFilterLink *outlink = ctx->outputs[i];
  315. switch (c->codec_type) {
  316. case AVMEDIA_TYPE_VIDEO:
  317. list[0] = c->pix_fmt;
  318. ff_formats_ref(ff_make_format_list(list), &outlink->in_formats);
  319. break;
  320. case AVMEDIA_TYPE_AUDIO:
  321. list[0] = c->sample_fmt;
  322. ff_formats_ref(ff_make_format_list(list), &outlink->in_formats);
  323. list[0] = c->sample_rate;
  324. ff_formats_ref(ff_make_format_list(list), &outlink->in_samplerates);
  325. list64[0] = c->channel_layout;
  326. ff_channel_layouts_ref(avfilter_make_format64_list(list64),
  327. &outlink->in_channel_layouts);
  328. break;
  329. }
  330. }
  331. return 0;
  332. }
  333. static int movie_config_output_props(AVFilterLink *outlink)
  334. {
  335. AVFilterContext *ctx = outlink->src;
  336. MovieContext *movie = ctx->priv;
  337. unsigned out_id = FF_OUTLINK_IDX(outlink);
  338. MovieStream *st = &movie->st[out_id];
  339. AVCodecContext *c = st->st->codec;
  340. outlink->time_base = st->st->time_base;
  341. switch (c->codec_type) {
  342. case AVMEDIA_TYPE_VIDEO:
  343. outlink->w = c->width;
  344. outlink->h = c->height;
  345. outlink->frame_rate = st->st->r_frame_rate;
  346. break;
  347. case AVMEDIA_TYPE_AUDIO:
  348. break;
  349. }
  350. return 0;
  351. }
  352. static AVFilterBufferRef *frame_to_buf(enum AVMediaType type, AVFrame *frame,
  353. AVFilterLink *outlink)
  354. {
  355. AVFilterBufferRef *buf, *copy;
  356. buf = avfilter_get_buffer_ref_from_frame(type, frame,
  357. AV_PERM_WRITE |
  358. AV_PERM_PRESERVE |
  359. AV_PERM_REUSE2);
  360. if (!buf)
  361. return NULL;
  362. buf->pts = av_frame_get_best_effort_timestamp(frame);
  363. copy = ff_copy_buffer_ref(outlink, buf);
  364. if (!copy)
  365. return NULL;
  366. buf->buf->data[0] = NULL; /* it belongs to the frame */
  367. avfilter_unref_buffer(buf);
  368. return copy;
  369. }
  370. static char *describe_bufref_to_str(char *dst, size_t dst_size,
  371. AVFilterBufferRef *buf,
  372. AVFilterLink *link)
  373. {
  374. switch (buf->type) {
  375. case AVMEDIA_TYPE_VIDEO:
  376. snprintf(dst, dst_size,
  377. "video pts:%s time:%s pos:%"PRId64" size:%dx%d aspect:%d/%d",
  378. av_ts2str(buf->pts), av_ts2timestr(buf->pts, &link->time_base),
  379. buf->pos, buf->video->w, buf->video->h,
  380. buf->video->sample_aspect_ratio.num,
  381. buf->video->sample_aspect_ratio.den);
  382. break;
  383. case AVMEDIA_TYPE_AUDIO:
  384. snprintf(dst, dst_size,
  385. "audio pts:%s time:%s pos:%"PRId64" samples:%d",
  386. av_ts2str(buf->pts), av_ts2timestr(buf->pts, &link->time_base),
  387. buf->pos, buf->audio->nb_samples);
  388. break;
  389. default:
  390. snprintf(dst, dst_size, "%s BUG", av_get_media_type_string(buf->type));
  391. break;
  392. }
  393. return dst;
  394. }
  395. #define describe_bufref(buf, link) \
  396. describe_bufref_to_str((char[1024]){0}, 1024, buf, link)
  397. static int rewind_file(AVFilterContext *ctx)
  398. {
  399. MovieContext *movie = ctx->priv;
  400. int64_t timestamp = movie->seek_point;
  401. int ret, i;
  402. if (movie->format_ctx->start_time != AV_NOPTS_VALUE)
  403. timestamp += movie->format_ctx->start_time;
  404. ret = av_seek_frame(movie->format_ctx, -1, timestamp, AVSEEK_FLAG_BACKWARD);
  405. if (ret < 0) {
  406. av_log(ctx, AV_LOG_ERROR, "Unable to loop: %s\n", av_err2str(ret));
  407. movie->loop_count = 1; /* do not try again */
  408. return ret;
  409. }
  410. for (i = 0; i < ctx->nb_outputs; i++) {
  411. avcodec_flush_buffers(movie->st[i].st->codec);
  412. movie->st[i].done = 0;
  413. }
  414. movie->eof = 0;
  415. return 0;
  416. }
  417. /**
  418. * Try to push a frame to the requested output.
  419. *
  420. * @return 1 if a frame was pushed on the requested output,
  421. * 0 if another attempt is possible,
  422. * <0 AVERROR code
  423. */
  424. static int movie_push_frame(AVFilterContext *ctx, unsigned out_id)
  425. {
  426. MovieContext *movie = ctx->priv;
  427. AVPacket *pkt = &movie->pkt;
  428. MovieStream *st;
  429. int ret, got_frame = 0, pkt_out_id;
  430. AVFilterLink *outlink;
  431. AVFilterBufferRef *buf;
  432. if (!pkt->size) {
  433. if (movie->eof) {
  434. if (movie->st[out_id].done) {
  435. if (movie->loop_count != 1) {
  436. ret = rewind_file(ctx);
  437. if (ret < 0)
  438. return ret;
  439. movie->loop_count -= movie->loop_count > 1;
  440. av_log(ctx, AV_LOG_VERBOSE, "Stream finished, looping.\n");
  441. return 0; /* retry */
  442. }
  443. return AVERROR_EOF;
  444. }
  445. /* packet is already ready for flushing */
  446. } else {
  447. ret = av_read_frame(movie->format_ctx, &movie->pkt0);
  448. if (ret < 0) {
  449. av_init_packet(&movie->pkt0); /* ready for flushing */
  450. *pkt = movie->pkt0;
  451. if (ret == AVERROR_EOF) {
  452. movie->eof = 1;
  453. return 0; /* start flushing */
  454. }
  455. return ret;
  456. }
  457. *pkt = movie->pkt0;
  458. }
  459. }
  460. pkt_out_id = pkt->stream_index > movie->max_stream_index ? -1 :
  461. movie->out_index[pkt->stream_index];
  462. if (pkt_out_id < 0) {
  463. av_free_packet(&movie->pkt0);
  464. pkt->size = 0; /* ready for next run */
  465. pkt->data = NULL;
  466. return 0;
  467. }
  468. st = &movie->st[pkt_out_id];
  469. outlink = ctx->outputs[pkt_out_id];
  470. switch (st->st->codec->codec_type) {
  471. case AVMEDIA_TYPE_VIDEO:
  472. ret = avcodec_decode_video2(st->st->codec, movie->frame, &got_frame, pkt);
  473. break;
  474. case AVMEDIA_TYPE_AUDIO:
  475. ret = avcodec_decode_audio4(st->st->codec, movie->frame, &got_frame, pkt);
  476. break;
  477. default:
  478. ret = AVERROR(ENOSYS);
  479. break;
  480. }
  481. if (ret < 0) {
  482. av_log(ctx, AV_LOG_WARNING, "Decode error: %s\n", av_err2str(ret));
  483. return 0;
  484. }
  485. if (!ret)
  486. ret = pkt->size;
  487. pkt->data += ret;
  488. pkt->size -= ret;
  489. if (pkt->size <= 0) {
  490. av_free_packet(&movie->pkt0);
  491. pkt->size = 0; /* ready for next run */
  492. pkt->data = NULL;
  493. }
  494. if (!got_frame) {
  495. if (!ret)
  496. st->done = 1;
  497. return 0;
  498. }
  499. buf = frame_to_buf(st->st->codec->codec_type, movie->frame, outlink);
  500. if (!buf)
  501. return AVERROR(ENOMEM);
  502. av_dlog(ctx, "movie_push_frame(): file:'%s' %s\n", movie->file_name,
  503. describe_bufref(buf, outlink));
  504. switch (st->st->codec->codec_type) {
  505. case AVMEDIA_TYPE_VIDEO:
  506. if (!movie->frame->sample_aspect_ratio.num)
  507. buf->video->sample_aspect_ratio = st->st->sample_aspect_ratio;
  508. ff_start_frame(outlink, buf);
  509. ff_draw_slice(outlink, 0, outlink->h, 1);
  510. ff_end_frame(outlink);
  511. break;
  512. case AVMEDIA_TYPE_AUDIO:
  513. ff_filter_samples(outlink, buf);
  514. break;
  515. }
  516. return pkt_out_id == out_id;
  517. }
  518. static int movie_request_frame(AVFilterLink *outlink)
  519. {
  520. AVFilterContext *ctx = outlink->src;
  521. unsigned out_id = FF_OUTLINK_IDX(outlink);
  522. int ret;
  523. while (1) {
  524. ret = movie_push_frame(ctx, out_id);
  525. if (ret)
  526. return FFMIN(ret, 0);
  527. }
  528. }
  529. #if CONFIG_MOVIE_FILTER
  530. AVFilter avfilter_avsrc_movie = {
  531. .name = "movie",
  532. .description = NULL_IF_CONFIG_SMALL("Read from a movie source."),
  533. .priv_size = sizeof(MovieContext),
  534. .init = movie_init,
  535. .uninit = movie_uninit,
  536. .query_formats = movie_query_formats,
  537. .inputs = (const AVFilterPad[]) {{ .name = NULL }},
  538. .outputs = (const AVFilterPad[]) {{ .name = NULL }},
  539. };
  540. #endif /* CONFIG_MOVIE_FILTER */
  541. #if CONFIG_AMOVIE_FILTER
  542. AVFilter avfilter_avsrc_amovie = {
  543. .name = "amovie",
  544. .description = NULL_IF_CONFIG_SMALL("Read audio from a movie source."),
  545. .priv_size = sizeof(MovieContext),
  546. .init = movie_init,
  547. .uninit = movie_uninit,
  548. .query_formats = movie_query_formats,
  549. .inputs = (const AVFilterPad[]) {{ .name = NULL }},
  550. .outputs = (const AVFilterPad[]) {{ .name = NULL }},
  551. };
  552. #endif /* CONFIG_AMOVIE_FILTER */