[FFmpeg-devel] [PATCH] lavfi: add asendcmd and sendcmd filters

Nicolas George nicolas.george at normalesup.org
Wed Aug 15 00:16:36 CEST 2012

L'octidi 28 thermidor, an CCXX, Stefano Sabatini a écrit :
> Well, I suppose we could detect when the time goes back in case t2 <=
> t1, and seek back to the first command with time >= t2.

I am afraid it is more complicated than that. For example, if you want to
remove an annoying logo from t=5mn to t=15mn, you will put a command to
activate delogo at 5mn and deactivate it at 15mn, but there may be other
unrelated commands between them. If the user seeks from 18mn to 12mn, the
command to activate delogo has to be executed, but if they seek directly
from 15mn to 3mn, it does not.

I do not believe having a solution for that problem right now is mandatory,
but having a syntax that be extended to implement a solution would be

> > What happens if your lines are terminated by \r\n?
> Syntax error (a line containing only "\r" doesn't contain enough
> information.

I was not only thinking about empty lines. I suppose a correct timed command
line terminated by \r\n would just have the \r taken as part of the
argument, does it not?

This is not very windows-users-friendly. Not that I care at all about
windows, but it will definitely generate noise on the users mailing list and
bug tracker.

We could have some kind of av_read_file with flags to eliminate \r before
\n, and possibly even other features. If you think it is a good idea, I can
implement that.

> Yes. At the moment I don't know how to support commands which spans
> for more than one line. I suppose we could make use of some form of
> \n escaping.

If you use av_get_token, I believe you can have a multi-line argument just
by delimiting with single quotes.

> It will abort since the line doesn't contain a command (# not at the
> begin of the line are not treated as comments).

Skipping the spaces at the beginning of lines would not be hard.

> I don't know if we have already a mergesort implementation in our
> codebase or if I should hack it.

Michael added qsort.h with a quick-sort and a merge-sort as macros. Another
solution would be to just add an index in the command structure (maybe the
line number, useful in the verbose message?) and use it as a secondary sort

> Thanks (I implemented it mainly as a testing device, but can be useful
> in many reconfiguration scenarios).
> Patch updated. Todo:
> 1. stable sort of commands
> 2. ecaping of newlines (useful for commands which contains newlines in
> the argument
> 3. silly \r\n line ending support??
> 4. more meaningful drawtext examples

I do not see anything to add to that.


  Nicolas George
-------------- 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/20120815/14ad65a7/attachment.asc>

More information about the ffmpeg-devel mailing list