More STL binary reading stuff.
[libsub.git] / src / subtitle.h
index 889f405d2d3e397d17214e3c80d4c63f14be7333..fc08ac7ce9ad9b001b234a0c68d9750a63e50e98 100644 (file)
@@ -42,6 +42,7 @@ public:
                , line (0)
        {}
 
+       /** Subtitle text in UTF-8 */
        std::string text;
        std::string font;
 
@@ -51,10 +52,11 @@ public:
                boost::optional<float> proportional;
                /** in points */
                boost::optional<int> points;
-
-               void convert ();
        } font_size;
 
+       float font_size_proportional (int screen_height_in_points) const;
+       int font_size_points (int screen_height_in_points) const;
+
        /** vertical position of the baseline of the text */
        struct {
                /** as a proportion of screen height offset from some reference point */
@@ -70,7 +72,7 @@ public:
        bool bold;      ///< true to use a bold version of font
        bool italic;    ///< true to use an italic version of font
        bool underline; ///< true to underline
-       int line;
+       int line;       ///< line number, starting from 0
 
        /** from time */
        struct {
@@ -78,21 +80,24 @@ public:
                boost::optional<MetricTime> metric;
        } from;
 
+       FrameTime  from_frame  (float frames_per_second) const;
+       MetricTime from_metric (float frames_per_second) const;
+
        /** to time */
        struct {
                boost::optional<FrameTime> frame;
                boost::optional<MetricTime> metric;
        } to;
 
+       FrameTime  to_frame  (float frames_per_second) const;
+       MetricTime to_metric (float frames_per_second) const;
+       
        boost::optional<MetricTime> fade_up;
        boost::optional<MetricTime> fade_down;
 };
 
 bool operator< (Subtitle const & a, Subtitle const & b);       
 
-void convert_font_sizes (std::list<Subtitle> &, int screen_height_in_points);
-void convert_times (std::list<Subtitle> &, float frames_per_second);
-       
 }
 
 #endif