[FFmpeg-devel] [PATCH] Command passing interface for libavfilter
Michael Niedermayer
michaelni at gmx.at
Mon Aug 29 20:38:26 CEST 2011
On Mon, Aug 29, 2011 at 08:30:13PM +0200, Nicolas George wrote:
> Le duodi 12 fructidor, an CCXIX, Michael Niedermayer a écrit :
> > > > the 5 patches below allow changing drawtext parameters at runtime
> > > > with ffmpeg. And add a interface to pass commands to filters and
> > > > their responses back. As well as queing commands for specific times
>
> Cool. Thanks.
>
> > +/**
> > + * Send a command to one or more filter instances.
> > + *
> > + * @param graph the filter graph
> > + * @param target the filter(s) to which the command should be sent
> > + * "all" sends to all filters
>
> Maybe "*" rather than "all"? It makes it more explicit that this is a
> special case.
i was trying to avoid special letters to make handling of the strings
require as little escaping as possible.
>
> > + if(cmd && cmd->time <= picref->pts * av_q2d(link->time_base)){
> > + avfilter_process_command(link->dst, cmd->command, cmd->arg, 0, 0, cmd->flags);
> > + command_queue_pop(link->dst);
> > + }
>
> I believe it should be a loop, here: several command can have expired in a
> single run.
fixed
>
> > + for (i = 0; i < graph->filter_count; i++) {
> > + AVFilterContext *filter = graph->filters[i];
> > + if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){
> > + AVFilterCommand **que = &filter->command_queue;
> > + while(*que) que = &(*que)->next;
>
> This part is inefficient and requires the commands to be queued in ascending
> order.
>
> If we want to keep the ordering constraint, keeping a pointer to the last
> command makes the loop useless and the insert instantaneous.
>
> But I think it would be a better idea to change it into:
>
> while(*que && *que->ts <= ts)
will fix in a moment
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110829/3f79d6c0/attachment.asc>
More information about the ffmpeg-devel
mailing list