Browse code

Implement in AVFilterGraph the scale_sws_opts field, and pass its value in the args for the auto-inserted scale filters.

Originally committed as revision 17547 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefano Sabatini authored on 2009/02/24 08:45:21
Showing 3 changed files
... ...
@@ -23,7 +23,7 @@
23 23
 #define AVFILTER_AVFILTER_H
24 24
 
25 25
 #define LIBAVFILTER_VERSION_MAJOR  0
26
-#define LIBAVFILTER_VERSION_MINOR  3
26
+#define LIBAVFILTER_VERSION_MINOR  4
27 27
 #define LIBAVFILTER_VERSION_MICRO  0
28 28
 
29 29
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
... ...
@@ -30,6 +30,7 @@ void avfilter_destroy_graph(AVFilterGraph *graph)
30 30
 {
31 31
     for(; graph->filter_count > 0; graph->filter_count --)
32 32
         avfilter_destroy(graph->filters[graph->filter_count - 1]);
33
+    av_freep(&graph->scale_sws_opts);
33 34
     av_freep(&graph->filters);
34 35
 }
35 36
 
... ...
@@ -111,13 +112,15 @@ static int query_formats(AVFilterGraph *graph)
111 111
                 if(!avfilter_merge_formats(link->in_formats,
112 112
                                            link->out_formats)) {
113 113
                     AVFilterContext *scale;
114
+                    char scale_args[256];
114 115
                     /* couldn't merge format lists. auto-insert scale filter */
115 116
                     snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",
116 117
                              scaler_count);
117 118
                     scale =
118 119
                         avfilter_open(avfilter_get_by_name("scale"),inst_name);
119 120
 
120
-                    if(!scale || scale->filter->init(scale, NULL, NULL) ||
121
+                    snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts);
122
+                    if(!scale || scale->filter->init(scale, scale_args, NULL) ||
121 123
                                  avfilter_insert_filter(link, scale, 0, 0)) {
122 124
                         avfilter_destroy(scale);
123 125
                         return -1;
... ...
@@ -27,6 +27,8 @@
27 27
 typedef struct AVFilterGraph {
28 28
     unsigned filter_count;
29 29
     AVFilterContext **filters;
30
+
31
+    char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters
30 32
 } AVFilterGraph;
31 33
 
32 34
 /**