From 0983c78067d86d25426fd34655ad9a9992ef04c7 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Thu, 27 Oct 2016 16:59:36 -0600 Subject: [PATCH] add missing xml closers, add fix for folder bug, add roundoff fixups --- cinelerra-5.1/cinelerra/adcuts.C | 2 ++ cinelerra-5.1/cinelerra/batchrender.C | 3 +++ cinelerra-5.1/cinelerra/edit.C | 3 +++ cinelerra-5.1/cinelerra/edl.C | 12 ++++++++++++ cinelerra-5.1/cinelerra/filexml.C | 16 ++++++++++++++++ cinelerra-5.1/cinelerra/filexml.h | 1 + cinelerra-5.1/cinelerra/indexstate.C | 5 +++++ cinelerra-5.1/cinelerra/mediadb.C | 4 ++++ cinelerra-5.1/cinelerra/track.C | 6 +++++- cinelerra-5.1/guicast/units.C | 15 ++++++++------- cinelerra-5.1/plugins/piano/piano.C | 2 ++ cinelerra-5.1/plugins/rgb601/ivtc.C.2 | 2 ++ cinelerra-5.1/plugins/synthesizer/synthesizer.C | 2 ++ cinelerra-5.1/plugins/yuv411/yuv411.C | 8 ++++++++ 14 files changed, 73 insertions(+), 8 deletions(-) diff --git a/cinelerra-5.1/cinelerra/adcuts.C b/cinelerra-5.1/cinelerra/adcuts.C index 93a6a90a..1fa1700d 100644 --- a/cinelerra-5.1/cinelerra/adcuts.C +++ b/cinelerra-5.1/cinelerra/adcuts.C @@ -79,6 +79,8 @@ save(FileXML &xml) xml.tag.set_property("TIME", cut->time); xml.tag.set_property("ACTION", cut->action); xml.append_tag(); + xml.tag.set_title("/CUT"); + xml.append_tag(); xml.append_newline(); } diff --git a/cinelerra-5.1/cinelerra/batchrender.C b/cinelerra-5.1/cinelerra/batchrender.C index 3fa755bc..a02a8cff 100644 --- a/cinelerra-5.1/cinelerra/batchrender.C +++ b/cinelerra-5.1/cinelerra/batchrender.C @@ -340,6 +340,9 @@ void BatchRenderThread::save_jobs(char *path) file.tag.set_title("JOB"); jobs.values[i]->save(&file); } + file.tag.set_title("/JOBS"); + file.append_tag(); + file.append_newline(); if(path[0]) file.write_to_file(path); diff --git a/cinelerra-5.1/cinelerra/edit.C b/cinelerra-5.1/cinelerra/edit.C index 0792fa44..2575cfa3 100644 --- a/cinelerra-5.1/cinelerra/edit.C +++ b/cinelerra-5.1/cinelerra/edit.C @@ -150,6 +150,9 @@ int Edit::copy(int64_t start, file->tag.set_title("NESTED_EDL"); file->tag.set_property("SRC", nested_edl->path); file->append_tag(); + file->tag.set_title("/NESTED_EDL"); + file->append_tag(); + file->append_newline(); } if(asset) diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index 3082788c..1b00471b 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -278,6 +278,8 @@ int EDL::load_xml(FileXML *file, if((load_flags & LOAD_VCONFIG) && (load_flags & LOAD_SESSION)) session->load_video_config(file, 0, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is("AUDIO")) @@ -285,6 +287,8 @@ int EDL::load_xml(FileXML *file, if((load_flags & LOAD_ACONFIG) && (load_flags & LOAD_SESSION)) session->load_audio_config(file, 0, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is("FOLDER")) @@ -298,12 +302,16 @@ int EDL::load_xml(FileXML *file, { if(load_flags & LOAD_ASSETS) assets->load(file, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is(labels->xml_tag)) { if(load_flags & LOAD_TIMEBAR) labels->load(file, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is("LOCALSESSION")) @@ -311,6 +319,8 @@ int EDL::load_xml(FileXML *file, if((load_flags & LOAD_SESSION) || (load_flags & LOAD_TIMEBAR)) local_session->load_xml(file, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is("SESSION")) @@ -318,6 +328,8 @@ int EDL::load_xml(FileXML *file, if((load_flags & LOAD_SESSION) && !parent_edl) session->load_xml(file, 0, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is("TRACK")) diff --git a/cinelerra-5.1/cinelerra/filexml.C b/cinelerra-5.1/cinelerra/filexml.C index eccb503a..5aa82f56 100644 --- a/cinelerra-5.1/cinelerra/filexml.C +++ b/cinelerra-5.1/cinelerra/filexml.C @@ -472,6 +472,22 @@ int FileXML::read_tag() return tag.read_tag(this); } +int FileXML::skip_tag() +{ + char tag_title[sizeof(tag.title)]; + strcpy(tag_title, tag.title); + int n = 1; + while( !read_tag() ) { + if( tag.title[0] == tag_title[0] ) { + if( !strcasecmp(&tag_title[1], &tag.title[1]) ) ++n; + } + else if( tag.title[0] != '/' ) continue; + else if( strcasecmp(&tag_title[0], &tag.title[1]) ) continue; + else if( --n <= 0 ) return 0; + } + return 1; +} + int FileXML::read_data_until(const char *tag_end, char *out, int len) { long ipos = buffer->itell(); diff --git a/cinelerra-5.1/cinelerra/filexml.h b/cinelerra-5.1/cinelerra/filexml.h index 44da4374..270b763d 100644 --- a/cinelerra-5.1/cinelerra/filexml.h +++ b/cinelerra-5.1/cinelerra/filexml.h @@ -136,6 +136,7 @@ public: int read_data_until(const char *tag_end, char *out, int len); int read_text_until(const char *tag_end, char *out, int len); int read_tag(); + int skip_tag(); int write_to_file(const char *filename); int write_to_file(FILE *file, const char *filename=""); int read_from_file(const char *filename, int ignore_error = 0); diff --git a/cinelerra-5.1/cinelerra/indexstate.C b/cinelerra-5.1/cinelerra/indexstate.C index fed102cf..f4c0a9a4 100644 --- a/cinelerra-5.1/cinelerra/indexstate.C +++ b/cinelerra-5.1/cinelerra/indexstate.C @@ -158,9 +158,14 @@ void IndexState::write_xml(FileXML *file) file->tag.set_title("OFFSET"); file->tag.set_property("FLOAT", index_entries[i]->offset); file->append_tag(); + file->tag.set_title("/OFFSET"); + file->append_tag(); file->tag.set_title("SIZE"); file->tag.set_property("FLOAT", index_entries[i]->size); file->append_tag(); + file->tag.set_title("/SIZE"); + file->append_tag(); + file->append_newline(); } file->append_newline(); diff --git a/cinelerra-5.1/cinelerra/mediadb.C b/cinelerra-5.1/cinelerra/mediadb.C index bb2e826c..4f075ff9 100644 --- a/cinelerra-5.1/cinelerra/mediadb.C +++ b/cinelerra-5.1/cinelerra/mediadb.C @@ -149,6 +149,8 @@ save(FileXML &xml) xml.tag.set_property("TIME", del->time); xml.tag.set_property("ACTION", del->action); xml.append_tag(); + xml.tag.set_title("/DEL"); + xml.append_tag(); xml.append_newline(); } @@ -298,6 +300,8 @@ save(FileXML &xml) xml.tag.set_property("START", start); xml.tag.set_property("END", end); xml.append_tag(); + xml.tag.set_title("/CLIP"); + xml.append_tag(); xml.append_newline(); } diff --git a/cinelerra-5.1/cinelerra/track.C b/cinelerra-5.1/cinelerra/track.C index 3dac186c..05bb5036 100644 --- a/cinelerra-5.1/cinelerra/track.C +++ b/cinelerra-5.1/cinelerra/track.C @@ -339,7 +339,7 @@ int Track::load(FileXML *file, int track_offset, uint32_t load_flags) else if(file->tag.title_is("TITLE")) { - file->read_text_until("/TITLE", title, BCTEXTLEN); + result = file->skip_tag(); } else if(load_flags && automation->load(file) @@ -352,6 +352,8 @@ int Track::load(FileXML *file, int track_offset, uint32_t load_flags) { if(load_flags & LOAD_EDITS) edits->load(file, track_offset); + else + result = file->skip_tag(); } else if(file->tag.title_is("PLUGINSET")) @@ -372,6 +374,8 @@ int Track::load(FileXML *file, int track_offset, uint32_t load_flags) current_plugin++; } } + else + result = file->skip_tag(); } else load_derived(file, load_flags); diff --git a/cinelerra-5.1/guicast/units.C b/cinelerra-5.1/guicast/units.C index 049d8f92..eed940dc 100644 --- a/cinelerra-5.1/guicast/units.C +++ b/cinelerra-5.1/guicast/units.C @@ -166,7 +166,8 @@ char* Units::totext(char *text, double seconds, int time_format, switch(time_format) { case TIME_SECONDS: { - seconds = fabs(seconds); +// add 1.0e-6 to prevent round off truncation from glitching a bunch of digits + seconds = fabs(seconds) + 1.0e-6; second = seconds; seconds -= (int64_t)seconds; thousandths = (int64_t)(seconds*1000) % 1000; @@ -174,7 +175,7 @@ char* Units::totext(char *text, double seconds, int time_format, break; } case TIME_HMS: { - seconds = fabs(seconds); + seconds = fabs(seconds) + 1.0e-6; hour = seconds/3600; minute = seconds/60 - hour*60; second = seconds - (hour*3600 + minute*60); @@ -185,7 +186,7 @@ char* Units::totext(char *text, double seconds, int time_format, break; } case TIME_HMS2: { - seconds = fabs(seconds); + seconds = fabs(seconds) + 1.0e-6; hour = seconds/3600; minute = seconds/60 - hour*60; second = seconds - (hour*3600 + minute*60); @@ -193,7 +194,7 @@ char* Units::totext(char *text, double seconds, int time_format, break; } case TIME_HMS3: { - seconds = fabs(seconds); + seconds = fabs(seconds) + 1.0e-6; hour = seconds/3600; minute = seconds/60 - hour*60; second = seconds - (hour*3600 + minute*60); @@ -201,7 +202,7 @@ char* Units::totext(char *text, double seconds, int time_format, break; } case TIME_HMSF: { - seconds = fabs(seconds); + seconds = fabs(seconds) + 1.0e-6; hour = seconds/3600; minute = seconds/60 - hour*60; second = seconds - (hour*3600 + minute*60); @@ -232,7 +233,7 @@ char* Units::totext(char *text, double seconds, int time_format, break; } case TIME_MS1: { - seconds = fabs(seconds); + seconds = fabs(seconds) + 1.0e-6; minute = seconds/60; second = seconds - minute*60; sprintf(text, "%d:%02d", minute, second); @@ -240,7 +241,7 @@ char* Units::totext(char *text, double seconds, int time_format, case TIME_MS2: { int sign = seconds >= 0 ? '+' : '-'; - seconds = fabs(seconds); + seconds = fabs(seconds) + 1.0e-6; minute = seconds/60; second = seconds - minute*60; sprintf(text, "%c%d:%02d", sign, minute, second); diff --git a/cinelerra-5.1/plugins/piano/piano.C b/cinelerra-5.1/plugins/piano/piano.C index 3b471ba1..b5f4a9ba 100644 --- a/cinelerra-5.1/plugins/piano/piano.C +++ b/cinelerra-5.1/plugins/piano/piano.C @@ -1529,6 +1529,8 @@ void PianoOscillatorConfig::save_data(FileXML *file) file->tag.set_property("PHASE", (float)phase); file->tag.set_property("FREQFACTOR", (float)freq_factor); file->append_tag(); + file->tag.set_title("/OSCILLATOR"); + file->append_tag(); file->append_newline(); } diff --git a/cinelerra-5.1/plugins/rgb601/ivtc.C.2 b/cinelerra-5.1/plugins/rgb601/ivtc.C.2 index ef39aba9..d7e25e48 100644 --- a/cinelerra-5.1/plugins/rgb601/ivtc.C.2 +++ b/cinelerra-5.1/plugins/rgb601/ivtc.C.2 @@ -95,6 +95,8 @@ void RGB601Main::save_data(KeyFrame *keyframe) output.tag.set_property("AUTOMATIC", config.automatic); output.tag.set_property("AUTO_THRESHOLD", config.auto_threshold); output.append_tag(); + output.tag.set_title("/RGB601"); + output.append_tag(); output.terminate_string(); } diff --git a/cinelerra-5.1/plugins/synthesizer/synthesizer.C b/cinelerra-5.1/plugins/synthesizer/synthesizer.C index 546aaf91..d284d238 100644 --- a/cinelerra-5.1/plugins/synthesizer/synthesizer.C +++ b/cinelerra-5.1/plugins/synthesizer/synthesizer.C @@ -2106,6 +2106,8 @@ void SynthOscillatorConfig::save_data(FileXML *file) file->tag.set_property("PHASE", (float)phase); file->tag.set_property("FREQFACTOR", (float)freq_factor); file->append_tag(); + file->tag.set_title("/OSCILLATOR"); + file->append_tag(); file->append_newline(); } diff --git a/cinelerra-5.1/plugins/yuv411/yuv411.C b/cinelerra-5.1/plugins/yuv411/yuv411.C index 161ae331..fbe0ed98 100644 --- a/cinelerra-5.1/plugins/yuv411/yuv411.C +++ b/cinelerra-5.1/plugins/yuv411/yuv411.C @@ -247,15 +247,23 @@ void yuv411Main::save_data(KeyFrame *keyframe) if(config.avg_vertical) { output.tag.set_title("VERTICAL"); output.append_tag(); + output.tag.set_title("/VERTICAL"); + output.append_tag(); } if(config.int_horizontal) { output.tag.set_title("HORIZONTAL"); output.append_tag(); + output.tag.set_title("/HORIZONTAL"); + output.append_tag(); } if(config.inpainting ) { output.tag.set_title("INPAINTING"); output.append_tag(); + output.tag.set_title("/INPAINTING"); + output.append_tag(); } + output.tag.set_title("/YUV411"); + output.append_tag(); output.terminate_string(); } -- 2.26.2