lavfi: allow building without swscale.
authorAnton Khirnov <anton@khirnov.net>
Wed, 13 Jun 2012 08:10:31 +0000 (10:10 +0200)
committerAnton Khirnov <anton@khirnov.net>
Wed, 13 Jun 2012 11:57:47 +0000 (13:57 +0200)
configure
libavfilter/Makefile
libavfilter/allfilters.c
libavfilter/avfiltergraph.c

index 5f9eed3..31c437c 100755 (executable)
--- a/configure
+++ b/configure
@@ -1531,16 +1531,16 @@ frei0r_src_filter_extralibs='$ldl'
 hqdn3d_filter_deps="gpl"
 resample_filter_deps="avresample"
 ocv_filter_deps="libopencv"
+scale_filter_deps="swscale"
 yadif_filter_deps="gpl"
 
 # libraries
 avdevice_deps="avcodec avformat"
-avfilter_deps="swscale"
 avformat_deps="avcodec"
 
 # programs
 avconv_deps="avcodec avfilter avformat avresample swscale format_filter
-             setpts_filter"
+             scale_filter setpts_filter"
 avplay_deps="avcodec avformat swscale sdl"
 avplay_select="rdft"
 avprobe_deps="avcodec avformat"
index 7e1a6d1..955a97c 100644 (file)
@@ -1,8 +1,9 @@
 NAME = avfilter
-FFLIBS = avutil swscale
+FFLIBS = avutil
 FFLIBS-$(CONFIG_ASYNCTS_FILTER) += avresample
 FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec
 FFLIBS-$(CONFIG_RESAMPLE_FILTER) += avresample
+FFLIBS-$(CONFIG_SCALE_FILTER)   += swscale
 
 HEADERS = avfilter.h                                                    \
           avfiltergraph.h                                               \
@@ -63,6 +64,7 @@ OBJS-$(CONFIG_OCV_FILTER)                    += vf_libopencv.o
 OBJS-$(CONFIG_OVERLAY_FILTER)                += vf_overlay.o
 OBJS-$(CONFIG_PAD_FILTER)                    += vf_pad.o
 OBJS-$(CONFIG_PIXDESCTEST_FILTER)            += vf_pixdesctest.o
+OBJS-$(CONFIG_SCALE_FILTER)                  += vf_scale.o
 OBJS-$(CONFIG_SELECT_FILTER)                 += vf_select.o
 OBJS-$(CONFIG_SETDAR_FILTER)                 += vf_aspect.o
 OBJS-$(CONFIG_SETPTS_FILTER)                 += vf_setpts.o
index 6814871..118f09d 100644 (file)
@@ -73,6 +73,7 @@ void avfilter_register_all(void)
     REGISTER_FILTER (OVERLAY,     overlay,     vf);
     REGISTER_FILTER (PAD,         pad,         vf);
     REGISTER_FILTER (PIXDESCTEST, pixdesctest, vf);
+    REGISTER_FILTER (SCALE,       scale,       vf);
     REGISTER_FILTER (SELECT,      select,      vf);
     REGISTER_FILTER (SETDAR,      setdar,      vf);
     REGISTER_FILTER (SETPTS,      setpts,      vf);
@@ -113,8 +114,4 @@ void avfilter_register_all(void)
         extern AVFilter avfilter_asink_abuffer;
         avfilter_register(&avfilter_asink_abuffer);
     }
-    {
-        extern AVFilter avfilter_vf_scale;
-        avfilter_register(&avfilter_vf_scale);
-    }
 }
index 4521f79..0a863e5 100644 (file)
@@ -213,11 +213,16 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
                 /* couldn't merge format lists. auto-insert conversion filter */
                 switch (link->type) {
                 case AVMEDIA_TYPE_VIDEO:
+                    if (!(filter = avfilter_get_by_name("scale"))) {
+                        av_log(log_ctx, AV_LOG_ERROR, "'scale' filter "
+                               "not present, cannot convert pixel formats.\n");
+                        return AVERROR(EINVAL);
+                    }
+
                     snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",
                              scaler_count++);
                     snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts);
-                    if ((ret = avfilter_graph_create_filter(&convert,
-                                                            avfilter_get_by_name("scale"),
+                    if ((ret = avfilter_graph_create_filter(&convert, filter,
                                                             inst_name, scale_args, NULL,
                                                             graph)) < 0)
                         return ret;