[FFmpeg-devel] [PATCH] Set systems that should support DOS paths in configure

Ramiro Polla ramiro.polla
Tue Oct 7 21:53:16 CEST 2008


On Tue, Oct 7, 2008 at 4:29 PM, M?ns Rullg?rd <mans at mansr.com> wrote:
> "Ramiro Polla" <ramiro.polla at gmail.com> writes:
>
>> Hi,
>>
>> On Tue, Oct 7, 2008 at 3:21 PM, Reimar D?ffinger
>> <Reimar.Doeffinger at stud.uni-karlsruhe.de> wrote:
>>> Hello,
>>> On Tue, Oct 07, 2008 at 08:01:15PM +0200, V?ctor Paesa wrote:
>>>> I tried this for fun on WinXP SP3 (Spanish variety):
>>>>
>>>> C:\ subst ?: c:\caca
>>>>
>>>> C:\ ?:
>>>
>>> Same behaviour with XP x64, English, except I tried with ?:
>>>
>>>>  Directorio de ?:\
>>>
>>> It says O:\ there, but dir O: does not work, only dir ?:
>>> If you do not want to change keyboard layout, :: and !: are funny,
>>> too.
>>
>> With attached patch FFmpeg will happily accept:
>> ffmpeg.exe -i "?:\test.avi" -y " :\test2.avi"
>>
>> But it is being picked up by:
>>     while (*p != '\0' && *p != ':') {
>>         /* protocols can only contain alphabetic chars */
>>         if (!isalpha(*p))
>>             goto file_proto;
>>
>> isalpha() on Windows will return 1 for upper and 2 for lower, and 0
>> for everything else.
>>
>>> Windows Explorer still behaves as with win98, so it seems impossible to
>>> access such drives with it
>>
>> Seems like a bug in Windows Explorer. Firefox has no problem
>> displaying the happy face drive:
>> file:///(:/
>>
>>> (I admit I do not know if subst actually
>>> affects Windows Gui applications).
>>
>> I checked with a simple msvc++ app and CreateFile() works with
>> "?:\test.avi" as input filename.
>>
>>> Very scary...
>>
>> Very very scary...
>
> I'm so glad I don't have a windows machine...

Well then you're limited to not creating happy face files with FFmpeg :P

>> Index: configure
>> ===================================================================
>> --- configure (revision 15575)
>> +++ configure (working copy)
>> @@ -750,6 +750,7 @@
>>      dev_video_bktr_ioctl_bt848_h
>>      dlfcn_h
>>      dlopen
>> +    dos_paths
>>      ebp_available
>>      ebx_available
>>      fast_64bit
>> @@ -1291,6 +1292,7 @@
>>          SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
>>          SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
>>          objformat="win32"
>> +        enable dos_paths
>>          ;;
>>      cygwin*)
>>          target_os=cygwin
>> @@ -1308,6 +1310,7 @@
>>          SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
>>          SHFLAGS='-shared -Wl,--enable-auto-image-base'
>>          objformat="win32"
>> +        enable dos_paths
>>          ;;
>>      *-dos|freedos|opendos)
>>          disable ffplay ffserver vhook
>> @@ -1315,6 +1318,7 @@
>>          network_extralibs="-lsocket"
>>          EXESUF=".exe"
>>          objformat="win32"
>> +        enable dos_paths
>>          ;;
>>      linux)
>>          enable dv1394
>> @@ -1346,6 +1350,7 @@
>>          SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
>>          SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
>>          disable vhook
>> +        enable dos_paths
>>          ;;
>>      interix)
>>          disable vhook
>
> OK, as before.

>> Index: libavformat/os_support.h
>> ===================================================================
>> --- libavformat/os_support.h  (revision 15575)
>> +++ libavformat/os_support.h  (working copy)
>> @@ -32,6 +32,15 @@
>>  #  define lseek(f,p,w) _lseeki64((f), (p), (w))
>>  #endif
>>
>> +static inline int is_dos_path(const char *path)
>> +{
>> +#ifdef HAVE_DOS_PATHS
>> +    if (path[0] && path[1] == ':')
>> +        return 1;
>> +#endif
>> +    return 0;
>> +}
>> +
>
> The preceding discussion has convinced me that this is probably the
> safest solution.

>>  #ifdef __BEOS__
>>  #  include <sys/socket.h>
>>  #  include <netinet/in.h>
>> Index: libavformat/avio.c
>> ===================================================================
>> --- libavformat/avio.c        (revision 15575)
>> +++ libavformat/avio.c        (working copy)
>> @@ -21,6 +21,7 @@
>>
>>  #include "libavutil/avstring.h"
>>  #include "libavcodec/opt.h"
>> +#include "os_support.h"
>>  #include "avformat.h"
>>
>>  #if LIBAVFORMAT_VERSION_MAJOR >= 53
>> @@ -115,7 +116,7 @@
>>          p++;
>>      }
>>      /* if the protocol has length 1, we consider it is a dos drive */
>> -    if (*p == '\0' || (q - proto_str) <= 1) {
>> +    if (*p == '\0' || is_dos_path(filename)) {
>>      file_proto:
>>          strcpy(proto_str, "file");
>>      } else {
>
> Over to the maintainer...

Which is probably Michael since this file is not listed in
MAINTAINERS. So I'll apply it on Friday if there are no more
objections.

Ramiro Polla




More information about the ffmpeg-devel mailing list