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
71567156
71577157 Read audio and/or video stream(s) from a movie container.
71587158
7159−It accepts the syntax: @var{movie_name}[:@var{options}] where
7160−@var{movie_name} is the name of the resource to read (not necessarily
7161−a file but also a device or a stream accessed through some protocol),
7162−and @var{options} is an optional sequence of @var{key}=@var{value}
7163−pairs, separated by ":".
7164−
7165−The description of the accepted options follows.
7159+This filter accepts the following options:
71667160
71677161 @table @option
7162+@item filename
7163+The name of the resource to read (not necessarily a file but also a device or a
7164+stream accessed through some protocol).
71687165
71697166 @item format_name, f
71707167 Specifies 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
712712 !strcmp(filter->filter->name, "lowpass" ) ||
713713 !strcmp(filter->filter->name, "mandelbrot" ) ||
714714 !strcmp(filter->filter->name, "mptestsrc" ) ||
715+ !strcmp(filter->filter->name, "movie" ) ||
716+ !strcmp(filter->filter->name, "amovie" ) ||
715717 !strcmp(filter->filter->name, "negate" ) ||
716718 !strcmp(filter->filter->name, "noise" ) ||
717719 !strcmp(filter->filter->name, "nullsrc" ) ||
libavfilter/src_movie.c+17−28
@@ -70,19 +70,20 @@ typedef struct { · 69 unmodified lines
7070 } MovieContext;
7171
7272 #define OFFSET(x) offsetof(MovieContext, x)
73−#define F AV_OPT_FLAG_FILTERING_PARAM
73+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM
7474
7575 static const AVOption movie_options[]= {
76−{"format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX, F },
77−{"f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX, F },
78−{"streams", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, F },
79−{"s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, F },
80−{"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, F },
81−{"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, F },
82−{"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000, F },
83−{"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000, F },
84−{"loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, F },
85−{NULL},
76+ { "filename", NULL, OFFSET(file_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
77+ { "format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
78+ { "f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
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, FLAGS },
81+ { "seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, 0, (INT64_MAX-1) / 1000000, FLAGS },
82+ { "sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, 0, (INT64_MAX-1) / 1000000, FLAGS },
83+ { "streams", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, FLAGS },
84+ { "s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, FLAGS },
85+ { "loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, FLAGS },
86+ { NULL },
8687 };
8788
8889 static 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
186187 return 0;
187188 }
188189
189−static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, const AVClass *class)
190+static av_cold int movie_common_init(AVFilterContext *ctx)
190191 {
191192 MovieContext *movie = ctx->priv;
192193 AVInputFormat *iformat = NULL;
@@ -196,22 +197,11 @@ static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, con · 3 unmodified lines
196197 char name[16];
197198 AVStream *st;
198199
199− movie->class = class;
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) {
200+ if (!*movie->file_name) {
208201 av_log(ctx, AV_LOG_ERROR, "No filename provided!\n");
209202 return AVERROR(EINVAL);
210203 }
211204
212− if (*args++ == ':' && (ret = av_set_options_string(movie, args, "=", ":")) < 0)
213− return ret;
214−
215205 movie->seek_point = movie->seek_point_d * 1000000 + 0.5;
216206
217207 stream_specs = movie->stream_specs;
@@ -332,7 +322,6 @@ static av_cold void movie_uninit(AVFilterContext *ctx) · 114 unmodified lines
332322 if (movie->st[i].st)
333323 avcodec_close(movie->st[i].st->codec);
334324 }
335− av_opt_free(movie);
336325 av_freep(&movie->file_name);
337326 av_freep(&movie->st);
338327 av_freep(&movie->out_index);
@@ -576,20 +565,20 @@ AVFILTER_DEFINE_CLASS(movie); · 237 unmodified lines
576565
577566 static av_cold int movie_init(AVFilterContext *ctx, const char *args)
578567 {
579− return movie_common_init(ctx, args, &movie_class);
568+ return movie_common_init(ctx);
580569 }
581570
582571 AVFilter avfilter_avsrc_movie = {
583572 .name = "movie",
584573 .description = NULL_IF_CONFIG_SMALL("Read from a movie source."),
585574 .priv_size = sizeof(MovieContext),
575+ .priv_class = &movie_class,
586576 .init = movie_init,
587577 .uninit = movie_uninit,
588578 .query_formats = movie_query_formats,
589579
590580 .inputs = NULL,
591581 .outputs = NULL,
592− .priv_class = &movie_class,
593582 };
594583
595584 #endif /* CONFIG_MOVIE_FILTER */
@@ -601,7 +590,7 @@ AVFILTER_DEFINE_CLASS(amovie); · 5 unmodified lines
601590
602591 static av_cold int amovie_init(AVFilterContext *ctx, const char *args)
603592 {
604− return movie_common_init(ctx, args, &amovie_class);
593+ return movie_common_init(ctx);
605594 }
606595
607596 AVFilter 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