vf_split.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 Bobby Bingham
3  *
4  * This file is part of Libav.
5  *
6  * Libav is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * Libav is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with Libav; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
26 #include "avfilter.h"
27 
28 static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
29 {
30  avfilter_start_frame(inlink->dst->outputs[0],
32  avfilter_start_frame(inlink->dst->outputs[1],
34 }
35 
36 static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
37 {
38  avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
39  avfilter_draw_slice(inlink->dst->outputs[1], y, h, slice_dir);
40 }
41 
42 static void end_frame(AVFilterLink *inlink)
43 {
44  avfilter_end_frame(inlink->dst->outputs[0]);
45  avfilter_end_frame(inlink->dst->outputs[1]);
46 
48 }
49 
51  .name = "split",
52  .description = NULL_IF_CONFIG_SMALL("Pass on the input to two outputs."),
53 
54  .inputs = (AVFilterPad[]) {{ .name = "default",
55  .type = AVMEDIA_TYPE_VIDEO,
56  .get_video_buffer= avfilter_null_get_video_buffer,
57  .start_frame = start_frame,
58  .draw_slice = draw_slice,
59  .end_frame = end_frame, },
60  { .name = NULL}},
61  .outputs = (AVFilterPad[]) {{ .name = "output1",
62  .type = AVMEDIA_TYPE_VIDEO, },
63  { .name = "output2",
64  .type = AVMEDIA_TYPE_VIDEO, },
65  { .name = NULL}},
66 };
static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
Definition: vf_split.c:36
void avfilter_end_frame(AVFilterLink *link)
Notifie the next filter that the current frame has finished.
Definition: avfilter.c:430
A filter pad used for either input or output.
Definition: avfilter.h:312
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:191
static void end_frame(AVFilterLink *inlink)
Definition: vf_split.c:42
AVFilter avfilter_vf_split
Definition: vf_split.c:50
void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
Send a slice to the next filter.
Definition: avfilter.c:447
void avfilter_unref_buffer(AVFilterBufferRef *ref)
Remove a reference to a buffer.
Definition: avfilter.c:73
A reference to an AVFilterBuffer.
Definition: avfilter.h:124
NULL
Definition: eval.c:50
Filter definition.
Definition: avfilter.h:497
AVFilterBufferRef * avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
Add a new reference to a buffer.
Definition: avfilter.c:47
void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
Notify the next filter of the start of a frame.
Definition: avfilter.c:400
const char * name
filter name
Definition: avfilter.h:498
AVFilterBufferRef * avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
get_video_buffer() handler for filters which simply pass video along
Definition: defaults.c:288
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:551
#define AV_PERM_WRITE
can write to the buffer
Definition: avfilter.h:82
static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
Definition: vf_split.c:28