[FFmpeg-devel] [PATCH] Fix pipes on OS/2

Diego Biurrun diego
Sun Jul 6 17:43:19 CEST 2008


On Sat, Jun 14, 2008 at 06:40:59PM -0700, Dave Yeo wrote:
> On 06/07/08 04:37 pm, M?ns Rullg?rd wrote:
>>
>> I am slightly sceptical to randomly including headers with such
>> generic names.  We don't know what effects that might have on another
>> system.  Can't we somehow get rid of the setmode() call instead.  It's
>> horribly non-portable.  So badly, in fact, that the function exists on
>> many systems, but does entirely different things.
>
> Unluckily setmode() is used on most all DOSish compilers including all 4  
> versions of GCC that FFmpeg supports. Since it is always declared in  
> io.h perhaps this solution is best. This should also fix BEOS since it  
> has O_BINARY and the BSD setmode().
> --- configure	(revision 13773)
> +++ configure	(working copy)
> @@ -765,6 +765,7 @@
>      roundf
>      sdl
>      sdl_video_size
> +    setmode
>      socklen_t
>      soundcard_h
>      poll_h
> @@ -1602,6 +1603,7 @@
>  check_func  inet_aton $network_extralibs
>  check_func  memalign
>  check_func  mkstemp
> +check_func2 io.h setmode
>  check_func2 windows.h GetProcessTimes
>  
>  check_header byteswap.h
> --- libavformat/file.c	(revision 13773)
> +++ libavformat/file.c	(working copy)
> @@ -22,6 +22,9 @@
>  #include "libavutil/avstring.h"
>  #include "avformat.h"
>  #include <fcntl.h>
> +#ifdef HAVE_SETMODE
> +#include <io.h>
> +#endif
>  #include <unistd.h>
>  #include <sys/time.h>
>  #include <stdlib.h>
> @@ -104,7 +107,7 @@
>              fd = 0;
>          }
>      }
> -#ifdef O_BINARY
> +#ifdef HAVE_SETMODE
>      setmode(fd, O_BINARY);
>  #endif
>      h->priv_data = (void *)(size_t)fd;

So is this version of the patch OK?  I will apply on Wednesday unless I
hear objections...

Diego




More information about the ffmpeg-devel mailing list