Ginga  0.13.6
 All Classes Namespaces Functions Variables
XineVideoProvider.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 XineVideoProvider_H_
51 #define XineVideoProvider_H_
52 
53 #include "mb/interface/IContinuousMediaProvider.h"
54 
55 using namespace ::br::pucrio::telemidia::ginga::core::mb;
56 
57 #ifndef METRONOM_INTERNAL
58 #define METRONOM_INTERNAL 1
59 #endif
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 #include <stdio.h>
65 #include <directfb.h>
66 #include <xine.h>
67 #include <xine/xineutils.h>
68 #include <xine/xine_internal.h>
69 #ifdef __cplusplus
70 }
71 #endif
72 
74  bool isValid;
75  ISurface* surface;
76  IProviderListener* listener;
77  xine_t* xine;
78  xine_video_port_t* vo;
79  xine_audio_port_t* ao;
80  xine_stream_t* stream;
81  char* config;
82 };
83 
85 
86 /******************** Xine-DFB Driver Specific Data ***************************/
87 typedef void (*DVOutputCallback) ( void *cdata,
88  int width,
89  int height,
90  double ratio,
91  DFBSurfacePixelFormat format,
92  DFBRectangle *dest_rect );
93 
94 typedef struct {
95  IDirectFBSurface *destination;
96  IDirectFBSurface *subpicture;
97 
98  DVOutputCallback output_cb;
99  void *output_cdata;
100 
101  DVFrameCallback frame_cb;
102  void *frame_cdata;
103 } dfb_visual_t;
104 /******************** Xine-DFB Driver Specific Data ***************************/
105 
106 #include <set>
107 using namespace std;
108 
109 namespace br {
110 namespace pucrio {
111 namespace telemidia {
112 namespace ginga {
113 namespace core {
114 namespace mb {
116  private:
117  GingaScreenID myScreen;
118  XineRendererContainer* rContainer;
119  dfb_visual_t visual;
120  int resumePos;
121  int startPos;
122  string symbol;
123 
124  public:
125  XineVideoProvider(GingaScreenID screenId, const char* mrl);
126  virtual ~XineVideoProvider();
127 
128  private:
129  bool initializeXine(const char* mrl);
130  void initializeAudio();
131 
132  public:
133  void setLoadSymbol(string symbol);
134  string getLoadSymbol();
135 
136  bool getHasVisual(){return true;};
137 
138  void setAVPid(int aPid, int vPid);
139  void* getProviderContent();
140  void setProviderContent(void* content){};
141  void feedBuffers();
142 
143  private:
144  void getVideoSurfaceDescription(DFBSurfaceDescription* dsc);
145  IDirectFBSurface* getPerfectDFBSurface();
146 
147  public:
148  bool checkVideoResizeEvent(ISurface* frame);
149 
150  private:
151  static void dynamicRenderCallBack(void* surface);
152  static void outputCallBack(
153  void *cdata,
154  int width,
155  int height,
156  double ratio,
157  DFBSurfacePixelFormat format,
158  DFBRectangle *dest_rect);
159 
160  public:
161  void getOriginalResolution(int* width, int* height);
162  double getTotalMediaTime();
163  int64_t getVPts();
164  double getMediaTime();
165  void setMediaTime(double pos);
166 
167  private:
168  bool updateVisualData(ISurface* surface);
169 
170  public:
171  void playOver(
172  ISurface* surface,
173  bool hasVisual=true, IProviderListener* listener=NULL);
174 
175  void resume(ISurface* surface, bool hasVisual=true);
176  void pause();
177  void stop();
178  void setSoundLevel(float level);
179  bool releaseAll();
180  void refreshDR(void* data){};
181  };
182 }
183 }
184 }
185 }
186 }
187 }
188 
189 #endif /*XineVideoProvider_H_*/
Definition: NetworkUtil.h:53
Definition: XineVideoProvider.h:73
Definition: XineVideoProvider.h:94