Use FAB subtitler's rather odd DFC -> frame rate mapping.
authorCarl Hetherington <cth@carlh.net>
Sat, 2 Aug 2014 12:54:09 +0000 (13:54 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 2 Aug 2014 12:54:09 +0000 (13:54 +0100)
src/stl_binary_reader.cc
src/stl_binary_writer.cc
src/wscript

index c8eff45a9b2e5da48815711767371b00090c4156..dd0020f37766205e810fbdbc336f679ed0eadfb0 100644 (file)
 
 */
 
-#include <boost/lexical_cast.hpp>
-#include <boost/algorithm/string.hpp>
-#include <boost/locale.hpp>
 #include "stl_binary_reader.h"
 #include "exceptions.h"
 #include "iso6937.h"
+#include "stl_util.h"
 #include "compose.hpp"
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string.hpp>
+#include <boost/locale.hpp>
 
 using std::map;
 using std::vector;
@@ -45,18 +46,7 @@ STLBinaryReader::STLBinaryReader (istream& in)
        }
 
        code_page_number = atoi (get_string (0, 3).c_str ());
-       
-       string const dfc = get_string (3, 8);
-       if (dfc == "STL24.01") {
-               frame_rate = 24;
-       } else if (dfc == "STL25.01") {
-               frame_rate = 25;
-       } else if (dfc == "STL30.01") {
-               frame_rate = 30;
-       } else {
-               throw STLError (String::compose ("Unknown disk format code %1 in binary STL file", dfc));
-       }
-
+       frame_rate = stl_dfc_to_frame_rate (get_string (3, 8));
        display_standard = _tables.display_standard_file_to_enum (get_string (11, 1));
        language_group = _tables.language_group_file_to_enum (get_string (12, 2));
        language = _tables.language_file_to_enum (get_string (14, 2));
index cb6c71a67c547c6bd73d8abbb8d23d17831bb085..9b98b84cf7de4fe3888045384e3d407d20876cbd 100644 (file)
@@ -20,6 +20,7 @@
 #include "stl_binary_writer.h"
 #include "subtitle.h"
 #include "iso6937.h"
+#include "stl_util.h"
 #include "compose.hpp"
 #include <boost/locale.hpp>
 #include <list>
@@ -155,7 +156,7 @@ sub::write_stl_binary (
        /* Code page: 850 */
        put_string (buffer + 0, "850");
        /* Disk format code */
-       put_string (buffer + 3, String::compose ("STL%1.01", rint (frames_per_second)));
+       put_string (buffer + 3, stl_frame_rate_to_dfc (frames_per_second));
        /* Display standard code: open subtitling */
        put_string (buffer + 11, "0");
        /* Character code table: Latin (ISO 6937) */
index 5298ad7c1d96c853f36c2175123cc843d516434f..ef5c787ab370c37fe3313f51c65589aecdcca107 100644 (file)
@@ -26,6 +26,7 @@ def build(bld):
                  stl_binary_tables.cc
                  stl_binary_writer.cc
                  stl_text_reader.cc
+                 stl_util.cc
                  time_pair.cc
                  subtitle.cc
                  vertical_reference.cc