Ginga  0.13.6
 All Classes Namespaces Functions Variables
SmilPlayer.h
1 /******************************************************************************
2 Este arquivo eh parte da implementacao do ambiente declarativo do middleware
3 Ginga (Ginga-NCL).
4 
5 Direitos Autorais Reservados (c) 1989-2007 PUC-Rio/Laboratorio TeleMidia
6 
7 Este programa eh software livre; voce pode redistribui-lo e/ou modificah-lo sob
8 os termos da Licenca Publica Geral GNU versao 2 conforme publicada pela Free
9 Software Foundation.
10 
11 Este programa eh distribuido na expectativa de que seja util, porem, SEM
12 NENHUMA GARANTIA; nem mesmo a garantia implicita de COMERCIABILIDADE OU
13 ADEQUACAO A UMA FINALIDADE ESPECIFICA. Consulte a Licenca Publica Geral do
14 GNU versao 2 para mais detalhes.
15 
16 Voce deve ter recebido uma copia da Licenca Publica Geral do GNU versao 2 junto
17 com este programa; se nao, escreva para a Free Software Foundation, Inc., no
18 endereco 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
19 
20 Para maiores informacoes:
21 ncl @ telemidia.puc-rio.br
22 http://www.ncl.org.br
23 http://www.ginga.org.br
24 http://www.telemidia.puc-rio.br
25 ******************************************************************************
26 This file is part of the declarative environment of middleware Ginga (Ginga-NCL)
27 
28 Copyright: 1989-2007 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved.
29 
30 This program is free software; you can redistribute it and/or modify it under
31 the terms of the GNU General Public License version 2 as published by
32 the Free Software Foundation.
33 
34 This program is distributed in the hope that it will be useful, but WITHOUT ANY
35 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
36 PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
37 details.
38 
39 You should have received a copy of the GNU General Public License version 2
40 along with this program; if not, write to the Free Software
41 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
42 
43 For further information contact:
44 ncl @ telemidia.puc-rio.br
45 http://www.ncl.org.br
46 http://www.ginga.org.br
47 http://www.telemidia.puc-rio.br
48 *******************************************************************************/
49 
50 #ifndef SmilPlayer_H_
51 #define SmilPlayer_H_
52 
53 #include "system/thread/Thread.h"
54 using namespace ::br::pucrio::telemidia::ginga::core::system::thread;
55 
56 #include "system/compat/SystemCompat.h"
57 using namespace ::br::pucrio::telemidia::ginga::core::system::compat;
58 
59 #include "mb/IInputManager.h"
60 #include "mb/interface/IInputEventListener.h"
61 using namespace ::br::pucrio::telemidia::ginga::core::mb;
62 
63 #include "mb/ILocalScreenManager.h"
64 #include "mb/interface/IWindow.h"
65 using namespace ::br::pucrio::telemidia::ginga::core::mb;
66 
67 #include "Player.h"
68 
69 #include <string>
70 using namespace std;
71 
72 // ambulant player includes
73 #include "ambulant/version.h"
74 #include "ambulant/common/player.h"
75 #include "ambulant/common/plugin_engine.h"
76 #include "ambulant/net/url.h"
77 #include "ambulant/lib/logger.h"
78 
79 /* Workaround to ambulant header files that are needed but not installed */
80 #include "ambulant/player_gtk/gtk_mainloop.h"
81 
82 //GTK
83 #include <gtk/gtk.h>
84 #include <gdk/gdkx.h>
85 
86 //XXX temp source code from npambulant
87 //some fake gtk_gui functions needed by gtk_mainloop
88 // void gtk_gui::internal_message(int, char*) {}
89 // GtkWidget* gtk_gui::get_document_container() { return m_documentcontainer; }
90 //XXXX FIXME fake gtk_gui constructor 1st arg is used as GtkWindow, 2nd arg as smilfile
91 // gtk_gui::gtk_gui(const char* s, const char* s2) {
92 // cout << "gtk_gui::gtk_gui " << endl;
93 // memset (this, 0, sizeof(gtk_gui));
94 
95 // m_toplevelcontainer = (GtkWindow*) s;
96 // m_documentcontainer = gtk_drawing_area_new();
97 // gtk_widget_hide(m_documentcontainer);
98 //XXXX FIXME vbox only needed to give m_documentcontainer a parent widget at *draw() callback time
99 // m_guicontainer = gtk_vbox_new(FALSE, 0);
100 // gtk_container_add(GTK_CONTAINER(m_toplevelcontainer), GTK_WIDGET (m_guicontainer));
101 // gtk_box_pack_start (GTK_BOX(m_guicontainer), m_documentcontainer, TRUE, TRUE, 0);
102 //XXXX not used: m_guicontainer = menubar = NULL;
103 //XXXX FIXME <EMBED src="xxx" ../> attr value is 2nd contructor arg.
104 // m_smilfilename = s2;
105 // main_loop = g_main_loop_new(NULL, FALSE);
106 //
107 // cout << "gtk_gui::gtk_gui all done" << endl;
108 //}
109 //
110 //gtk_gui::~gtk_gui() {
111 // g_object_unref (G_OBJECT (main_loop));
112 //}
113 
114 namespace br {
115 namespace pucrio {
116 namespace telemidia {
117 namespace ginga {
118 namespace core {
119 namespace player {
120  class SmilPlayer :
121  public Player, public IInputEventListener, public Thread {
122 
123  private:
124  IInputManager* im;
125  int x, y, w, h;
126  ambulant::common::player* ambulantPlayer;
127 
128  //TODO: make it independent from GTK
129  gtk_mainloop* mainLoop;
130  GtkWidget* gtkwidget;
131  gtk_gui* gui;
132 
133  lib::document* smilDoc;
134  lib::node* smilRootNode;
135  const lib::node_context* smilNodeContext;
136  common::state_component* smilStateCmp;
137 
138  public:
139  SmilPlayer(GingaScreenID screenId, string mrl);
140  virtual ~SmilPlayer();
141 
142  private:
143  void initPrefs();
144  void initGui();
145 
146  public:
147  ISurface* getSurface();
148 
149  bool userEventReceived(IInputEvent* ev);
150 
151  void setNotifyContentUpdate(bool notify);
152 
153  bool play();
154  void stop();
155  void pause();
156  void resume();
157 
158  bool setOutWindow(GingaWindowID windowId);
159  void setBounds(int x, int y, int w, int h);
160 
161  void setPropertyValue(string name, string value);
162 
163  bool setKeyHandler(bool isHandler);
164 
165  protected:
166  void run();
167  };
168 }
169 }
170 }
171 }
172 }
173 }
174 
175 #endif /*SmilPlayer_H_*/
Definition: Player.h:249