summaryrefslogtreecommitdiff
path: root/src/lib/film_state.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/film_state.cc')
-rw-r--r--src/lib/film_state.cc89
1 files changed, 87 insertions, 2 deletions
diff --git a/src/lib/film_state.cc b/src/lib/film_state.cc
index 3d58a4fec..fed506863 100644
--- a/src/lib/film_state.cc
+++ b/src/lib/film_state.cc
@@ -29,6 +29,7 @@
#include <iomanip>
#include <sstream>
#include <boost/filesystem.hpp>
+#include <boost/date_time.hpp>
#include "film_state.h"
#include "scaler.h"
#include "filter.h"
@@ -80,6 +81,9 @@ FilmState::write_metadata (ofstream& f) const
f << "audio_gain " << audio_gain << "\n";
f << "audio_delay " << audio_delay << "\n";
f << "still_duration " << still_duration << "\n";
+ f << "with_subtitles " << with_subtitles << "\n";
+ f << "subtitle_offset " << subtitle_offset << "\n";
+ f << "subtitle_scale " << subtitle_scale << "\n";
/* Cached stuff; this is information about our content; we could
look it up each time, but that's slow.
@@ -94,6 +98,7 @@ FilmState::write_metadata (ofstream& f) const
f << "audio_sample_rate " << audio_sample_rate << "\n";
f << "audio_sample_format " << audio_sample_format_to_string (audio_sample_format) << "\n";
f << "content_digest " << content_digest << "\n";
+ f << "has_subtitles " << has_subtitles << "\n";
}
/** Read state from a key / value pair.
@@ -142,6 +147,12 @@ FilmState::read_metadata (string k, string v)
audio_delay = atoi (v.c_str ());
} else if (k == "still_duration") {
still_duration = atoi (v.c_str ());
+ } else if (k == "with_subtitles") {
+ with_subtitles = (v == "1");
+ } else if (k == "subtitle_offset") {
+ subtitle_offset = atoi (v.c_str ());
+ } else if (k == "subtitle_scale") {
+ subtitle_scale = atof (v.c_str ());
}
/* Cached stuff */
@@ -165,6 +176,8 @@ FilmState::read_metadata (string k, string v)
audio_sample_format = audio_sample_format_from_string (v);
} else if (k == "content_digest") {
content_digest = v;
+ } else if (k == "has_subtitles") {
+ has_subtitles = (v == "1");
}
}
@@ -185,9 +198,21 @@ FilmState::thumb_file (int n) const
string
FilmState::thumb_file_for_frame (int n) const
{
+ return thumb_base_for_frame(n) + ".png";
+}
+
+string
+FilmState::thumb_base (int n) const
+{
+ return thumb_base_for_frame (thumb_frame (n));
+}
+
+string
+FilmState::thumb_base_for_frame (int n) const
+{
stringstream s;
s.width (8);
- s << setfill('0') << n << ".tiff";
+ s << setfill('0') << n;
filesystem::path p;
p /= dir ("thumbs");
@@ -306,4 +331,64 @@ FilmState::dcp_length () const
return length;
}
-
+string
+FilmState::dci_name () const
+{
+ stringstream d;
+ d << dci_name_prefix << "_";
+
+ if (dcp_content_type) {
+ d << dcp_content_type->dci_name() << "_";
+ }
+
+ if (format) {
+ d << format->dci_name() << "_";
+ }
+
+ if (!audio_language.empty ()) {
+ d << audio_language;
+ if (!subtitle_language.empty ()) {
+ d << "-" << subtitle_language;
+ }
+ d << "_";
+ }
+
+ if (!territory.empty ()) {
+ d << territory;
+ if (!rating.empty ()) {
+ d << "-" << rating;
+ }
+ d << "_";
+ }
+
+ switch (audio_channels) {
+ case 1:
+ d << "1_";
+ break;
+ case 2:
+ d << "2_";
+ break;
+ case 6:
+ d << "51_";
+ break;
+ }
+
+ d << "2K_";
+
+ if (!studio.empty ()) {
+ d << studio << "_";
+ }
+
+ gregorian::date today = gregorian::day_clock::local_day ();
+ d << gregorian::to_iso_extended_string (today) << "_";
+
+ if (!facility.empty ()) {
+ d << facility << "_";
+ }
+
+ if (!package_type.empty ()) {
+ d << package_type;
+ }
+
+ return d.str ();
+}