changeset 27965:1388c6a08a50

Handle fb_dev_name similar to vo_fbdev in vo_wii.
author diego
date Sun, 23 Nov 2008 14:57:51 +0000
parents f559fdc6fb96
children 2a7bdb921eee
files libvo/vo_fbdev.c libvo/vo_wii.c
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_fbdev.c	Sun Nov 23 14:32:39 2008 +0000
+++ b/libvo/vo_fbdev.c	Sun Nov 23 14:57:51 2008 +0000
@@ -532,7 +532,7 @@
 ******************************/
 
 /* 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;
 
--- a/libvo/vo_wii.c	Sun Nov 23 14:32:39 2008 +0000
+++ b/libvo/vo_wii.c	Sun Nov 23 14:57:51 2008 +0000
@@ -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 @@
 
 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 @@
   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 @@
   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;
   }