[FFmpeg-devel] [Patch] Add input swap functionality to movie filter (src_movie.c)

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri May 6 18:15:29 CEST 2016



On 04.05.2016, at 17:01, "Felt, Patrick" <Patrick.Felt at echostar.com> wrote:

> 
> On 5/4/16, 5:52 AM, "ffmpeg-devel on behalf of Clément Bœsch" <ffmpeg-devel-bounces at ffmpeg.org on behalf of u at pkh.me> wrote:
> 
>> 
>> [...]
>>> +/* libavfilter documentation says that filter init will be called only once.  ffmpeg calls the init twice to enable it to validate
>>> + * the complex filtering has the right input and output pads. this allows us to bypass the first call if we've specified a stream
>>> + * specifier string */
>>> +static int initRun=0;
>>> +static int uninitRun=0;
>> 
>> You're not allowed to do this, it belongs in the local context.
> 
> I did realize that there will be issues if I tried to load the filter twice.  It wouldn’t function as expected with the current solution.  The problem is that ffmpeg calls init twice with two different contexts so any values I set in the context are cleared on the second run.  Indeed, the uninit() function is called after the first round.  Named Pipes don’t like being opened and closed; the ffmpeg process on the other end terminates because the reader left and sent an EOF.  I need a reasonable way to prevent opening a pipe twice.

Just don't open it in init, but only when it's actually needed?


More information about the ffmpeg-devel mailing list