2008-02-15 21:58:25 +00:00
|
|
|
/*
|
|
|
|
* Filter layer - default implementations
|
2010-11-28 10:22:58 +00:00
|
|
|
* Copyright (c) 2007 Bobby Bingham
|
2008-02-15 21:58:25 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2011-12-25 22:35:06 +00:00
|
|
|
#include "libavutil/avassert.h"
|
2011-02-07 13:37:08 +00:00
|
|
|
#include "libavutil/audioconvert.h"
|
|
|
|
#include "libavutil/imgutils.h"
|
|
|
|
#include "libavutil/samplefmt.h"
|
2012-05-07 08:51:23 +00:00
|
|
|
|
2008-02-15 21:58:25 +00:00
|
|
|
#include "avfilter.h"
|
2010-11-25 20:50:23 +00:00
|
|
|
#include "internal.h"
|
2012-05-06 05:00:22 +00:00
|
|
|
#include "formats.h"
|
2008-02-15 21:58:25 +00:00
|
|
|
|
2011-06-19 18:31:24 +00:00
|
|
|
static void set_common_formats(AVFilterContext *ctx, AVFilterFormats *fmts,
|
|
|
|
enum AVMediaType type, int offin, int offout)
|
2008-02-15 21:58:25 +00:00
|
|
|
{
|
2011-06-19 18:31:24 +00:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < ctx->input_count; i++)
|
|
|
|
if (ctx->inputs[i] && ctx->inputs[i]->type == type)
|
2012-06-16 09:47:46 +00:00
|
|
|
ff_formats_ref(fmts, (AVFilterFormats **)((uint8_t *)ctx->inputs[i]+offout));
|
2011-06-19 18:31:24 +00:00
|
|
|
|
|
|
|
for (i = 0; i < ctx->output_count; i++)
|
|
|
|
if (ctx->outputs[i] && ctx->outputs[i]->type == type)
|
2012-06-16 09:47:46 +00:00
|
|
|
ff_formats_ref(fmts, (AVFilterFormats **)((uint8_t *)ctx->outputs[i]+offin));
|
2011-06-19 18:31:24 +00:00
|
|
|
|
|
|
|
if (!fmts->refcount) {
|
|
|
|
av_free(fmts->formats);
|
|
|
|
av_free(fmts->refs);
|
|
|
|
av_free(fmts);
|
2008-02-15 22:00:03 +00:00
|
|
|
}
|
2011-06-19 18:31:24 +00:00
|
|
|
}
|