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

Ramiro Polla ramiro.polla
Mon Oct 6 23:13:12 CEST 2008


Hi,

On Mon, Oct 6, 2008 at 5:52 PM, M?ns Rullg?rd <mans at mansr.com> wrote:
> "Ramiro Polla" <ramiro.polla at gmail.com> writes:
>
>> Hi,
>>
>> On Fri, Oct 3, 2008 at 7:58 PM, M?ns Rullg?rd <mans at mansr.com> wrote:
>>> "Ramiro Polla" <ramiro.polla at gmail.com> writes:
>>>> $subj
>> [...]
>>>> Index: libavformat/os_support.h
>>>> ===================================================================
>>>> --- libavformat/os_support.h  (revision 15464)
>>>> +++ libavformat/os_support.h  (working copy)
>>>> @@ -35,6 +35,12 @@
>>>>  #  define lseek(f,p,w) _lseeki64((f), (p), (w))
>>>>  #endif
>>>>
>>>> +#ifdef HAVE_DOS_PATHS
>>>> +    #define is_dos_path(path) (path[1]==':')
>>>
>>> This allows anything as the "drive letter", though maybe that's
>>> considered OK.
>>
>> According to [0], only letters are allowed for the drive letter
>> (altough I've seen some program, fsdext2 IIRC, using numbers). Added
>> isalpha() for path[0].
>>
>>>> +#else
>>>> +    #define is_dos_path(path) (0)
>>>
>>> Useless ().
>>
>> Removed.
>>
>> Also changed from #define to static inline int like ff_network_init().
>>
>> Ramiro Polla
>> [0] http://msdn.microsoft.com/en-us/library/cc232152.aspx
>>
>> Index: libavformat/os_support.h
>> ===================================================================
>> --- libavformat/os_support.h  (revision 15572)
>> +++ 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 (isalpha(path[0]) && path[1] == ':')
>> +             return 1;
>
> Weird indentation.

I know... I sent another patch right afterwards which should have fixed this.

>> +#endif
>> +    return 0;
>> +}
>> +
>>  #ifdef __BEOS__
>>  #  include <sys/socket.h>
>>  #  include <netinet/in.h>
>> Index: libavformat/avio.c
>> ===================================================================
>> --- libavformat/avio.c        (revision 15572)
>> +++ 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)) {
>
> Not that I mind making the check stricter, but does this not cover
> what you need?

In Windows, yes, it does. The difference is that this was also being
special-cased in all other systems. With this patch it becomes
consistent. It will work the same way with and without the patch for
DOS-based systems, and
ffmpeg -i x:something
will now fail the same way as
ffmpeg -i xx:something
in non-DOS-based systems.

Besides this adds the function so it can be used by presets as well.

Ramiro Polla




More information about the ffmpeg-devel mailing list