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

Clément Bœsch u at pkh.me
Tue Nov 26 09:58:49 CET 2013


On Sun, Nov 24, 2013 at 02:16:45AM -0500, Stephen Hutchinson wrote:
> > 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.
> 

av_escape() won't help?

I'm pretty sure we already deal with such issue. Try:
  make libavutil/avstring-test
  make tools/ffescape
...and look how they work.

> >> > +    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.

I was just referring to the method used:

  const int indent = 2;
  av_log(NULL, level, "\n%*cconfiguration:\n", indent, ' ');
  while (splitconf) {
      av_log(NULL, level, "%*c%s\n", indent * 2, ' ', splitconf);

...which I find a bit more sexy. Consider this a nitpick.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131126/f2d79e6f/attachment.asc>


More information about the ffmpeg-devel mailing list