[FFmpeg-devel] [PATCH] Support for UTF8 filenames on Windows

Karl Blomster thefluff
Thu Jul 16 16:20:00 CEST 2009

Ramiro Polla wrote:
> On Mon, Jul 13, 2009 at 2:32 PM, Michael Niedermayer<michaelni at gmx.at> wrote:
>> On Mon, Jul 13, 2009 at 10:14:47AM +0100, M?ns Rullg?rd wrote:
>>> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
>>>> On Mon, Jul 13, 2009 at 04:37:26AM -0300, Ramiro Polla wrote:
>>>>> On Sun, Jul 12, 2009 at 5:17 PM, Ramiro Polla<ramiro.polla at gmail.com> wrote:
>>>>>> On Thu, Jul 9, 2009 at 3:32 AM, Ramiro Polla<ramiro.polla at gmail.com> wrote:
>>>>>>> On Fri, Jun 26, 2009 at 1:10 PM, Karl Blomster<thefluff at uppcon.com> wrote:
>>>>>>>> Ramiro Polla wrote:
>>>>>> [...]
>>>>>>>>> But I'm still not really happy about having to choose at compile-time.
>>>>>>>>> Is there no way the user could specify it at run-time?
>>>>>>>> You could add an enable_win_utf8 parameter to
>>>>>>>> av_open_input_file I guess but that would be a really ugly
>>>>>>>> thing to have in the API and I doubt it'd be OK'd. This patch
>>>>>>>> only changes the API, not the commandline interfaces and
>>>>>>>> whatnot, so the only users of it would be people who use the
>>>>>>>> ffmpeg API, and those people presumably compile ffmpeg
>>>>>>>> themselves anyway and would know if they want UTF-8 support or
>>>>>>>> not.
>>>>>>> I'm thinking of maybe adding a field to URLContext to specify
>>>>>>> win32_utf8, or adding URL_WIN32_UTF8 to flags. Does anyone have
>>>>>>> other/better suggestions to let the user choose between the system
>>>>>>> codepage or utf8 files on Windows at runtime?
>>>>>> I could also use an environment variable. Any comments on any of the
>>>>>> three approaches?
>>>>>> 1. add a boolean field to URLContext;
>>>>>> 2. add a flag to URLContext.flags;
>>>>>> 3. add an environment variable.
>>>>> Patch for option 3 attached.
>>>>> Please comment.
>>>> I think it is no good for libavformat, IMO libraries shouldn't change
>>>> their API due to a environment variable (and I think this is toggling a
>>>> different API).
>>> That's the purpose of environment variables.  Can you suggest a better
>>> solution?  I'd rather not start adding flags for every OS quirk in the
>>> world.  This is nicely contained to the OS hacks section, as it should
>>> be.
>> agree, i also dont like the idea of adding such stuff to random structs
> Reimar, could you please comment on the replies? If there are no more
> comments or objections I'll apply it on the weekend.
> Can anyone take a look at the documentation? I think it could be
> better worded, but that's the best I can come up with.

Unless I am severely missing something in your updated patch (thanks for the 
nice work, by the way!) it will not work with the FFmpeg commandline program. If 
you want an Unicode commandline in Windows you need to use wmain() or _tmain() 
instead of plain old main(), AFAIK. As I said earlier my original patch was only 
intended to let the API support Unicode. Working it into ffmpeg.c would be a lot 
more work, I think.

Karl Blomster

More information about the ffmpeg-devel mailing list