[FFmpeg-devel] [PATCH] preset dir for win32

Michael Niedermayer michaelni at gmx.at
Sat May 21 03:40:35 CEST 2011


On Sat, May 21, 2011 at 02:24:01AM +0200, Gianluigi Tiesi wrote:
> On Wed, May 18, 2011 at 01:24:17PM +0200, Michael Niedermayer wrote:
> > is below ok?
> > 
> > --- a/cmdutils.c
> > +++ b/cmdutils.c
> > @@ -848,6 +848,19 @@ FILE *get_preset_file(char *filename, size_t filename_size,
> >          av_strlcpy(filename, preset_name, filename_size);
> >          f = fopen(filename, "r");
> >      } else {
> > +#ifdef _WIN32
> > +        char arr[MAX_PATH], *ls;
> > +
> > +        if (!GetModuleFileName(GetModuleHandle(NULL), arr, sizeof(arr) - 1))
> > +            return NULL;
> > +
> > +        if (!(ls = strrchr(arr, '\\')))
> > +            return NULL;
> > +
> > +        *ls = 0;
> > +
> > +        base[2]= arr;
> > +#endif
> >          for (i = 0; i < 3 && !f; i++) {
> >              if (!base[i])
> >                  continue;
> > 
> > 
> 
> oh, good idea, I've revised the patch a bit:

thx


> - make explicit use of GetModuleFileNameA and GetModuleHandleA
> - renamed arr to datadir
> - conversion from backslash to forward slash to avoid mixing (it should be ok but I've got some problems)
> - added /ffpresets to executable directory, it's better to have ffpresets/abc.preset
> - when an error occurs base[2] will be NULL, so at least base[0] and base[1] are checked
> - documented doxygen comment cmdutils.h and ffmpeg.texi (please check, I'm Italian :D)

locally applied, will push soon.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- 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/20110521/71c38b49/attachment.asc>


More information about the ffmpeg-devel mailing list