Revision e4b89522

View differences:

ffplay.c
186 186
static int fs_screen_height;
187 187
static int screen_width = 0;
188 188
static int screen_height = 0;
189
static int frame_width = 0;
190
static int frame_height = 0;
191
static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
189 192
static int audio_disable;
190 193
static int video_disable;
191 194
static int wanted_audio_stream= 0;
......
1866 1869
    ap->initial_pause = 1; /* we force a pause when starting an RTSP
1867 1870
                              stream */
1868 1871

  
1869
    ap->width = screen_width;
1870
    ap->height= screen_height;
1872
    ap->width = frame_width;
1873
    ap->height= frame_height;
1871 1874
    ap->time_base= (AVRational){1, 25};
1875
    ap->pix_fmt = frame_pix_fmt;
1872 1876

  
1873 1877
    err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap);
1874 1878
    if (err < 0) {
......
2335 2339
    }
2336 2340
}
2337 2341

  
2342
static void opt_frame_size(const char *arg)
2343
{
2344
    if (parse_image_size(&screen_width, &screen_height, arg) < 0) {
2345
        fprintf(stderr, "Incorrect frame size\n");
2346
        exit(1);
2347
    }
2348
    if ((frame_width % 2) != 0 || (frame_height % 2) != 0) {
2349
        fprintf(stderr, "Frame size must be a multiple of 2\n");
2350
        exit(1);
2351
    }
2352
}
2353

  
2338 2354
void opt_width(const char *arg)
2339 2355
{
2340 2356
    screen_width = atoi(arg);
......
2362 2378
    }
2363 2379
}
2364 2380

  
2381
static void opt_frame_pix_fmt(const char *arg)
2382
{
2383
    frame_pix_fmt = avcodec_get_pix_fmt(arg);
2384
}
2385

  
2365 2386
#ifdef CONFIG_NETWORK
2366 2387
void opt_rtp_tcp(void)
2367 2388
{
......
2410 2431
    { "h", 0, {(void*)show_help}, "show help" },
2411 2432
    { "x", HAS_ARG, {(void*)opt_width}, "force displayed width", "width" },
2412 2433
    { "y", HAS_ARG, {(void*)opt_height}, "force displayed height", "height" },
2434
    { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
2413 2435
    { "fs", OPT_BOOL, {(void*)&is_full_screen}, "force full screen" },
2414 2436
    { "an", OPT_BOOL, {(void*)&audio_disable}, "disable audio" },
2415 2437
    { "vn", OPT_BOOL, {(void*)&video_disable}, "disable video" },
......
2418 2440
    { "bytes", OPT_BOOL, {(void*)&seek_by_bytes}, "seek by bytes" },
2419 2441
    { "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
2420 2442
    { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
2443
    { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format", "format" },
2421 2444
    { "stats", OPT_BOOL | OPT_EXPERT, {(void*)&show_status}, "show status", "" },
2422 2445
    { "debug", HAS_ARG | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info", "" },
2423 2446
    { "bug", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&workaround_bugs}, "workaround bugs", "" },

Also available in: Unified diff