libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moGsGraph Class Reference

GStreamer Graph Class. More...

#include <moGsGraph.h>

Inheritance diagram for moGsGraph:
moVideoGraph moAbstract

Public Member Functions

 moGsGraph ()
 Constructor. More...
 
virtual ~moGsGraph ()
 Destructor. More...
 
virtual bool InitGraph ()
 Inicialización del grafo. More...
 
virtual bool FinishGraph ()
 Finalización del grafo. More...
 
bool BuildLiveGraph (moBucketsPool *pBucketsPool, moCaptureDevice p_capdev)
 
bool SetCaptureDevice (moText deviceport, MOint idevice=0)
 
bool BuildLiveDVGraph (moBucketsPool *pBucketsPool, moCaptureDevice &p_capdev)
 
bool BuildLiveWebcamGraph (moBucketsPool *pBucketsPool, moCaptureDevice &p_capdev)
 
bool BuildLiveVideoGraph (moText filename, moBucketsPool *pBucketsPool)
 Grafo de reproducción de video en modo vivo, asyncronicamente reproducido en función del clock. More...
 
bool BuildLiveQTVideoGraph (moText filename, moBucketsPool *pBucketsPool)
 
bool BuildLiveSound (moText filename)
 
bool BuildLiveStreamingGraph (moBucketsPool *pBucketsPool, moText p_location)
 
bool BuildRecordGraph (moText filename, moBucketsPool *pBucketsPool)
 
virtual moStreamState GetState ()
 Estado de la reproducción. More...
 
void Play ()
 Reproducir el video. More...
 
void Stop ()
 Detener la reproducción del video. More...
 
void Pause ()
 Pausa la reproducción del video. More...
 
void Seek (MOuint frame, float rate=1.0)
 
bool IsRunning ()
 Está corriendo. More...
 
MOulong GetFramesLength ()
 La cantidad de frames, el largo del stream. More...
 
MOulong GetSamplesLength ()
 
MObyteGetFrameBuffer (MOlong *size)
 
virtual MOulong GetDuration ()
 La duración total del stream en nanosegundos. More...
 
virtual MOulong GetPosition ()
 
virtual MOulong GetPositionMS ()
 
void SetVolume (float volume)
 
void SetBalance (float balance)
 Fija el balance entre canal izquierdo y derecho en caso de haberlos. More...
 
void SetPitch (float pitch)
 
void SetEchoDelay (float delay)
 
void SetEchoIntensity (float intensity)
 
void SetEchoFeedback (float feedback)
 
void SetBrightness (float brightness)
 
void SetContrast (float contrast)
 
void SetSaturation (float saturation)
 
void SetHue (float hue)
 
void BuildAudioFilters ()
 
void SetVideoFormat (moGstCaps *caps, moGstBuffer *buffer=NULL)
 
void SetAudioFormat (moGstCaps *caps, moGstBuffer *buffer=NULL)
 
bool CheckState (moGstStateChangeReturn state_change_result, bool waitforsync=false)
 
void RetreivePads (moGstElement *FilterElement)
 
void WaitForFormatDefinition (MOulong timeout)
 
void CopyVideoFrame (void *bufferdst, int size)
 
virtual bool IsEOS ()
 
virtual void SetEOS (bool iseos)
 
- Public Member Functions inherited from moVideoGraph
 moVideoGraph ()
 
virtual ~moVideoGraph ()
 
moVideoMode GetVideoMode ()
 Devuelve el modo de video. More...
 
moVideoFormat GetVideoFormat ()
 Devuelve el formato de video. More...
 
moAudioFormat GetAudioFormat ()
 Devuelve el formato de audio. More...
 
- Public Member Functions inherited from moAbstract
 moAbstract ()
 
virtual ~moAbstract ()
 
virtual MOboolean Init ()
 Inicializa el objeto. More...
 
virtual MOboolean Finish ()
 Finaliza el objeto, libera recursos. More...
 
MOboolean Initialized ()
 Pregunta si está inicializado. More...
 

Static Public Member Functions

static moGBoolean cb_have_data (moGstPad *pad, moGstBuffer *buffer, moGPointer u_data)
 
static moGBoolean cb_buffer_disconnected (moGPointer u_data)
 
static void on_rtsppadd_added (moGstElement *rtspsrc, moGstPad *pad, moGPointer u_data)
 
