Ginga  0.13.6
 All Classes Namespaces Functions Variables
FormatterPlayerAdapter.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 _FORMATTERPLAYER_H_
51 #define _FORMATTERPLAYER_H_
52 
53 #include "util/functions.h"
54 using namespace ::br::pucrio::telemidia::util;
55 
56 #include "system/compat/SystemCompat.h"
57 using namespace ::br::pucrio::telemidia::ginga::core::system::compat;
58 
59 #include "mb/LocalScreenManager.h"
60 #include "mb/interface/IInputEventListener.h"
61 #include "mb/interface/ISurface.h"
62 using namespace ::br::pucrio::telemidia::ginga::core::mb;
63 
64 #include "player/IPlayer.h"
65 using namespace ::br::pucrio::telemidia::ginga::core::player;
66 
67 #include "ncl/components/Content.h"
68 #include "ncl/components/ContentNode.h"
69 #include "ncl/components/NodeEntity.h"
70 #include "ncl/components/ReferenceContent.h"
71 using namespace ::br::pucrio::telemidia::ncl::components;
72 
73 #include "ncl/interfaces/LambdaAnchor.h"
74 #include "ncl/interfaces/IntervalAnchor.h"
75 using namespace ::br::pucrio::telemidia::ncl::interfaces;
76 
77 #include "ncl/connectors/EventUtil.h"
78 using namespace ::br::pucrio::telemidia::ncl::connectors;
79 
80 #include "gingancl/model/CompositeExecutionObject.h"
81 #include "gingancl/model/ExecutionObject.h"
82 using namespace ::br::pucrio::telemidia::ginga::ncl::model::components;
83 
84 #include "gingancl/model/AttributionEvent.h"
85 #include "gingancl/model/FormatterEvent.h"
86 #include "gingancl/model/PresentationEvent.h"
87 using namespace ::br::pucrio::telemidia::ginga::ncl::model::event;
88 
89 #include "IPlayerAdapterManager.h"
90 #include "IPlayerAdapter.h"
91 #include "NominalEventMonitor.h"
92 
93 //#include <limits>
94 #include <string>
95 #include <map>
96 #include <set>
97 using namespace std;
98 
99 namespace br {
100 namespace pucrio {
101 namespace telemidia {
102 namespace ginga {
103 namespace ncl {
104 namespace adapters {
106  public IPlayerListener, public IAttributeValueMaintainer,
107  public IInputEventListener {
108 
109  protected:
110  static ILocalScreenManager* dm;
111  static double eventTS;
112  IInputManager* im;
113 
114  IPlayerAdapterManager* manager;
115  NominalEventMonitor* anchorMonitor;
116  set<string> typeSet;
117  ExecutionObject* object;
118  IPlayer* player;
119  string playerCompName;
120  string mrl;
121  int objectDevice;
122  GingaScreenID myScreen;
123 
124  private:
125  double outTransDur;
126  double outTransTime;
127  bool isLocked;
128  pthread_mutex_t objectMutex;
129 
130  public:
132  virtual ~FormatterPlayerAdapter();
133 
134  bool instanceOf(string s);
135  virtual void setNclEditListener(IPlayerListener* listener){};
136  void setOutputWindow(GingaWindowID windowId);
137 
138  protected:
139  virtual void rebase();
140  virtual void createPlayer();
141 
142  public:
143  int getObjectDevice();
144  virtual bool hasPrepared();
145  bool setKeyHandler(bool isHandler);
146 
147  protected:
148  double prepareProperties(ExecutionObject* obj);
149 
150  public:
151  virtual bool prepare(
152  ExecutionObject* object, FormatterEvent* mainEvent);
153 
154  protected:
155  void prepare();
156  virtual void prepareScope(double offset=-1);
157 
158  private:
159  double getOutTransDur();
160 
161  public:
162  double getOutTransTime();
163  void checkAnchorMonitor();
164 
165  static void printAction(
166  string action,
167  ExecutionObject* object);
168 
169  static void printAction(string command);
170 
171  public:
172  virtual bool start();
173  virtual bool stop();
174  virtual bool pause();
175  virtual bool resume();
176  virtual bool abort();
177  virtual void naturalEnd();
178 
179  private:
180  bool checkRepeat(PresentationEvent* mainEvent);
181 
182  public:
183  virtual bool unprepare();
184  virtual bool setPropertyValue(
185  AttributionEvent* event, string value);
186 
187  void setPropertyValue(string name, string value);
188 
189  string getPropertyValue(void* event);
190  virtual string getPropertyValue(string name);
191 
192  double getObjectExpectedDuration();
193  void updateObjectExpectedDuration();
194  double getMediaTime();
195  IPlayer* getPlayer();
196  void setTimeBasePlayer(FormatterPlayerAdapter* timeBasePlayer);
197  virtual void updateStatus(
198  short code,
199  string parameter="",
200  short type=10,
201  string value="");
202 
203  bool userEventReceived(IInputEvent* ev);
204 
205  private:
206  void setVisible(bool visible);
207 
208  protected:
209  bool lockObject();
210  bool unlockObject();
211 
212  public:
213  virtual void flip(){};
214  virtual void timeShift(string direction);
215  };
216 }
217 }
218 }
219 }
220 }
221 }
222 
223 using namespace ::br::pucrio::telemidia::ginga::ncl::adapters;
224 
225 #endif //_FORMATTERPLAYER_H_