skin_common.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * skin_common.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: d680319d09e607f38f0f2ed2ea98b05051087c51 $
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
00008  *          Olivier Teulière <ipkiss@via.ecp.fr>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License along
00021  * with this program; if not, write to the Free Software Foundation, Inc.,
00022  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifdef HAVE_CONFIG_H
00026 # include "config.h"
00027 #endif
00028 
00029 #ifndef SKIN_COMMON_HPP
00030 #define SKIN_COMMON_HPP
00031 
00032 #include <vlc_common.h>
00033 #include <vlc_interface.h>
00034 #include <vlc_charset.h>
00035 #include <vlc_fs.h>
00036 
00037 #include <string>
00038 using namespace std;
00039 
00040 class AsyncQueue;
00041 class Logger;
00042 class Dialogs;
00043 class Interpreter;
00044 class OSFactory;
00045 class OSLoop;
00046 class VarManager;
00047 class VlcProc;
00048 class VoutManager;
00049 class Theme;
00050 class ThemeRepository;
00051 
00052 #ifndef M_PI
00053 #   define M_PI 3.14159265358979323846
00054 #endif
00055 
00056 #ifdef _MSC_VER
00057 // turn off 'warning C4355: 'this' : used in base member initializer list'
00058 #pragma warning ( disable:4355 )
00059 // turn off 'identifier was truncated to '255' characters in the debug info'
00060 #pragma warning ( disable:4786 )
00061 #endif
00062 
00063 
00064 /// Wrapper around FromLocale, to avoid the need to call LocaleFree()
00065 static inline string sFromLocale( const string &rLocale )
00066 {
00067     char *s = FromLocale( rLocale.c_str() );
00068     string res = s;
00069     LocaleFree( s );
00070     return res;
00071 }
00072 
00073 #ifdef WIN32
00074 /// Wrapper around FromWide, to avoid the need to call free()
00075 static inline string sFromWide( const wstring &rWide )
00076 {
00077     char *s = FromWide( rWide.c_str() );
00078     string res = s;
00079     free( s );
00080     return res;
00081 }
00082 #endif
00083 
00084 /// Wrapper around ToLocale, to avoid the need to call LocaleFree()
00085 static inline string sToLocale( const string &rUTF8 )
00086 {
00087     char *s = ToLocale( rUTF8.c_str() );
00088     string res = s;
00089     LocaleFree( s );
00090     return res;
00091 }
00092 
00093 
00094 //---------------------------------------------------------------------------
00095 // intf_sys_t: description and status of skin interface
00096 //---------------------------------------------------------------------------
00097 struct intf_sys_t
00098 {
00099     /// The input thread
00100     input_thread_t *p_input;
00101 
00102     /// The playlist thread
00103     playlist_t *p_playlist;
00104 
00105     /// Message bank subscription
00106     msg_subscription_t *p_sub;
00107 
00108     // "Singleton" objects: MUST be initialized to NULL !
00109     /// Logger
00110     Logger *p_logger;
00111     /// Asynchronous command queue
00112     AsyncQueue *p_queue;
00113     /// Dialog provider
00114     Dialogs *p_dialogs;
00115     /// Script interpreter
00116     Interpreter *p_interpreter;
00117     /// Factory for OS specific classes
00118     OSFactory *p_osFactory;
00119     /// Main OS specific message loop
00120     OSLoop *p_osLoop;
00121     /// Variable manager
00122     VarManager *p_varManager;
00123     /// VLC state handler
00124     VlcProc *p_vlcProc;
00125     /// Vout manager
00126     VoutManager *p_voutManager;
00127     /// Theme repository
00128     ThemeRepository *p_repository;
00129 
00130     /// Current theme
00131     Theme *p_theme;
00132 
00133     /// synchronisation at start of interface
00134     vlc_thread_t thread;
00135     vlc_mutex_t  init_lock;
00136     vlc_cond_t   init_wait;
00137     bool         b_ready;
00138 
00139     /// handle (vout windows)
00140     void*        handle;
00141     vlc_mutex_t  vout_lock;
00142     vlc_cond_t   vout_wait;
00143     bool         b_vout_ready;
00144 };
00145 
00146 
00147 /// Base class for all skin classes
00148 class SkinObject
00149 {
00150 public:
00151     SkinObject( intf_thread_t *pIntf ): m_pIntf( pIntf ) { }
00152     virtual ~SkinObject() { }
00153 
00154     /// Getter (public because it is used in C callbacks in the win32
00155     /// interface)
00156     intf_thread_t *getIntf() const { return m_pIntf; }
00157 
00158 private:
00159     intf_thread_t *m_pIntf;
00160 };
00161 
00162 
00163 #endif

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6