static void cb_newpad (moGstElement *decodebin, moGstPad *pad, moGBoolean last, moGPointer u_data)
 
static void cb_pad_added (moGstElement *decodebin2, moGstPad *pad, moGPointer u_data)
 
static void cb_handoff (moGstElement *fakesrc, moGstBuffer *buffer, moGstPad *pad, moGPointer user_data)
 
- Static Public Member Functions inherited from moVideoGraph
static moText StateToText (moStreamState state)
 Estado de la reproducción (version texto) More...
 

Public Attributes

long cb_have_data_handler_id
 
long signal_rtsppad_added_id
 
long signal_newpad_id
 
long m_BusWatchId
 
long signal_handoff_id
 
- Public Attributes inherited from moAbstract
MOboolean m_bInitialized
 Valor de inicialización More...
 

Additional Inherited Members

- Static Public Attributes inherited from moAbstract
static moDebugMODebug2 = new moDebug()
 Clase de impresión de errores para depuración More...
 
static moTextHeapMODebug = new moTextHeap()
 Lista de textos. More...
 
- Protected Attributes inherited from moVideoGraph
moVideoFormat m_VideoFormat
 
moAudioFormat m_AudioFormat
 Formato de video. More...
 

Detailed Description

GStreamer Graph Class.

GStreamer Graph Class for video filters and video reproduction: you don't have to link to gstreamer This is C++ wrapper to some GStreamer basic functions...

Definition at line 151 of file moGsGraph.h.

Constructor & Destructor Documentation

moGsGraph::moGsGraph ( )

Constructor.

Definition at line 1445 of file moGsGraph.cpp.

moGsGraph::~moGsGraph ( )
virtual

Destructor.

Definition at line 1499 of file moGsGraph.cpp.

Member Function Documentation

void moGsGraph::BuildAudioFilters ( )

Definition at line 2917 of file moGsGraph.cpp.

bool moGsGraph::BuildLiveDVGraph ( moBucketsPool pBucketsPool,
moCaptureDevice p_capdev 
)

TODO: no need to implement ?!

Definition at line 1952 of file moGsGraph.cpp.

bool moGsGraph::BuildLiveGraph ( moBucketsPool pBucketsPool,
moCaptureDevice  p_capdev 
)
virtual

selecciona entrada!!!

v4lctl setnorm NTSC

y

v4lctl setinput Composite1

Implements moVideoGraph.

Definition at line 1821 of file moGsGraph.cpp.

bool moGsGraph::BuildLiveQTVideoGraph ( moText  filename,
moBucketsPool pBucketsPool 
)
virtual

Implements moVideoGraph.

Definition at line 2628 of file moGsGraph.cpp.

bool moGsGraph::BuildLiveSound ( moText  filename)

AUDIOFX

Definition at line 2737 of file moGsGraph.cpp.

bool moGsGraph::BuildLiveStreamingGraph ( moBucketsPool pBucketsPool,
moText  p_location 
)

SEND gst-launch -m filesrc location=test-aac.3gp ! qtdemux ! rtpmp4gpay ! udpsink host=172.20.122.9 port=19790

RECEIVE gst-launch -m udpsrc port=19790 ! rtpmp4gdepay ! faad ! queue ! amrnbenc ! rtpamrpay pt=98 ! udpsink host=172.20.122.23 port=2006

SEND: gst-launch -m filesrc location=test.wav ! wavparse ! audioconvert ! audioresample !alawenc ! rtppcmapay ! udpsink host=127.0.0.1 port=19790

RECEIVE: gst-launch -m udpsrc port=19790 ! rtppcmadepay ! alawdec ! queue ! amrnbenc ! rtpamrpay pt=98 ! udpsink host=127.0.0.1 port=2006

TODO: implement BuildLiveStreamingGraph

Definition at line 1841 of file moGsGraph.cpp.

bool moGsGraph::BuildLiveVideoGraph ( moText  filename,
moBucketsPool pBucketsPool 
)
virtual

Grafo de reproducción de video en modo vivo, asyncronicamente reproducido en función del clock.

genera un grafo para reproducir un video en modo normal

Returns
verdadero si fue exitoso, falso sino

SOUND...

FIN SOUND

marcamos el sync a true para que reproduzca en sync.

agrega sonido en sincro

