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.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/lib/film_state.cc b/src/lib/film_state.cc
index 3d58a4fec..a4d88d0e0 100644
--- a/src/lib/film_state.cc
+++ b/src/lib/film_state.cc
@@ -80,6 +80,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 +97,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 +146,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 +175,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 +197,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");