diff options
| author | Comment <tim@gray.(none)> | 2013-09-27 19:36:29 -0400 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-09-27 19:36:29 -0400 |
| commit | 873f295e28a20e2e774852d8d7010ff5629549b4 (patch) | |
| tree | 3237d0b7f9852d3ab0f69bdd59aac2848ed1dec1 /rotord/src/graph.cpp | |
| parent | f40d511775eb8dfae9a28870c5e0125b5e55b305 (diff) | |
fixed crash when no node specified to load video
Diffstat (limited to 'rotord/src/graph.cpp')
| -rw-r--r-- | rotord/src/graph.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp index b94d04c..f904a9d 100644 --- a/rotord/src/graph.cpp +++ b/rotord/src/graph.cpp @@ -79,7 +79,7 @@ bool Graph::preview(xmlIO &XML,string &node,string &_format,int frame,int w,int return false; } -bool Graph::video_render(const string &output_filename,const float framerate) { +bool Graph::video_render(const string &output_filename,const float framerate,int start, int stop) { //https://www.adobe.com/devnet/video/articles/mp4_movie_atom.html //https://www.google.ie/search?q=ffmbc&aq=f&oq=ffmbc&aqs=chrome.0.57j0l2j60j0j60.4360j0&sourceid=chrome&ie=UTF-8#q=ffmbc+git @@ -130,9 +130,9 @@ bool Graph::video_render(const string &output_filename,const float framerate) { //25fps video and 43.06640625fps audio? hmm //how to get the timecodes correct for the interleaved files - struct timeval start, end; + struct timeval _start, _end; - gettimeofday(&start, NULL); + gettimeofday(&_start, NULL); uint16_t *audioframe=nullptr; uint16_t *audio=nullptr; @@ -148,13 +148,13 @@ bool Graph::video_render(const string &output_filename,const float framerate) { float vstep=1.0f/framerate; float v=0.0f; - float vf=0.0f; - float af=0.0f; + float vf=start*vstep; + float af=start*vstep; int aoffs=0; int audioend=0; Audio_frame *a; - int64_t sample_start=0; - while (vf<duration&&!cancelled){ //-vstep) { + int64_t sample_start=(start*audioloader.get_sample_rate())/framerate; + while (vf<min(duration,stop*vstep)&&!cancelled){ //-vstep) { if (usingaudio) { if (audioloader.get_samples(audio,sample_start,samples_in_frame)) { @@ -217,9 +217,9 @@ bool Graph::video_render(const string &output_filename,const float framerate) { exporter.finishRecord(); - gettimeofday(&end, NULL); + gettimeofday(&_end, NULL); - float mtime = ((end.tv_sec-start.tv_sec) + (end.tv_usec-start.tv_usec)/1000000.0) + 0.5; + float mtime = ((_end.tv_sec-_start.tv_sec) + (_end.tv_usec-_start.tv_usec)/1000000.0) + 0.5; logger.information("Video_output: rendered "+output_filename+": in "+toString(mtime)+" seconds"); |
