Revision 990c8438 ffplay.c

View differences:

ffplay.c
829 829
    SDL_UpdateRect(screen, s->xleft, s->ytop, s->width, s->height);
830 830
}
831 831

  
832
static int video_open(VideoState *is);
832
static int video_open(VideoState *is){
833
    int flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
834
    int w,h;
835

  
836
    if (is_full_screen && fs_screen_width) {
837
        w = fs_screen_width;
838
        h = fs_screen_height;
839
        flags |= SDL_FULLSCREEN;
840
    } else {
841
        if(screen_width){
842
            w = screen_width;
843
            h = screen_height;
844
        }else if (is->video_st && is->video_st->codec->width){
845
            w = is->video_st->codec->width;
846
            h = is->video_st->codec->height;
847
        } else {
848
            w = 640;
849
            h = 480;
850
        }
851
        flags |= SDL_RESIZABLE;
852
    }
853
#ifndef CONFIG_DARWIN
854
    screen = SDL_SetVideoMode(w, h, 0, flags);
855
#else
856
    /* setting bits_per_pixel = 0 or 32 causes blank video on OS X */
857
    screen = SDL_SetVideoMode(w, h, 24, flags);
858
#endif
859
    if (!screen) {
860
        fprintf(stderr, "SDL: could not set video mode - exiting\n");
861
        return -1;
862
    }
863
    SDL_WM_SetCaption("FFplay", "FFplay");
864

  
865
    is->width = screen->w;
866
    is->height = screen->h;
867

  
868
    return 0;
869
}
833 870

  
834 871
/* display the current picture, if any */
835 872
static void video_display(VideoState *is)
......
1599 1636
    }
1600 1637
}
1601 1638

  
1602
static int video_open(VideoState *is){
1603
    int flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
1604
    int w,h;
1605

  
1606
    if (is_full_screen && fs_screen_width) {
1607
        w = fs_screen_width;
1608
        h = fs_screen_height;
1609
        flags |= SDL_FULLSCREEN;
1610
    } else {
1611
        if(screen_width){
1612
            w = screen_width;
1613
            h = screen_height;
1614
        }else if (is->video_st && is->video_st->codec->width){
1615
            w = is->video_st->codec->width;
1616
            h = is->video_st->codec->height;
1617
        } else {
1618
            w = 640;
1619
            h = 480;
1620
        }
1621
        flags |= SDL_RESIZABLE;
1622
    }
1623
#ifndef CONFIG_DARWIN
1624
    screen = SDL_SetVideoMode(w, h, 0, flags);
1625
#else
1626
    /* setting bits_per_pixel = 0 or 32 causes blank video on OS X */
1627
    screen = SDL_SetVideoMode(w, h, 24, flags);
1628
#endif
1629
    if (!screen) {
1630
        fprintf(stderr, "SDL: could not set video mode - exiting\n");
1631
        return -1;
1632
    }
1633
    SDL_WM_SetCaption("FFplay", "FFplay");
1634

  
1635
    is->width = screen->w;
1636
    is->height = screen->h;
1637

  
1638
    return 0;
1639
}
1640

  
1641 1639
/* open a given stream. Return 0 if OK */
1642 1640
static int stream_component_open(VideoState *is, int stream_index)
1643 1641
{

Also available in: Unified diff