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

Michael Niedermayer michaelni at gmx.at
Wed May 18 13:24:17 CEST 2011


On Wed, May 18, 2011 at 03:43:06AM +0200, Gianluigi Tiesi wrote:
> On Tue, May 17, 2011 at 08:26:42PM +0300, aviad rozenhek wrote:
> > >
> > >
> > > An idea can be to have FFMPEG_DATADIR as a char ptr on win32
> > > (inited somewhere to executabledir\ffpresets) and get_preset_file()
> > > unchanged
> > >
> > >
> > +1
> 
> 
> init_opts() in cmdutils.c
> 
> but FFMPEG_DATADIR in configure ?
> 
> maybe something like:
> #define FFMPEG_DATADIR win32_datadir
> and static char win32_datadir[] in cmdutils.c inside an ifdef _WIN32
> 
> or not defining it in config.h for win32 target

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;


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- 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/20110518/d3ca1692/attachment.asc>


More information about the ffmpeg-devel mailing list