summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-01-16 10:43:53 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-01-16 10:43:53 +0000
commitdd08b83c876275ae4741225a4820997c935b956d (patch)
tree6ecfa50d3f7873c16e546f861e76d9fe835c206a /libavfilter
parente1bb0364f848978785a956dcb209d025427a5f77 (diff)
Implement null video source.
Originally committed as revision 21240 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/Makefile2
-rw-r--r--libavfilter/allfilters.c2
-rw-r--r--libavfilter/avfilter.h2
-rw-r--r--libavfilter/vsrc_nullsrc.c83
4 files changed, 88 insertions, 1 deletions
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index b8a8772bae..08d60800f4 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -20,4 +20,6 @@ OBJS-$(CONFIG_SCALE_FILTER) += vf_scale.o
OBJS-$(CONFIG_SLICIFY_FILTER) += vf_slicify.o
OBJS-$(CONFIG_VFLIP_FILTER) += vf_vflip.o
+OBJS-$(CONFIG_NULLSRC_FILTER) += vsrc_nullsrc.o
+
include $(SUBDIR)../subdir.mak
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index a4cbdade86..81eec21598 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -41,4 +41,6 @@ void avfilter_register_all(void)
REGISTER_FILTER (SCALE, scale, vf);
REGISTER_FILTER (SLICIFY, slicify, vf);
REGISTER_FILTER (VFLIP, vflip, vf);
+
+ REGISTER_FILTER (NULLSRC, nullsrc, vsrc);
}
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 8f12d7d1d5..5b85427ac1 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -25,7 +25,7 @@
#include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 1
-#define LIBAVFILTER_VERSION_MINOR 15
+#define LIBAVFILTER_VERSION_MINOR 16
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vsrc_nullsrc.c b/libavfilter/vsrc_nullsrc.c
new file mode 100644
index 0000000000..ff14ea68b2
--- /dev/null
+++ b/libavfilter/vsrc_nullsrc.c
@@ -0,0 +1,83 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file libavfilter/vsrc_nullsrc.c
+ * null video source
+ */
+
+#include "avfilter.h"
+
+typedef struct {
+ int w, h;
+} NullContext;
+
+static int init(AVFilterContext *ctx, const char *args, void *opaque)
+{
+ NullContext *priv = ctx->priv;
+
+ priv->w = 352;
+ priv->h = 288;
+
+ if (args)
+ sscanf(args, "%d:%d", &priv->w, &priv->h);
+
+ if (priv->w <= 0 || priv->h <= 0) {
+ av_log(ctx, AV_LOG_ERROR, "Non-positive size values are not acceptable.\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+static int config_props(AVFilterLink *outlink)
+{
+ NullContext *priv = outlink->src->priv;
+
+ outlink->w = priv->w;
+ outlink->h = priv->h;
+
+ av_log(outlink->src, AV_LOG_INFO, "w:%d h:%d\n", priv->w, priv->h);
+
+ return 0;
+}
+
+static int request_frame(AVFilterLink *link)
+{
+ return -1;
+}
+
+AVFilter avfilter_vsrc_nullsrc = {
+ .name = "nullsrc",
+ .description = "Null video source, never return images.",
+
+ .init = init,
+ .priv_size = sizeof(NullContext),
+
+ .inputs = (AVFilterPad[]) {{ .name = NULL}},
+
+ .outputs = (AVFilterPad[]) {
+ {
+ .name = "default",
+ .type = CODEC_TYPE_VIDEO,
+ .config_props = config_props,
+ .request_frame = request_frame,
+ },
+ { .name = NULL}
+ },
+};