libavfilter/vf_split.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2007 Bobby Bingham
00003  *
00004  * This file is part of FFmpeg.
00005  *
00006  * FFmpeg is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * FFmpeg is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with FFmpeg; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00026 #include "avfilter.h"
00027 
00028 static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
00029 {
00030     avfilter_start_frame(inlink->dst->outputs[0],
00031                          avfilter_ref_buffer(picref, ~AV_PERM_WRITE));
00032     avfilter_start_frame(inlink->dst->outputs[1],
00033                          avfilter_ref_buffer(picref, ~AV_PERM_WRITE));
00034 }
00035 
00036 static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
00037 {
00038     avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
00039     avfilter_draw_slice(inlink->dst->outputs[1], y, h, slice_dir);
00040 }
00041 
00042 static void end_frame(AVFilterLink *inlink)
00043 {
00044     avfilter_end_frame(inlink->dst->outputs[0]);
00045     avfilter_end_frame(inlink->dst->outputs[1]);
00046 
00047     avfilter_unref_buffer(inlink->cur_buf);
00048 }
00049 
00050 AVFilter avfilter_vf_split = {
00051     .name      = "split",
00052     .description = NULL_IF_CONFIG_SMALL("Pass on the input to two outputs."),
00053 
00054     .inputs    = (const AVFilterPad[]) {{ .name      = "default",
00055                                     .type            = AVMEDIA_TYPE_VIDEO,
00056                                     .get_video_buffer= avfilter_null_get_video_buffer,
00057                                     .start_frame     = start_frame,
00058                                     .draw_slice      = draw_slice,
00059                                     .end_frame       = end_frame, },
00060                                   { .name = NULL}},
00061     .outputs   = (const AVFilterPad[]) {{ .name      = "output1",
00062                                     .type            = AVMEDIA_TYPE_VIDEO, },
00063                                   { .name            = "output2",
00064                                     .type            = AVMEDIA_TYPE_VIDEO, },
00065                                   { .name = NULL}},
00066 };