Implements moVideoGraph.

Definition at line 2952 of file moGsGraph.cpp.

bool moGsGraph::BuildLiveWebcamGraph ( moBucketsPool pBucketsPool,
moCaptureDevice p_capdev 
)

gstreamer example tests: gst-launch -v dshowvideosrc ! ffmpegcolorspace ! video/x-raw-rgb,bpp=16 ! videoscale ! video/x-raw-rgb,width=160,height=120 ! autovideosink

gstreamer example tests: gst-launch -v dshowvideosrc ! ffmpegcolorspace ! video/x-raw-rgb,bpp=16 ! videoscale ! video/x-raw-rgb,width=160,height=120 ! autovideosink

gst-launch rtspsrc location="rtsp://192.168.0.101/live.sdp" latency=100 ! queue ! rtpmp4vdepay ! queue ! ffdec_mpeg4 ! ffmpegcolorspace ! autovideosink

usando TCP se soluciona la desconección del server automática....

gst-launch rtspsrc location="rtsp://192.168.0.101/live.sdp" latency=100 debug=true protocols=0x00000004 ! queue ! rtpmp4vdepay ! queue ! ffdec_mpeg4 ! ffmpegcolorspace ! autovideosink

referencias:

http://nuald.blogspot.com/2009/07/creating-video-conference-application.html http://stackoverflow.com/questions/1884204/playing-an-incoming-rtp-stream-with-gstreamer

ok

ok link_result = gst_element_link_many( (GstElement*) m_pRTSPSource, (GstElement*) m_pRTSPDepay, NULL );

try to link later dynamically

SOUP HTTP source (MJPEG/HTTP) videofeed

STANDAR DEVICES....

m_pColorSpaceSource = gst_element_factory_make ( VIDEOCONVERT, "colorsource"); if (m_pCapsFilterSource) { res = gst_bin_add (GST_BIN (m_pGstPipeline), (GstElement*) m_pColorSpaceSource ); }

(GstElement*) m_pColorSpaceSource,

Definition at line 1981 of file moGsGraph.cpp.

bool moGsGraph::BuildRecordGraph ( moText  filename,
moBucketsPool pBucketsPool 
)
virtual

grab at the same time with: gst-launch-0.10 v4l2src ! queue ! ffmpegcolorspace ! theoraenc quality=1 ! queue ! oggmux name=mux alsasrc ! audio/x-raw-int,rate=8000,channels=1,depth=8 ! queue ! audioconvert ! vorbisenc ! queue ! mux. mux. ! queue ! tee name= t ! queue ! filesink location=test.ogg t. ! queue ! shout2send ip=giss.tv port=8000 password=pass

TODO: implement BuildRecordGraph

0x000000FF

0x0000FF00

0x00FF0000

Implements moVideoGraph.

Definition at line 1854 of file moGsGraph.cpp.

moGBoolean moGsGraph::cb_buffer_disconnected ( moGPointer  u_data)
static

Definition at line 160 of file moGsGraph.cpp.

void moGsGraph::cb_handoff ( moGstElement fakesrc,
moGstBuffer buffer,
moGstPad pad,
moGPointer  user_data 
)
static

unused

unused

moAbstract::MODebug2->Push(moText("frame nbr"));

Definition at line 841 of file moGsGraph.cpp.

moGBoolean moGsGraph::cb_have_data ( moGstPad pad,
moGstBuffer buffer,
moGPointer  u_data 
)
static

g_signal_connect (data.appsink, "new-buffer", G_CALLBACK (appsink_new_buffer), &data); void appsink_new_buffer (GstElement *sink, CustomData *data) { GstBuffer *buffer;

Retrieve the buffer g_signal_emit_by_name (sink, "pull-buffer", &buffer); if (buffer) {

(((CustomData*)data)->appsink_buffer_count)++;

push buffer onto queue, to be processed in different thread if (GstBufferQueue->size() > GSTBUFFERQUEUE_SIZE) { error message printf ("GstBufferQueue is full!\n"); release buffer gst_buffer_unref (buffer); } else { push onto queue GstBufferQueue->push(buffer); activate thread connectionDataAvailable_GstBufferQueue.notify_all(); } } }

Definition at line 275 of file moGsGraph.cpp.

void moGsGraph::cb_newpad ( moGstElement decodebin,
moGstPad pad,
moGBoolean  last,
moGPointer  u_data 
)
static

