Revision 01558ee6 ffmpeg.c

View differences:

ffmpeg.c
3599 3599

  
3600 3600
static void opt_target(const char *arg)
3601 3601
{
3602
    int norm = -1;
3602
    enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN;
3603 3603
    static const char *const frame_rates[] = {"25", "30000/1001", "24000/1001"};
3604 3604

  
3605 3605
    if(!strncmp(arg, "pal-", 4)) {
3606
        norm = 0;
3606
        norm = PAL;
3607 3607
        arg += 4;
3608 3608
    } else if(!strncmp(arg, "ntsc-", 5)) {
3609
        norm = 1;
3609
        norm = NTSC;
3610 3610
        arg += 5;
3611 3611
    } else if(!strncmp(arg, "film-", 5)) {
3612
        norm = 2;
3612
        norm = FILM;
3613 3613
        arg += 5;
3614 3614
    } else {
3615 3615
        int fr;
3616 3616
        /* Calculate FR via float to avoid int overflow */
3617 3617
        fr = (int)(frame_rate.num * 1000.0 / frame_rate.den);
3618 3618
        if(fr == 25000) {
3619
            norm = 0;
3619
            norm = PAL;
3620 3620
        } else if((fr == 29970) || (fr == 23976)) {
3621
            norm = 1;
3621
            norm = NTSC;
3622 3622
        } else {
3623 3623
            /* Try to determine PAL/NTSC by peeking in the input files */
3624 3624
            if(nb_input_files) {
......
3630 3630
                            continue;
3631 3631
                        fr = c->time_base.den * 1000 / c->time_base.num;
3632 3632
                        if(fr == 25000) {
3633
                            norm = 0;
3633
                            norm = PAL;
3634 3634
                            break;
3635 3635
                        } else if((fr == 29970) || (fr == 23976)) {
3636
                            norm = 1;
3636
                            norm = NTSC;
3637 3637
                            break;
3638 3638
                        }
3639 3639
                    }
3640
                    if(norm >= 0)
3640
                    if(norm != UNKNOWN)
3641 3641
                        break;
3642 3642
                }
3643 3643
            }
3644 3644
        }
3645
        if(verbose && norm >= 0)
3646
            fprintf(stderr, "Assuming %s for target.\n", norm ? "NTSC" : "PAL");
3645
        if(verbose && norm != UNKNOWN)
3646
            fprintf(stderr, "Assuming %s for target.\n", norm != PAL ? "NTSC" : "PAL");
3647 3647
    }
3648 3648

  
3649
    if(norm < 0) {
3649
    if(norm == UNKNOWN) {
3650 3650
        fprintf(stderr, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n");
3651 3651
        fprintf(stderr, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n");
3652 3652
        fprintf(stderr, "or set a framerate with \"-r xxx\".\n");
......
3659 3659
        opt_audio_codec("mp2");
3660 3660
        opt_format("vcd");
3661 3661

  
3662
        opt_frame_size(norm ? "352x240" : "352x288");
3662
        opt_frame_size(norm != PAL ? "352x240" : "352x288");
3663 3663
        opt_frame_rate(NULL, frame_rates[norm]);
3664
        opt_default("g", norm ? "18" : "15");
3664
        opt_default("g", norm != PAL ? "18" : "15");
3665 3665

  
3666 3666
        opt_default("b", "1150000");
3667 3667
        opt_default("maxrate", "1150000");
......
3687 3687
        opt_audio_codec("mp2");
3688 3688
        opt_format("svcd");
3689 3689

  
3690
        opt_frame_size(norm ? "480x480" : "480x576");
3690
        opt_frame_size(norm != PAL ? "480x480" : "480x576");
3691 3691
        opt_frame_rate(NULL, frame_rates[norm]);
3692
        opt_default("g", norm ? "18" : "15");
3692
        opt_default("g", norm != PAL ? "18" : "15");
3693 3693

  
3694 3694
        opt_default("b", "2040000");
3695 3695
        opt_default("maxrate", "2516000");
......
3709 3709
        opt_audio_codec("ac3");
3710 3710
        opt_format("dvd");
3711 3711

  
3712
        opt_frame_size(norm ? "720x480" : "720x576");
3712
        opt_frame_size(norm != PAL ? "720x480" : "720x576");
3713 3713
        opt_frame_rate(NULL, frame_rates[norm]);
3714
        opt_default("g", norm ? "18" : "15");
3714
        opt_default("g", norm != PAL ? "18" : "15");
3715 3715

  
3716 3716
        opt_default("b", "6000000");
3717 3717
        opt_default("maxrate", "9000000");
......
3728 3728

  
3729 3729
        opt_format("dv");
3730 3730

  
3731
        opt_frame_size(norm ? "720x480" : "720x576");
3731
        opt_frame_size(norm != PAL ? "720x480" : "720x576");
3732 3732
        opt_frame_pix_fmt(!strncmp(arg, "dv50", 4) ? "yuv422p" :
3733
                                             (norm ? "yuv411p" : "yuv420p"));
3733
                                             (norm != PAL ? "yuv411p" : "yuv420p"));
3734 3734
        opt_frame_rate(NULL, frame_rates[norm]);
3735 3735

  
3736 3736
        audio_sample_rate = 48000;

Also available in: Unified diff