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

mmstypes.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 MMSTYPES_H_
00034 #define MMSTYPES_H_
00035 
00036 #include <string>
00037 
00038 using namespace std;
00039 
00040 #include <sigc++/sigc++.h>
00041 
00042 // sigc++ accumulators.......................................................
00043 
00044 //example from: http://libsigc.sourceforge.net/libsigc2/docs/reference/html/classsigc_1_1signal_1_1accumulated.html
00045 //! this accumulator calculates the arithmetic mean value
00046 struct arithmetic_mean_accumulator
00047 {
00048   typedef double result_type;
00049   template<typename T_iterator>
00050   result_type operator()(T_iterator first, T_iterator last) const
00051   {
00052     result_type value_ = 0;
00053     int n_ = 0;
00054     for (; first != last; ++first, ++n_)
00055       value_ += *first;
00056     return value_ / n_;
00057   }
00058 };
00059 
00060 //example from: http://libsigc.sourceforge.net/libsigc2/docs/reference/html/classsigc_1_1signal_1_1accumulated.html
00061 //! this accumulator stops signal emission when a slot returns zero
00062 struct interruptable_accumulator
00063 {
00064   typedef bool result_type;
00065   template<typename T_iterator>
00066   result_type operator()(T_iterator first, T_iterator last) const
00067   {
00068     int n_ = 0;
00069     for (; first != last; ++first, ++n_)
00070       if (!*first) return false;
00071     return true;
00072   }
00073 };
00074 
00075 //! bool accumulator
00076 /*!
00077 with this accumulator the emit() method of a callback ends with
00078  - true,  if the no callback methods are connected or all connected callback methods returns true
00079  - false, if at least one connected callback method returns false
00080 */
00081 struct bool_accumulator
00082 {
00083   typedef bool result_type;
00084   template<typename T_iterator>
00085   result_type operator()(T_iterator first, T_iterator last) const
00086   {
00087     bool ret_ = true;
00088     int n_ = 0;
00089     for (; first != last; ++first, ++n_)
00090       if (!*first) ret_ = false;
00091     return ret_;
00092   }
00093 };
00094 
00095 
00096 //! bool accumulator (not)
00097 /*!
00098 with this accumulator the emit() method of a callback ends with
00099  - false, if the no callback methods are connected or all connected callback methods returns false
00100  - true,  if at least one connected callback method returns true
00101 */
00102 struct neg_bool_accumulator
00103 {
00104   typedef bool result_type;
00105   template<typename T_iterator>
00106   result_type operator()(T_iterator first, T_iterator last) const
00107   {
00108     bool ret_ = false;
00109     int n_ = 0;
00110     for (; first != last; ++first, ++n_)
00111       if (*first) ret_ = true;
00112     return ret_;
00113   }
00114 };
00115 
00116 
00117 
00118 // plane description.........................................................
00119 
00120 //! Describes up to 3 planes of an surface buffer.
00121 class MMSFBSurfacePlanes {
00122     public:
00123         //! buffer is a hardware buffer?
00124         bool    hwbuffer;
00125         //! the current pixel data describes a full opaque surface
00126         bool    opaque;
00127         //! the current pixel data describes a full transparent surface
00128         bool    transparent;
00129         //! first plane
00130         void    *ptr;
00131         //! pitch of first plane
00132         int     pitch;
00133         //! second plane or NULL if surface has only one plane
00134         void    *ptr2;
00135         //! pitch of second plane
00136         int     pitch2;
00137         //! third plane or NULL if surface has only one or two planes
00138         void    *ptr3;
00139         //! pitch of third plane
00140         int     pitch3;
00141 
00142         MMSFBSurfacePlanes(void *ptr = NULL, int pitch = 0, void *ptr2 = NULL, int pitch2 = 0, void *ptr3 = NULL, int pitch3 = 0) {
00143             this->hwbuffer      = false;
00144             this->opaque        = false;
00145             this->transparent   = false;
00146             this->ptr           = ptr;
00147             this->pitch         = pitch;
00148             this->ptr2          = ptr2;
00149             this->pitch2        = pitch2;
00150             this->ptr3          = ptr3;
00151             this->pitch3        = pitch3;
00152         }
00153 };
00154 
00155 //! for compatibility reason
00156 #define MMSFBExternalSurfaceBuffer  MMSFBSurfacePlanes
00157 
00158 //! max. number of buffers (3=TRIPLE buffering)
00159 #define MMSFB_MAX_SURFACE_PLANES_BUFFERS    3
00160 
00161 //! describes multiple buffers for backbuffer/triple buffer handling
00162 typedef class MMSFBSurfacePlanes MMSFBSurfacePlanesBuffer[MMSFB_MAX_SURFACE_PLANES_BUFFERS];
00163 
00164 
00165 // display backend types.....................................................
00166 
00167 //! supported display backends
00168 typedef enum {
00169     //! none
00170     MMSFB_BE_NONE = 0,
00171     //! directfb backend
00172     MMSFB_BE_DFB,
00173     //! X11 backend from disko framework
00174     MMSFB_BE_X11,
00175     //! FBDEV backend from disko framework
00176     MMSFB_BE_FBDEV,
00177     //! KMS backend from disko framework
00178     MMSFB_BE_KMS
00179 } MMSFBBackend;
00180 
00181 //! backend: none
00182 #define MMSFB_BE_NONE_STR       ""
00183 //! backend: DFB
00184 #define MMSFB_BE_DFB_STR        "DFB"
00185 //! backend: X11
00186 #define MMSFB_BE_X11_STR        "X11"
00187 //! backend: FBDEV
00188 #define MMSFB_BE_FBDEV_STR      "FBDEV"
00189 //! backend: KMS
00190 #define MMSFB_BE_KMS_STR        "KMS"
00191 
00192 //! list of valid backend types
00193 #define MMSFB_BE_VALID_VALUES   "DFB, X11, FBDEV, KMS"
00194 
00195 //! list of valid backend types for output types MMSFB_OT_xxxFB
00196 #define MMSFB_BE_VALID_VALUES_OT_FB "DFB, FBDEV"
00197 
00198 //! list of valid backend types for output type MMSFB_OT_X11
00199 #define MMSFB_BE_VALID_VALUES_OT_X11    "DFB, X11"
00200 
00201 //! list of valid backend types for output type MMSFB_OT_X
00202 #define MMSFB_BE_VALID_VALUES_OT_X      "X11"
00203 
00204 // conversion routines for backend types
00205 string getMMSFBBackendString(MMSFBBackend be);
00206 MMSFBBackend getMMSFBBackendFromString(string be);
00207 
00208 
00209 // output types..............................................................
00210 
00211 //! supported output types
00212 typedef enum {
00213     //! none
00214     MMSFB_OT_NONE = 0,
00215     //! STDFB (backend: DFB and FBDEV)
00216     MMSFB_OT_STDFB,
00217     //! MATROXFB (backend: DFB and FBDEV)
00218     MMSFB_OT_MATROXFB,
00219     //! VIAFB (backend: DFB)
00220     MMSFB_OT_VIAFB,
00221     //! X11 (backend: DFB and X11)
00222     MMSFB_OT_X11,
00223     //! XSHM (backend: X11)
00224     MMSFB_OT_XSHM,
00225     //! XVSHM (backend: X11)
00226     MMSFB_OT_XVSHM,
00227     //! DAVINCIFB (backend: DFB and FBDEV)
00228     MMSFB_OT_DAVINCIFB,
00229     //! OMAPFB (backend: DFB and FBDEV)
00230     MMSFB_OT_OMAPFB,
00231     //! OGL (backend: X11 and FBDEV)
00232     MMSFB_OT_OGL
00233 } MMSFBOutputType;
00234 
00235 //! output type: none
00236 #define MMSFB_OT_NONE_STR       ""
00237 //! output type: STDFB (backend: DFB and FBDEV)
00238 #define MMSFB_OT_STDFB_STR      "STDFB"
00239 //! output type: MATROXFB (backend: DFB and FBDEV)
00240 #define MMSFB_OT_MATROXFB_STR   "MATROXFB"
00241 //! output type: VIAFB (backend: DFB)
00242 #define MMSFB_OT_VIAFB_STR      "VIAFB"
00243 //! output type: X11 (backend: DFB and X11)
00244 #define MMSFB_OT_X11_STR        "X11"
00245 //! output type: XSHM (backend: X11)
00246 #define MMSFB_OT_XSHM_STR       "XSHM"
00247 //! output type: XVSHM (backend: X11)
00248 #define MMSFB_OT_XVSHM_STR      "XVSHM"
00249 //! output type: DAVINCIFB (backend: DFB and FBDEV)
00250 #define MMSFB_OT_DAVINCIFB_STR  "DAVINCIFB"
00251 //! output type: OMAPFB (backend: DFB and FBDEV)
00252 #define MMSFB_OT_OMAPFB_STR "OMAPFB"
00253 //! output type: OGL (backend: X11 and FBDEV)
00254 #define MMSFB_OT_OGL_STR        "OGL"
00255 
00256 //! list of valid output types
00257 #define MMSFB_OT_VALID_VALUES           "STDFB, MATROXFB, VIAFB, X11, XSHM, XVSHM, DAVINCIFB, OMAPFB, OGL"
00258 
00259 //! list of valid output types for backend MMSFB_BE_DFB
00260 #define MMSFB_OT_VALID_VALUES_BE_DFB    "STDFB, MATROXFB, VIAFB, X11, DAVINCIFB, OMAPFB"
00261 
00262 //! list of valid output types for backend MMSFB_BE_X11
00263 #define MMSFB_OT_VALID_VALUES_BE_X11    "X11, XSHM, XVSHM, OGL"
00264 
00265 //! list of valid output types for backend MMSFB_BE_FBDEV
00266 #define MMSFB_OT_VALID_VALUES_BE_FBDEV  "STDFB, MATROXFB, DAVINCIFB, OMAPFB, OGL"
00267 
00268 //! list of valid output types for backend MMSFB_BE_KMS
00269 #define MMSFB_OT_VALID_VALUES_BE_KMS    "OMAPFB, OGL"
00270 
00271 // conversion routines for output types
00272 string getMMSFBOutputTypeString(MMSFBOutputType ot);
00273 MMSFBOutputType getMMSFBOutputTypeFromString(string ot);
00274 
00275 
00276 // full screen modes.........................................................
00277 
00278 //! supported full screen modes
00279 typedef enum {
00280     //! none
00281     MMSFB_FSM_NONE = 0,
00282     //! disabled
00283     MMSFB_FSM_FALSE,
00284     //! enabled
00285     MMSFB_FSM_TRUE,
00286     //! enabled, using the correct aspect ratio
00287     MMSFB_FSM_ASPECT_RATIO
00288 } MMSFBFullScreenMode;
00289 
00290 //! full screen mode: none
00291 #define MMSFB_FSM_NONE_STR          ""
00292 //! full screen mode: disabled
00293 #define MMSFB_FSM_FALSE_STR         "FALSE"
00294 //! full screen mode: enabled
00295 #define MMSFB_FSM_TRUE_STR          "TRUE"
00296 //! full screen mode: enabled, using the correct aspect ratio
00297 #define MMSFB_FSM_ASPECT_RATIO_STR  "ASPECT_RATIO"
00298 
00299 //! list of valid full screen modes
00300 #define MMSFB_FSM_VALID_VALUES      "FALSE, TRUE, ASPECT_RATIO"
00301 
00302 // conversion routines for full screen modes
00303 string getMMSFBFullScreenModeString(MMSFBFullScreenMode fsm);
00304 MMSFBFullScreenMode getMMSFBFullScreenModeFromString(string fsm);
00305 
00306 
00307 // pixelformats..............................................................
00308 
00309 //! supported pixel formats
00310 typedef enum {
00311     //! none
00312     MMSFB_PF_NONE = 0,
00313     //! 16 bit RGB (2 byte, red 5\@11, green 6\@5, blue 5\@0)
00314     MMSFB_PF_RGB16,
00315     //! 24 bit RGB (3 byte, red 8\@16, green 8\@8, blue 8\@0)
00316     MMSFB_PF_RGB24,
00317     //! 24 bit RGB (4 byte, nothing 8\@24, red 8\@16, green 8\@8, blue 8\@0)
00318     MMSFB_PF_RGB32,
00319     //! 32 bit ARGB (4 byte, alpha 8\@24, red 8\@16, green 8\@8, blue 8\@0)
00320     MMSFB_PF_ARGB,
00321     //! 8 bit alpha (1 byte, alpha 8\@0), e.g. anti-aliased glyphs
00322     MMSFB_PF_A8,
00323     //! 16 bit YUV (4 byte/2 pixel, macropixel contains CbYCrY [31:0])
00324     MMSFB_PF_YUY2,
00325     //! 16 bit YUV (4 byte/2 pixel, macropixel contains YCbYCr [31:0])
00326     MMSFB_PF_UYVY,
00327     //! 12 bit YUV (8 bit Y plane followed by 8 bit quarter size U/V planes)
00328     MMSFB_PF_I420,
00329     //! 12 bit YUV (8 bit Y plane followed by 8 bit quarter size V/U planes)
00330     MMSFB_PF_YV12,
00331     //! 32 bit ARGB (4 byte, inv. alpha 8\@24, red 8\@16, green 8\@8, blue 8\@0)
00332     MMSFB_PF_AiRGB,
00333     //! 1 bit alpha (1 byte/8 pixel, most significant bit used first)
00334     MMSFB_PF_A1,
00335     //! 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CbCr [15:0] plane)
00336     MMSFB_PF_NV12,
00337     //! 16 bit YUV (8 bit Y plane followed by one 16 bit half width CbCr [15:0] plane)
00338     MMSFB_PF_NV16,
00339     //! 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CrCb [15:0] plane)
00340     MMSFB_PF_NV21,
00341     //! 32 bit AYUV (4 byte, alpha 8\@24, Y 8\@16, Cb 8\@8, Cr 8\@0)
00342     MMSFB_PF_AYUV,
00343     //! 4 bit alpha (1 byte/2 pixel, more significant nibble used first)
00344     MMSFB_PF_A4,
00345     //! 19 bit ARGB (3 byte, nothing 5\@19, alpha 1\@18, red 6\@12, green 6\@6, blue 6\@0)
00346     MMSFB_PF_ARGB1666,
00347     //! 24 bit ARGB (3 byte, alpha 6\@18, red 6\@12, green 6\@6, blue 6\@0)
00348     MMSFB_PF_ARGB6666,
00349     //! 18 bit RGB (3 byte, nothing 6\@18, red 6\@12, green 6\@6, blue 6\@0)
00350     MMSFB_PF_RGB18,
00351     //! 2 bit LUT (1 byte/4 pixel, 2 bit color and alpha lookup from palette)
00352     MMSFB_PF_LUT2,
00353     //! 12 bit RGB (2 byte, nothing 4\@12, red 4\@8, green 4\@4, blue 4\@0)
00354     MMSFB_PF_RGB444,
00355     //! 15 bit RGB (2 byte, nothing 1\@15, red 5\@10, green 5\@5, blue 5\@0)
00356     MMSFB_PF_RGB555,
00357     //! 16 bit ARGB (2 byte, alpha 1\@15, red 5\@10, green 5\@5, blue 5\@0)
00358     MMSFB_PF_ARGB1555,
00359     //! 8 bit RGB (1 byte, red 3\@5, green 3\@2, blue 2\@0)
00360     MMSFB_PF_RGB332,
00361     //! 8 bit ALUT (1 byte, alpha 4\@4, color lookup 4\@0)
00362     MMSFB_PF_ALUT44,
00363     //! 8 bit LUT (8 bit color and alpha lookup from palette)
00364     MMSFB_PF_LUT8,
00365     //! 16 bit ARGB (2 byte, alpha 2\@14, red 5\@9, green 5\@4, blue 4\@0)
00366     MMSFB_PF_ARGB2554,
00367     //! 16 bit ARGB (2 byte, alpha 4\@12, red 4\@8, green 4\@4, blue 4\@0)
00368     MMSFB_PF_ARGB4444,
00369     //! 19 bit ARGB (16 bit RGB565 plane followed by 4 bit alpha plane (highest bit unused))
00370     MMSFB_PF_ARGB3565,
00371     //! 24 bit BGR (3 byte, blue 8\@16, green 8\@8, red 8\@0)
00372     MMSFB_PF_BGR24,
00373     //! 15 bit BGR (2 byte, nothing 1\@15, blue 5\@10, green 5\@5, red 5\@0)
00374     MMSFB_PF_BGR555,
00375     //! 32 bit ABGR (4 byte, alpha 8\@24, blue 8\@16, green 8\@8, red 8\@0)
00376     MMSFB_PF_ABGR,
00377     //! number of supported pixelformats
00378     MMSFB_PF_CNT
00379 } MMSFBSurfacePixelFormat;
00380 
00381 //! pixel format: none
00382 #define MMSFB_PF_NONE_STR       ""
00383 //! pixel format: 16 bit RGB (2 byte, red 5\@11, green 6\@5, blue 5\@0)
00384 #define MMSFB_PF_RGB16_STR      "RGB16"
00385 //! pixel format: 24 bit RGB (3 byte, red 8\@16, green 8\@8, blue 8\@0)
00386 #define MMSFB_PF_RGB24_STR      "RGB24"
00387 //! pixel format: 24 bit RGB (4 byte, nothing 8\@24, red 8\@16, green 8\@8, blue 8\@0)
00388 #define MMSFB_PF_RGB32_STR      "RGB32"
00389 //! pixel format: 32 bit ARGB (4 byte, alpha 8\@24, red 8\@16, green 8\@8, blue 8\@0)
00390 #define MMSFB_PF_ARGB_STR       "ARGB"
00391 //! pixel format: 8 bit alpha (1 byte, alpha 8\@0), e.g. anti-aliased glyphs
00392 #define MMSFB_PF_A8_STR         "A8"
00393 //! pixel format: 16 bit YUV (4 byte/2 pixel, macropixel contains CbYCrY [31:0])
00394 #define MMSFB_PF_YUY2_STR       "YUY2"
00395 //! pixel format: 16 bit YUV (4 byte/2 pixel, macropixel contains YCbYCr [31:0])
00396 #define MMSFB_PF_UYVY_STR       "UYVY"
00397 //! pixel format: 12 bit YUV (8 bit Y plane followed by 8 bit quarter size U/V planes)
00398 #define MMSFB_PF_I420_STR       "I420"
00399 //! pixel format: 12 bit YUV (8 bit Y plane followed by 8 bit quarter size V/U planes)
00400 #define MMSFB_PF_YV12_STR       "YV12"
00401 //! pixel format: 32 bit ARGB (4 byte, inv. alpha 8\@24, red 8\@16, green 8\@8, blue 8\@0)
00402 #define MMSFB_PF_AiRGB_STR      "AiRGB"
00403 //! pixel format: 1 bit alpha (1 byte/8 pixel, most significant bit used first)
00404 #define MMSFB_PF_A1_STR         "A1"
00405 //! pixel format: 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CbCr [15:0] plane)
00406 #define MMSFB_PF_NV12_STR       "NV12"
00407 //! pixel format: 16 bit YUV (8 bit Y plane followed by one 16 bit half width CbCr [15:0] plane)
00408 #define MMSFB_PF_NV16_STR       "NV16"
00409 //! pixel format: 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CrCb [15:0] plane)
00410 #define MMSFB_PF_NV21_STR       "NV21"
00411 //! pixel format: 32 bit AYUV (4 byte, alpha 8\@24, Y 8\@16, Cb 8\@8, Cr 8\@0)
00412 #define MMSFB_PF_AYUV_STR       "AYUV"
00413 //! pixel format: 4 bit alpha (1 byte/2 pixel, more significant nibble used first)
00414 #define MMSFB_PF_A4_STR         "A4"
00415 //! pixel format: 19 bit ARGB (3 byte, nothing 5\@19, alpha 1\@18, red 6\@12, green 6\@6, blue 6\@0)
00416 #define MMSFB_PF_ARGB1666_STR   "ARGB1666"
00417 //! pixel format: 24 bit ARGB (3 byte, alpha 6\@18, red 6\@12, green 6\@6, blue 6\@0)
00418 #define MMSFB_PF_ARGB6666_STR   "ARGB6666"
00419 //! pixel format: 18 bit RGB (3 byte, nothing 6\@18, red 6\@12, green 6\@6, blue 6\@0)
00420 #define MMSFB_PF_RGB18_STR      "RGB18"
00421 //! pixel format: 2 bit LUT (1 byte/4 pixel, 2 bit color and alpha lookup from palette)
00422 #define MMSFB_PF_LUT2_STR       "LUT2"
00423 //! pixel format: 12 bit RGB (2 byte, nothing 4\@12, red 4\@8, green 4\@4, blue 4\@0)
00424 #define MMSFB_PF_RGB444_STR     "RGB444"
00425 //! pixel format: 15 bit RGB (2 byte, nothing 1\@15, red 5\@10, green 5\@5, blue 5\@0)
00426 #define MMSFB_PF_RGB555_STR     "RGB555"
00427 //! pixel format: 16 bit ARGB (2 byte, alpha 1\@15, red 5\@10, green 5\@5, blue 5\@0)
00428 #define MMSFB_PF_ARGB1555_STR   "ARGB1555"
00429 //! pixel format: 8 bit RGB (1 byte, red 3\@5, green 3\@2, blue 2\@0)
00430 #define MMSFB_PF_RGB332_STR     "RGB332"
00431 //! pixel format: 8 bit ALUT (1 byte, alpha 4\@4, color lookup 4\@0)
00432 #define MMSFB_PF_ALUT44_STR     "ALUT44"
00433 //! pixel format: 8 bit LUT (8 bit color and alpha lookup from palette)
00434 #define MMSFB_PF_LUT8_STR       "LUT8"
00435 //! pixel format: 16 bit ARGB (2 byte, alpha 2\@14, red 5\@9, green 5\@4, blue 4\@0)
00436 #define MMSFB_PF_ARGB2554_STR   "ARGB2554"
00437 //! pixel format: 16 bit ARGB (2 byte, alpha 4\@12, red 4\@8, green 4\@4, blue 4\@0)
00438 #define MMSFB_PF_ARGB4444_STR   "ARGB4444"
00439 //! pixel format: 19 bit ARGB (16 bit RGB565 plane followed by 4 bit alpha plane (highest bit unused))
00440 #define MMSFB_PF_ARGB3565_STR   "ARGB3565"
00441 //! pixel format: 24 bit BGR (3 byte, blue 8\@16, green 8\@8, red 8\@0)
00442 #define MMSFB_PF_BGR24_STR      "BGR24"
00443 //! pixel format: 15 bit BGR (2 byte, nothing 1\@15, blue 5\@10, green 5\@5, red 5\@0)
00444 #define MMSFB_PF_BGR555_STR     "BGR555"
00445 //! pixel format: 32 bit ABGR (4 byte, alpha 8\@24, blue 8\@16, green 8\@8, red 8\@0)
00446 #define MMSFB_PF_ABGR_STR       "ABGR"
00447 
00448 //! list of valid pixelformats
00449 #define MMSFB_PF_VALID_VALUES   "RGB16, RGB24, RGB32, ARGB, A8, YUY2, UYVY, I420, YV12, AiRGB, A1, NV12, NV16, NV21, AYUV, A4, ARGB1666, ARGB6666, RGB18, LUT2, RGB444, RGB555, ARGB1555, RGB332, ALUT44, LUT8, ARGB2554, ARGB4444, ARGB3565, BGR24, BGR555, ABGR"
00450 
00451 //! list of valid pixelformats used for layer surfaces
00452 #define MMSFB_PF_VALID_VALUES_LAYER "RGB16, RGB24, RGB32, ARGB, YUY2, UYVY, I420, YV12, AiRGB, NV12, NV16, NV21, AYUV, ARGB1666, ARGB6666, RGB18, LUT2, RGB444, RGB555, ARGB1555, RGB332, LUT8, ARGB2554, ARGB4444, ARGB3565, BGR24, BGR555, ABGR"
00453 
00454 //! list of valid pixelformats used for windows surfaces
00455 #define MMSFB_PF_VALID_VALUES_WINDOWS   "ARGB, AiRGB, AYUV, ARGB4444, RGB16, ABGR, empty string for auto detection"
00456 
00457 //! list of valid pixelformats used for worker surfaces
00458 #define MMSFB_PF_VALID_VALUES_SURFACES  "ARGB, AiRGB, AYUV, ARGB4444, RGB16, ABGR, empty string for auto detection"
00459 
00460 //! list of valid pixelformats for X11.XVSHM
00461 #define MMSFB_PF_VALID_VALUES_BE_X11_OT_XVSHM   "YV12"
00462 
00463 //! list of valid pixelformats for X11.XSHM
00464 #define MMSFB_PF_VALID_VALUES_BE_X11_OT_XSHM    "RGB32, ARGB, YV12"
00465 
00466 //! list of valid pixelformats for X11.OGL
00467 #define MMSFB_PF_VALID_VALUES_BE_X11_OT_OGL "RGB32, ARGB, ABGR"
00468 
00469 //! list of valid pixelformats for DAVINCIFB, OSD Layer
00470 #define MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_DAVINCIFB_LAYER_0 "ARGB3565, RGB16"
00471 
00472 //! list of valid pixelformats for DAVINCIFB, Video Layer
00473 #define MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_DAVINCIFB_LAYER_1 "YUY2"
00474 
00475 //! list of valid pixelformats for OMAPFB, OSD Layer
00476 #define MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_OMAPFB_LAYER_0    "ARGB, RGB32, RGB16"
00477 
00478 //! list of valid pixelformats for OMAPFB, Video Layer
00479 #define MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_OMAPFB_LAYER_1    "YUY2, RGB32"
00480 
00481 //! list of valid pixelformats for FBDEV.OGL
00482 #define MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_OGL   "RGB32, ARGB, ABGR"
00483 
00484 //! list of valid pixelformats for KMS.OGL
00485 #define MMSFB_PF_VALID_VALUES_BE_KMS_OT_OGL "RGB32, ARGB, ABGR"
00486 
00487 //! list of valid pixelformats used for layer surfaces
00488 #define MMSFB_PF_VALID_BUFFERMODES "BACKVIDEO BACKSYSTEM FRONTONLY TRIPLE WINDOWS"
00489 #define MMSFB_PF_VALID_BUFFERMODES_X11 "BACKVIDEO BACKSYSTEM TRIPLE WINDOWS"
00490 
00491 // conversion routines for pixel formats
00492 string getMMSFBPixelFormatString(MMSFBSurfacePixelFormat pf);
00493 MMSFBSurfacePixelFormat getMMSFBPixelFormatFromString(string pf);
00494 
00495 
00496 // color definition..........................................................
00497 
00498 //! describes a color with alpha
00499 class MMSFBColor {
00500     public:
00501         //! red
00502         unsigned char r;
00503         //! green
00504         unsigned char g;
00505         //! blue
00506         unsigned char b;
00507         //! alphachannel
00508         unsigned char a;
00509 
00510         MMSFBColor() {
00511             this->r = 0x00;
00512             this->g = 0x00;
00513             this->b = 0x00;
00514             this->a = 0x00;
00515         }
00516 
00517         MMSFBColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a) {
00518             this->r = r;
00519             this->g = g;
00520             this->b = b;
00521             this->a = a;
00522         }
00523 
00524         MMSFBColor(unsigned int argb) {
00525             this->b = argb & 0xff;
00526             this->g = (argb << 16) >> 24;
00527             this->r = (argb << 8)  >> 24;
00528             this->a = argb >> 24;
00529         }
00530 
00531         unsigned int getARGB() {
00532             unsigned int argb;
00533             argb = (unsigned int)this->b;
00534             argb|= ((unsigned int)this->g) << 8;
00535             argb|= ((unsigned int)this->r) << 16;
00536             argb|= ((unsigned int)this->a) << 24;
00537             return argb;
00538         }
00539 
00540         bool operator==(const MMSFBColor &c) {
00541             return (this->r == c.r && this->g == c.g && this->b == c.b && this->a == c.a);
00542         }
00543 
00544         bool operator!=(const MMSFBColor &c) {
00545             return (this->r != c.r || this->g != c.g || this->b != c.b || this->a != c.a);
00546         }
00547 
00548 };
00549 
00550 //! Convert a color string into MMSFBColor.
00551 /*!
00552 The input string has the syntax "#rrggbbaa".
00553 
00554     rr - hex value for red
00555     gg - hex value for green
00556     bb - hex value for blue
00557     aa - hex value for alpha channel (value ff means full opaque)
00558 
00559 \param input  the input string
00560 \param color  pointer to the color to be returned
00561 \return true if input is correct
00562 \note If the function fails, the color is set to "#00000000".
00563 */
00564 bool getMMSFBColorFromString(string input, MMSFBColor *color);
00565 
00566 
00567 //! Convert MMSFBColor to a color string.
00568 /*!
00569 The output string has the syntax "#rrggbbaa".
00570 
00571     rr - hex value for red
00572     gg - hex value for green
00573     bb - hex value for blue
00574     aa - hex value for alpha channel (value ff means full opaque)
00575 
00576 \param color  color to be converted
00577 \return color string
00578 */
00579 string getMMSFBColorString(MMSFBColor color);
00580 
00581 
00582 // rectangles, regions, etc..................................................
00583 
00584 //! describes a rectangle
00585 class MMSFBRectangle {
00586     public:
00587         //! x
00588         int x;
00589         //! y
00590         int y;
00591         //! width
00592         int w;
00593         //! height
00594         int h;
00595 
00596         MMSFBRectangle(int x = 0, int y = 0, int w = 0, int h = 0) {
00597             this->x = x;
00598             this->y = y;
00599             this->w = w;
00600             this->h = h;
00601         }
00602 };
00603 
00604 //! describes a region
00605 class MMSFBRegion {
00606     public:
00607         //! x1
00608         int x1;
00609         //! y1
00610         int y1;
00611         //! x2
00612         int x2;
00613         //! y2
00614         int y2;
00615 
00616         MMSFBRegion(int x1 = 0, int y1 = 0, int x2 = 0, int y2 = 0) {
00617             this->x1 = x1;
00618             this->y1 = y1;
00619             this->x2 = x2;
00620             this->y2 = y2;
00621         }
00622 };
00623 
00624 //! describes a triangle
00625 class MMSFBTriangle {
00626     public:
00627         //! x1
00628         int x1;
00629         //! y1
00630         int y1;
00631         //! x2
00632         int x2;
00633         //! y2
00634         int y2;
00635         //! x3
00636         int x3;
00637         //! y3
00638         int y3;
00639 
00640         MMSFBTriangle(int x1 = 0, int y1 = 0, int x2 = 0, int y2 = 0, int x3 = 0, int y3 = 0) {
00641             this->x1 = x1;
00642             this->y1 = y1;
00643             this->x2 = x2;
00644             this->y2 = y2;
00645             this->x3 = x3;
00646             this->y3 = y3;
00647         }
00648 };
00649 
00650 
00651 
00652 
00653 // pointer mode..............................................................
00654 
00655 //! supported pointer modes
00656 typedef enum {
00657     //! none
00658     MMSFB_PM_NONE = 0,
00659     //! disabled
00660     MMSFB_PM_FALSE,
00661     //! enabled, using internal mouse pointer
00662     MMSFB_PM_TRUE,
00663     //! enabled, using external mouse pointer e.g. from X11, if using the X11 backend
00664     MMSFB_PM_EXTERNAL
00665 } MMSFBPointerMode;
00666 
00667 //! pointer mode: none
00668 #define MMSFB_PM_NONE_STR           ""
00669 //! pointer mode: disabled
00670 #define MMSFB_PM_FALSE_STR          "FALSE"
00671 //! pointer mode: enabled, using internal mouse pointer
00672 #define MMSFB_PM_TRUE_STR           "TRUE"
00673 //! pointer mode: enabled, using external mouse pointer e.g. from X11, if using the X11 backend
00674 #define MMSFB_PM_EXTERNAL_STR       "EXTERNAL"
00675 
00676 //! list of valid pointer modes
00677 #define MMSFB_PM_VALID_VALUES       "FALSE, TRUE, EXTERNAL"
00678 
00679 
00680 // conversion routines for pointer modes
00681 string getMMSFBPointerModeString(MMSFBPointerMode pm);
00682 MMSFBPointerMode getMMSFBPointerModeFromString(string pm);
00683 
00684 // media backend types.......................................................
00685 
00686 //! supported media backends
00687 typedef enum {
00688     //! none
00689     MMSMEDIA_BE_NONE = 0,
00690     //! xine
00691     MMSMEDIA_BE_XINE,
00692     //! gstreamer
00693     MMSMEDIA_BE_GST
00694 } MMSMEDIABackend;
00695 
00696 
00697 
00698 // key symbols...............................................................
00699 
00700 //! supported keys
00701 typedef enum {
00702     MMSKEY_UNKNOWN=0,
00703     MMSKEY_BACKSPACE=1,
00704     MMSKEY_TAB=2,
00705     MMSKEY_RETURN=3,
00706     MMSKEY_CANCEL=4,
00707     MMSKEY_ESCAPE=5,
00708     MMSKEY_SPACE=6,
00709     MMSKEY_EXCLAMATION_MARK=7,
00710     MMSKEY_QUOTATION=8,
00711     MMSKEY_NUMBER_SIGN=9,
00712     MMSKEY_DOLLAR_SIGN=10,
00713     MMSKEY_PERCENT_SIGN=11,
00714     MMSKEY_AMPERSAND=12,
00715     MMSKEY_APOSTROPHE=13,
00716     MMSKEY_PARENTHESIS_LEFT=14,
00717     MMSKEY_PARENTHESIS_RIGHT=15,
00718     MMSKEY_ASTERISK=16,
00719     MMSKEY_PLUS_SIGN=17,
00720     MMSKEY_COMMA=18,
00721     MMSKEY_MINUS_SIGN=19,
00722     MMSKEY_PERIOD=20,
00723     MMSKEY_SLASH=21,
00724     MMSKEY_0=22,
00725     MMSKEY_1=23,
00726     MMSKEY_2=24,
00727     MMSKEY_3=25,
00728     MMSKEY_4=26,
00729     MMSKEY_5=27,
00730     MMSKEY_6=28,
00731     MMSKEY_7=29,
00732     MMSKEY_8=30,
00733     MMSKEY_9=31,
00734     MMSKEY_COLON=32,
00735     MMSKEY_SEMICOLON=33,
00736     MMSKEY_LESS_THAN_SIGN=34,
00737     MMSKEY_EQUALS_SIGN=35,
00738     MMSKEY_GREATER_THAN_SIGN=36,
00739     MMSKEY_QUESTION_MARK=37,
00740     MMSKEY_AT=38,
00741     MMSKEY_CAPITAL_A=39,
00742     MMSKEY_CAPITAL_B=40,
00743     MMSKEY_CAPITAL_C=41,
00744     MMSKEY_CAPITAL_D=42,
00745     MMSKEY_CAPITAL_E=43,
00746     MMSKEY_CAPITAL_F=44,
00747     MMSKEY_CAPITAL_G=45,
00748     MMSKEY_CAPITAL_H=46,
00749     MMSKEY_CAPITAL_I=47,
00750     MMSKEY_CAPITAL_J=48,
00751     MMSKEY_CAPITAL_K=49,
00752     MMSKEY_CAPITAL_L=50,
00753     MMSKEY_CAPITAL_M=51,
00754     MMSKEY_CAPITAL_N=52,
00755     MMSKEY_CAPITAL_O=53,
00756     MMSKEY_CAPITAL_P=54,
00757     MMSKEY_CAPITAL_Q=55,
00758     MMSKEY_CAPITAL_R=56,
00759     MMSKEY_CAPITAL_S=57,
00760     MMSKEY_CAPITAL_T=58,
00761     MMSKEY_CAPITAL_U=59,
00762     MMSKEY_CAPITAL_V=60,
00763     MMSKEY_CAPITAL_W=61,
00764     MMSKEY_CAPITAL_X=62,
00765     MMSKEY_CAPITAL_Y=63,
00766     MMSKEY_CAPITAL_Z=64,
00767     MMSKEY_SQUARE_BRACKET_LEFT=65,
00768     MMSKEY_BACKSLASH=66,
00769     MMSKEY_SQUARE_BRACKET_RIGHT=67,
00770     MMSKEY_CIRCUMFLEX_ACCENT=68,
00771     MMSKEY_UNDERSCORE=69,
00772     MMSKEY_GRAVE_ACCENT=70,
00773     MMSKEY_SMALL_A=71,
00774     MMSKEY_SMALL_B=72,
00775     MMSKEY_SMALL_C=73,
00776     MMSKEY_SMALL_D=74,
00777     MMSKEY_SMALL_E=75,
00778     MMSKEY_SMALL_F=76,
00779     MMSKEY_SMALL_G=77,
00780     MMSKEY_SMALL_H=78,
00781     MMSKEY_SMALL_I=79,
00782     MMSKEY_SMALL_J=80,
00783     MMSKEY_SMALL_K=81,
00784     MMSKEY_SMALL_L=82,
00785     MMSKEY_SMALL_M=83,
00786     MMSKEY_SMALL_N=84,
00787     MMSKEY_SMALL_O=85,
00788     MMSKEY_SMALL_P=86,
00789     MMSKEY_SMALL_Q=87,
00790     MMSKEY_SMALL_R=88,
00791     MMSKEY_SMALL_S=89,
00792     MMSKEY_SMALL_T=90,
00793     MMSKEY_SMALL_U=91,
00794     MMSKEY_SMALL_V=92,
00795     MMSKEY_SMALL_W=93,
00796     MMSKEY_SMALL_X=94,
00797     MMSKEY_SMALL_Y=95,
00798     MMSKEY_SMALL_Z=96,
00799     MMSKEY_CURLY_BRACKET_LEFT=97,
00800     MMSKEY_VERTICAL_BAR=98,
00801     MMSKEY_CURLY_BRACKET_RIGHT=99,
00802     MMSKEY_TILDE=100,
00803     MMSKEY_DELETE=101,
00804     MMSKEY_CURSOR_LEFT=102,
00805     MMSKEY_CURSOR_RIGHT=103,
00806     MMSKEY_CURSOR_UP=104,
00807     MMSKEY_CURSOR_DOWN=105,
00808     MMSKEY_INSERT=106,
00809     MMSKEY_HOME=107,
00810     MMSKEY_END=108,
00811     MMSKEY_PAGE_UP=109,
00812     MMSKEY_PAGE_DOWN=110,
00813     MMSKEY_PRINT=111,
00814     MMSKEY_PAUSE=112,
00815     MMSKEY_OK=113,
00816     MMSKEY_SELECT=114,
00817     MMSKEY_GOTO=115,
00818     MMSKEY_CLEAR=116,
00819     MMSKEY_POWER=117,
00820     MMSKEY_POWER2=118,
00821     MMSKEY_OPTION=119,
00822     MMSKEY_MENU=120,
00823     MMSKEY_HELP=121,
00824     MMSKEY_INFO=122,
00825     MMSKEY_TIME=123,
00826     MMSKEY_VENDOR=124,
00827     MMSKEY_ARCHIVE=125,
00828     MMSKEY_PROGRAM=126,
00829     MMSKEY_CHANNEL=127,
00830     MMSKEY_FAVORITES=128,
00831     MMSKEY_EPG=129,
00832     MMSKEY_PVR=130,
00833     MMSKEY_MHP=131,
00834     MMSKEY_LANGUAGE=132,
00835     MMSKEY_TITLE=133,
00836     MMSKEY_SUBTITLE=134,
00837     MMSKEY_ANGLE=135,
00838     MMSKEY_ZOOM=136,
00839     MMSKEY_MODE=137,
00840     MMSKEY_KEYBOARD=138,
00841     MMSKEY_PC=139,
00842     MMSKEY_SCREEN=140,
00843     MMSKEY_TV=141,
00844     MMSKEY_TV2=142,
00845     MMSKEY_VCR=143,
00846     MMSKEY_VCR2=144,
00847     MMSKEY_SAT=145,
00848     MMSKEY_SAT2=146,
00849     MMSKEY_CD=147,
00850     MMSKEY_TAPE=148,
00851     MMSKEY_RADIO=149,
00852     MMSKEY_TUNER=150,
00853     MMSKEY_PLAYER=151,
00854     MMSKEY_TEXT=152,
00855     MMSKEY_DVD=153,
00856     MMSKEY_AUX=154,
00857     MMSKEY_MP3=155,
00858     MMSKEY_PHONE=156,
00859     MMSKEY_AUDIO=157,
00860     MMSKEY_VIDEO=158,
00861     MMSKEY_INTERNET=159,
00862     MMSKEY_MAIL=160,
00863     MMSKEY_NEWS=161,
00864     MMSKEY_DIRECTORY=162,
00865     MMSKEY_LIST=163,
00866     MMSKEY_CALCULATOR=164,
00867     MMSKEY_MEMO=165,
00868     MMSKEY_CALENDAR=166,
00869     MMSKEY_EDITOR=167,
00870     MMSKEY_RED=168,
00871     MMSKEY_GREEN=169,
00872     MMSKEY_YELLOW=170,
00873     MMSKEY_BLUE=171,
00874     MMSKEY_CHANNEL_UP=172,
00875     MMSKEY_CHANNEL_DOWN=173,
00876     MMSKEY_BACK=174,
00877     MMSKEY_FORWARD=175,
00878     MMSKEY_FIRST=176,
00879     MMSKEY_LAST=177,
00880     MMSKEY_VOLUME_UP=178,
00881     MMSKEY_VOLUME_DOWN=179,
00882     MMSKEY_MUTE=180,
00883     MMSKEY_AB=181,
00884     MMSKEY_PLAYPAUSE=182,
00885     MMSKEY_PLAY=183,
00886     MMSKEY_STOP=184,
00887     MMSKEY_RESTART=185,
00888     MMSKEY_SLOW=186,
00889     MMSKEY_FAST=187,
00890     MMSKEY_RECORD=188,
00891     MMSKEY_EJECT=189,
00892     MMSKEY_SHUFFLE=190,
00893     MMSKEY_REWIND=191,
00894     MMSKEY_FASTFORWARD=192,
00895     MMSKEY_PREVIOUS=193,
00896     MMSKEY_NEXT=194,
00897     MMSKEY_BEGIN=195,
00898     MMSKEY_DIGITS=196,
00899     MMSKEY_TEEN=197,
00900     MMSKEY_TWEN=198,
00901     MMSKEY_BREAK=199,
00902     MMSKEY_EXIT=200,
00903     MMSKEY_SETUP=201,
00904     MMSKEY_CURSOR_LEFT_UP=202,
00905     MMSKEY_CURSOR_LEFT_DOWN=203,
00906     MMSKEY_CURSOR_UP_RIGHT=204,
00907     MMSKEY_CURSOR_DOWN_RIGHT=205,
00908     MMSKEY_F1=206,
00909     MMSKEY_F2=207,
00910     MMSKEY_F3=208,
00911     MMSKEY_F4=209,
00912     MMSKEY_F5=210,
00913     MMSKEY_F6=211,
00914     MMSKEY_F7=212,
00915     MMSKEY_F8=213,
00916     MMSKEY_F9=214,
00917     MMSKEY_F10=215,
00918     MMSKEY_F11=216,
00919     MMSKEY_F12=217,
00920     MMSKEY_SHIFT=218,
00921     MMSKEY_CONTROL=219,
00922     MMSKEY_ALT=220,
00923     MMSKEY_ALTGR=221,
00924     MMSKEY_META=222,
00925     MMSKEY_SUPER=223,
00926     MMSKEY_HYPER=224,
00927     MMSKEY_CAPS_LOCK=225,
00928     MMSKEY_NUM_LOCK=226,
00929     MMSKEY_SCROLL_LOCK=227,
00930     MMSKEY_DEAD_ABOVEDOT=228,
00931     MMSKEY_DEAD_ABOVERING=229,
00932     MMSKEY_DEAD_ACUTE=230,
00933     MMSKEY_DEAD_BREVE=231,
00934     MMSKEY_DEAD_CARON=232,
00935     MMSKEY_DEAD_CEDILLA=233,
00936     MMSKEY_DEAD_CIRCUMFLEX=234,
00937     MMSKEY_DEAD_DIAERESIS=235,
00938     MMSKEY_DEAD_DOUBLEACUTE=236,
00939     MMSKEY_DEAD_GRAVE=237,
00940     MMSKEY_DEAD_IOTA=238,
00941     MMSKEY_DEAD_MACRON=239,
00942     MMSKEY_DEAD_OGONEK=240,
00943     MMSKEY_DEAD_SEMIVOICED_SOUND=241,
00944     MMSKEY_DEAD_TILDE=242,
00945     MMSKEY_DEAD_VOICED_SOUND=243,
00946     MMSKEY_CUSTOM0=244,
00947     MMSKEY_CUSTOM1=245,
00948     MMSKEY_CUSTOM2=246,
00949     MMSKEY_CUSTOM3=247,
00950     MMSKEY_CUSTOM4=248,
00951     MMSKEY_CUSTOM5=249,
00952     MMSKEY_CUSTOM6=250,
00953     MMSKEY_CUSTOM7=251,
00954     MMSKEY_CUSTOM8=252,
00955     MMSKEY_CUSTOM9=253,
00956     MMSKEY_CUSTOM10=254,
00957     MMSKEY_CUSTOM11=255,
00958     MMSKEY_CUSTOM12=256,
00959     MMSKEY_CUSTOM13=257,
00960     MMSKEY_CUSTOM14=258,
00961     MMSKEY_CUSTOM15=259,
00962     MMSKEY_CUSTOM16=260,
00963     MMSKEY_CUSTOM17=261,
00964     MMSKEY_CUSTOM18=262,
00965     MMSKEY_CUSTOM19=263,
00966     MMSKEY_CUSTOM20=264,
00967     MMSKEY_CUSTOM21=265,
00968     MMSKEY_CUSTOM22=266,
00969     MMSKEY_CUSTOM23=267,
00970     MMSKEY_CUSTOM24=268,
00971     MMSKEY_CUSTOM25=269,
00972     MMSKEY_CUSTOM26=270,
00973     MMSKEY_CUSTOM27=271,
00974     MMSKEY_CUSTOM28=272,
00975     MMSKEY_CUSTOM29=273,
00976     MMSKEY_CUSTOM30=274,
00977     MMSKEY_CUSTOM31=275,
00978     MMSKEY_CUSTOM32=276,
00979     MMSKEY_CUSTOM33=277,
00980     MMSKEY_CUSTOM34=278,
00981     MMSKEY_CUSTOM35=279,
00982     MMSKEY_CUSTOM36=280,
00983     MMSKEY_CUSTOM37=281,
00984     MMSKEY_CUSTOM38=282,
00985     MMSKEY_CUSTOM39=283,
00986     MMSKEY_CUSTOM40=284,
00987     MMSKEY_CUSTOM41=285,
00988     MMSKEY_CUSTOM42=286,
00989     MMSKEY_CUSTOM43=287,
00990     MMSKEY_CUSTOM44=288,
00991     MMSKEY_CUSTOM45=289,
00992     MMSKEY_CUSTOM46=290,
00993     MMSKEY_CUSTOM47=291,
00994     MMSKEY_CUSTOM48=292,
00995     MMSKEY_CUSTOM49=293,
00996     MMSKEY_CUSTOM50=294,
00997     MMSKEY_CUSTOM51=295,
00998     MMSKEY_CUSTOM52=296,
00999     MMSKEY_CUSTOM53=297,
01000     MMSKEY_CUSTOM54=298,
01001     MMSKEY_CUSTOM55=299,
01002     MMSKEY_CUSTOM56=300,
01003     MMSKEY_CUSTOM57=301,
01004     MMSKEY_CUSTOM58=302,
01005     MMSKEY_CUSTOM59=303,
01006     MMSKEY_CUSTOM60=304,
01007     MMSKEY_CUSTOM61=305,
01008     MMSKEY_CUSTOM62=306,
01009     MMSKEY_CUSTOM63=307,
01010     MMSKEY_CUSTOM64=308,
01011     MMSKEY_CUSTOM65=309,
01012     MMSKEY_CUSTOM66=310,
01013     MMSKEY_CUSTOM67=311,
01014     MMSKEY_CUSTOM68=312,
01015     MMSKEY_CUSTOM69=313,
01016     MMSKEY_CUSTOM70=314,
01017     MMSKEY_CUSTOM71=315,
01018     MMSKEY_CUSTOM72=316,
01019     MMSKEY_CUSTOM73=317,
01020     MMSKEY_CUSTOM74=318,
01021     MMSKEY_CUSTOM75=319,
01022     MMSKEY_CUSTOM76=320,
01023     MMSKEY_CUSTOM77=321,
01024     MMSKEY_CUSTOM78=322,
01025     MMSKEY_CUSTOM79=323,
01026     MMSKEY_CUSTOM80=324,
01027     MMSKEY_CUSTOM81=325,
01028     MMSKEY_CUSTOM82=326,
01029     MMSKEY_CUSTOM83=327,
01030     MMSKEY_CUSTOM84=328,
01031     MMSKEY_CUSTOM85=329,
01032     MMSKEY_CUSTOM86=330,
01033     MMSKEY_CUSTOM87=331,
01034     MMSKEY_CUSTOM88=332,
01035     MMSKEY_CUSTOM89=333,
01036     MMSKEY_CUSTOM90=334,
01037     MMSKEY_CUSTOM91=335,
01038     MMSKEY_CUSTOM92=336,
01039     MMSKEY_CUSTOM93=337,
01040     MMSKEY_CUSTOM94=338,
01041     MMSKEY_CUSTOM95=339,
01042     MMSKEY_CUSTOM96=340,
01043     MMSKEY_CUSTOM97=341,
01044     MMSKEY_CUSTOM98=342,
01045     MMSKEY_CUSTOM99=343,
01046     MMSKEY_NULL=344
01047 } MMSKeySymbol;
01048 
01049 // returned strings must be equal to XKeysymToString()
01050 // we use GStreamer function gst_element_send_event() which uses "application/x-gst-navigation"
01051 const char *convertMMSKeySymbolToXKeysymString(MMSKeySymbol key);
01052 
01053 
01054 // Special State Type .......................................................
01055 
01056 //! special state type
01057 typedef enum {
01058     //! false
01059     MMSSTATE_FALSE = 0,
01060     //! true
01061     MMSSTATE_TRUE,
01062     //! auto
01063     MMSSTATE_AUTO
01064 } MMSSTATE;
01065 
01066 
01067 
01068 // Sequence mode ............................................................
01069 
01070 //! sequence mode
01071 typedef enum {
01072     //! no sequence
01073     MMSSEQUENCEMODE_NONE = 0,
01074     //! linear sequence
01075     MMSSEQUENCEMODE_LINEAR,
01076     //! logarithmical sequence, soft start and stop of the sequence
01077     MMSSEQUENCEMODE_LOG,
01078     //! logarithmical sequence, soft start
01079     MMSSEQUENCEMODE_LOG_SOFT_START,
01080     //! logarithmical sequence, soft end
01081     MMSSEQUENCEMODE_LOG_SOFT_END
01082 } MMSSEQUENCEMODE;
01083 
01084 
01085 
01086 // known languages...........................................................
01087 
01088 //! known languages
01089 typedef enum {
01090     //! none
01091     MMSLANG_NONE = 0,
01092     //! german
01093     MMSLANG_DE,
01094     //! english
01095     MMSLANG_EN,
01096     //! denmark
01097     MMSLANG_DK,
01098     //! spanish
01099     MMSLANG_ES,
01100     //! finnish
01101     MMSLANG_FI,
01102     //! french
01103     MMSLANG_FR,
01104     //! italian
01105     MMSLANG_IT,
01106     //! dutch
01107     MMSLANG_NL,
01108     //! norwegian
01109     MMSLANG_NO,
01110     //! swedish
01111     MMSLANG_SE,
01112     //! turkish
01113     MMSLANG_TR,
01114     //! chinese
01115     MMSLANG_CN,
01116     //! israeli
01117     MMSLANG_IL,
01118     //! arabic
01119     MMSLANG_AR,
01120     //! czech
01121     MMSLANG_CS,
01122     //! russian
01123     MMSLANG_RU,
01124     //! croatia
01125     MMSLANG_HR,
01126     //! number of languages
01127     MMSLANG_SIZE
01128 } MMSLanguage;
01129 
01130 //! language: none
01131 #define MMSLANG_NONE_STR        ""
01132 //! language: german
01133 #define MMSLANG_DE_STR          "DE"
01134 //! language: english
01135 #define MMSLANG_EN_STR          "EN"
01136 //! language: denmark
01137 #define MMSLANG_DK_STR          "DK"
01138 //! language: spanish
01139 #define MMSLANG_ES_STR          "ES"
01140 //! language: finnish
01141 #define MMSLANG_FI_STR          "FI"
01142 //! language: french
01143 #define MMSLANG_FR_STR          "FR"
01144 //! language: italian
01145 #define MMSLANG_IT_STR          "IT"
01146 //! language: dutch
01147 #define MMSLANG_NL_STR          "NL"
01148 //! language: norwegian
01149 #define MMSLANG_NO_STR          "NO"
01150 //! language: swedish
01151 #define MMSLANG_SE_STR          "SE"
01152 //! language: turkish
01153 #define MMSLANG_TR_STR          "TR"
01154 //! language: chinese
01155 #define MMSLANG_CN_STR          "CN"
01156 //! language: israeli
01157 #define MMSLANG_IL_STR          "IL"
01158 //! language: arabic
01159 #define MMSLANG_AR_STR          "AR"
01160 //! language: czech
01161 #define MMSLANG_CS_STR          "CS"
01162 //! language: russian
01163 #define MMSLANG_RU_STR          "RU"
01164 //! language: croatia
01165 #define MMSLANG_HR_STR          "HR"
01166 
01167 // conversion routines for languages
01168 string getMMSLanguageString(MMSLanguage lang);
01169 MMSLanguage getMMSLanguageFromString(string lang);
01170 
01171 
01172 
01173 
01174 // -15 stored using a single precision bias of 127
01175 const unsigned int HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP = 0x38000000;
01176 
01177 // max exponent value in single precision that will be converted
01178 // to Inf or Nan when stored as a half-float
01179 const unsigned int HALF_FLOAT_MAX_BIASED_EXP_AS_SINGLE_FP_EXP = 0x47800000;
01180 
01181 // 255 is the max exponent biased value
01182 const unsigned int FLOAT_MAX_BIASED_EXP = (0xFF << 23);
01183 const unsigned int HALF_FLOAT_MAX_BIASED_EXP = (0x1F << 10);
01184 
01185 // half-float type
01186 typedef unsigned short MMS_HALF_FLOAT;
01187 
01188 MMS_HALF_FLOAT convertFloat2HalfFloat(float f);
01189 float convertHalfFloat2Float(MMS_HALF_FLOAT hf);
01190 
01191 
01192 
01193 //! type of vertex data
01194 typedef enum {
01195     MMS_VERTEX_DATA_TYPE_FLOAT = 0,
01196     MMS_VERTEX_DATA_TYPE_HALF_FLOAT
01197 } MMS_VERTEX_DATA_TYPE;
01198 
01199 //! vertex array
01200 typedef struct {
01201     //! type of vertex data
01202     MMS_VERTEX_DATA_TYPE    dtype;
01203     //! vertex data
01204     void    *data;
01205     //! number of values per vertex
01206     int     eSize;
01207     //! number of vertices
01208     int     eNum;
01209 } MMS_VERTEX_ARRAY;
01210 
01211 #define MMS_VA_SET_VERTEX_2v(va, idx, val0, val1)   \
01212             if (va) { \
01213                 if (va->dtype == MMS_VERTEX_DATA_TYPE_HALF_FLOAT) { \
01214                     ((MMS_HALF_FLOAT*)va->data)[(idx) * va->eSize + 0] = convertFloat2HalfFloat((float)(val0)); \
01215                     ((MMS_HALF_FLOAT*)va->data)[(idx) * va->eSize + 1] = convertFloat2HalfFloat((float)(val1)); \
01216                 } else { \
01217                     ((float*)va->data)[(idx) * va->eSize + 0] = (float)(val0); \
01218                     ((float*)va->data)[(idx) * va->eSize + 1] = (float)(val1); \
01219                 } \
01220             }
01221 
01222 #define MMS_VA_SET_VERTEX_3v(va, idx, val0, val1, val2) \
01223             if (va) { \
01224                 if (va->dtype == MMS_VERTEX_DATA_TYPE_HALF_FLOAT) { \
01225                     ((MMS_HALF_FLOAT*)va->data)[(idx) * va->eSize + 0] = convertFloat2HalfFloat((float)(val0)); \
01226                     ((MMS_HALF_FLOAT*)va->data)[(idx) * va->eSize + 1] = convertFloat2HalfFloat((float)(val1)); \
01227                     ((MMS_HALF_FLOAT*)va->data)[(idx) * va->eSize + 2] = convertFloat2HalfFloat((float)(val2)); \
01228                 } else { \
01229                     ((float*)va->data)[(idx) * va->eSize + 0] = (float)(val0); \
01230                     ((float*)va->data)[(idx) * va->eSize + 1] = (float)(val1); \
01231                     ((float*)va->data)[(idx) * va->eSize + 2] = (float)(val2); \
01232                 } \
01233             }
01234 
01235 //! vertex buffer
01236 typedef struct {
01237     //! type of vertex data
01238     MMS_VERTEX_DATA_TYPE    dtype;
01239     //! id of buffer object
01240     unsigned int bo;
01241     //! offset into the buffer object's data store where data replacement will begin
01242     unsigned int offs;
01243     //! number of floats per vertex
01244     int     eSize;
01245     //! number of vertices
01246     int     eNum;
01247 } MMS_VERTEX_BUFFER;
01248 
01249 //! element type
01250 typedef enum {
01251     MMS_INDEX_ARRAY_TYPE_TRIANGLES = 0,
01252     MMS_INDEX_ARRAY_TYPE_TRIANGLE_STRIP,
01253     MMS_INDEX_ARRAY_TYPE_TRIANGLE_FAN,
01254     MMS_INDEX_ARRAY_TYPE_LINES,
01255     MMS_INDEX_ARRAY_TYPE_LINE_STRIP,
01256     MMS_INDEX_ARRAY_TYPE_LINE_LOOP
01257 } MMS_INDEX_ARRAY_TYPE;
01258 
01259 //! index array
01260 typedef struct {
01261     //! element type
01262     MMS_INDEX_ARRAY_TYPE    type;
01263     //! array of unsigned ints
01264     unsigned int    *data;
01265     //! number of indices
01266     int             eNum;
01267 } MMS_INDEX_ARRAY;
01268 
01269 //! index buffer
01270 typedef struct {
01271     //! element type
01272     MMS_INDEX_ARRAY_TYPE    type;
01273     //! id of buffer object
01274     unsigned int    bo;
01275     //! offset into the buffer object's data store where data replacement will begin
01276     unsigned int    offs;
01277     //! number of indices
01278     int             eNum;
01279 } MMS_INDEX_BUFFER;
01280 
01281 
01282 //! Initialize a MMS_VERTEX_ARRAY.
01283 /*!
01284 \param array    MMS_VERTEX_ARRAY to initialize
01285 \param eSize    number of values per vertex
01286 \param eNum     number of vertices
01287 \param dtype    type of vertex data, default is MMS_VERTEX_DATA_TYPE_FLOAT
01288 \param data     pointer to existing vertex data or NULL, default is NULL
01289 \return true if the array is successfully initialized
01290 \note If no data pointer is given by the caller, the function will allocate new space for vertex data.
01291 */
01292 bool initVertexArray(MMS_VERTEX_ARRAY *array, int eSize, int eNum,
01293                      MMS_VERTEX_DATA_TYPE dtype = MMS_VERTEX_DATA_TYPE_FLOAT, void *data = NULL);
01294 
01295 //! Release allocated space of a MMS_VERTEX_ARRAY.
01296 void freeVertexArray(MMS_VERTEX_ARRAY *array);
01297 
01298 //! Get size of a MMS_VERTEX_ARRAY in bytes.
01299 unsigned int getVertexArraySize(MMS_VERTEX_ARRAY *array);
01300 
01301 
01302 //! Initialize a MMS_INDEX_ARRAY.
01303 /*!
01304 \param array    MMS_INDEX_ARRAY to initialize
01305 \param type     specifies what kind of primitives to render
01306 \param eNum     number of indices or 0, default is 0
01307 \param data     pointer to existing index data or NULL, default is NULL
01308 \return true if the array is successfully initialized
01309 \note It is possible to have an index array with 0 indices.
01310 \note If no data pointer is given by the caller, the function will allocate new space for index data.
01311 */
01312 bool initIndexArray(MMS_INDEX_ARRAY *array, MMS_INDEX_ARRAY_TYPE type, int eNum = 0, unsigned int *data = NULL);
01313 
01314 //! Release allocated space of a MMS_INDEX_ARRAY.
01315 void freeIndexArray(MMS_INDEX_ARRAY *array);
01316 
01317 //! Get size of a MMS_INDEX_ARRAY in bytes.
01318 unsigned int getIndexArraySize(MMS_INDEX_ARRAY *array);
01319 
01320 
01321 typedef struct {
01322     float r;
01323     float g;
01324     float b;
01325     float a;
01326 } MMS3D_RGBA;
01327 
01328 typedef struct {
01329     MMS3D_RGBA  emission;
01330     MMS3D_RGBA  ambient;
01331     MMS3D_RGBA  diffuse;
01332     MMS3D_RGBA  specular;
01333     float       shininess;
01334 } MMS3D_MATERIAL_S;
01335 
01336 typedef float MMS3D_MATERIAL_A[17];
01337 
01338 typedef union {
01339     //! structure access
01340     MMS3D_MATERIAL_S    s;
01341     //! array access
01342     MMS3D_MATERIAL_A    a;
01343 } MMS3D_MATERIAL;
01344 
01345 
01346 
01347 
01348 
01349 
01350 #define MMS_PI 3.1415926535897932384626433832795f
01351 
01352 typedef float MMSMatrix[4][4];
01353 
01354 void multiplyMatrix(MMSMatrix result, MMSMatrix srcA, MMSMatrix srcB);
01355 void copyMatrix(MMSMatrix result, MMSMatrix src);
01356 bool equalMatrix(MMSMatrix result, MMSMatrix src);
01357 void loadIdentityMatrix(MMSMatrix result);
01358 void scaleMatrix(MMSMatrix result, float sx, float sy, float sz);
01359 void translateMatrix(MMSMatrix result, float tx, float ty, float tz);
01360 void rotateMatrix(MMSMatrix result, float angle, float x, float y, float z);
01361 void frustumMatrix(MMSMatrix result, float left, float right, float bottom, float top, float nearZ, float farZ);
01362 void perspectiveMatrix(MMSMatrix result, float fovy, float aspect, float nearZ, float farZ);
01363 void orthoMatrix(MMSMatrix result, float left, float right, float bottom, float top, float nearZ, float farZ);
01364 
01365 
01366 //! decribes a 3D object which can be rendered
01367 typedef struct _bei_object {
01368     //! parent of object or NULL
01369     _bei_object *parent;
01370 
01371     //! index to available vertices, else negative
01372     int     vertices;
01373 
01374     //! index to available normals, else negative
01375     int     normals;
01376 
01377     //! index to available texture coordinates, else negative
01378     int     texcoords;
01379 
01380     //! index to available indices, else negative
01381     int     indices;
01382 
01383     //! index to available material, else negative
01384     int     material;
01385 
01386     //! index to available texture, else negative
01387     int     texture;
01388 
01389     //! object is shown?
01390     bool    shown;
01391 
01392     //! cull face?
01393     bool    cullface;
01394 
01395     //! matrix of the object
01396     MMSMatrix   matrix;
01397 } MMS3D_OBJECT;
01398 
01399 
01400 bool isMMS3DObjectShown(MMS3D_OBJECT *object);
01401 
01402 
01403 
01404 
01405 
01406 
01407 #endif /* MMSTYPES_H_ */
01408 
01409 
01410 
01411 
01412 

Generated by doxygen