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
moVideoGraph.h
Ir a la documentación de este archivo.
1 /*******************************************************************************
2 
3  moVideoGraph.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  Andrés Colubri
29 
30 *******************************************************************************/
31 
32 #ifndef __MO_VIDEOGRAPH_H__
33 #define __MO_VIDEOGRAPH_H__
34 
35 #include "moTypes.h"
36 #include "moText.h"
37 #include "moBuckets.h"
38 #include "moArray.h"
39 #include "moAbstract.h"
40 
41 /*
42  RESOLUCIONES
43 
44  http://en.wikipedia.org/wiki/Display_resolution
45 
46 
47 Digital TV standard Resolution Display aspect ratio Pixels
48 Video CD 352 �240 (NTSC) 4:3 (non-square pixels) 84,480
49  352 �288 (PAL) 101,376
50 China Video Disc 352 �480 (NTSC) 4:3 (non-square pixels) 168,960
51  352 �576 (PAL) 202,725
52 SVCD 480 �480 (NTSC) 4:3 (non-square pixels) 230,400
53  480 �576 (PAL) 276,480
54 EDTV 480p 640 �480 4:3 or 16:9 307,200
55  704 �480 337,920
56  852 �480 408,960
57 DVD 704 �480 (NTSC) 4:3 or 16:9 (non-square pixels) 337,920
58  704 �576 (PAL) 405,504
59 D1 720 �480 (NTSC) 4:3 or 16:9 (non-square pixels) 345,600
60  720 �576 (PAL) 414,720
61 D1 (NTSC with square pixels) 720 �540 4:3 388,800
62 HDTV 720p 1280 �720 16:9 921,600
63 HDTV 1080p, 1080i 1920 �1080 16:9 2,073,600
64 */
66 
70  PAL_D1 = 414720, //720 x 576
71  NTSC_D1 = 345600, //720 x 480
72  NTSC_SQUARE = 388800, //720x540
73 
74  NTSC_VDISC = 168960, //352x480
75  PAL_VDISC = 202725, //352x576
76 
77  NTSC_SVCD = 230400, //480x480
78  PAL_SVCD = 276480, //480x576
79 
80  NTSC_VCD = 84480, //352x240
81  PAL_VCD = 101376, //352x288
82 
83  PAL_DVD = 337920, //704 x 576
84  NTSC_DVD = 405504,//704 x 480
85 
86  HDTV_720p = 921600, //1280x720
87  HDTV_1080p = 2073600, //1920x1080
88 
89  VGA = 307200, //640 x 480
90  HVGA = 76800, //320 x 240
91  CGA = 64000, //320x200
93 };
94 
96 
100  MONO_44100_8 = 10844100,
101  MONO_44100_16 = 11644100,
102  MONO_44100_24 = 12444100,
103  MONO_44100_32 = 13244100,
104  MONO_48000_8 = 10848000,
105  MONO_48000_16 = 11648000,
106  MONO_48000_24 = 12448000,
107  MONO_48000_32 = 13248000,
108  ESTEREO_44100_8 = 20844100,
109  ESTEREO_44100_16 = 21644100,
110  ESTEREO_44100_24 = 22444100,
111  ESTEREO_44100_32 = 23244100,
112  ESTEREO_48000_8 = 2848000,
113  ESTEREO_48000_16 = 21648000,
114  ESTEREO_48000_24 = 22448000,
115  ESTEREO_48000_32 = 23248000,
117 };
118 
120 
124  DEFAULT = 0,
125  YUV = 1,
126  RGB = 2,
127  I420 = 3,
128  YUY2 = 4
129 };
130 
141 
148 };
149 
151 
156 
157  public:
159  m_VideoMode = MOVIDEOMODE_UNKNOWN;
160  m_Height = 0;
161  m_Width = 0;
162  m_BitRate = 0;
163  m_TimePerFrame = 0;
164  m_BitCount = 0;
165  m_BufferSize = 0;
166  m_FrameRate = 0;
167  m_WaitForFormat = true;
168  m_RedMask = 0;
169  m_GreenMask = 0;
170  m_BlueMask = 0;
171  }
172 
173  void SetVideoMode() {
174  switch(m_BufferSize) {
175  case PAL_D1:
176  case NTSC_D1:
177  case NTSC_SQUARE:
178  case NTSC_VDISC:
179  case PAL_VDISC:
180  case NTSC_SVCD:
181  case PAL_SVCD:
182  case NTSC_VCD:
183  case PAL_VCD:
184  case PAL_DVD:
185  case NTSC_DVD:
186  case HDTV_720p:
187  case HDTV_1080p:
188  case VGA:
189  case HVGA:
190  case CGA:
191  m_VideoMode = (moVideoMode)m_BufferSize;
192  break;
193 
194  default:
195  m_VideoMode = MOVIDEOMODE_UNKNOWN;
196  break;
197 
198  }
199  }
200 
215 
216 };
217 
219 
224 
225  public:
227  m_AudioMode = MOAUDIOMODE_UNKNOWN;
228  m_Width = 0;
229  m_Depth = 0;
230  m_BitRate = 0;
231  m_TimePerSample = 0;
232  m_BitCount = 0;
233  m_Channels = 0;
234  m_BufferSize = 0;
235  m_SampleRate = 0;
236  m_WaitForFormat = true;
237  }
238 
239  void SetAudioMode() {
240  switch(m_BufferSize) {
241  case MONO_44100_8:
242  case MONO_44100_16:
243  case MONO_44100_24:
244  case MONO_44100_32:
245  case MONO_48000_8:
246  case MONO_48000_16:
247  case MONO_48000_24:
248  case MONO_48000_32:
249  case ESTEREO_44100_8:
250  case ESTEREO_44100_16:
251  case ESTEREO_44100_24:
252  case ESTEREO_44100_32:
253  case ESTEREO_48000_8:
254  case ESTEREO_48000_16:
255  case ESTEREO_48000_24:
256  case ESTEREO_48000_32:
257  m_AudioMode = (moAudioMode)m_BufferSize;
258  break;
259 
260  default:
261  m_AudioMode = MOAUDIOMODE_UNKNOWN;
262  break;
263 
264  }
265  }
266 
268  //moColorMode m_ColorMode;
284 };
285 
287 
291 
292  public:
293 
296  m_pSampleBuffer = NULL;
297  }
298 
301  m_VideoFormat = p_vs.m_VideoFormat;
302  m_pSampleBuffer = p_vs.m_pSampleBuffer;
303  return (*this);
304  }
305 
307  moVideoSample( moVideoFormat p_videoformat, MOpointer p_buffer ) {
308 
309  m_VideoFormat = p_videoformat;
310  m_pSampleBuffer = p_buffer;
311 
312  }
313 
315 
321  void SetVideoSample( moVideoFormat p_videoformat, MOpointer p_buffer ) {
322  m_VideoFormat = p_videoformat;
323  m_pSampleBuffer = p_buffer;
324  }
325 
328 
329 };
330 
332 
337  public:
338 
340  moCaptureDevice();
341 
343  moCaptureDevice( const moText &p_name, const moText &p_description, const moText &p_path, MOint p_deviceport = 0, MOint p_sourcewidth = 0, MOint p_sourceheight = 0, MOint p_bpp = 0, MOint p_fliph=0, MOint p_flipv=0 );
344 
347  (*this) = src;
348  }
349 
352  {
353  m_bPresent = src.m_bPresent;
354  m_bPreferred = src.m_bPreferred;
355  m_Name = src.m_Name;
356  m_Description = src.m_Description;
357  m_Path = src.m_Path ;
358  m_VideoFormat = src.m_VideoFormat;
359  m_LabelName = src.m_LabelName;
360  m_DevicePort = src.m_DevicePort;
361  m_SourceWidth = src.m_SourceWidth;
362  m_SourceHeight = src.m_SourceHeight;
363  m_SourceBpp = src.m_SourceBpp;
364  m_SourceFlipH = src.m_SourceFlipH;
365  m_SourceFlipV = src.m_SourceFlipV;
366 
367  return *this;
368  }
369 
370  virtual ~moCaptureDevice() {
371  }
372 
373 
374 
375  void SetName( const moText &p_name ) {
376  m_Name = p_name;
377  }
378 
380  const moText& GetName() const {
381  return m_Name;
382  }
383 
385  const moText& GetDescription() const {
386  return m_Description;
387  }
388 
390  const moText& GetPath() const {
391  return m_Path;
392  }
393 
395  MOint GetPort() const {
396  return m_DevicePort;
397  }
398 
401 
402  return m_VideoFormat;
403  }
404 
406  void SetVideoFormat( const moVideoFormat &p_videoformat ) {
407 
408  m_VideoFormat = p_videoformat;
409 
410  }
411 
413  void Present( bool p = true ) {
414  m_bPresent = p;
415  }
416 
418  bool IsPresent() const {
419  return m_bPresent;
420  }
421 
423  void SetLabelName( const moText &p_labelname ) {
424  m_LabelName = p_labelname;
425  }
426 
428  const moText& GetLabelName() const {
429  return m_LabelName;
430  }
431 
433  int GetSourceWidth() const {
434  return m_SourceWidth;
435  }
436 
438  int GetSourceHeight() const {
439  return m_SourceHeight;
440  }
441 
443  int GetSourceBpp() const {
444  return m_SourceBpp;
445  }
446 
448  int GetSourceFlipH() const {
449  return m_SourceFlipH;
450  }
451 
453  int GetSourceFlipV() const {
454  return m_SourceFlipV;
455  }
456 
457  void SetPreffered( bool setpreferred = true) {
458  m_bPreferred = setpreferred;
459  }
460 
461  bool IsPreferred() {
462  return m_bPreferred;
463  }
464 
465 
466  public:
474 
480 
482 
483 };
484 
485 
487 
489 
497 
498  public:
499 
501  virtual ~moVideoFramework();
502 
504 
507  virtual void SetPreferredDevices( moCaptureDevices* p_pPreferredDevices );
508 
510 
513  virtual void SetPreferredFormat( const moCaptureDevice &p_CaptureDevice );
514 
516 
519  virtual moCaptureDevices* GetPreferredDevices() {
520  return &m_PreferredDevices;
521  }
522 
524 
527  virtual moCaptureDevices* GetCaptureDevices() {
528  return &m_CaptureDevices;
529  }
530 
532 
536  virtual moCaptureDevices* LoadCaptureDevices() = 0;
537 
539 
543  virtual moCaptureDevices* UpdateCaptureDevices() = 0;
544 
546 
552  virtual bool CheckCaptureDevice( int i ) = 0;
553 
555 
559  virtual bool AddCaptureDevice( moCaptureDevice& p_capdev ) = 0;
560 
561 
563 
566  virtual void CleanCaptureDevices() {
567  m_CaptureDevices.Empty();
568  }
569 
570  protected:
571  moCaptureDevices m_CaptureDevices;
572  moCaptureDevices m_PreferredDevices;
573 
574 };
575 
577 
585 
586  public:
587 
588  moVideoGraph();
589  virtual ~moVideoGraph();
590 
591 //================================================
592 // INITIALIZATION AND FINALIZATION METHODS
593 //================================================
595 
599  virtual bool InitGraph() = 0;
600 
602 
606  virtual bool FinishGraph() = 0;
608 
612  virtual bool BuildLiveGraph( moBucketsPool *pBucketsPool, moCaptureDevice p_capdev) = 0;
613 
615 
619  virtual bool BuildLiveVideoGraph( moText filename, moBucketsPool* pBucketsPool) = 0;
620 
621  virtual bool BuildLiveQTVideoGraph( moText filename, moBucketsPool* pBucketsPool) = 0;
622 
624 
628  virtual bool BuildRecordGraph( moText filename, moBucketsPool* pBucketsPool) = 0;
629 
630 //================================================
631 // CONTROL METHODS
632 //================================================
634 
637  virtual void Play() = 0;
638 
640 
643  virtual void Stop() = 0;
644 
646 
649  virtual void Pause() = 0;
650 
652 
656  virtual void Seek( MOuint frame, float rate = 1.0 ) = 0;
657 
659 
663  virtual bool IsRunning() = 0;
664 
666 
670  virtual MOulong GetFramesLength() = 0;
671 
673 
677  virtual MOulong GetPosition() = 0;
678 
680 
684  virtual MOulong GetDuration() = 0;
685 
687 
691  virtual MObyte* GetFrameBuffer(MOlong *size) = 0;
692 
694 
698  moVideoMode GetVideoMode();
699 
701 
705  virtual void SetVolume( float volume ) = 0;
706 
708 
714  virtual void SetBalance( float balance ) = 0;
715 
716  virtual void SetBrightness( float brightness ) = 0;
717  virtual void SetContrast( float contrast ) = 0;
718  virtual void SetSaturation( float saturation ) = 0;
719  virtual void SetHue( float hue ) = 0;
720  virtual bool IsEOS() = 0;
721  virtual void SetEOS(bool iseos) = 0;
722 
723 
725 
729  moVideoFormat GetVideoFormat();
730 
732 
736  moAudioFormat GetAudioFormat();
737 
739 
749  virtual moStreamState GetState();
750 
752 
757  static moText StateToText( moStreamState state );
758 
759  protected:
760 
763 
764 };
765 
766 
767 
768 
769 
770 
771 
772 
773 
774 #endif
775 
moAudioMode m_AudioMode
Definition: moVideoGraph.h:267
moCaptureDevices m_PreferredDevices
Dispositivos de video disponibles.
Definition: moVideoGraph.h:572
moAudioFormat m_AudioFormat
Formato de video.
Definition: moVideoGraph.h:762
MOuint m_SampleRate
Definition: moVideoGraph.h:275
MOuint m_TimePerSample
Definition: moVideoGraph.h:276
MOint m_SourceWidth
PUERTO DEL DISPOSITIVO.
Definition: moVideoGraph.h:475
MOuint m_GreenMask
Definition: moVideoGraph.h:212
moText m_Description
Nombre del dispositivo.
Definition: moVideoGraph.h:470
#define MOulong
Definition: moTypes.h:392
moDeclareExportedDynamicArray(moCaptureDevice, moCaptureDevices)
int GetSourceHeight() const
Devuelve el alto de la imagen de origen.
Definition: moVideoGraph.h:438
int GetSourceBpp() const
Devuelve los bits por pixel de la imagen de origen.
Definition: moVideoGraph.h:443
Plataforma de reproducción de video, actualmente GStreamer para todas las plataformas.
Definition: moVideoGraph.h:496
MOuint m_BufferSize
Definition: moVideoGraph.h:208
function p(by, bw, bv)
Definition: jquery.js:28
MOuint m_RedMask
Definition: moVideoGraph.h:211
moColorMode
Formatos de codificacion de color.
Definition: moVideoGraph.h:123
int GetSourceFlipH() const
Devuelve el valor de inversión de imagen horizontal.
Definition: moVideoGraph.h:448
moColorMode m_ColorMode
Definition: moVideoGraph.h:202
moCaptureDevices m_CaptureDevices
Definition: moVideoGraph.h:571
#define MOboolean
Definition: moTypes.h:385
moCaptureDevice(const moCaptureDevice &src)
Copy constructor.
Definition: moVideoGraph.h:346
void SetVideoFormat(const moVideoFormat &p_videoformat)
Devuelve el formato de video del dispositivo.
Definition: moVideoGraph.h:406
MOuint m_TimePerFrame
Definition: moVideoGraph.h:206
void SetVideoMode()
Definition: moVideoGraph.h:173
MOuint m_BufferSize
Definition: moVideoGraph.h:280
MOuint m_BitRate
Definition: moVideoGraph.h:205
#define MObyte
Definition: moTypes.h:400
virtual void CleanCaptureDevices()
Limpia el arreglo de dispositivos de video.
Definition: moVideoGraph.h:566
Clase base abstracta de donde deben derivar los objetos [virtual pura].
Definition: moAbstract.h:191
virtual moCaptureDevices * GetCaptureDevices()
Acceso a los dispositivos de video disponibles.
Definition: moVideoGraph.h:527
#define LIBMOLDEO_API
Definition: moTypes.h:180
int GetSourceFlipV() const
Devuelve el valor de inversión de imagen vertical.
Definition: moVideoGraph.h:453
void SetAudioMode()
Definition: moVideoGraph.h:239
MOboolean m_WaitForFormat
Definition: moVideoGraph.h:282
moVideoFormat & GetVideoFormat()
Devuelve el formato de video del dispositivo.
Definition: moVideoGraph.h:400
moVideoMode m_VideoMode
Definition: moVideoGraph.h:201
clase de para manejar textos
Definition: moText.h:75
Formato de audio.
Definition: moVideoGraph.h:223
moVideoSample(moVideoFormat p_videoformat, MOpointer p_buffer)
Constructor con formato de video y el puntero al buffer de datos.
Definition: moVideoGraph.h:307
MOuint m_Channels
Definition: moVideoGraph.h:271
#define MOlong
Definition: moTypes.h:391
Grafo de reproducción de video.
Definition: moVideoGraph.h:584
MOuint m_BlueMask
Definition: moVideoGraph.h:213
Muestra de video o cuadro.
Definition: moVideoGraph.h:290
moTypes MOint moText moParamIndex moParamReference int iRow int int i int i
Definition: all_f.js:18
MOint m_DevicePort
Formato video del dispositivo.
Definition: moVideoGraph.h:473
bool IsPresent() const
Señala y verifica si está presente el dispositivo.
Definition: moVideoGraph.h:418
const moText & GetLabelName() const
Devuelve el nombre de código del dispositivo.
Definition: moVideoGraph.h:428
moStreamState
Definition: moVideoGraph.h:140
void SetLabelName(const moText &p_labelname)
Fija el nombre de código del dispositivo.
Definition: moVideoGraph.h:423
void Present(bool p=true)
Fija la presencia del dispositivo.
Definition: moVideoGraph.h:413
const moText & GetName() const
Devuelve el nombre del dispositivo.
Definition: moVideoGraph.h:380
#define MOint
Definition: moTypes.h:388
moVideoSample()
Constructor.
Definition: moVideoGraph.h:295
MOuint m_BitRate
Definition: moVideoGraph.h:273
Administrador de moBucket 's.
Definition: moBuckets.h:152
const moText & GetDescription() const
Devuelve la descripción del dispositivo.
Definition: moVideoGraph.h:385
const moText & GetPath() const
Devuelve el camino al dispositivo.
Definition: moVideoGraph.h:390
MOuint m_AlphaMask
Definition: moVideoGraph.h:214
int GetSourceWidth() const
Devuelve el ancho de la imagen de origen.
Definition: moVideoGraph.h:433
void * m_pSampleBuffer
Formato de video de la muestra.
Definition: moVideoGraph.h:327
void SetVideoSample(moVideoFormat p_videoformat, MOpointer p_buffer)
Fija el formato de video y puntero al buffer de datos.
Definition: moVideoGraph.h:321
Definición de un dispositivo de video, generalmente uno de captura de video, o camara.
Definition: moVideoGraph.h:336
moMatrix3 & operator=(const moMatrix3 &rkM)
void SetName(const moText &p_name)
Definition: moVideoGraph.h:375
void SetPreffered(bool setpreferred=true)
Definition: moVideoGraph.h:457
MOuint m_SampleSize
Definition: moVideoGraph.h:274
virtual ~moCaptureDevice()
Definition: moVideoGraph.h:370
#define MOuint
Definition: moTypes.h:387
MOuint m_BitCount
Definition: moVideoGraph.h:207
MOboolean m_WaitForFormat
Definition: moVideoGraph.h:210
MOuint m_FrameRate
Definition: moVideoGraph.h:209
Formato de video.
Definition: moVideoGraph.h:155
MOuint m_BitCount
Definition: moVideoGraph.h:278
moText m_Name
Dispositivo preferido siempre se dan de alta cuando están presentes.
Definition: moVideoGraph.h:469
bool m_bPreferred
Presencia del dispositivo.
Definition: moVideoGraph.h:468
moVideoMode
Resoluciones de video.
Definition: moVideoGraph.h:69
moVideoFormat m_VideoFormat
Definition: moVideoGraph.h:761
virtual moCaptureDevices * GetPreferredDevices()
Acceso a los dispositivos de video preferidos.
Definition: moVideoGraph.h:519
moAudioMode
Resoluciones de audio.
Definition: moVideoGraph.h:99
#define MOpointer
Definition: moTypes.h:409
moVideoFormat m_VideoFormat
Camino o clave del dispositivo.
Definition: moVideoGraph.h:472
moVideoFormat m_VideoFormat
Definition: moVideoGraph.h:326
moText m_Path
Descripción del dispositivo.
Definition: moVideoGraph.h:471
MOint GetPort() const
Devuelve el puerto del dispositivo.
Definition: moVideoGraph.h:395