[FFmpeg-cvslog] r21240 - in trunk: doc/libavfilter.texi libavfilter/Makefile libavfilter/allfilters.c libavfilter/avfilter.h libavfilter/vsrc_nullsrc.c
stefano
subversion
Sat Jan 16 11:43:53 CET 2010
Author: stefano
Date: Sat Jan 16 11:43:53 2010
New Revision: 21240
Log:
Implement null video source.
Added:
trunk/libavfilter/vsrc_nullsrc.c
Modified:
trunk/doc/libavfilter.texi
trunk/libavfilter/Makefile
trunk/libavfilter/allfilters.c
trunk/libavfilter/avfilter.h
Modified: trunk/doc/libavfilter.texi
==============================================================================
--- trunk/doc/libavfilter.texi Sat Jan 16 11:41:52 2010 (r21239)
+++ trunk/doc/libavfilter.texi Sat Jan 16 11:43:53 2010 (r21240)
@@ -197,4 +197,20 @@ Flip the input video vertically.
./ffmpeg -i in.avi -vfilters "vflip" out.avi
@end example
+ at chapter Available video sources
+
+Below is a description of the currently available video sources.
+
+ at section nullsrc
+
+Null video source, never return images. It is mainly useful as a
+template and to be employed in analysis / debugging tools.
+
+It accepts as optional parameter a string of the form
+``width:height'', where ``width'' and ``height'' specify the size of
+the configured source.
+
+The default values of ``width'' and ``height'' are respectively 352
+and 288 (corresponding to the CIF size format).
+
@bye
Modified: trunk/libavfilter/Makefile
==============================================================================
--- trunk/libavfilter/Makefile Sat Jan 16 11:41:52 2010 (r21239)
+++ trunk/libavfilter/Makefile Sat Jan 16 11:43:53 2010 (r21240)
@@ -20,4 +20,6 @@ OBJS-$(CONFIG_SCALE_FILTER)
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
Modified: trunk/libavfilter/allfilters.c
==============================================================================
--- trunk/libavfilter/allfilters.c Sat Jan 16 11:41:52 2010 (r21239)
+++ trunk/libavfilter/allfilters.c Sat Jan 16 11:43:53 2010 (r21240)
@@ -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);
}
Modified: trunk/libavfilter/avfilter.h
==============================================================================
--- trunk/libavfilter/avfilter.h Sat Jan 16 11:41:52 2010 (r21239)
+++ trunk/libavfilter/avfilter.h Sat Jan 16 11:43:53 2010 (r21240)
@@ -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, \
Added: trunk/libavfilter/vsrc_nullsrc.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/libavfilter/vsrc_nullsrc.c Sat Jan 16 11:43:53 2010 (r21240)
@@ -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}
+ },
+};
More information about the ffmpeg-cvslog
mailing list