summaryrefslogtreecommitdiff
path: root/src/types.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-01-16 10:35:44 +0000
committerCarl Hetherington <cth@carlh.net>2015-01-16 10:35:44 +0000
commitee03fd414e2c6e3dd398107ceb4ee365ff427adc (patch)
treeff1450b622a1dbbee751bcbe5b829c21f8d144c6 /src/types.cc
parentd67d3fc2281c7d83ff2a4e3913f63022bd5f8f16 (diff)
Support horizontal alignment specification in subtitles.
Diffstat (limited to 'src/types.cc')
-rw-r--r--src/types.cc41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/types.cc b/src/types.cc
index f45e3345..920cc5e9 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -159,11 +159,11 @@ string
libdcp::valign_to_string (VAlign v)
{
switch (v) {
- case TOP:
+ case VERTICAL_TOP:
return "top";
- case CENTER:
+ case VERTICAL_CENTER:
return "center";
- case BOTTOM:
+ case VERTICAL_BOTTOM:
return "bottom";
}
@@ -174,14 +174,41 @@ VAlign
libdcp::string_to_valign (string s)
{
if (s == "top") {
- return TOP;
+ return VERTICAL_TOP;
} else if (s == "center") {
- return CENTER;
+ return VERTICAL_CENTER;
} else if (s == "bottom") {
- return BOTTOM;
+ return VERTICAL_BOTTOM;
}
boost::throw_exception (DCPReadError ("unknown subtitle valign type"));
}
-
+string
+libdcp::halign_to_string (HAlign h)
+{
+ switch (h) {
+ case HORIZONTAL_LEFT:
+ return "left";
+ case HORIZONTAL_CENTER:
+ return "center";
+ case HORIZONTAL_RIGHT:
+ return "right";
+ }
+
+ boost::throw_exception (MiscError ("unknown halign type"));
+}
+
+HAlign
+libdcp::string_to_halign (string s)
+{
+ if (s == "left") {
+ return HORIZONTAL_LEFT;
+ } else if (s == "center") {
+ return HORIZONTAL_CENTER;
+ } else if (s == "right") {
+ return HORIZONTAL_RIGHT;
+ }
+
+ boost::throw_exception (DCPReadError ("unknown subtitle halign type"));
+}