Merge commit 'a42d6e6c4c19912b73cae8ca9133b4202667c303'
* commit 'a42d6e6c4c19912b73cae8ca9133b4202667c303': vsrc_movie: switch to an AVOptions-based system. Conflicts: doc/filters.texi libavfilter/src_movie.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
3a3d984445
@ -7156,15 +7156,12 @@ stream by default.
|
|||||||
|
|
||||||
Read audio and/or video stream(s) from a movie container.
|
Read audio and/or video stream(s) from a movie container.
|
||||||
|
|
||||||
It accepts the syntax: @var{movie_name}[:@var{options}] where
|
This filter accepts the following options:
|
||||||
@var{movie_name} is the name of the resource to read (not necessarily
|
|
||||||
a file but also a device or a stream accessed through some protocol),
|
|
||||||
and @var{options} is an optional sequence of @var{key}=@var{value}
|
|
||||||
pairs, separated by ":".
|
|
||||||
|
|
||||||
The description of the accepted options follows.
|
|
||||||
|
|
||||||
@table @option
|
@table @option
|
||||||
|
@item filename
|
||||||
|
The name of the resource to read (not necessarily a file but also a device or a
|
||||||
|
stream accessed through some protocol).
|
||||||
|
|
||||||
@item format_name, f
|
@item format_name, f
|
||||||
Specifies the format assumed for the movie to read, and can be either
|
Specifies the format assumed for the movie to read, and can be either
|
||||||
|
@ -712,6 +712,8 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
|
|||||||
!strcmp(filter->filter->name, "lowpass" ) ||
|
!strcmp(filter->filter->name, "lowpass" ) ||
|
||||||
!strcmp(filter->filter->name, "mandelbrot" ) ||
|
!strcmp(filter->filter->name, "mandelbrot" ) ||
|
||||||
!strcmp(filter->filter->name, "mptestsrc" ) ||
|
!strcmp(filter->filter->name, "mptestsrc" ) ||
|
||||||
|
!strcmp(filter->filter->name, "movie" ) ||
|
||||||
|
!strcmp(filter->filter->name, "amovie" ) ||
|
||||||
!strcmp(filter->filter->name, "negate" ) ||
|
!strcmp(filter->filter->name, "negate" ) ||
|
||||||
!strcmp(filter->filter->name, "noise" ) ||
|
!strcmp(filter->filter->name, "noise" ) ||
|
||||||
!strcmp(filter->filter->name, "nullsrc" ) ||
|
!strcmp(filter->filter->name, "nullsrc" ) ||
|
||||||
|
@ -70,19 +70,20 @@ typedef struct {
|
|||||||
} MovieContext;
|
} MovieContext;
|
||||||
|
|
||||||
#define OFFSET(x) offsetof(MovieContext, x)
|
#define OFFSET(x) offsetof(MovieContext, x)
|
||||||
#define F AV_OPT_FLAG_FILTERING_PARAM
|
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM
|
||||||
|
|
||||||
static const AVOption movie_options[]= {
|
static const AVOption movie_options[]= {
|
||||||
{"format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX, F },
|
{ "filename", NULL, OFFSET(file_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
|
||||||
{"f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX, F },
|
{ "format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
|
||||||
{"streams", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, F },
|
{ "f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
|
||||||
{"s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, F },
|
{ "stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
|
||||||
{"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, F },
|
{ "si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
|
||||||
{"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, F },
|
{ "seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, 0, (INT64_MAX-1) / 1000000, FLAGS },
|
||||||
{"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000, F },
|
{ "sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, 0, (INT64_MAX-1) / 1000000, FLAGS },
|
||||||
{"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000, F },
|
{ "streams", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, FLAGS },
|
||||||
{"loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, F },
|
{ "s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, FLAGS },
|
||||||
{NULL},
|
{ "loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, FLAGS },
|
||||||
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int movie_config_output_props(AVFilterLink *outlink);
|
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)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, const AVClass *class)
|
static av_cold int movie_common_init(AVFilterContext *ctx)
|
||||||
{
|
{
|
||||||
MovieContext *movie = ctx->priv;
|
MovieContext *movie = ctx->priv;
|
||||||
AVInputFormat *iformat = NULL;
|
AVInputFormat *iformat = NULL;
|
||||||
@ -196,22 +197,11 @@ static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, con
|
|||||||
char name[16];
|
char name[16];
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
|
|
||||||
movie->class = class;
|
if (!*movie->file_name) {
|
||||||
av_opt_set_defaults(movie);
|
|
||||||
|
|
||||||
if (args) {
|
|
||||||
movie->file_name = av_get_token(&args, ":");
|
|
||||||
if (!movie->file_name)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
}
|
|
||||||
if (!args || !*movie->file_name) {
|
|
||||||
av_log(ctx, AV_LOG_ERROR, "No filename provided!\n");
|
av_log(ctx, AV_LOG_ERROR, "No filename provided!\n");
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*args++ == ':' && (ret = av_set_options_string(movie, args, "=", ":")) < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
movie->seek_point = movie->seek_point_d * 1000000 + 0.5;
|
movie->seek_point = movie->seek_point_d * 1000000 + 0.5;
|
||||||
|
|
||||||
stream_specs = movie->stream_specs;
|
stream_specs = movie->stream_specs;
|
||||||
@ -332,7 +322,6 @@ static av_cold void movie_uninit(AVFilterContext *ctx)
|
|||||||
if (movie->st[i].st)
|
if (movie->st[i].st)
|
||||||
avcodec_close(movie->st[i].st->codec);
|
avcodec_close(movie->st[i].st->codec);
|
||||||
}
|
}
|
||||||
av_opt_free(movie);
|
|
||||||
av_freep(&movie->file_name);
|
av_freep(&movie->file_name);
|
||||||
av_freep(&movie->st);
|
av_freep(&movie->st);
|
||||||
av_freep(&movie->out_index);
|
av_freep(&movie->out_index);
|
||||||
@ -576,20 +565,20 @@ AVFILTER_DEFINE_CLASS(movie);
|
|||||||
|
|
||||||
static av_cold int movie_init(AVFilterContext *ctx, const char *args)
|
static av_cold int movie_init(AVFilterContext *ctx, const char *args)
|
||||||
{
|
{
|
||||||
return movie_common_init(ctx, args, &movie_class);
|
return movie_common_init(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
AVFilter avfilter_avsrc_movie = {
|
AVFilter avfilter_avsrc_movie = {
|
||||||
.name = "movie",
|
.name = "movie",
|
||||||
.description = NULL_IF_CONFIG_SMALL("Read from a movie source."),
|
.description = NULL_IF_CONFIG_SMALL("Read from a movie source."),
|
||||||
.priv_size = sizeof(MovieContext),
|
.priv_size = sizeof(MovieContext),
|
||||||
|
.priv_class = &movie_class,
|
||||||
.init = movie_init,
|
.init = movie_init,
|
||||||
.uninit = movie_uninit,
|
.uninit = movie_uninit,
|
||||||
.query_formats = movie_query_formats,
|
.query_formats = movie_query_formats,
|
||||||
|
|
||||||
.inputs = NULL,
|
.inputs = NULL,
|
||||||
.outputs = NULL,
|
.outputs = NULL,
|
||||||
.priv_class = &movie_class,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CONFIG_MOVIE_FILTER */
|
#endif /* CONFIG_MOVIE_FILTER */
|
||||||
@ -601,7 +590,7 @@ AVFILTER_DEFINE_CLASS(amovie);
|
|||||||
|
|
||||||
static av_cold int amovie_init(AVFilterContext *ctx, const char *args)
|
static av_cold int amovie_init(AVFilterContext *ctx, const char *args)
|
||||||
{
|
{
|
||||||
return movie_common_init(ctx, args, &amovie_class);
|
return movie_common_init(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
AVFilter avfilter_avsrc_amovie = {
|
AVFilter avfilter_avsrc_amovie = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user