Use FAB subtitler's rather odd DFC -> frame rate mapping.
[libsub.git] / src / stl_binary_writer.cc
index 445333279aae4d900dac9c77e3cd605f84f8a602..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) */
@@ -208,8 +209,10 @@ sub::write_stl_binary (
                put_int_as_int (buffer + 0, 1, 1);
                /* Subtitle number */
                put_int_as_int (buffer + 1, N, 2);
-               /* Extension block number */
-               put_int_as_int (buffer + 3, 0, 1);
+               /* Extension block number.  Use 0xff here to indicate that it is the last TTI
+                  block in this subtitle "set", as we only ever use one.
+               */
+               put_int_as_int (buffer + 3, 255, 1);
                /* Cumulative status */
                put_int_as_int (buffer + 4, tables.cumulative_status_enum_to_file (CUMULATIVE_STATUS_NOT_CUMULATIVE), 1);
                /* Time code in */