[FFmpeg-soc] [PATCH] Make avfi graph call resample filter for filters with conflicting sample fmts.
Michael Niedermayer
michaelni at gmx.at
Wed Aug 4 16:39:58 CEST 2010
On Sat, Jul 31, 2010 at 03:28:26AM -0700, S.N. Hemanth Meenakshisundaram wrote:
> If two filters have incompatible sample formats, attempt inserting a
> scaler (resample filter).
>
> ---
> libavfilter/avfiltergraph.c | 14 ++++++++++----
> 1 files changed, 10 insertions(+), 4 deletions(-)
>
>
>
> avfiltergraph.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
> 3f41f8914b0d9c215195ef89bde61f38ed428661 0001-Make-avfi-graph-call-resample-filter-for-filters-wit.patch
> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
> index 6f219a6..ff33960 100644
> --- a/libavfilter/avfiltergraph.c
> +++ b/libavfilter/avfiltergraph.c
> @@ -128,15 +128,21 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
> if(link && link->in_formats != link->out_formats) {
> if(!avfilter_merge_formats(link->in_formats,
> link->out_formats)) {
> + enum AVMediaType type = link->type;
> AVFilterContext *scale;
> char scale_args[256];
> /* couldn't merge format lists. auto-insert scale filter */
> snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",
> scaler_count++);
> - scale =
> - avfilter_open(avfilter_get_by_name("scale"),inst_name);
> -
> - snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts);
> + scale = type == AVMEDIA_TYPE_VIDEO ?
> + avfilter_open(avfilter_get_by_name("scale"),inst_name) :
> + type == AVMEDIA_TYPE_AUDIO ?
> + avfilter_open(avfilter_get_by_name("resample"),inst_name) : NULL;
filter_name= type == AVMEDIA_TYPE_VIDEO ? "scale" :"resample"
scale = avfilter_open(avfilter_get_by_name(filter_name),inst_name);
ok otherwise
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20100804/0a1be7b3/attachment.pgp>
More information about the FFmpeg-soc
mailing list