[FFmpeg-devel] [PATCH] Define FFMPEG_PREFIX in config.h
Tue Jan 6 21:59:47 CET 2009
On date Monday 2009-01-05 19:28:47 +0100, Diego Biurrun encoded:
> On Mon, Jan 05, 2009 at 11:52:06AM +0100, Stefano Sabatini wrote:
> > On date Wednesday 2008-12-24 18:55:16 +0100, Stefano Sabatini encoded:
> > > On date Saturday 2008-11-08 17:23:18 +0100, Stefano Sabatini encoded:
> > > > On date Friday 2008-10-31 18:51:16 +0100, Diego Biurrun encoded:
> > > > > On Tue, Sep 30, 2008 at 12:22:30AM +0200, Stefano Sabatini wrote:
> > > > > > Hi, as in subject,
> > > > > >
> > > > > > conceived for supporting $prefix/share/ffmpeg preset paths but useful
> > > > > > by its own.
> > > > >
> > > > > I don't quite understand what exactly this is useful for, please
> > > > > elaborate...
> > > >
> > > > For example if we decide to install the bundled preset files, we
> > > > should install them in that directory, then the generated binary
> > > > should be able to access them directly looking in that directory.
> > >
> > > Maybe I didn't explain it very well.
> > >
> > > I mean that if the user uses as prefix PREFIX, then the ffmpeg binary
> > > should look at the preset files in $prefix/share/ffmpeg, for example
> > > if she installs ffmpeg in $HOME the presets should be looked for in
> > > $HOME/share/ffmpeg.
> > >
> > > Also maybe it would be a good idea to automatically install the
> > > already packaged preset files in PREFIX/share/ffmpeg.
> > Ping.
> I think you should just define a datadir in configure, which can then
> be exported to config.mak and config.h.
Yes I agree.
Now the technical problem is that the default datadir is defined as:
so it needs to be evalled before to be catted to $TMPH.
So we need to escape special characters during the first evaluation,
but preserving the $ which is used for variable expansion (which we
need to perform).
Then it needs to be escaped a second time for the special C chars,
namely '"' and '\', which is the easy part.
So we have:
grep command to be executed:
Since this string contains contains the ')' and '(' chars, which will
be used in a $() context, then we need to use " sh escaping and escape
the special chars '`', '\' and '"'
This can be used safely also for C-escaping, since the escaping of the
non special C-char '`' has no effects, that is:
printf("\'") = printf("`")
This seems to work fine even with pathological cases like this:
#define FFMPEG_CONFIGURATION "--datadir="`", """ and "\" escaping is much 'boresome'"
#define FFMPEG_DATADIR "\"\`\", \"\"\" and \"\\\" escaping is much 'boresome'"
Unfortunately this can't work with strings containing '$', and for even
worst cases like strings containing for example the '!' char which
*can't be escaped* as far as I know inside a sh "-context.
So we have *at least* this limitation, that is datadir won't have to
contain the "$" and "!" chars, and maybe others (I'm not a sh
If we can't accept this limitation, we need to deal with the datadir
in a different way when it is specified by the user, so that we won't
need to pass through the first evaluation.
Attached patch implements the first solution.
FFmpeg = Fierce & Foolish Multimedia Patchable Enlightened Guru
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2036 bytes
Desc: not available
More information about the ffmpeg-devel