Copy another test over from DCP-o-matic.
[libsub.git] / src / stl_binary_reader.cc
index 022ed29a6d53b51018c568acef5f370271351733..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));
@@ -78,7 +68,7 @@ STLBinaryReader::STLBinaryReader (istream& in)
        maximum_rows = atoi (get_string (253, 2).c_str ());
        timecode_status = _tables.timecode_status_file_to_enum (get_string (255, 1));
        start_of_programme = get_string (256, 8);
-       first_in_cue = get_string (256, 8);
+       first_in_cue = get_string (264, 8);
        disks = atoi (get_string (272, 1).c_str ());
        disk_sequence_number = atoi (get_string (273, 1).c_str ());
        country_of_origin = get_string (274, 3);