[FFmpeg-devel] [FFmpeg-cvslog] cmdutils: Add -buildconf option.

Stephen Hutchinson qyot27 at gmail.com
Sun Nov 24 08:16:45 CET 2013

> On Thu, Nov 21, 2013 at 12:55:53PM +0100, Clément Bœsch wrote:
>> On Tue, Nov 19, 2013 at 10:32:32PM +0100, Stephen Hutchinson wrote:
>> > +
>> > +    // Compensate for the weirdness this would cause
>> > +    // when passing 'pkg-config --static'.
>> > +    while( (remove_tilde = strstr(str, "pkg-config~")) != NULL ) {
>> > +        strncpy(remove_tilde, "pkg-config ",11);
>> > +    }
>> > +
>> This hack is not enough to deal with a lot of similar options. It needs
>> proper string escaping.

I've been struggling with getting anything remotely close to this to
work.  IMO, if something is implemented for this it should actually be
a general-use function in libavutil/avstring.* and then used by
print_buildconf() to do what needs to be done.

IMO, what it needs is a delimited-substring finding function, so that
the spaces inside of the delimiters could be found and any operations
restricted to the substring only.  The issue is that everything
between the single-quotes in a =' ' sequence needs to be completely
ignored (or prepped, so it can be ignored later by av_strtok).  So,
kind of like strstr, except that the user would give it a delimiter
and the string being searched for and it'd return the first result
that's contained within a pair of the delimiters.  One foreseeable
problem is how to let it know that an end delimiter isn't a start
delimiter in the case that both are the same - it'd need to count from
the beginning of the master string and only allow 1+2, 3+4, 5+6, etc.
- or be made to use two different, non-overlapping delimiters.

Unfortunately, that takes it beyond the realm of my ability.  I was
hitting too many walls/segfaults/hangs trying to figure out how to
zero in on only the quoted substrings.  I could probably handle it
without much trouble if the substring function existed, though.

>> > +    splitconf = strtok(str, "~");
>> av_strtok()

I've done this locally.  I can send a patch for this, although I'd
been wanting to get the substring stuff figured out first (but since
that hit a reef...).

>> > +    av_log(NULL, level, "\n%sconfiguration:\n",indent);
>> > +    while(splitconf != NULL) {
>> > +        av_log(NULL, level, "%s%s%s\n", indent, indent, splitconf);
>> See JSON_INDENT() in ffprobe.

How exactly is JSON_INDENT() preferable to just using the
already-defined 'indent' twice (or using a four-space-wide
'indent_double' once) so that configuration: is indented two spaces
and the options are indented four spaces?  I'm guessing it's in the
method used, not by pulling in all of the json-related stuff from
ffprobe; if all the rest of the json stuff is necessary just to have
the indent_level not collapse to a single space, then that would seem
a bit of overkill.

Sending this to the mailing list so that it can get more feedback.

More information about the ffmpeg-devel mailing list