unused

unused

Definition at line 473 of file moGsGraph.cpp.

void moGsGraph::cb_pad_added ( moGstElement decodebin2,
moGstPad pad,
moGPointer  u_data 
)
static

Definition at line 666 of file moGsGraph.cpp.

bool moGsGraph::CheckState ( moGstStateChangeReturn  state_change_result,
bool  waitforsync = false 
)

Definition at line 3494 of file moGsGraph.cpp.

void moGsGraph::CopyVideoFrame ( void *  bufferdst,
int  size 
)

Definition at line 1790 of file moGsGraph.cpp.

bool moGsGraph::FinishGraph ( )
virtual

Finalización del grafo.

Destruye los punteros y estructuras de la clase creadas dinámicamente en la función InitGraph

Returns
verdadero si fue exitoso, falso sino

this is only a reference doesnt destroy it, just pass to null

FINALLY UNREFERENCE PIPELINE, DESTROY ALL

Implements moVideoGraph.

Definition at line 1606 of file moGsGraph.cpp.

MOulong moGsGraph::GetDuration ( )
virtual

La duración total del stream en nanosegundos.

devuelve la duración total del stream que se encuentra reproduciendo en nanosegundos

Returns
duración total del stream en nanosegundos

Implements moVideoGraph.

Definition at line 3771 of file moGsGraph.cpp.

MObyte * moGsGraph::GetFrameBuffer ( MOlong size)
virtual

cantidad de muestras de sonido

TODO: ?? GetFrameBuffer

Implements moVideoGraph.

Definition at line 3916 of file moGsGraph.cpp.

MOulong moGsGraph::GetFramesLength ( )
virtual

La cantidad de frames, el largo del stream.

devuelve el largo del stream convertido a frames

Returns
largo en frames

Implements moVideoGraph.

Definition at line 3723 of file moGsGraph.cpp.

MOulong moGsGraph::GetPosition ( )
virtual

en nanosegundos para gstreamer!!! 1E-9 1 s = 1E9 ns = 1 billion ns

TODO:GetFramePosition vs GetSamplePosition sample position = duration / samplerate

Implements moVideoGraph.

Definition at line 3794 of file moGsGraph.cpp.

MOulong moGsGraph::GetPositionMS ( )
virtual

en cuadros

Definition at line 3814 of file moGsGraph.cpp.

MOulong moGsGraph::GetSamplesLength ( )

cantidad de cuadros

Definition at line 3748 of file moGsGraph.cpp.

moStreamState moGsGraph::GetState ( )
virtual

Estado de la reproducción.

Devuelve el estado en que se encuentra el grafo, un valor entre MO_STREAMSTATE_UNKNOWN=-1, MO_STREAMSTATE_PAUSED, MO_STREAMSTATE_PLAYING, MO_STREAMSTATE_WAITING, MO_STREAMSTATE_READY, MO_STREAMSTATE_STOPPED

Returns
moStreamState estado del stream del grafo

Reimplemented from moVideoGraph.

Definition at line 3553 of file moGsGraph.cpp.

bool moGsGraph::InitGraph ( )
virtual

Inicialización del grafo.

Inicializa los punteros y estructuras de la clase

Returns
verdadero si fue exitoso, falso sino

Implements moVideoGraph.

Definition at line 1532 of file moGsGraph.cpp.

bool moGsGraph::IsEOS ( )
virtual

Implements moVideoGraph.

Definition at line 1767 of file moGsGraph.cpp.

bool moGsGraph::IsRunning ( )
virtual

Está corriendo.

indicador que señala si el grafo se está reproduciendo

Returns
verdadero o falso

Implements moVideoGraph.

Definition at line 3831 of file moGsGraph.cpp.

void moGsGraph::on_rtsppadd_added ( moGstElement rtspsrc,
moGstPad pad,
moGPointer  u_data 
)
static

unused

link video...

all ok!!!

all ok!!!

Definition at line 411 of file moGsGraph.cpp.

void moGsGraph::Pause ( )
virtual

Pausa la reproducción del video.

comando de pause, interrumpe la reproducción del video

TODO: for live-stream pause works ok... not for others

Implements moVideoGraph.

Definition at line 3660 of file moGsGraph.cpp.

