[FFmpeg-cvslog] lavfi/movie: split class definitions for movie and amovie

Stefano Sabatini git at videolan.org
Sat Aug 18 10:55:08 CEST 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Mon Aug 13 13:30:50 2012 +0200| [831a999ddaf89ad3bb31bfcf4201463098444539] | committer: Stefano Sabatini

lavfi/movie: split class definitions for movie and amovie

This is required for iterating through the filter class (without
incurring into a loop).

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=831a999ddaf89ad3bb31bfcf4201463098444539
---

 libavfilter/src_movie.c |   23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 74cf97b..a3f9d37 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)
@@ -597,6 +595,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."),
@@ -613,11 +618,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,
 



More information about the ffmpeg-cvslog mailing list