[FFmpeg-devel] [PATCH] lavfi/movie: split class definitions for movie and amovie
Stefano Sabatini
stefasab at gmail.com
Mon Aug 13 13:45:25 CEST 2012
This is required for iterating through the filter class (without
incurring into a loop).
---
libavfilter/src_movie.c | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 09dfe5d..cca77cc 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -84,8 +84,6 @@ static const AVOption movie_options[]= {
{NULL},
};
-AVFILTER_DEFINE_CLASS(movie);
-
static int movie_config_output_props(AVFilterLink *outlink);
static int movie_request_frame(AVFilterLink *outlink);
@@ -185,7 +183,7 @@ static int guess_channel_layout(MovieStream *st, int st_index, void *log_ctx)
return 0;
}
-static av_cold int movie_init(AVFilterContext *ctx, const char *args)
+static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, const AVClass *class)
{
MovieContext *movie = ctx->priv;
AVInputFormat *iformat = NULL;
@@ -195,7 +193,7 @@ static av_cold int movie_init(AVFilterContext *ctx, const char *args)
char name[16];
AVStream *st;
- movie->class = &movie_class;
+ movie->class = class;
av_opt_set_defaults(movie);
if (args)
@@ -592,6 +590,13 @@ static int movie_request_frame(AVFilterLink *outlink)
#if CONFIG_MOVIE_FILTER
+AVFILTER_DEFINE_CLASS(movie);
+
+static av_cold int movie_init(AVFilterContext *ctx, const char *args)
+{
+ return movie_common_init(ctx, args, &movie_class);
+}
+
AVFilter avfilter_avsrc_movie = {
.name = "movie",
.description = NULL_IF_CONFIG_SMALL("Read from a movie source."),
@@ -608,11 +613,19 @@ AVFilter avfilter_avsrc_movie = {
#if CONFIG_AMOVIE_FILTER
+#define amovie_options movie_options
+AVFILTER_DEFINE_CLASS(amovie);
+
+static av_cold int amovie_init(AVFilterContext *ctx, const char *args)
+{
+ return movie_common_init(ctx, args, &amovie_class);
+}
+
AVFilter avfilter_avsrc_amovie = {
.name = "amovie",
.description = NULL_IF_CONFIG_SMALL("Read audio from a movie source."),
.priv_size = sizeof(MovieContext),
- .init = movie_init,
+ .init = amovie_init,
.uninit = movie_uninit,
.query_formats = movie_query_formats,
--
1.7.5.4
More information about the ffmpeg-devel
mailing list