Thread: need to fix argument in the main function, but how ?

  1. #1
    Registered User
    Join Date
    Mar 2020
    Posts
    4

    need to fix argument in the main function, but how ?

    Hi all,<br>
    I need to fix some arguments or defualt arguments in the main function below, but i don't know how, all what i've test does not work, thanks for your help. It's ffmpeg.c source and i need to fix input stream and output stream as follow:<br>
    ffmpeg -i rtsp://host/live -f flv rtmp://remotehost/live<br>
    int main(int argc, char **argv)
    {
    int i, ret;
    BenchmarkTimeStamps ti;


    init_dynload();


    register_exit(ffmpeg_cleanup);


    setvbuf(stderr,NULL,_IONBF,0);




    av_log_set_flags(AV_LOG_SKIP_REPEATED);
    parse_loglevel(argc, argv, options);




    if(argc>1 && !strcmp(argv[1], "-d")){
    run_as_daemon=1;
    av_log_set_callback(log_callback_null);
    argc--;
    argv++;
    }






    #if CONFIG_AVDEVICE
    avdevice_register_all();
    #endif
    avformat_network_init();


    show_banner(argc, argv, options);


    /* parse options and open all input/output files */
    ret = ffmpeg_parse_options(argc, argv);
    if (ret < 0)
    exit_program(1);


    if (nb_output_files <= 0 && nb_input_files == 0) {
    show_usage();
    av_log(NULL, AV_LOG_WARNING, "Use -h to get full help or, even better, run 'man %s'\n", program_name);
    exit_program(1);
    }


    /* file converter / grab */
    if (nb_output_files <= 0) {
    av_log(NULL, AV_LOG_FATAL, "At least one output file must be specified\n");
    exit_program(1);
    }


    for (i = 0; i < nb_output_files; i++) {
    if (strcmp(output_files[i]->ctx->oformat->name, "rtp"))
    want_sdp = 0;
    }


    /* current_time = ti = get_benchmark_time_stamps();*/
    if (transcode() < 0)
    exit_program(1);
    if (do_benchmark) {
    int64_t utime, stime, rtime;
    current_time = get_benchmark_time_stamps();
    utime = current_time.user_usec - ti.user_usec;
    stime = current_time.sys_usec - ti.sys_usec;
    rtime = current_time.real_usec - ti.real_usec;
    av_log(NULL, AV_LOG_INFO,
    "bench: utime=%0.3fs stime=%0.3fs rtime=%0.3fs\n",
    utime / 1000000.0, stime / 1000000.0, rtime / 1000000.0);
    }


    av_log(NULL, AV_LOG_DEBUG, "%"PRIu64" frames successfully decoded, %"PRIu64" decoding errors\n",
    decode_error_stat[0], decode_error_stat[1]);
    if ((decode_error_stat[0] + decode_error_stat[1]) * max_error_rate < decode_error_stat[1])
    exit_program(69);


    exit_program(received_nb_signals ? 255 : main_return_code);
    return main_return_code;
    }

    Last edited by netlink1987; 03-09-2020 at 10:38 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need to fix argument in the main function, but how ?
    By netlink1987 in forum C Programming
    Replies: 6
    Last Post: 03-09-2020, 11:17 PM
  2. How to Pass Main Fuction argument to some Other Function
    By SimplySud in forum C Programming
    Replies: 3
    Last Post: 12-26-2014, 08:49 AM
  3. Replies: 6
    Last Post: 05-08-2014, 10:57 AM
  4. Replies: 2
    Last Post: 06-04-2013, 08:25 AM
  5. Template Argument inside the Argument of a Function Declaration
    By manasij7479 in forum C++ Programming
    Replies: 3
    Last Post: 06-11-2011, 05:53 AM

Tags for this Thread