[FFmpeg-devel] [PATCH] Check for the isatty function

Måns Rullgård mans
Tue Jul 14 17:15:12 CEST 2009


Martin Storsj? <martin at martin.st> writes:

> The attached patches check for the isatty function in configure, and 
> makes the code in ffmpeg.c that uses it conditional.
>
> This reduces the amount of ugly hacks needed on WinCE.
>
> // Martin 
>
> ---
>  configure |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/configure b/configure
> index 0b3cb49..23efd1f 100755
> --- a/configure
> +++ b/configure
> @@ -925,6 +925,7 @@ HAVE_LIST="
>      getrusage
>      inet_aton
>      inline_asm
> +    isatty
>      ldbrx
>      libdc1394_1
>      libdc1394_2
> @@ -2072,6 +2073,7 @@ check_func  fork
>  check_func  gethrtime
>  check_func  getrusage
>  check_func  inet_aton $network_extralibs
> +check_func  isatty
>  check_func  memalign
>  check_func  mkstemp
>  check_func  posix_memalign

OK

> ---
>  ffmpeg.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/ffmpeg.c b/ffmpeg.c
> index ca083de..15b1dcd 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -3978,8 +3978,10 @@ int main(int argc, char **argv)
>      avdevice_register_all();
>      av_register_all();
>  
> +#if HAVE_ISATTY
>      if(isatty(STDIN_FILENO))
>          url_set_interrupt_cb(decode_interrupt_cb);
> +#endif
>  
>      for(i=0; i<CODEC_TYPE_NB; i++){
>          avcodec_opts[i]= avcodec_alloc_context2(i);

Fine by me.

That said, why do we do this only if stdin is a terminal?

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list