Skip to content

Commit

Permalink
moved examples to _ instead of -, windows PG breaks on that
Browse files Browse the repository at this point in the history
add common timestamps to all channels
  • Loading branch information
arturoc committed Feb 26, 2014
1 parent 6f60b09 commit 6dd14d3
Show file tree
Hide file tree
Showing 95 changed files with 133 additions and 59 deletions.
8 changes: 3 additions & 5 deletions .cproject
@@ -1,26 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>

<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.toolchain.gnu.base.385864388">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.385864388" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="ofxGstRTP" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.base.385864388" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.base.385864388.1516750176" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.base.1786897561" name="cdt.managedbuild.toolchain.gnu.base" superClass="cdt.managedbuild.toolchain.gnu.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1231977672" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
<builder cleanBuildTarget="CleanRelease -C example-video_audio " id="cdt.managedbuild.target.gnu.builder.base.912949310" incrementalBuildTarget="-C example-video_audio Release" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
<builder cleanBuildTarget="CleanRelease -C example_all" id="cdt.managedbuild.target.gnu.builder.base.912949310" incrementalBuildTarget="-C example_all Release" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.153798979" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.2028688233" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.32859015" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@ example*/obj/**
example*/bin/*
!example*/bin/data
example*/bin/data/settings.xml
settings.xml
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 5 additions & 4 deletions example-all/src/ofApp.cpp → example_all/src/ofApp.cpp
Expand Up @@ -150,14 +150,15 @@ void ofApp::exit(){
void ofApp::update(){
{
kinect.update();
GstClockTime now = rtp.getServer().getTimeStamp();

if(kinect.isFrameNewVideo()){
fpsRGB.newFrame();
textureVideoLocal.loadData(kinect.getPixelsRef());

{
//kinectUpdater.signalNewKinectFrame();
rtp.getServer().newFrame(kinect.getPixelsRef());
rtp.getServer().newFrame(kinect.getPixelsRef(),now);
}

}
Expand All @@ -174,9 +175,9 @@ void ofApp::update(){
{
//kinectUpdater.signalNewKinectFrame();
if(depth16){
rtp.getServer().newFrameDepth(kinect.getRawDepthPixelsRef());
rtp.getServer().newFrameDepth(kinect.getRawDepthPixelsRef(),now);
}else{
rtp.getServer().newFrameDepth(kinect.getDepthPixelsRef());
rtp.getServer().newFrameDepth(kinect.getDepthPixelsRef(),now);
}
}

Expand All @@ -196,7 +197,7 @@ void ofApp::update(){
msg.addFloatArg(blob[i].y);
}
}
rtp.getServer().newOscMsg(msg);
rtp.getServer().newOscMsg(msg,now);
}

if(drawState==LocalPointCloud){
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions example_audio/.cproject
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.toolchain.gnu.base.496650559">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.496650559" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" id="cdt.managedbuild.toolchain.gnu.base.496650559" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.base.496650559.943886362" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.base.1811964444" name="cdt.managedbuild.toolchain.gnu.base" superClass="cdt.managedbuild.toolchain.gnu.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.917626621" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
<builder id="cdt.managedbuild.target.gnu.builder.base.1523720040" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="cdt.managedbuild.target.gnu.builder.base"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1932156402" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1925197670" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1825389272" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.474411030" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.303533614" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.base.792276653" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="example-audio.null.883993402" name="example-audio"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>
27 changes: 27 additions & 0 deletions example_audio/.project
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>example-audio</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions example_audio/.settings/language.settings.xml
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="cdt.managedbuild.toolchain.gnu.base.496650559" name="Default">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(gcc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
</extension>
</configuration>
</project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions example_video_audio/,
@@ -0,0 +1,5 @@
<settings>
<server>talk.google.com</server>
<user>telekinect2@gmail.com</user>
<pwd>telekinect34*</pwd>
</settings>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
80 changes: 34 additions & 46 deletions src/ofxGstRTPServer.cpp
Expand Up @@ -640,7 +640,7 @@ void ofxGstRTPServer::on_new_ssrc_handler(GstBin *rtpbin, guint session, guint s

void ofxGstRTPServer::update(ofEventArgs & args){
if(ofGetFrameNum()%60==0){
if(videoSSRC!=0 && videoSessionNumber!=-1){
if(videoSSRC!=0 && videoSessionNumber!=guint(-1)){
GObject * internalSession;
g_signal_emit_by_name(rtpbin,"get-internal-session",videoSessionNumber,&internalSession,NULL);

Expand Down Expand Up @@ -706,7 +706,7 @@ void ofxGstRTPServer::update(ofEventArgs & args){
}
}

if(depthSSRC!=0 && depthSessionNumber!=-1){
if(depthSSRC!=0 && depthSessionNumber!=guint(-1)){
GObject * internalSession;
g_signal_emit_by_name(rtpbin,"get-internal-session",depthSessionNumber,&internalSession,NULL);

Expand Down Expand Up @@ -764,7 +764,7 @@ void ofxGstRTPServer::update(ofEventArgs & args){
}
}

if(audioSSRC!=0 && audioSessionNumber!=-1){
if(audioSSRC!=0 && audioSessionNumber!=guint(-1)){
GObject * internalSession;
g_signal_emit_by_name(rtpbin,"get-internal-session",audioSessionNumber,&internalSession,NULL);

Expand Down Expand Up @@ -817,7 +817,7 @@ void ofxGstRTPServer::update(ofEventArgs & args){
}
}

if(oscSSRC!=0 && oscSessionNumber!=-1){
if(oscSSRC!=0 && oscSessionNumber!=guint(-1)){
GObject * internalSession;
g_signal_emit_by_name(rtpbin,"get-internal-session",oscSessionNumber,&internalSession,NULL);

Expand Down Expand Up @@ -933,21 +933,18 @@ void ofxGstRTPServer::emitDepthKeyFrame(){

}

void ofxGstRTPServer::newFrame(ofPixels & pixels){
void ofxGstRTPServer::newFrame(ofPixels & pixels, GstClockTime timestamp){
// here we push new video frames in the pipeline, it's important
// to timestamp them properly so gstreamer can sync them with the
// audio.

if(!bufferPool || !appSrcVideoRGB) return;

// get current time from the pipeline
GstClock * clock = gst_pipeline_get_clock(GST_PIPELINE(gst.getPipeline()));
gst_object_ref(clock);
GstClockTime time = gst_clock_get_time (clock);
GstClockTime now = time - gst_element_get_base_time(gst.getPipeline());
gst_object_unref (clock);

GstClockTime now = timestamp;
if(!videoAutoTimestamp){
if(now==GST_CLOCK_TIME_NONE){
now = getTimeStamp();
}
if(firstVideoFrame){
prevTimestamp = now;
firstVideoFrame = false;
Expand Down Expand Up @@ -992,21 +989,18 @@ void ofxGstRTPServer::newFrame(ofPixels & pixels){
}


void ofxGstRTPServer::newFrameDepth(ofPixels & pixels){
void ofxGstRTPServer::newFrameDepth(ofPixels & pixels, GstClockTime timestamp){
// here we push new depth frames in the pipeline, it's important
// to timestamp them properly so gstreamer can sync them with the
// audio.

if(!bufferPoolDepth || !appSrcDepth) return;

// get current time from the pipeline

GstClock * clock = gst_pipeline_get_clock(GST_PIPELINE(gst.getPipeline()));
gst_object_ref(clock);
GstClockTime time = gst_clock_get_time (clock);
GstClockTime now = time - gst_element_get_base_time(gst.getPipeline());
gst_object_unref (clock);
GstClockTime now = timestamp;
if(!depthAutoTimestamp){
if(now==GST_CLOCK_TIME_NONE){
now = getTimeStamp();
}

if(firstDepthFrame){
prevTimestampDepth = now;
Expand Down Expand Up @@ -1052,7 +1046,7 @@ void ofxGstRTPServer::newFrameDepth(ofPixels & pixels){
}


void ofxGstRTPServer::newFrameDepth(ofShortPixels & pixels){
void ofxGstRTPServer::newFrameDepth(ofShortPixels & pixels, GstClockTime timestamp){
//unsigned long long time = ofGetElapsedTimeMicros();

// here we push new depth frames in the pipeline, it's important
Expand All @@ -1061,13 +1055,11 @@ void ofxGstRTPServer::newFrameDepth(ofShortPixels & pixels){

if(!bufferPoolDepth || !appSrcDepth) return;

// get current time from the pipeline

GstClock * clock = gst_pipeline_get_clock(GST_PIPELINE(gst.getPipeline()));
gst_object_ref(clock);
GstClockTime now = gst_clock_get_time (clock) - gst_element_get_base_time(gst.getPipeline());
gst_object_unref (clock);
GstClockTime now = timestamp;
if(!depthAutoTimestamp){
if(now==GST_CLOCK_TIME_NONE){
now = getTimeStamp();
}

if(firstDepthFrame){
prevTimestampDepth = now;
Expand Down Expand Up @@ -1100,17 +1092,7 @@ void ofxGstRTPServer::newFrameDepth(ofShortPixels & pixels){
}

if(sendDepthKeyFrame){
GstClock * clock = gst_pipeline_get_clock(GST_PIPELINE(gst.getPipeline()));
gst_object_ref(clock);
GstClockTime time = gst_clock_get_time (clock);
GstClockTime now = time - gst_element_get_base_time(gst.getPipeline());
gst_object_unref (clock);
GstEvent * keyFrameEvent = gst_video_event_new_downstream_force_key_unit(now,
time,
now,
TRUE,
0);
gst_element_send_event(gst.getPipeline(),keyFrameEvent);
emitDepthKeyFrame();
}

// finally push the buffer into the pipeline through the appsrc element
Expand All @@ -1123,17 +1105,14 @@ void ofxGstRTPServer::newFrameDepth(ofShortPixels & pixels){
}


void ofxGstRTPServer::newOscMsg(ofxOscMessage & msg){
void ofxGstRTPServer::newOscMsg(ofxOscMessage & msg, GstClockTime timestamp){
if(!appSrcOsc) return;

// get current time from the pipeline

GstClock * clock = gst_pipeline_get_clock(GST_PIPELINE(gst.getPipeline()));

gst_object_ref(clock);
GstClockTime now = gst_clock_get_time (clock) - gst_element_get_base_time(gst.getPipeline());
gst_object_unref (clock);
GstClockTime now = timestamp;
if(!oscAutoTimestamp){
if(now==GST_CLOCK_TIME_NONE){
now = getTimeStamp();
}

if(firstOscFrame){
prevTimestampOsc = now;
Expand Down Expand Up @@ -1163,6 +1142,15 @@ void ofxGstRTPServer::newOscMsg(ofxOscMessage & msg){
}
}

GstClockTime ofxGstRTPServer::getTimeStamp(){
if(!gst.isLoaded()) return GST_CLOCK_TIME_NONE;
GstClock * clock = gst_pipeline_get_clock(GST_PIPELINE(gst.getPipeline()));

gst_object_ref(clock);
GstClockTime now = gst_clock_get_time (clock) - gst_element_get_base_time(gst.getPipeline());
gst_object_unref (clock);
return now;
}

void ofxGstRTPServer::appendMessage( ofxOscMessage& message, osc::OutboundPacketStream& p )
{
Expand Down
9 changes: 5 additions & 4 deletions src/ofxGstRTPServer.h
Expand Up @@ -73,11 +73,12 @@ class ofxGstRTPServer: public ofGstAppSink {
void emitVideoKeyFrame();
void emitDepthKeyFrame();

void newFrame(ofPixels & pixels);
void newFrameDepth(ofPixels & pixels);
void newFrameDepth(ofShortPixels & pixels);
GstClockTime getTimeStamp();

void newOscMsg(ofxOscMessage & msg);
void newFrame(ofPixels & pixels, GstClockTime timestamp=GST_CLOCK_TIME_NONE);
void newFrameDepth(ofPixels & pixels, GstClockTime timestamp=GST_CLOCK_TIME_NONE);
void newFrameDepth(ofShortPixels & pixels, GstClockTime timestamp=GST_CLOCK_TIME_NONE);
void newOscMsg(ofxOscMessage & msg, GstClockTime timestamp=GST_CLOCK_TIME_NONE);

bool on_message(GstMessage * msg);

Expand Down

0 comments on commit 6dd14d3

Please sign in to comment.