From dad7f23f3341ee113d52c7fee4e0272c2c0ba9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Sun, 21 Oct 2012 23:05:19 +0200 Subject: [PATCH 1/2] lavd/lavfi: honor sws flags. --- libavdevice/lavfi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index 82c5844..86ad97c 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -40,6 +40,8 @@ #include "libavformat/internal.h" #include "avdevice.h" +extern struct SwsContext *sws_opts; + typedef struct { AVClass *class; ///< class for private options char *graph_str; @@ -85,6 +87,14 @@ av_cold static int lavfi_read_close(AVFormatContext *avctx) return 0; } +static char *get_sws_flags(void) +{ + char sws_flags_str[128]; + const int sws_flags = av_get_int(sws_opts, "sws_flags", NULL); + snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags); + return av_strdup(sws_flags_str); +} + av_cold static int lavfi_read_header(AVFormatContext *avctx) { LavfiContext *lavfi = avctx->priv_data; @@ -111,6 +121,8 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) if (!(lavfi->graph = avfilter_graph_alloc())) FAIL(AVERROR(ENOMEM)); + lavfi->graph->scale_sws_opts = get_sws_flags(); + if ((ret = avfilter_graph_parse(lavfi->graph, lavfi->graph_str, &input_links, &output_links, avctx)) < 0) FAIL(ret); -- 1.7.12.4