[Ffmpeg-devel] Re: [PATCH] remove mingw32 ifdefs in file.c

Ramiro Polla angustia
Fri Dec 22 18:58:17 CET 2006


Aurelien Jacobs wrote:
> On Thu, 21 Dec 2006 13:49:27 +0000 (UTC)
> Joakim Plate <elupus at ecce.se> wrote:
>
>   
>>> Diego Biurrun <diego <at> biurrun.de> writes:
>>>
>>> Patch applied, we're on a crusade against this system-specific hackery
>>> anyway.
>>>
>>> Diego
>>>
>>>       
>> I suspect this is one of those things you wish to have fixed in mingw, but
>> anyways worth noting. 
>>
>> The commit made on this will break support for >2gb files in mingw. mingw
>> doesn't have a 64bit off_t and standard file functions. It only has explicit
>> support for it using off64_t, lseeki64 and similars.
>>     
>
> Maybe the attached patch would fix this issue ?
> Could someone test it ?
>
> Aurel
>   
> ------------------------------------------------------------------------
>
> Index: libavformat/os_support.h
> ===================================================================
> --- libavformat/os_support.h	(r??vision 6773)
> +++ libavformat/os_support.h	(copie de travail)
> @@ -27,14 +27,17 @@
>   * miscellaneous OS support macros and functions.
>   *
>   * - usleep() (Win32, BeOS, OS/2)
> + * - lseek()  (Win32)
>   * - floatf() (OS/2)
>   * - strcasecmp() (OS/2)
>   */
>  
>  #ifdef __MINGW32__
>  __declspec(dllimport) void __stdcall Sleep(unsigned long dwMilliseconds);
> +__declspec(dllimport) int64_t __stdcall _lseeki64(int, int64_t, int);
>  // #  include <windows.h>
>  #  define usleep(t)    Sleep((t) / 1000)
> +#  define lseek(f,p,w) _lseeki64((f), (p), (w))
>  #endif
>  
>  #ifdef __BEOS__
>   
This didn't work.
- The correct declaration of _lseeki64 is __cdecl. There's no need to 
declare it here. Sleep is declared because windows.h is not included, 
but in this case, fcntl.h has this function.
- By including first this define from lseek to _lseeki64, when fcntl.h 
is included, it tries to define _lseeki64 twice (one for the real 
function, and another for lseek, which was defined to be _lseeki64).

Altough I can confirm that my previous patch did break files > 2 gb, and 
that it does work when _lseeki64 is used.

Ramiro Polla




More information about the ffmpeg-devel mailing list