Browse code

Make avfilter_all_colorspaces() add to the returned list of pixel formats only the non-HW-accelerated formats, for which there is no sense in filtering.

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

Stefano Sabatini authored on 2010/01/04 09:08:11
Showing 1 changed files
... ...
@@ -19,6 +19,7 @@
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
  */
21 21
 
22
+#include "libavutil/pixdesc.h"
22 23
 #include "avfilter.h"
23 24
 
24 25
 /**
... ...
@@ -101,14 +102,12 @@ int avfilter_add_colorspace(AVFilterFormats *avff, enum PixelFormat pix_fmt)
101 101
 AVFilterFormats *avfilter_all_colorspaces(void)
102 102
 {
103 103
     AVFilterFormats *ret;
104
-    int i;
104
+    enum PixelFormat pix_fmt;
105 105
 
106 106
     ret = av_mallocz(sizeof(AVFilterFormats));
107
-    ret->formats = av_malloc(sizeof(*ret->formats) * PIX_FMT_NB);
108
-    ret->format_count = PIX_FMT_NB;
109
-
110
-    for(i = 0; i < PIX_FMT_NB; i ++)
111
-        ret->formats[i] = i;
107
+    for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
108
+        if (!(av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL))
109
+            avfilter_add_colorspace(ret, pix_fmt);
112 110
 
113 111
     return ret;
114 112
 }