diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2005-08-28 01:11:21 +0000 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2005-08-28 01:11:21 +0000 |
commit | 7cb89d83b0d845270e583c2848b0eaaa5e053217 (patch) | |
tree | 4c01b1fabea76e84f54bfa3a7454a85678320c4f | |
parent | f45651f26bc3aa1b312d282c5d8c4b04be0c2505 (diff) | |
download | xine-lib-7cb89d83b0d845270e583c2848b0eaaa5e053217.tar.gz xine-lib-7cb89d83b0d845270e583c2848b0eaaa5e053217.tar.bz2 |
Set up the framebuffer palette.
CVS patchset: 7711
CVS date: 2005/08/28 01:11:21
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/video_out/video_out_fb.c | 30 |
2 files changed, 30 insertions, 1 deletions
@@ -3,6 +3,7 @@ xine-lib (1.1.1) When playing a 44.1khz stream on a 48khz only capable sound card. It bypasses alsa-lib resampler and uses xine's * Windows ports fixes and improvements + * Set up the framebuffer palette (fb video out). xine-lib (1.1.0) * new quality deinterlacer from dscaler: GreedyH (Greedy High Motion) diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 46f0250fd..a7ce8f8e1 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_fb.c,v 1.40 2004/12/12 22:01:27 mroi Exp $ + * $Id: video_out_fb.c,v 1.41 2005/08/28 01:11:21 dsalt Exp $ * * video_out_fb.c, frame buffer xine driver by Miguel Freitas * @@ -767,6 +767,32 @@ static int get_fb_fix_screeninfo(int fd, struct fb_fix_screeninfo *fix, xine_t * return 1; } +static int set_fb_palette (int fd, const struct fb_var_screeninfo *var) +{ + unsigned short red[256], green[256], blue[256]; + const struct fb_cmap fb_cmap = { + 0, 256, red, green, blue, NULL + }; + int i, mask; + + if (!var->red.offset && !var->green.offset && !var->blue.offset) + return 1; /* we only handle true-colour modes */ + + /* Fill in the palette data */ + mask = (1 << var->red.length) - 1; + for (i = 0; i < 256; ++i) + red[i] = (i & mask) * 65535.0 / mask; + mask = (1 << var->green.length) - 1; + for (i = 0; i < 256; ++i) + green[i] = (i & mask) * 65535.0 / mask; + mask = (1 << var->blue.length) - 1; + for (i = 0; i < 256; ++i) + blue[i] = (i & mask) * 65535.0 / mask; + + /* Set the palette; return true on success */ + return !ioctl (fd, FBIOPUTCMAP, &fb_cmap); +} + static void register_callbacks(fb_driver_t *this) { this->vo_driver.get_capabilities = fb_get_capabilities; @@ -989,6 +1015,8 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, goto error; if(!get_fb_fix_screeninfo(this->fd, &this->fb_fix, class->xine)) goto error; + if (!set_fb_palette (this->fd, &this->fb_var)) + goto error; this->xine = class->xine; |