Skip to content

Allow auto-syncing to be disabled for non-realtime streams #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/ofxVideoRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ bool ofxVideoRecorder::setupCustomOutput(int w, int h, float fps, int sampleRate
bIsInitialized = true;
bIsRecording = false;
bIsPaused = false;
bIsAutoSync = true;

startTime = 0;
recordingDuration = 0;
Expand All @@ -363,7 +364,7 @@ bool ofxVideoRecorder::addFrame(const ofPixels &pixels){
{
int framesToAdd = 1; // default add one frame per request

if((bRecordAudio || bSysClockSync) && !bFinishing){
if(bIsAutoSync && (bRecordAudio || bSysClockSync) && !bFinishing){

double syncDelta;
double videoRecordedTime = videoFramesRecorded / frameRate;
Expand Down Expand Up @@ -470,6 +471,11 @@ void ofxVideoRecorder::setPaused(bool bPause){
}
}

//--------------------------------------------------------------
void ofxVideoRecorder::setAutoSync(bool bAutoSync){
bIsAutoSync = bAutoSync;
}

//--------------------------------------------------------------
void ofxVideoRecorder::close(){
if(!bIsInitialized) return;
Expand Down
2 changes: 2 additions & 0 deletions src/ofxVideoRecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class ofxVideoRecorder : public ofThread
void start();
void close();
void setPaused(bool bPause);
void setAutoSync(bool bAutoSync);

bool hasVideoError();
bool hasAudioError();
Expand Down Expand Up @@ -178,6 +179,7 @@ class ofxVideoRecorder : public ofThread
bool bRecordVideo;
bool bIsRecording;
bool bIsPaused;
bool bIsAutoSync;
bool bFinishing;
bool bIsSilent;

Expand Down