Browse code

Make the scale filter set in the input and output links only the respective pixel formats effectively supported by libswscale.

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

Stefano Sabatini authored on 2010/01/09 08:48:32
Showing 1 changed files
... ...
@@ -69,13 +69,27 @@ static av_cold void uninit(AVFilterContext *ctx)
69 69
 static int query_formats(AVFilterContext *ctx)
70 70
 {
71 71
     AVFilterFormats *formats;
72
+    enum PixelFormat pix_fmt;
73
+    int ret;
72 74
 
73 75
     if (ctx->inputs[0]) {
74
-        formats = avfilter_all_colorspaces();
76
+        formats = NULL;
77
+        for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
78
+            if (   sws_isSupportedInput(pix_fmt)
79
+                && (ret = avfilter_add_colorspace(&formats, pix_fmt)) < 0) {
80
+                avfilter_formats_unref(&formats);
81
+                return ret;
82
+            }
75 83
         avfilter_formats_ref(formats, &ctx->inputs[0]->out_formats);
76 84
     }
77 85
     if (ctx->outputs[0]) {
78
-        formats = avfilter_all_colorspaces();
86
+        formats = NULL;
87
+        for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
88
+            if (    sws_isSupportedOutput(pix_fmt)
89
+                && (ret = avfilter_add_colorspace(&formats, pix_fmt)) < 0) {
90
+                avfilter_formats_unref(&formats);
91
+                return ret;
92
+            }
79 93
         avfilter_formats_ref(formats, &ctx->outputs[0]->in_formats);
80 94
     }
81 95