From 3ec261ae5d7352b7d77aa0f9a60f24ef1f9e08a5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 8 Apr 2019 16:11:38 +0200 Subject: [PATCH] Fix OMFtool; sample_rate vs frame_rate --- tools/omf/omftool.cc | 18 +++++++++--------- tools/omf/omftool.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/omf/omftool.cc b/tools/omf/omftool.cc index fc207fb6ce..68fc6bd83c 100644 --- a/tools/omf/omftool.cc +++ b/tools/omf/omftool.cc @@ -68,7 +68,7 @@ OMF::OMF () session_name = "omfsession"; base_dir = "."; sample_rate = 0; - sample_rate = 0; + frame_rate = 0; version = 3000; db = 0; file = 0; @@ -675,15 +675,15 @@ OMF::create_xml () fread(&num, 4, 1, file); num = e32(num); INFO ("Rate = %d / %d\n", num, denom); - if (sample_rate == 0) { - sample_rate = (double) num / (double) denom; + if (frame_rate == 0) { + frame_rate = (double) num / (double) denom; } if (sample_rate == 0) { sample_rate = denom; } } else { INFO ("OMF file is missing frame rate information for track %d\n", i); - sample_rate = 0.04; // 25FPS + frame_rate = 0.04; // 25FPS if (sample_rate == 0) { sample_rate = 44100; } @@ -706,7 +706,7 @@ OMF::create_xml () char **len; int lenCount; double length = 0.0; - int lenSamples = 0; + int lenFrames = 0; region = 0; @@ -728,8 +728,8 @@ OMF::create_xml () continue; } - lenSamples = atoi(len[1]); - length = lenSamples * sample_rate; + lenFrames = atoi(len[1]); + length = lenFrames * frame_rate; if (!strcmp(type[1], "TRAN")) { @@ -837,7 +837,7 @@ OMF::create_xml () region->add_property ("position", sbuf); snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (length * sample_rate)); region->add_property ("length", sbuf); - snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (start * sample_rate * sample_rate)); + snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (start * frame_rate * sample_rate)); region->add_property ("start", sbuf); set_region_sources (region, sinfo); @@ -913,7 +913,7 @@ OMF::create_xml () region->add_property ("position", sbuf); snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (length * sample_rate)); region->add_property ("length", sbuf); - snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (start * sample_rate * sample_rate)); + snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (start * frame_rate * sample_rate)); region->add_property ("start", sbuf); set_region_sources (region, sinfo); diff --git a/tools/omf/omftool.h b/tools/omf/omftool.h index f33bb5cb77..9f16aec94f 100644 --- a/tools/omf/omftool.h +++ b/tools/omf/omftool.h @@ -43,7 +43,7 @@ private: std::string session_name; std::vector audiofile_path_vector; int sample_rate; /* audio samples per second */ - double sample_rate; /* time per video frame */ + double frame_rate; /* time per video frame */ XMLNode* session; XMLNode* sources; XMLNode* routes;