Revision 39aafa5e ffmpeg.c

View differences:

ffmpeg.c
235 235
static int exit_on_error = 0;
236 236
static int using_stdin = 0;
237 237
static int verbose = 1;
238
static int daemon  = 0;
238 239
static int thread_count= 1;
239 240
static int q_pressed = 0;
240 241
static int64_t video_size = 0;
......
444 445
{
445 446
    av_log(NULL, AV_LOG_QUIET, "");
446 447
#if HAVE_TERMIOS_H
447
    tcsetattr (0, TCSANOW, &oldtty);
448
    if(!daemon)
449
        tcsetattr (0, TCSANOW, &oldtty);
448 450
#endif
449 451
}
450 452

  
......
461 463
static void term_init(void)
462 464
{
463 465
#if HAVE_TERMIOS_H
466
    if(!daemon){
464 467
    struct termios tty;
465 468

  
466 469
    tcgetattr (0, &tty);
......
478 481

  
479 482
    tcsetattr (0, TCSANOW, &tty);
480 483
    signal(SIGQUIT, sigterm_handler); /* Quit (POSIX).  */
484
    }
481 485
#endif
482 486

  
483 487
    signal(SIGINT , sigterm_handler); /* Interrupt (ANSI).  */
......
496 500
    struct timeval tv;
497 501
    fd_set rfds;
498 502

  
503
    if(daemon)
504
        return -1;
505

  
499 506
    FD_ZERO(&rfds);
500 507
    FD_SET(0, &rfds);
501 508
    tv.tv_sec = 0;
......
4266 4273
    return 0;
4267 4274
}
4268 4275

  
4276
static void log_callback_null(void* ptr, int level, const char* fmt, va_list vl)
4277
{
4278
}
4279

  
4269 4280
static const OptionDef options[] = {
4270 4281
    /* main options */
4271 4282
#include "cmdutils_common_opts.h"
......
4409 4420

  
4410 4421
    av_log_set_flags(AV_LOG_SKIP_REPEATED);
4411 4422

  
4423
    if(argc>1 && !strcmp(argv[1], "-d")){
4424
        daemon=1;
4425
        verbose=-1;
4426
        av_log_set_callback(log_callback_null);
4427
        argc--;
4428
        argv++;
4429
    }
4430

  
4412 4431
    avcodec_register_all();
4413 4432
#if CONFIG_AVDEVICE
4414 4433
    avdevice_register_all();

Also available in: Unified diff