Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmsfblayer.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider,             *
00003  *                           Matthias Hardt, Guido Madaus                  *
00004  *                                                                         *
00005  *   Copyright (C) 2007-2008 BerLinux Solutions GbR                        *
00006  *                           Stefan Schwarzer & Guido Madaus               *
00007  *                                                                         *
00008  *   Copyright (C) 2009-2013 BerLinux Solutions GmbH                       *
00009  *                                                                         *
00010  *   Authors:                                                              *
00011  *      Stefan Schwarzer   <stefan.schwarzer@diskohq.org>,                 *
00012  *      Matthias Hardt     <matthias.hardt@diskohq.org>,                   *
00013  *      Jens Schneider     <jens.schneider@diskohq.org>,                   *
00014  *      Guido Madaus       <guido.madaus@diskohq.org>,                     *
00015  *      Patrick Helterhoff <patrick.helterhoff@diskohq.org>,               *
00016  *      René Bählkow       <rene.baehlkow@diskohq.org>                     *
00017  *                                                                         *
00018  *   This library is free software; you can redistribute it and/or         *
00019  *   modify it under the terms of the GNU Lesser General Public            *
00020  *   License version 2.1 as published by the Free Software Foundation.     *
00021  *                                                                         *
00022  *   This library is distributed in the hope that it will be useful,       *
00023  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00024  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00025  *   Lesser General Public License for more details.                       *
00026  *                                                                         *
00027  *   You should have received a copy of the GNU Lesser General Public      *
00028  *   License along with this library; if not, write to the                 *
00029  *   Free Software Foundation, Inc.,                                       *
00030  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
00031  **************************************************************************/
00032 
00033 #ifndef MMSFBLAYER_H_
00034 #define MMSFBLAYER_H_
00035 
00036 #include "mmstools/mmslogger.h"
00037 #include "mmsgui/fb/mmsfbbase.h"
00038 #include "mmsgui/fb/mmsfbsurface.h"
00039 #include "mmsgui/fb/mmsfbwindow.h"
00040 
00041 #ifdef __HAVE_XLIB__
00042 #include <X11/extensions/Xrender.h>
00043 #include <X11/extensions/Xcomposite.h>
00044 
00045 typedef struct {
00046     Display *x_display;
00047     Window x_window;
00048     GC x_gc;
00049     int xv_port;
00050 #ifdef __HAVE_XV__
00051     XvImage *xv_image1;
00052     XvImage *xv_image2;
00053 #endif
00054     int w;
00055     int h;
00056     int x_screen;
00057 } X11_IMPL;
00058 #endif
00059 
00060 //! describes the config of a layer
00061 typedef struct {
00062     //! config available?
00063     bool    avail;
00064     //! layer's id
00065     int     id;
00066     //! used backend, normally it is not layer specific
00067     MMSFBBackend backend;
00068     //! used outputtype, can be layer specific
00069     MMSFBOutputType outputtype;
00070     //! width
00071     int     w;
00072     //! height
00073     int     h;
00074     //! pixelformat
00075     MMSFBSurfacePixelFormat pixelformat;
00076     //! buffer mode
00077     string  buffermode;
00078     //! options
00079     string  options;
00080     //! pixelformat for windows
00081     MMSFBSurfacePixelFormat window_pixelformat;
00082     //! pixelformat for surfaces
00083     MMSFBSurfacePixelFormat surface_pixelformat;
00084 } MMSFBLayerConfig;
00085 
00086 //! This class describes a display layer.
00087 /*!
00088 \author Jens Schneider
00089 */
00090 class MMSFBLayer {
00091     private:
00092         //! is initialized?
00093         bool initialized;
00094 
00095 #ifdef  __HAVE_DIRECTFB__
00096         //! interface to the dfb layer
00097         IDirectFBDisplayLayer   *dfblayer;
00098 #endif
00099 
00100 #if defined(__HAVE_FBDEV__) || defined(__HAVE_KMS__)
00101         MMSFBSurface    *mmsfbdev_surface;
00102 #endif
00103 
00104 #ifdef __HAVE_XLIB__
00105         XImage            *x_image1;
00106         XShmSegmentInfo   x_shminfo1;
00107         XImage            *x_image2;
00108         XShmSegmentInfo   x_shminfo2;
00109         XImage            *x_image_scaler;
00110         XShmSegmentInfo   x_shminfo_scaler;
00111         MMSFBSurface      *scaler;
00112         Visual            *x_visual;
00113         Window            x_window;
00114         Pixmap            pixmap;
00115         XRenderPictFormat *pict_format;
00116         Picture           x_pixmap_pict;
00117         Picture           x_window_pict;
00118         GC                x_gc;
00119         int               x_window_h;
00120         int               x_window_w;
00121         X11_IMPL          impl;
00122 
00123 #endif
00124 #ifdef __HAVE_XV__
00125         XvImage         *xv_image1;
00126         XShmSegmentInfo xv_shminfo1;
00127         XvImage         *xv_image2;
00128         XShmSegmentInfo xv_shminfo2;
00129 #endif
00130 
00131         // layer configuration
00132         MMSFBLayerConfig        config;
00133 
00134         // layers surface
00135         MMSFBSurface            *surface;
00136 
00137         // flags which are used when flipping
00138         MMSFBFlipFlags          flipflags;
00139 
00140         // first time flag for createSurface()
00141         static bool             firsttime_createsurface;
00142 
00143         // first time flags for createWindow()
00144         static bool             firsttime_createwindow_usealpha;
00145         static bool             firsttime_createwindow_noalpha;
00146 
00147     public:
00148         MMSFBLayer(int id, MMSFBBackend backend, MMSFBOutputType outputtype);
00149         virtual ~MMSFBLayer();
00150 
00151         bool isInitialized();
00152 
00153         bool getID(int *id);
00154         bool setExclusiveAccess();
00155         bool getConfiguration(MMSFBLayerConfig *config = NULL);
00156         bool getResolution(int *w, int *h);
00157         bool getPixelFormat(MMSFBSurfacePixelFormat *pixelformat);
00158         bool setConfiguration(int w=0, int h=0, MMSFBSurfacePixelFormat pixelformat=MMSFB_PF_NONE, string buffermode="", string options="",
00159                               MMSFBSurfacePixelFormat window_pixelformat=MMSFB_PF_NONE, MMSFBSurfacePixelFormat surface_pixelformat=MMSFB_PF_NONE);
00160         bool setOpacity(unsigned char opacity);
00161         bool setLevel(int level);
00162         bool getSurface(MMSFBSurface **surface, bool clear = false);
00163 
00164         bool setFlipFlags(MMSFBFlipFlags flags);
00165 
00166         bool releaseLayer();
00167         bool restoreLayer();
00168 
00169         bool createSurface(MMSFBSurface **surface, int w, int h,
00170                            MMSFBSurfacePixelFormat pixelformat = MMSFB_PF_NONE, int backbuffer = 0);
00171         bool createWindow(MMSFBWindow **window, int x, int y, int w, int h,
00172                            MMSFBSurfacePixelFormat pixelformat = MMSFB_PF_NONE,
00173                            bool usealpha = true, int backbuffer = 1);
00174 
00175         void *getImplementation();
00176 
00177         friend class MMSFBManager;
00178         friend class MMSFBSurface;
00179 };
00180 
00181 #endif /*MMSFBLAYER_H_*/

Generated by doxygen