History

Merge commit 'a42d6e6c4c19912b73cae8ca9133b4202667c303'

* commit 'a42d6e6c4c19912b73cae8ca9133b4202667c303': vsrc_movie: switch to an AVOptions-based system. Conflicts: doc/filters.texi libavfilter/src_movie.c

Michael Niedermayer committed 13 years ago

Commit 3a3d9842 parents 670e0f7 a42d6e63 files · +23 −35Browse files

Unified · Split

3 files
  1. doc/filters.texi +4 −7
  2. libavfilter/avfilter.c +2 −0
  3. libavfilter/src_movie.c +17 −28
doc/filters.texi+4−7
@@ -7156,15 +7156,12 @@ stream by default. · 7155 unmodified lines
7156 7156
7157Read audio and/or video stream(s) from a movie container.7157Read audio and/or video stream(s) from a movie container.
7158 7158
7159It accepts the syntax: @var{movie_name}[:@var{options}] where7159This filter accepts the following options:
7160@var{movie_name} is the name of the resource to read (not necessarily
7161a file but also a device or a stream accessed through some protocol),
7162and @var{options} is an optional sequence of @var{key}=@var{value}
7163pairs, separated by ":".
7164
7165The description of the accepted options follows.
7166 7160
7167@table @option7161@table @option
7162@item filename
7163The name of the resource to read (not necessarily a file but also a device or a
7164stream accessed through some protocol).
7168 7165
7169@item format_name, f7166@item format_name, f
7170Specifies the format assumed for the movie to read, and can be either7167Specifies the format assumed for the movie to read, and can be either
libavfilter/avfilter.c+2−0
@@ -712,6 +712,8 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque · 711 unmodified lines
712 !strcmp(filter->filter->name, "lowpass" ) ||712 !strcmp(filter->filter->name, "lowpass" ) ||
713 !strcmp(filter->filter->name, "mandelbrot" ) ||713 !strcmp(filter->filter->name, "mandelbrot" ) ||
714 !strcmp(filter->filter->name, "mptestsrc" ) ||714 !strcmp(filter->filter->name, "mptestsrc" ) ||
715 !strcmp(filter->filter->name, "movie" ) ||
716 !strcmp(filter->filter->name, "amovie" ) ||
715 !strcmp(filter->filter->name, "negate" ) ||717 !strcmp(filter->filter->name, "negate" ) ||
716 !strcmp(filter->filter->name, "noise" ) ||718 !strcmp(filter->filter->name, "noise" ) ||
717 !strcmp(filter->filter->name, "nullsrc" ) ||719 !strcmp(filter->filter->name, "nullsrc" ) ||
libavfilter/src_movie.c+17−28
@@ -70,19 +70,20 @@ typedef struct { · 69 unmodified lines
70} MovieContext;70} MovieContext;
71 71
72#define OFFSET(x) offsetof(MovieContext, x)72#define OFFSET(x) offsetof(MovieContext, x)
73#define F AV_OPT_FLAG_FILTERING_PARAM73#define FLAGS AV_OPT_FLAG_FILTERING_PARAM
74 74
75static const AVOption movie_options[]= {75static const AVOption movie_options[]= {
76{"format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX, F },76 { "filename", NULL, OFFSET(file_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
77{"f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX, F },77 { "format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
78{"streams", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, F },78 { "f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
79{"s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, F },79 { "stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
80{"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, F },80 { "si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
81{"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, F },81 { "seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, 0, (INT64_MAX-1) / 1000000, FLAGS },
82{"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000, F },82 { "sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, 0, (INT64_MAX-1) / 1000000, FLAGS },
83{"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000, F },83 { "streams", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, FLAGS },
84{"loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, F },84 { "s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, FLAGS },
85{NULL},85 { "loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, FLAGS },
86 { NULL },
86};87};
87 88
88static int movie_config_output_props(AVFilterLink *outlink);89static int movie_config_output_props(AVFilterLink *outlink);
@@ -186,7 +187,7 @@ static int guess_channel_layout(MovieStream *st, int st_index, void *log_ctx) · 97 unmodified lines
186 return 0;187 return 0;
187}188}
188 189
189static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, const AVClass *class)190static av_cold int movie_common_init(AVFilterContext *ctx)
190{191{
191 MovieContext *movie = ctx->priv;192 MovieContext *movie = ctx->priv;
192 AVInputFormat *iformat = NULL;193 AVInputFormat *iformat = NULL;
@@ -196,22 +197,11 @@ static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, con · 3 unmodified lines
196 char name[16];197 char name[16];
197 AVStream *st;198 AVStream *st;
198 199
199 movie->class = class;200 if (!*movie->file_name) {
200 av_opt_set_defaults(movie);
201
202 if (args) {
203 movie->file_name = av_get_token(&args, ":");
204 if (!movie->file_name)
205 return AVERROR(ENOMEM);
206 }
207 if (!args || !*movie->file_name) {
208 av_log(ctx, AV_LOG_ERROR, "No filename provided!\n");201 av_log(ctx, AV_LOG_ERROR, "No filename provided!\n");
209 return AVERROR(EINVAL);202 return AVERROR(EINVAL);
210 }203 }
211 204
212 if (*args++ == ':' && (ret = av_set_options_string(movie, args, "=", ":")) < 0)
213 return ret;
214
215 movie->seek_point = movie->seek_point_d * 1000000 + 0.5;205 movie->seek_point = movie->seek_point_d * 1000000 + 0.5;
216 206
217 stream_specs = movie->stream_specs;207 stream_specs = movie->stream_specs;
@@ -332,7 +322,6 @@ static av_cold void movie_uninit(AVFilterContext *ctx) · 114 unmodified lines
332 if (movie->st[i].st)322 if (movie->st[i].st)
333 avcodec_close(movie->st[i].st->codec);323 avcodec_close(movie->st[i].st->codec);
334 }324 }
335 av_opt_free(movie);
336 av_freep(&movie->file_name);325 av_freep(&movie->file_name);
337 av_freep(&movie->st);326 av_freep(&movie->st);
338 av_freep(&movie->out_index);327 av_freep(&movie->out_index);
@@ -576,20 +565,20 @@ AVFILTER_DEFINE_CLASS(movie); · 237 unmodified lines
576 565
577static av_cold int movie_init(AVFilterContext *ctx, const char *args)566static av_cold int movie_init(AVFilterContext *ctx, const char *args)
578{567{
579 return movie_common_init(ctx, args, &movie_class);568 return movie_common_init(ctx);
580}569}
581 570
582AVFilter avfilter_avsrc_movie = {571AVFilter avfilter_avsrc_movie = {
583 .name = "movie",572 .name = "movie",
584 .description = NULL_IF_CONFIG_SMALL("Read from a movie source."),573 .description = NULL_IF_CONFIG_SMALL("Read from a movie source."),
585 .priv_size = sizeof(MovieContext),574 .priv_size = sizeof(MovieContext),
575 .priv_class = &movie_class,
586 .init = movie_init,576 .init = movie_init,
587 .uninit = movie_uninit,577 .uninit = movie_uninit,
588 .query_formats = movie_query_formats,578 .query_formats = movie_query_formats,
589 579
590 .inputs = NULL,580 .inputs = NULL,
591 .outputs = NULL,581 .outputs = NULL,
592 .priv_class = &movie_class,
593};582};
594 583
595#endif /* CONFIG_MOVIE_FILTER */584#endif /* CONFIG_MOVIE_FILTER */
@@ -601,7 +590,7 @@ AVFILTER_DEFINE_CLASS(amovie); · 5 unmodified lines
601 590
602static av_cold int amovie_init(AVFilterContext *ctx, const char *args)591static av_cold int amovie_init(AVFilterContext *ctx, const char *args)
603{592{
604 return movie_common_init(ctx, args, &amovie_class);593 return movie_common_init(ctx);
605}594}
606 595
607AVFilter avfilter_avsrc_amovie = {596AVFilter avfilter_avsrc_amovie = {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t