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

Felt, Patrick Patrick.Felt at echostar.com
Wed May 4 17:01:30 CEST 2016






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:

>On Wed, May 04, 2016 at 12:15:26AM +0000, Felt, Patrick wrote:
>> Afternoon all,
>>   I apologize if this isn’t right way to submit a patch.
>
>You're supposed to git commit and use git format-patch.

Mind throwing some pointers on where to read up on this?  As I said, I’m fairly green with git

>
>[...]
>> +/* 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.

Breakpoint 1, movie_common_init (ctx=0x106bbdb <av_opt_find2+107>) at libavfilter/src_movie.c:216
216	{
(gdb) n
217	    MovieContext *movie = ctx->priv;
(gdb)
218	    AVInputFormat *iformat = NULL;
(gdb) p movie
$1 = (MovieContext *) 0x2413b80
(gdb) c
Breakpoint 1, movie_common_init (ctx=0x106bbdb <av_opt_find2+107>) at libavfilter/src_movie.c:216
216	{
(gdb) n
217	    MovieContext *movie = ctx->priv;
(gdb)
218	    AVInputFormat *iformat = NULL;
(gdb) p movie
$2 = (MovieContext *) 0x240e160





>
>> +
>>  typedef struct MovieStream {
>>      AVStream *st;
>>      AVCodecContext *codec_ctx;
>>      int done;
>> +    int64_t lastPts;    /* this is used exclusively by the reset code */
>> +    int64_t basePts;    /* idem */
>
>Here and many times below, keep the naming convention.

Good point, I did name my variables a bit differently. I’ll rename then.


>
>[...]
>
>-- 
>Clément B.
>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list