void moGsGraph::Play ( )
virtual

Reproducir el video.

comando de play, reproduce el video o continua la reproducción

Implements moVideoGraph.

Definition at line 3641 of file moGsGraph.cpp.

void moGsGraph::RetreivePads ( moGstElement FilterElement)

Definition at line 2636 of file moGsGraph.cpp.

void moGsGraph::Seek ( MOuint  frame,
float  rate = 1.0 
)
virtual

TODO: TimeSeek() SampleSeek()

TODO: unused rate!!!

no leemos el ultimo cuadro para no generar un EOS esto depende del modo del play, si esta PLAYING o si esta en PAUSE

TIME SEEK: frame as time in milliseconds

res = gst_element_seek( (GstElement*)m_pGstPipeline, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_SET, 10 * GST_SECOND, GST_SEEK_TYPE_SET, 20 * GST_SECOND );

Implements moVideoGraph.

Definition at line 3674 of file moGsGraph.cpp.

void moGsGraph::SetAudioFormat ( moGstCaps caps,
moGstBuffer buffer = NULL 
)

Definition at line 3278 of file moGsGraph.cpp.

void moGsGraph::SetBalance ( float  balance)
virtual

Fija el balance entre canal izquierdo y derecho en caso de haberlos.

Permite modificar el balance estereo entre -1 y 1, siendo -1 todo a la izquierda y 1 todo a la derecha, 0 corresponde al equilibrio entre los dos canales.

Parameters
balancenivel balance entre los dos canales, entre -1 y 1

Implements moVideoGraph.

Definition at line 3845 of file moGsGraph.cpp.

void moGsGraph::SetBrightness ( float  brightness)
virtual

funciones de video

Implements moVideoGraph.

Definition at line 3883 of file moGsGraph.cpp.

bool moGsGraph::SetCaptureDevice ( moText  deviceport,
MOint  idevice = 0 
)

TODO: implement SetCaptureDevice

Definition at line 1780 of file moGsGraph.cpp.

void moGsGraph::SetContrast ( float  contrast)
virtual

Implements moVideoGraph.

Definition at line 3891 of file moGsGraph.cpp.

void moGsGraph::SetEchoDelay ( float  delay)

Definition at line 3861 of file moGsGraph.cpp.

void moGsGraph::SetEchoFeedback ( float  feedback)

Definition at line 3876 of file moGsGraph.cpp.

void moGsGraph::SetEchoIntensity ( float  intensity)

Definition at line 3869 of file moGsGraph.cpp.

void moGsGraph::SetEOS ( bool  iseos)
virtual

Implements moVideoGraph.

Definition at line 1772 of file moGsGraph.cpp.

void moGsGraph::SetHue ( float  hue)
virtual

Implements moVideoGraph.

Definition at line 3899 of file moGsGraph.cpp.

void moGsGraph::SetPitch ( float  pitch)

Definition at line 3852 of file moGsGraph.cpp.

void moGsGraph::SetSaturation ( float  saturation)
virtual

Implements moVideoGraph.

Definition at line 3907 of file moGsGraph.cpp.

void moGsGraph::SetVideoFormat ( moGstCaps caps,
moGstBuffer buffer = NULL 
)

Definition at line 3362 of file moGsGraph.cpp.

void moGsGraph::SetVolume ( float  volume)
virtual

en millisegundos Funciones de Audio

Implements moVideoGraph.

Definition at line 3838 of file moGsGraph.cpp.

void moGsGraph::Stop ( )
virtual

Detener la reproducción del video.

comando de stop, detiene la reproducción del video

Implements moVideoGraph.

Definition at line 3652 of file moGsGraph.cpp.

void moGsGraph::WaitForFormatDefinition ( MOulong  timeout)

Definition at line 2717 of file moGsGraph.cpp.

Member Data Documentation

long moGsGraph::cb_have_data_handler_id

Definition at line 250 of file moGsGraph.h.

long moGsGraph::m_BusWatchId

Definition at line 278 of file moGsGraph.h.

long moGsGraph::signal_handoff_id

Definition at line 285 of file moGsGraph.h.

long moGsGraph::signal_newpad_id

Definition at line 277 of file moGsGraph.h.

long moGsGraph::signal_rtsppad_added_id

Definition at line 255 of file moGsGraph.h.


The documentation for this class was generated from the following files: