[FFmpeg-soc] [soc]: r951 - in libavfilter: Makefile allfilters.h avfilter.c vf_split.c
koorogi
subversion at mplayerhq.hu
Sat Aug 18 05:38:40 CEST 2007
Author: koorogi
Date: Sat Aug 18 05:38:40 2007
New Revision: 951
Log:
Add a filter to output the same video to two outputs
Added:
libavfilter/vf_split.c
Modified:
libavfilter/Makefile
libavfilter/allfilters.h
libavfilter/avfilter.c
Modified: libavfilter/Makefile
==============================================================================
--- libavfilter/Makefile (original)
+++ libavfilter/Makefile Sat Aug 18 05:38:40 2007
@@ -17,6 +17,7 @@ OBJS-yes = vsrc_dummy.o \
vf_passthrough.o \
vf_rgb2bgr.o \
vf_slicify.o \
+ vf_split.o \
vf_vflip.o \
HEADERS = avfilter.h
Modified: libavfilter/allfilters.h
==============================================================================
--- libavfilter/allfilters.h (original)
+++ libavfilter/allfilters.h Sat Aug 18 05:38:40 2007
@@ -33,4 +33,5 @@ extern AVFilter vf_overlay;
extern AVFilter vf_passthrough;
extern AVFilter vf_rgb2bgr;
extern AVFilter vf_slicify;
+extern AVFilter vf_split;
extern AVFilter vf_vflip;
Modified: libavfilter/avfilter.c
==============================================================================
--- libavfilter/avfilter.c (original)
+++ libavfilter/avfilter.c Sat Aug 18 05:38:40 2007
@@ -277,6 +277,7 @@ void avfilter_init(void)
avfilter_register(&vf_passthrough);
avfilter_register(&vf_rgb2bgr);
avfilter_register(&vf_slicify);
+ avfilter_register(&vf_split);
avfilter_register(&vf_vflip);
}
Added: libavfilter/vf_split.c
==============================================================================
--- (empty file)
+++ libavfilter/vf_split.c Sat Aug 18 05:38:40 2007
@@ -0,0 +1,83 @@
+/*
+ * Video splitter
+ * copyright (c) 2007 Bobby Bingham
+ *
+ * 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
+ */
+
+#include "avfilter.h"
+
+static int *query_formats(AVFilterLink *link)
+{
+ return avfilter_make_format_list(31,
+ PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV420P,
+ PIX_FMT_YUV411P, PIX_FMT_YUV410P,
+ PIX_FMT_YUYV422, PIX_FMT_UYVY422, PIX_FMT_UYYVYY411,
+ PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P,
+ PIX_FMT_YUV440P, PIX_FMT_YUVJ440P,
+ PIX_FMT_RGB32, PIX_FMT_BGR32,
+ PIX_FMT_RGB32_1, PIX_FMT_BGR32_1,
+ PIX_FMT_RGB24, PIX_FMT_BGR24,
+ PIX_FMT_RGB565, PIX_FMT_BGR565,
+ PIX_FMT_RGB555, PIX_FMT_BGR555,
+ PIX_FMT_RGB8, PIX_FMT_BGR8,
+ PIX_FMT_RGB4_BYTE,PIX_FMT_BGR4_BYTE,
+ PIX_FMT_GRAY16BE, PIX_FMT_GRAY16LE,
+ PIX_FMT_GRAY8, PIX_FMT_PAL8);
+}
+
+static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
+{
+ avfilter_start_frame(link->dst->outputs[0],
+ avfilter_ref_pic(picref, ~AV_PERM_WRITE));
+ avfilter_start_frame(link->dst->outputs[1],
+ avfilter_ref_pic(picref, ~AV_PERM_WRITE));
+}
+
+static void end_frame(AVFilterLink *link)
+{
+ avfilter_end_frame(link->dst->outputs[0]);
+ avfilter_end_frame(link->dst->outputs[1]);
+
+ avfilter_unref_pic(link->cur_pic);
+}
+
+static void draw_slice(AVFilterLink *link, int y, int h)
+{
+ avfilter_draw_slice(link->dst->outputs[0], y, h);
+ avfilter_draw_slice(link->dst->outputs[1], y, h);
+}
+
+AVFilter vf_split =
+{
+ .name = "split",
+ .author = "Bobby Bingham",
+
+ .inputs = (AVFilterPad[]) {{ .name = "default",
+ .type = AV_PAD_VIDEO,
+ .start_frame = start_frame,
+ .draw_slice = draw_slice,
+ .query_formats = query_formats,
+ .end_frame = end_frame, },
+ { .name = NULL}},
+ .outputs = (AVFilterPad[]) {{ .name = "default",
+ .type = AV_PAD_VIDEO, },
+ { .name = "default2",
+ .type = AV_PAD_VIDEO, },
+ { .name = NULL}},
+};
+
More information about the FFmpeg-soc
mailing list