summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-02-24 00:17:26 +0000
committerCarl Hetherington <cth@carlh.net>2016-02-24 00:17:26 +0000
commite1ec5b2c81ec2e15d4c1d97cce8252fa34c7116a (patch)
tree78aed756a937f979983de33f51acbf2b43744aa4 /src/lib
parent794396aa29061894ea359a6f30aa0f759a1f1b74 (diff)
An unfortunately large set of timeline-related changes:
- Rename sequence_video to sequence, and sequence subtitle content like we do video content (i.e. adding multiple subtitle contents will result in them sequenced in time rather than overlaid). - Stop doing selection-changed related stuff in ContentPanel if no selection change has actually happened. - Attempt to tidy up event handling in the timeline a bit.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/film.cc30
-rw-r--r--src/lib/film.h10
-rw-r--r--src/lib/playlist.cc47
-rw-r--r--src/lib/playlist.h11
4 files changed, 68 insertions, 30 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index f4d983260..3ea7545df 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -127,7 +127,7 @@ Film::Film (boost::filesystem::path dir, bool log)
, _video_frame_rate (24)
, _audio_channels (6)
, _three_d (false)
- , _sequence_video (true)
+ , _sequence (true)
, _interop (Config::instance()->default_interop ())
, _audio_processor (0)
, _reel_type (REELTYPE_SINGLE)
@@ -168,7 +168,7 @@ Film::Film (boost::filesystem::path dir, bool log)
_log.reset (new NullLog);
}
- _playlist->set_sequence_video (_sequence_video);
+ _playlist->set_sequence (_sequence);
}
Film::~Film ()
@@ -347,7 +347,7 @@ Film::metadata () const
root->add_child("ISDCFDate")->add_child_text (boost::gregorian::to_iso_string (_isdcf_date));
root->add_child("AudioChannels")->add_child_text (raw_convert<string> (_audio_channels));
root->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0");
- root->add_child("SequenceVideo")->add_child_text (_sequence_video ? "1" : "0");
+ root->add_child("Sequence")->add_child_text (_sequence ? "1" : "0");
root->add_child("Interop")->add_child_text (_interop ? "1" : "0");
root->add_child("Signed")->add_child_text (_signed ? "1" : "0");
root->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0");
@@ -430,7 +430,13 @@ Film::read_metadata ()
} else if ((_audio_channels % 2) == 1) {
_audio_channels++;
}
- _sequence_video = f.bool_child ("SequenceVideo");
+
+ if (f.optional_bool_child("SequenceVideo")) {
+ _sequence = f.bool_child("SequenceVideo");
+ } else {
+ _sequence = f.bool_child("Sequence");
+ }
+
_three_d = f.bool_child ("ThreeD");
_interop = f.bool_child ("Interop");
_key = dcp::Key (f.string_child ("Key"));
@@ -886,8 +892,8 @@ Film::signal_changed (Property p)
set_video_frame_rate (_playlist->best_dcp_frame_rate ());
break;
case Film::VIDEO_FRAME_RATE:
- case Film::SEQUENCE_VIDEO:
- _playlist->maybe_sequence_video ();
+ case Film::SEQUENCE:
+ _playlist->maybe_sequence ();
break;
default:
break;
@@ -1040,9 +1046,11 @@ Film::maybe_add_content (weak_ptr<Job> j, weak_ptr<Content> c)
void
Film::add_content (shared_ptr<Content> c)
{
- /* Add video content after any existing content */
+ /* Add {video,subtitle} content after any existing {video,subtitle} content */
if (dynamic_pointer_cast<VideoContent> (c)) {
c->set_position (_playlist->video_end ());
+ } else if (dynamic_pointer_cast<SubtitleContent> (c)) {
+ c->set_position (_playlist->subtitle_end ());
}
_playlist->add (c);
@@ -1126,11 +1134,11 @@ Film::audio_frame_rate () const
}
void
-Film::set_sequence_video (bool s)
+Film::set_sequence (bool s)
{
- _sequence_video = s;
- _playlist->set_sequence_video (s);
- signal_changed (SEQUENCE_VIDEO);
+ _sequence = s;
+ _playlist->set_sequence (s);
+ signal_changed (SEQUENCE);
}
/** @return Size of the largest possible image in whatever resolution we are using */
diff --git a/src/lib/film.h b/src/lib/film.h
index a33c0238e..b34e4bcfa 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -177,7 +177,7 @@ public:
AUDIO_CHANNELS,
/** The setting of _three_d has changed */
THREE_D,
- SEQUENCE_VIDEO,
+ SEQUENCE,
INTEROP,
AUDIO_PROCESSOR,
REEL_TYPE,
@@ -246,8 +246,8 @@ public:
return _three_d;
}
- bool sequence_video () const {
- return _sequence_video;
+ bool sequence () const {
+ return _sequence;
}
bool interop () const {
@@ -294,7 +294,7 @@ public:
void set_audio_channels (int);
void set_three_d (bool);
void set_isdcf_date_today ();
- void set_sequence_video (bool);
+ void set_sequence (bool);
void set_interop (bool);
void set_audio_processor (AudioProcessor const * processor);
void set_reel_type (ReelType);
@@ -358,7 +358,7 @@ private:
This will be regardless of what content is on the playlist.
*/
bool _three_d;
- bool _sequence_video;
+ bool _sequence;
bool _interop;
AudioProcessor const * _audio_processor;
ReelType _reel_type;
diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc
index b5faec567..4c07a0d52 100644
--- a/src/lib/playlist.cc
+++ b/src/lib/playlist.cc
@@ -51,8 +51,8 @@ using boost::weak_ptr;
using boost::dynamic_pointer_cast;
Playlist::Playlist ()
- : _sequence_video (true)
- , _sequencing_video (false)
+ : _sequence (true)
+ , _sequencing (false)
{
}
@@ -72,7 +72,7 @@ Playlist::content_changed (weak_ptr<Content> content, int property, bool frequen
- any other position changes will be timeline drags which should not result in content
being sequenced.
*/
- maybe_sequence_video ();
+ maybe_sequence ();
}
if (
@@ -92,13 +92,15 @@ Playlist::content_changed (weak_ptr<Content> content, int property, bool frequen
}
void
-Playlist::maybe_sequence_video ()
+Playlist::maybe_sequence ()
{
- if (!_sequence_video || _sequencing_video) {
+ if (!_sequence || _sequencing) {
return;
}
- _sequencing_video = true;
+ _sequencing = true;
+
+ /* Video */
DCPTime next_left;
DCPTime next_right;
@@ -117,9 +119,23 @@ Playlist::maybe_sequence_video ()
}
}
+ /* Subtitles */
+
+ DCPTime next;
+ BOOST_FOREACH (shared_ptr<Content> i, _content) {
+ shared_ptr<SubtitleContent> sc = dynamic_pointer_cast<SubtitleContent> (i);
+ if (!sc) {
+ continue;
+ }
+
+ sc->set_position (next);
+ next = sc->end();
+ }
+
+
/* This won't change order, so it does not need a sort */
- _sequencing_video = false;
+ _sequencing = false;
}
string
@@ -333,6 +349,19 @@ Playlist::video_end () const
return end;
}
+DCPTime
+Playlist::subtitle_end () const
+{
+ DCPTime end;
+ BOOST_FOREACH (shared_ptr<Content> i, _content) {
+ if (dynamic_pointer_cast<const SubtitleContent> (i)) {
+ end = max (end, i->end ());
+ }
+ }
+
+ return end;
+}
+
FrameRateChange
Playlist::active_frame_rate_change (DCPTime t, int dcp_video_frame_rate) const
{
@@ -354,9 +383,9 @@ Playlist::active_frame_rate_change (DCPTime t, int dcp_video_frame_rate) const
}
void
-Playlist::set_sequence_video (bool s)
+Playlist::set_sequence (bool s)
{
- _sequence_video = s;
+ _sequence = s;
}
bool
diff --git a/src/lib/playlist.h b/src/lib/playlist.h
index 3af17bb6c..0ad70b524 100644
--- a/src/lib/playlist.h
+++ b/src/lib/playlist.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -63,10 +63,11 @@ public:
int best_dcp_frame_rate () const;
DCPTime video_end () const;
+ DCPTime subtitle_end () const;
FrameRateChange active_frame_rate_change (DCPTime, int dcp_frame_rate) const;
- void set_sequence_video (bool);
- void maybe_sequence_video ();
+ void set_sequence (bool);
+ void maybe_sequence ();
void repeat (ContentList, int);
@@ -85,8 +86,8 @@ private:
/** List of content. Kept sorted in position order. */
ContentList _content;
- bool _sequence_video;
- bool _sequencing_video;
+ bool _sequence;
+ bool _sequencing;
std::list<boost::signals2::connection> _content_connections;
};