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 #ifdef __HAVE_MMSFLASH__ 00034 00035 #ifndef MMSFLASH_H_ 00036 #define MMSFLASH_H_ 00037 00038 #include "mmsgui/mmsgui.h" 00039 00040 class MMSFlashThread; 00041 00042 //! Handles Flash playback and navigation. 00043 /*! 00044 \author Jens Schneider 00045 */ 00046 class MMSFlash { 00047 private: 00048 //! swfdec must be initialized once 00049 static bool swfdec_initialized; 00050 00051 //! this class is ready for playing 00052 bool ready; 00053 00054 //! this class is playing 00055 bool playing; 00056 00057 //! to make it thread-safe :) 00058 MMSMutex lock; 00059 00060 //! window that will display the flash file 00061 MMSWindow *window; 00062 00063 //! flash file to play 00064 string filename; 00065 00066 //! swfdec player 00067 void *swfdec_player; 00068 00069 //! frame rate 00070 double swfdec_rate; 00071 00072 //! width of the flash image 00073 int width; 00074 00075 //! height of the flash image 00076 int height; 00077 00078 //! temporary surface to let the swfdec render to 00079 MMSFBSurface *flash_temp_surface; 00080 00081 //! temporary cairo surface 00082 void *cairosurface; 00083 00084 //! temporary cairo 00085 void *cairo; 00086 00087 //! loader thread 00088 MMSFlashThread *loaderthread; 00089 00090 //! player thread 00091 MMSFlashThread *playerthread; 00092 00093 //! Internal method: Loading Flash, runs in the loader thread. 00094 void loader(bool &stop); 00095 00096 //! Internal method: Playing Flash, runs in the player thread. 00097 void player(bool &stop); 00098 00099 //! Internal method: Stop my threads. 00100 void stopThreads(void); 00101 00102 //! Internal method: Map keys. 00103 unsigned int mapKey(MMSKeySymbol key); 00104 00105 //! Internal method: Will be called on user input. 00106 bool onHandleInput(MMSWindow *window, MMSInputEvent *input); 00107 00108 public: 00109 00110 //! The Flash constructor. 00111 MMSFlash(MMSWindow *window); 00112 00113 //! The Flash destructor. 00114 ~MMSFlash(); 00115 00116 //! Start loading/playing of the given flash file. 00117 /*! 00118 If a other file is currently playing, the playback will be stopped before starting the new one. 00119 \param filename flash file to play 00120 */ 00121 void startPlaying(string filename); 00122 00123 //! Is the flash file ready for playing? 00124 /*! 00125 \return true if ready, else there are problems while loading the flash file 00126 \note This function is waiting for the ready or error state. 00127 */ 00128 bool isReady(); 00129 00130 //! Is the flash file playing? 00131 /*! 00132 \return true if playing 00133 */ 00134 bool isPlaying(bool wait = false); 00135 00136 friend class MMSFlashThread; 00137 }; 00138 00139 #endif /*MMSFLASH_H_*/ 00140 #endif /* __HAVE_MMSFLASH__ */