From 5b239d47bdb2b6a796b9a5718a4eeeea19ee2709 Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 23 Nov 2008 14:57:51 +0000 Subject: Handle fb_dev_name similar to vo_fbdev in vo_wii. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27999 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_fbdev.c | 2 +- libvo/vo_wii.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c index 78a355c4c0..e91bd4246f 100644 --- a/libvo/vo_fbdev.c +++ b/libvo/vo_fbdev.c @@ -532,7 +532,7 @@ static void fb_mode2fb_vinfo(fb_mode_t *m, struct fb_var_screeninfo *v) ******************************/ /* command line/config file options */ -char *fb_dev_name = NULL; +static char *fb_dev_name = NULL; char *fb_mode_cfgfile = NULL; char *fb_mode_name = NULL; diff --git a/libvo/vo_wii.c b/libvo/vo_wii.c index a4e8095874..9a5b54d74d 100644 --- a/libvo/vo_wii.c +++ b/libvo/vo_wii.c @@ -54,8 +54,6 @@ #include "sub.h" #include "mp_msg.h" -#define WII_DEV_NAME "/dev/fb0" - static const vo_info_t info = { "Nintendo Wii/GameCube Framebuffer Device", "wii", @@ -67,6 +65,8 @@ LIBVO_EXTERN(wii) static signed int pre_init_err = -2; +static char *fb_dev_name = NULL; + static FILE *vt_fp = NULL; static int vt_doit = 1; static int fb_dev_fd = -1; @@ -98,8 +98,12 @@ static int fb_preinit(int reset) if (fb_preinit_done) return fb_works; - if ((fb_dev_fd = open(WII_DEV_NAME, O_RDWR)) == -1) { - mp_msg(MSGT_VO, MSGL_ERR, "Can't open %s: %s\n", WII_DEV_NAME, strerror(errno)); + if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) + fb_dev_name = strdup("/dev/fb0"); + mp_msg(MSGT_VO, MSGL_V, "using %s\n", fb_dev_name); + + if ((fb_dev_fd = open(fb_dev_name, O_RDWR)) == -1) { + mp_msg(MSGT_VO, MSGL_ERR, "Can't open %s: %s\n", fb_dev_name, strerror(errno)); goto err_out; } if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) { @@ -212,7 +216,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, frame_buffer = NULL; if ((frame_buffer = (uint8_t *) mmap(0, fb_size, PROT_READ | PROT_WRITE, MAP_SHARED, fb_dev_fd, 0)) == (uint8_t *) -1) { - mp_msg(MSGT_VO, MSGL_ERR, "Can't mmap %s: %s\n", WII_DEV_NAME, strerror(errno)); + mp_msg(MSGT_VO, MSGL_ERR, "Can't mmap %s: %s\n", fb_dev_name, strerror(errno)); return 1; } -- cgit v1.2.3