libavfilter/af_asplit.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2011 Stefano Sabatini
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 filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
00029 {
00030     avfilter_filter_samples(inlink->dst->outputs[0],
00031                             avfilter_ref_buffer(insamples, ~AV_PERM_WRITE));
00032     avfilter_filter_samples(inlink->dst->outputs[1],
00033                             avfilter_ref_buffer(insamples, ~AV_PERM_WRITE));
00034     avfilter_unref_buffer(insamples);
00035 }
00036 
00037 AVFilter avfilter_af_asplit = {
00038     .name        = "asplit",
00039     .description = NULL_IF_CONFIG_SMALL("Pass on the audio input to two outputs."),
00040 
00041     .inputs = (const AVFilterPad[]) {
00042         { .name             = "default",
00043           .type             = AVMEDIA_TYPE_AUDIO,
00044           .get_audio_buffer = avfilter_null_get_audio_buffer,
00045           .filter_samples   = filter_samples, },
00046         { .name = NULL}
00047     },
00048     .outputs = (const AVFilterPad[]) {
00049         { .name             = "output1",
00050           .type             = AVMEDIA_TYPE_AUDIO, },
00051         { .name             = "output2",
00052           .type             = AVMEDIA_TYPE_AUDIO, },
00053         { .name = NULL}
00054     },
00055 };