[vlc-commits] directfb: simplify rgb setup
Rafaël Carré
git at videolan.org
Fri Apr 18 11:03:21 CEST 2014
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Fri Apr 18 10:31:15 2014 +0200| [141ba6b9433f10a0da56e5fe7279d4aae6383e19] | committer: Rafaël Carré
directfb: simplify rgb setup
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=141ba6b9433f10a0da56e5fe7279d4aae6383e19
---
modules/video_output/directfb.c | 35 ++++++-----------------------------
1 file changed, 6 insertions(+), 29 deletions(-)
diff --git a/modules/video_output/directfb.c b/modules/video_output/directfb.c
index e5fa678..14befba 100644
--- a/modules/video_output/directfb.c
+++ b/modules/video_output/directfb.c
@@ -86,16 +86,10 @@ static int Open(vlc_object_t *object)
vout_display_sys_t *sys;
/* Allocate structure */
- vd->sys = sys = malloc(sizeof(*sys));
+ vd->sys = sys = calloc(1, sizeof(*sys));
if (!sys)
return VLC_ENOMEM;
- sys->directfb = NULL;
- sys->primary = NULL;
- sys->width = 0;
- sys->height = 0;
- sys->pool = NULL;
-
/* Init DirectFB */
if (DirectFBInit(NULL,NULL) != DFB_OK) {
msg_Err(vd, "Cannot init DirectFB");
@@ -116,39 +110,22 @@ static int Open(vlc_object_t *object)
switch (sys->pixel_format) {
case DSPF_RGB332:
- /* 8 bit RGB (1 byte, red 3 at 5, green 3 at 2, blue 2 at 0) */
fmt.i_chroma = VLC_CODEC_RGB8;
fmt.i_rmask = 0x7 << 5;
fmt.i_gmask = 0x7 << 2;
fmt.i_bmask = 0x3 << 0;
break;
- case DSPF_RGB16:
- /* 16 bit RGB (2 byte, red 5 at 11, green 6 at 5, blue 5 at 0) */
- fmt.i_chroma = VLC_CODEC_RGB16;
- fmt.i_rmask = 0x1f << 11;
- fmt.i_gmask = 0x3f << 5;
- fmt.i_bmask = 0x1f << 0;
- break;
- case DSPF_RGB24:
- /* 24 bit RGB (3 byte, red 8 at 16, green 8 at 8, blue 8 at 0) */
- fmt.i_chroma = VLC_CODEC_RGB24;
- fmt.i_rmask = 0xff << 16;
- fmt.i_gmask = 0xff << 8;
- fmt.i_bmask = 0xff << 0;
- break;
- case DSPF_RGB32:
- /* 24 bit RGB (4 byte, nothing at 24, red 8 at 16, green 8 at 8, blue 8 at 0) */
- fmt.i_chroma = VLC_CODEC_RGB32;
- fmt.i_rmask = 0xff << 16;
- fmt.i_gmask = 0xff << 8;
- fmt.i_bmask = 0xff << 0;
- break;
+ case DSPF_RGB16: fmt.i_chroma = VLC_CODEC_RGB16; break;
+ case DSPF_RGB24: fmt.i_chroma = VLC_CODEC_RGB24; break;
+ case DSPF_RGB32: fmt.i_chroma = VLC_CODEC_RGB32; break;
default:
msg_Err(vd, "unknown screen depth %i", sys->pixel_format);
Close(VLC_OBJECT(vd));
return VLC_EGENERIC;
}
+ video_format_FixRgb(&fmt);
+
fmt.i_width = sys->width;
fmt.i_height = sys->height;
More information about the vlc-commits
mailing list