libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo es el conjunto de objetos y funciones, que permiten ejecutar las operaciones básicas de la plataforma Moldeo, y que compone su núcleo.
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Amigas 'defines' Grupos Páginas
moVideoManager.h
Ir a la documentación de este archivo.
1 /*******************************************************************************
2 
3  moVideoManager.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28 
29 
30 *******************************************************************************/
31 
32 #ifndef __MOVIDEOMANAGER_H
33 #define __MOVIDEOMANAGER_H
34 #include <moGsGraph.h>
35 #include <moDsGraph.h>
36 #include <moFBO.h>
37 #include <moTexture.h>
38 #include <moVideoGraph.h>
39 #include <moDebugManager.h>
40 #include <moDataManager.h>
41 #include <moTimeManager.h>
42 
43 //RESOLUTION
44 //NTSC - PAL
45 #define LIVE_SAMPLE_DV_0_720X480_3 0
46 #define LIVE_SAMPLE_DV_1_720X480_3 1
47 #define LIVE_SAMPLE_DV_2_720X480_3 2
48 #define LIVE_SAMPLE_DV_3_720X480_3 3
49 #define LIVE_SAMPLE_DV_0_720X576_3 4
50 #define LIVE_SAMPLE_DV_1_720X576_3 5
51 #define LIVE_SAMPLE_DV_2_720X576_3 6
52 #define LIVE_SAMPLE_DV_3_720X576_3 7
53 //WEBCAM - 320x240
54 #define LIVE_SAMPLE_WEBCAM_0_320X240_3 8
55 #define LIVE_SAMPLE_WEBCAM_1_320X240_3 9
56 #define LIVE_SAMPLE_WEBCAM_2_320X240_3 10
57 #define LIVE_SAMPLE_WEBCAM_3_320X240_3 11
58 //VIDEO PAL-NTSC
59 #define LIVE_SAMPLE_VIDEO_0_720X480_3 12
60 #define LIVE_SAMPLE_VIDEO_1_720X480_3 13
61 #define LIVE_SAMPLE_VIDEO_2_720X480_3 14
62 #define LIVE_SAMPLE_VIDEO_3_720X480_3 15
63 #define LIVE_SAMPLE_VIDEO_0_720X576_3 16
64 #define LIVE_SAMPLE_VIDEO_1_720X576_3 17
65 #define LIVE_SAMPLE_VIDEO_2_720X576_3 18
66 #define LIVE_SAMPLE_VIDEO_3_720X576_3 19
67 
68 //TAKE A SNAPSHOT OF A SAMPLE
69 #define LIVE_SNAPSHOT_DV_0_720X480_3 20
70 #define LIVE_SNAPSHOT_DV_0_720X576_3 21
71 #define LIVE_SNAPSHOT_WEBCAM_0_320X240_3 22
72 
73 //DEVICE PORTS
74 #define IEEE1394_0 0
75 #define IEEE1394_1 1
76 #define IEEE1394_2 2
77 #define IEEE1394_3 3
78 #define WEBCAM_0 4
79 #define WEBCAM_1 5
80 #define WEBCAM_2 6
81 #define WEBCAM_3 7
82 #define VIDEO_0 8
83 #define VIDEO_1 9
84 #define VIDEO_2 10
85 #define VIDEO_3 11
86 
87 #define MO_LIVE_LABELNAME 0
88 #define MO_LIVE_DEVICENAME 1
89 #define MO_LIVE_COLORMODE 2
90 #define MO_LIVE_WIDTH 3
91 #define MO_LIVE_HEIGHT 4
92 #define MO_LIVE_BITCOUNT 5
93 #define MO_LIVE_SCALEWIDTH 6
94 #define MO_LIVE_SCALEHEIGHT 7
95 #define MO_LIVE_FLIPH 8
96 #define MO_LIVE_FLIPV 9
97 
98 #define MO_VIDEO_BUFFERNAME 1
99 #define MO_VIDEO_BUFFERFORMAT 2
100 #define MO_VIDEO_WIDTH 3
101 #define MO_VIDEO_HEIGHT 4
102 #define MO_VIDEO_SOURCEXOFFSET 5
103 #define MO_VIDEO_SOURCEYOFFSET 6
104 #define MO_VIDEO_SOURCEWIDTH 7
105 #define MO_VIDEO_SOURCEHEIGHT 8
106 #define MO_VIDEO_SOURCEINTERPOLATION 9
107 #define MO_VIDEO_SOURCEINTERPOLATIONJUMP 10
108 #define MO_VIDEO_SOURCEINTERPOLATIONTIME 11
109 
110 
111 
112 #define MO_VIDEO_CIRCULARBUFFERINPUT 0
113 #define MO_VIDEO_CIRCULARBUFFERNAME 1
114 #define MO_VIDEO_CIRCULARBUFFERFORMAT 2
115 #define MO_VIDEO_CIRCULARBUFFERFRAMES 3
116 #define MO_VIDEO_CIRCULARWIDTH 4
117 #define MO_VIDEO_CIRCULARHEIGHT 5
118 #define MO_VIDEO_CIRCULARSOURCEXOFFSET 6
119 #define MO_VIDEO_CIRCULARSOURCEYOFFSET 7
120 #define MO_VIDEO_CIRCULARSOURCEWIDTH 8
121 #define MO_VIDEO_CIRCULARSOURCEHEIGHT 9
122 
126 };
127 
128 
130 
143 
144  public:
145 
146  moLiveSystem();
147  moLiveSystem( moCaptureDevice p_capdev );
148 
149  //Copy constructor
151  {
152  (*this)=p_ls;
153  }
154 
156  m_Type = p_ls.m_Type;
157  m_CaptureDevice = p_ls.m_CaptureDevice;
158  m_pBucketsPool = p_ls.m_pBucketsPool;
159  m_pVideoGraph = p_ls.m_pVideoGraph;
160  m_pVideoSample = p_ls.m_pVideoSample;
161  m_pTexture = p_ls.m_pTexture;
162  return (*this);
163  }
164 
165  virtual ~moLiveSystem();
166 
167  bool Init();
168  void Finish();
169 
170  void SetType( moLiveSystemType p_Type );
171  void SetCaptureDevice( moCaptureDevice p_capdev );
172 
173  moLiveSystemType GetType();
174  moText GetLabelName();
175  moText GetDeviceName();
176  moCaptureDevice GetCaptureDevice();
177  moBucketsPool* GetBucketsPool();
178  moVideoGraph* GetVideoGraph();
179  moVideoSample* GetVideoSample();
180  moTexture* GetTexture();
181  void SetTexture( moTexture* p_Texture );
182 
183  private:
184 
185  moLiveSystemType m_Type;
186  moCaptureDevice m_CaptureDevice;
187 
188  moBucketsPool* m_pBucketsPool;
189  moVideoGraph* m_pVideoGraph;
190 
191  moVideoSample* m_pVideoSample;
192  moTexture* m_pTexture;
193 
194 };
195 
197 
199 
200 
202 
206 class LIBMOLDEO_API moLiveSystems : public moLiveSystemPtrs {
207 
208  public:
209 
210  moLiveSystems();
211  virtual ~moLiveSystems();
212  bool LoadLiveSystems( moCaptureDevices* p_pPreferredDevices );
213  bool UpdateLiveSystems();
214  bool UnloadLiveSystems();
215  bool GetStatus( MOdevcode p_devcode );
216  moVideoFramework* GetVideoFramework();
217 
218  protected:
219 
221 
222 };
223 
225 
230 
231  public:
232 
233  moVideoFrame();
234  virtual ~moVideoFrame();
235 
236  virtual MOboolean Init();
237  virtual MOboolean Init( moText bufferformat, moBitmap* pImageResult );
238  virtual MOboolean Finish();
239 
240 
242 
245  //FIBITMAP *m_pImage;
246 
247 
249 
252 
253 };
254 
256 
258 
260 
267 
268  public:
269  moVideoBuffer();
270  virtual ~moVideoBuffer();
271 
272  virtual MOboolean Init();
273  virtual MOboolean Init( moText bufferpath, moText bufferformat, moResourceManager* p_pResourceManager, MOuint width, MOuint height, MOuint xsource, MOuint ysource, MOuint sourcewidth, MOuint sourceheight, MOint interpolation=0, MOint interpolationjump=0, MOint interpolationtime=0 );
274  virtual MOboolean Finish();
275 
276  virtual void GetFrame( MOuint p_i );
277 
278  MOboolean LoadImage( moBitmap* pImage , int indeximage=-1 );
279 
280  MOint GetXSource() { return m_XSource; }
281  MOint GetYSource() { return m_YSource; }
282  MOint GetSourceWidth() { return m_SourceWidth; }
283  MOint GetSourceHeight() { return m_SourceHeight; }
284  moText GetBufferPath() { return m_BufferPath; }
285  moText GetBufferFormat() { return m_BufferFormat; }
286 
287  private:
288 
289  moText m_BufferPath;
290  moText m_BufferFormat;
291 
293 
294  moVideoFrames m_Frames;
295 
296  MOuint m_XSource;
297  MOuint m_YSource;
298  MOuint m_SourceWidth;
299  MOuint m_SourceHeight;
300 
301 };
302 
304 
306 
307 
309 
325 
326  public:
328  virtual ~moCircularVideoBuffer();
329 
330  virtual MOboolean Init();
331  virtual MOboolean Init( moText videoinput, moText bufferformat, moResourceManager* p_pResourceManager, MOint frames, MOint width, MOint height, MOint xsource, MOint ysource, MOint sourcewidth, MOint sourceheight );
332  virtual MOboolean Finish();
333 
334  virtual void StartRecording( long at_position = -1 );
335  virtual void PauseRecording();
336  virtual void ContinueRecording();
337  virtual void JumpRecording( long at_position );
338  virtual void StopRecording();
339  virtual long GetRecordPosition();
340  virtual bool IsRecording();
341 
342  virtual void GetFrame( MOuint p_i );
343 
344  virtual MOboolean LoadSample( moVideoSample* pvideosample );
345  //MOboolean LoadImage( FIBITMAP* pImage , MOuint indeximage );
346 
347  virtual MOint GetXSource() { return m_XSource; }
348  virtual MOint GetYSource() { return m_YSource; }
349  virtual MOint GetSourceWidth() { return m_SourceWidth; }
350  virtual MOint GetSourceHeight() { return m_SourceHeight; }
351  virtual moText GetVideoInput() { return m_VideoInput; }
352  virtual moText GetBufferFormat() { return m_BufferFormat; }
353 
354  private:
355 
356  moTimer m_RecTimer;
357 
358  MOint m_WriteIndex;
359  MOint m_ReadIndex;
360 
361  moLock m_Lock;
362 
363  moText m_VideoInput;
364  moText m_BufferFormat;
365 
367 
368  moVideoFrames m_Frames;
369 
370  MOuint m_XSource;
371  MOuint m_YSource;
372  MOuint m_SourceWidth;
373  MOuint m_SourceHeight;
374 };
375 
377 
379 
380 class moDirectory;
381 
383 
384  public:
386  virtual ~moVideoBufferPath();
387 
388  virtual MOboolean Init();
389  virtual MOboolean Init( moResourceManager* pResources, moText videobufferpath );
390  virtual MOboolean Finish();
391 
392  MOboolean LoadCompleted();
393  moText GetPath();
394  moText GetCompletePath();
395  int GetTotalFiles();
396  int GetImagesProcessed();
397  int GetActualImage();
398 
399  //MOboolean LoadFromVideo( moText p_moviefile );
400  MOboolean UpdateImages( MOint maxfiles = -1 );
401  moVideoBuffers m_VideoBuffers;
402 
403  private:
404  moResourceManager* m_pResourceManager;
405 
406  moText m_VideoBufferPath;
407  moText m_CompletePath;
408 
409  moDirectory* m_pDirectory;
410 
411  MOint m_ImagesProcessed;
412  MOint m_TotalFiles;
413  MOboolean m_bLoadCompleted;
414  MOint m_ActualImage;
415 };
416 
418 
420 
421 //could be: Video, Camera, or VideoLoop...
423 
424  public:
425  moVideoIn();
426  virtual ~moVideoIn();
427 
428  virtual MOboolean Init();
429  virtual MOboolean Finish();
430 
431  private:
432 
433 };
434 
435 //could be: Video, Camera, or VideoLoop...
437 
438  public:
439  moVideoOut();
440  virtual ~moVideoOut();
441 
442  virtual MOboolean Init();
443  virtual MOboolean Finish();
444 
445 
446 };
447 
449 
451 {
452  public:
453 
454  moVideoManager();
455  virtual ~moVideoManager();
456 
457  virtual MOboolean Init();
458  virtual MOboolean Finish();
459 
460  virtual void Update(moEventList* p_EventList);
461 
462  MOswitch GetStatus(MOdevcode);
463  MOswitch SetStatus( MOdevcode,MOswitch);
464  MOint GetValue(MOdevcode);
465  MOpointer GetPointer( MOdevcode devcode );
466  MOdevcode GetCode( moText);
467 
473  moCamera* GetCamera( int cam_idx );
474 
481  moCamera* GetCameraByName( const moText& camera, bool load=false, moCaptureDevice customCD = moCaptureDevice() );
482 
483  moCamera* CreateCamera( const moCaptureDevice& p_CapDev );
484 
488  const moTextArray& GetCameraNames();
489 
495  const moCaptureDevices& GetCaptureDevices( bool reload = true );
496 
500  int GetCameraCount();
501 
505  moCircularVideoBuffer* GetCircularVideoBuffer( int cb_idx );
506 
510  int GetCircularVideoBufferCount();
511 
515  moVideoBufferPath* GetVideoBufferPath( int vb_idx );
516 
520  int GetVideoBufferPathCount();
521 
522 
526  moVideoBuffer* GetVideoBuffer( int vb_idx );
527 
531  int GetVideoBufferCount();
532 
533  static moText NanosecondsToTimecode( MOulonglong duration );
534  static moText FramesToTimecode( MOulonglong duration, double framespersecond );
535 
536  moTextArray m_CameraDevices;
537 
538  protected:
539 
541  moCaptureDevices m_CaptureDevices;
543 
544  moCircularVideoBuffers m_CircularVideoBuffers;
545  moVideoBufferPaths m_VideoBufferPaths;
547 
549 
550 };
551 
552 #include "moIODeviceManager.h"
553 #include "moResourceManager.h"
554 
555 #endif
556 
void moBitmap
Definition: moTexture.h:44
moVideoBufferPath * moVideoBufferPathPtr
Recurso ( objeto para cargar y manipular objetos físicos de datos de imágenes, audio, video, 3d, 2d, fuentes, shaders y de cualquier otro tipo extendible por un plugin )
Plataforma de reproducción de video, actualmente GStreamer para todas las plataformas.
Definition: moVideoGraph.h:496
Definition: moLock.h:50
virtual MOboolean Finish()
Finaliza el objeto, libera recursos.
Definition: moAbstract.cpp:147
virtual void GetFrame(MOuint p_i)
Definition: moTexture.cpp:1735
virtual MOint GetSourceWidth()
moDeclareExportedDynamicArray(moLiveSystemPtr, moLiveSystemPtrs)
MOboolean m_bLoading
MOint GetSourceHeight()
moVideoFrame * moVideoFramePtr
moResourceManager * m_pResourceManager
Definition: moTexture.h:394
#define MOboolean
Definition: moTypes.h:385
void moMemory
Definition: moTexture.h:46
moCaptureDevices m_CaptureDevices
moText GetBufferFormat()
moCircularVideoBuffer * moCircularVideoBufferPtr
Clase base abstracta de donde deben derivar los objetos [virtual pura].
Definition: moAbstract.h:191
virtual MOboolean Init()
Inicializa el objeto.
Definition: moAbstract.cpp:141
#define MOswitch
Definition: moTypes.h:386
#define LIBMOLDEO_API
Definition: moTypes.h:180
moBitmapFormat fif
virtual MOboolean Init()
virtual moText GetVideoInput()
Lista de eventos.
Definition: moEventList.h:139
clase de para manejar textos
Definition: moText.h:75
#define MOlong
Definition: moTypes.h:391
Grafo de reproducción de video.
Definition: moVideoGraph.h:584
#define MOdevcode
Definition: moTypes.h:412
Muestra de video o cuadro.
Definition: moVideoGraph.h:290
Buffer de imágenes para video.
virtual moText GetBufferFormat()
Sistema de tratamiento de una señal en vivo de video.
Clase de manipulación para el cuadro de un video en memoria.
#define MOint
Definition: moTypes.h:388
Sistema de tratamiento de señales en vivo de video.
int moBitmapFormat
Definition: moTexture.h:45
clase base para el manejo de una textura
Definition: moTexture.h:78
Administrador de moBucket 's.
Definition: moBuckets.h:152
Administrador de recursos.
virtual void Update(moEventList *p_EventList)
moVideoFramework * m_pVideoFramework
moTextArray m_CameraDevices
moLiveSystem moCamera
moLiveSystems * m_pLiveSystems
moCircularVideoBuffers m_CircularVideoBuffers
moTextureIndex Images
virtual MOboolean Finish()
Definición de un dispositivo de video, generalmente uno de captura de video, o camara.
Definition: moVideoGraph.h:336
MOint GetXSource()
MOlong m_FrameSize
moVideoBuffer * moVideoBufferPtr
Clase para el control de un temporizador (relativo) con identificación.
Definition: moTimer.h:321
moVideoBufferPaths m_VideoBufferPaths
#define MOulonglong
Definition: moTypes.h:394
moMemory * hmem
moMatrix3 & operator=(const moMatrix3 &rkM)
moLiveSystem(const moLiveSystem &p_ls)
#define MOuint
Definition: moTypes.h:387
moLiveSystemType
moText GetBufferPath()
moLiveSystem * moLiveSystemPtr
virtual MOboolean Finish()
Definition: moTexture.cpp:1421
una textura asociada a una animación de cuadros
Definition: moTexture.h:549
MOint GetYSource()
Buffer Circular de imágenes para video.
#define MOpointer
Definition: moTypes.h:409
MOint GetSourceWidth()
virtual MOint GetXSource()
virtual MOint GetYSource()
moVideoBuffers m_VideoBuffers
virtual MOint GetSourceHeight()