<div dir="ltr">It seems I've found the solution by myself looking inside<b> vf_scale.c</b>, I'll post the answer anyway for future references:<div><br></div><div>It seems that the correct way to modify an argument of a filter is to send a command to it, through the API <b>avfilter_graph_send_command()</b>.</div><div><br></div><div>The scale filter supports only "width" and "height", but that's more than enough for my needs, so the code to change the filter when the output widget size changes is simply:</div><div><br></div><div><div><font face="monospace, monospace"> if (avfilter_graph_send_command(filter_graph_, "Parsed_scale_1", "width", to_string(img_.Width()).c_str(), NULL, 0, 0) < 0)</font></div><div><span style="font-family:monospace,monospace">     ELOG << "Error setting new width!";</span></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> if (avfilter_graph_send_command(filter_graph_, "Parsed_scale_1", "height", to_string(img_.Height()).c_str(), NULL, 0, 0) < 0)</font></div><div><font face="monospace, monospace">     ELOG << "Error setting new height!";</font></div></div><div><font face="monospace, monospace"><br></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-02-08 14:22 GMT+01:00 Gabriele Greco <span dir="ltr"><<a href="mailto:gabriele.greco@wyscout.com" target="_blank">gabriele.greco@wyscout.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello everybody,<div><br></div><div>I've setup a filter chain in my program to deinterlace and scale the video frame before rendering, it works very well, and the code is faster that the custom deinterlace/scale that I used before, the problem I have is that I need to change the filter when the window is resized, here is the filter, as dumped by avfilter_graph_dump:</div><div><br></div><div><div><font face="monospace, monospace">+----------+</font></div><div><font face="monospace, monospace">|    in    |default--[720x576 64:45 yuv420p]--Parsed_yadif_0:<wbr>default</font></div><div><font face="monospace, monospace">| (buffer) |</font></div><div><font face="monospace, monospace">+----------+</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">                                                   +--------------+</font></div><div><font face="monospace, monospace">Parsed_scale_1:default--[<wbr>800x450 1:1 argb]--default|     out      |</font></div><div><font face="monospace, monospace">                                                   | (buffersink) |</font></div><div><font face="monospace, monospace">                                                   +--------------+</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">                                            +----------------+</font></div><div><font face="monospace, monospace">in:default--[720x576 64:45 yuv420p]--default| Parsed_yadif_0 |default--[720x576 64:45 yuv420p]--Parsed_scale_1:<wbr>default</font></div><div><font face="monospace, monospace">                                            |    (yadif)     |</font></div><div><font face="monospace, monospace">                                            +----------------+</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">                                                        +----------------+</font></div><div><font face="monospace, monospace">Parsed_yadif_0:default--[<wbr>720x576 64:45 yuv420p]--default| Parsed_scale_1 |default--[800x450 1:1 argb]--out:default</font></div><div><font face="monospace, monospace">                                                        |    (scale)     |</font></div><div><font face="monospace, monospace">                                                        +----------------+</font></div><div><br></div></div><div><br></div><div>When a resize event occurs I'm trying to change it in this way:</div><div><br></div><div><div><font face="monospace, monospace">    if (AVFilterContext *ctx = avfilter_graph_get_filter(<wbr>filter_graph_, "Parsed_scale_1")) {</font></div><div><font face="monospace, monospace">        std::ostringstream os;</font></div><div><font face="monospace, monospace">        os << "w=" << img_.Width() << ":h=" << img_.Height() << ":eval";</font></div><div><font face="monospace, monospace">        // passes w=XXX:h=YYY:eval to the filter</font></div><div><font face="monospace, monospace">        if (avfilter_init_str(ctx, os.str().c_str()) < 0) {</font></div><div><font face="monospace, monospace">            ELOG << "Unable to reinit filter!";</font></div><div><font face="monospace, monospace">        }</font></div><div>         }</div><div><font face="monospace, monospace">    else</font></div><div><font face="monospace, monospace">        ELOG << "Unable to find filter!";</font></div><div><br></div><div>... no error is reported but the filter is not changed after the call...</div><div><br></div><div>Note that I added to the filter the "eval" option since I read in the filter documentation that otherwise the size is evaluated only for the first frame...</div><div><br></div><div>I've tried to read through the avfilter documentation but I cannot find a specific function to do that, I hope that the only way to do that is not to delete all the filtergraph and rebuild it, I can do it if needed but I've a few concerns about the AVFilterInOut inputs/outputs, if they need to be freed or not, avfilter_graph_parse_ptr says it should not be freed by user, avfilter_graph_parse says it should...</div><div><br></div><div>Thanks in advance!</div><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_1280169608817108493gmail_signature"><div dir="ltr"><div dir="ltr"><div><font size="2"><b>Bye,</b></font></div><div dir="ltr"><font size="2"><b>Gabriele Greco</b><br></font><br></div></div></div></div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font size="2"><b>Gabriele Greco</b><br></font><b><font size="2">Senior Software Engineer - Mobile Division</font><br></b>Mobile: <u><font color="#0000ff">+39 3391941700</font></u><br>Website:  <a href="http://www.wyscout.com" target="_blank">www.wyscout.com</a></div><div dir="ltr"><img border="0" width="192" height="43" src="cid:image001.jpg@01D223A8.60441C40" alt="Descrizione: Descrizione: Descrizione: Descrizione: Logo_Wyscout_Nero_firma" style="color:rgb(31,73,125);font-family:Calibri,sans-serif;font-size:11pt"></div></div></div></div></div></div>
</div>