src_movie.c 20 KB

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