add missing xml closers, add fix for folder bug, add roundoff fixups
authorGood Guy <good1.2guy@gmail.com>
Thu, 27 Oct 2016 22:59:36 +0000 (16:59 -0600)
committerGood Guy <good1.2guy@gmail.com>
Thu, 27 Oct 2016 22:59:36 +0000 (16:59 -0600)
14 files changed:
cinelerra-5.1/cinelerra/adcuts.C
cinelerra-5.1/cinelerra/batchrender.C
cinelerra-5.1/cinelerra/edit.C
cinelerra-5.1/cinelerra/edl.C
cinelerra-5.1/cinelerra/filexml.C
cinelerra-5.1/cinelerra/filexml.h
cinelerra-5.1/cinelerra/indexstate.C
cinelerra-5.1/cinelerra/mediadb.C
cinelerra-5.1/cinelerra/track.C
cinelerra-5.1/guicast/units.C
cinelerra-5.1/plugins/piano/piano.C
cinelerra-5.1/plugins/rgb601/ivtc.C.2
cinelerra-5.1/plugins/synthesizer/synthesizer.C
cinelerra-5.1/plugins/yuv411/yuv411.C

index 93a6a90a2ff7cf01b1276df7a354535d4fd922ce..1fa1700d5e44087d6b060027c9cf2dacf2d8c00b 100644 (file)
@@ -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();
        }
 
index 3fa755bcdcf898723d0e466b725dd7d4e2157b72..a02a8cff87615b23942f0027ca8dca6a9135cc0c 100644 (file)
@@ -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);
index 0792fa443c5a3c179b1306c6f696c2f7e736b9eb..2575cfa359facc94c5b96a01544b57a30c7ccc93 100644 (file)
@@ -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)
index 3082788c2a85d5d647982ef2eb4b892adcf8cd01..1b00471bce325a5c89a3dd8ba647e054991f68ef 100644 (file)
@@ -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"))
index eccb503ac6143b1e9f5fa44c04236c89a87b670d..5aa82f56942f39f7425bd185ec3506c88f4952b2 100644 (file)
@@ -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();
index 44da4374c15325416e8ae1200c673469e9212ee5..270b763df7b29bf8e7533545c954cc8552ec42cd 100644 (file)
@@ -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);
index fed102cfd7611bbdaae4236628d394712261ed71..f4c0a9a44a47f6f619148018963e728ae4132481 100644 (file)
@@ -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();
index bb2e826cc42e0981843f94aa307ae4f3826cc406..4f075ff9f631c3cde29cb35c2f5632994fce9e8c 100644 (file)
@@ -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();
        }
 
index 3dac186c178e6eeda45ff27f0f711f0408c9307e..05bb50365446eeaddbda67a3b00b8273ac6a4445 100644 (file)
@@ -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);
index 049d8f92de44f850e8ac8d7171ecf556bb37a305..eed940dca20255a42539c02712093f47d1c98b6a 100644 (file)
@@ -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);
index 3b471ba1043d1c4e415d61d6ee4677b094d1c7c1..b5f4a9ba2841e3f00cdda1aaca9c91933ce3ab37 100644 (file)
@@ -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();
 }
 
index ef39aba98602ffb4d40a9ca0a63304bb767d4f96..d7e25e48c9ec8b330af2fb164086c6b3728f7786 100644 (file)
@@ -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();
 }
 
index 546aaf9167cd5efcf85290049fee8aa3e0df67f7..d284d2381d123fcf5693f5ef8f60017cdf39e5fe 100644 (file)
@@ -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();
 }
 
index 161ae3318384d9085ea4cd7f7fd8fea1af125e48..fbe0ed98a030248a34f1c4f536e040168b58ea20 100644 (file)
@@ -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();
 }