From a386709ec3cf1a41394c6a8567411598173d0d5c Mon Sep 17 00:00:00 2001 From: szabii Date: Wed, 11 Apr 2001 21:36:56 +0000 Subject: [PATCH] -fbdepth added git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@364 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cfg-mplayer.h | 1 + libvo/vo_fbdev.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ mplayer.c | 1 + 3 files changed, 46 insertions(+) diff --git a/cfg-mplayer.h b/cfg-mplayer.h index ddc96b67a4..6dc252cada 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -13,6 +13,7 @@ struct config conf[]={ {"fb", &fb_dev_name, CONF_TYPE_STRING, 0, 0, 0}, {"fbmode", &fb_mode_name, CONF_TYPE_STRING, 0, 0, 0}, {"fbmodeconfig", &fb_mode_cfgfile, CONF_TYPE_STRING, 0, 0, 0}, + {"fbdepth", &fb_mode_depth, CONF_TYPE_INT, CONF_RANGE, 15, 32}, #endif {"encode", &encode_name, CONF_TYPE_STRING, 0, 0, 0}, {"sub", &sub_name, CONF_TYPE_STRING, 0, 0, 0}, diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c index 6549c85fd9..d723529893 100644 --- a/libvo/vo_fbdev.c +++ b/libvo/vo_fbdev.c @@ -356,6 +356,7 @@ static int fb_screen_width; char *fb_mode_cfgfile = "/etc/fb.modes"; char *fb_mode_name = NULL; +int fb_mode_depth = 0; static fb_mode_t *fb_mode = NULL; static int fb_switch_mode = 0; @@ -450,6 +451,14 @@ static int fb_init(void) return 1; } fb_switch_mode = 1; + } else if (fb_mode_depth) { + printf("fb_init: Do _not_ use the 'fbdepth' parameter! " + "this parameter will be removed\n"); + if (fb_mode_depth != 15 || fb_mode_depth != 16 || + fb_mode_depth != 24 || fb_mode_depth != 32) { + printf("fb_init: can't switch to %d bpp\n", fb_mode_depth); + return 1; + } } if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) @@ -515,6 +524,41 @@ static int fb_init(void) fb_vinfo.vsync_len = fb_mode->vslen; fb_vinfo.sync = fb_mode->sync; fb_vinfo.vmode = fb_mode->vmode; + } else if (fb_mode_depth) { + fb_vinfo.bits_per_pixel = fb_mode_depth; + switch (fb_mode_depth) { + case 32: + case 24: + fb_vinfo.red.offset = 16; + fb_vinfo.red.length = 8; + fb_vinfo.red.msb_right = 0; + fb_vinfo.green.offset = 8; + fb_vinfo.green.length = 8; + fb_vinfo.green.msb_right = 0; + fb_vinfo.blue.offset = 0; + fb_vinfo.blue.length = 8; + fb_vinfo.blue.msb_right = 0; + case 16: + fb_vinfo.red.offset = 11; + fb_vinfo.red.length = 5; + fb_vinfo.red.msb_right = 0; + fb_vinfo.green.offset = 5; + fb_vinfo.green.length = 6; + fb_vinfo.green.msb_right = 0; + fb_vinfo.blue.offset = 0; + fb_vinfo.blue.length = 5; + fb_vinfo.blue.msb_right = 0; + case 15: + fb_vinfo.red.offset = 10; + fb_vinfo.red.length = 5; + fb_vinfo.red.msb_right = 0; + fb_vinfo.green.offset = 5; + fb_vinfo.green.length = 5; + fb_vinfo.green.msb_right = 0; + fb_vinfo.blue.offset = 0; + fb_vinfo.blue.length = 5; + fb_vinfo.blue.msb_right = 0; + } } fb_vinfo.xres_virtual = fb_vinfo.xres; fb_vinfo.yres_virtual = fb_vinfo.yres; diff --git a/mplayer.c b/mplayer.c index 60c1846257..ed5b564b95 100644 --- a/mplayer.c +++ b/mplayer.c @@ -72,6 +72,7 @@ XMM_PluginSound *pSound=NULL; extern char *fb_dev_name; extern char *fb_mode_cfgfile; extern char *fb_mode_name; +extern int fb_mode_depth; #endif extern int vo_screenwidth;