void
Playlist::content_changed (weak_ptr<Content> c, int p)
{
- if (p == ContentProperty::LENGTH && _sequence_video && !_sequencing_video) {
- _sequencing_video = true;
-
- ContentList cl = _content;
- sort (cl.begin(), cl.end(), ContentSorter ());
- Time last = 0;
- for (ContentList::iterator i = cl.begin(); i != cl.end(); ++i) {
- if (!dynamic_pointer_cast<VideoContent> (*i)) {
- continue;
- }
+ if (p == ContentProperty::LENGTH) {
+ maybe_sequence_video ();
+ }
+
+ ContentChanged (c, p);
+}
- (*i)->set_start (last);
- last = (*i)->end ();
+void
+Playlist::maybe_sequence_video ()
+{
+ if (!_sequence_video || _sequencing_video) {
+ return;
+ }
+
+ _sequencing_video = true;
+
+ ContentList cl = _content;
+ sort (cl.begin(), cl.end(), ContentSorter ());
+ Time last = 0;
+ for (ContentList::iterator i = cl.begin(); i != cl.end(); ++i) {
+ if (!dynamic_pointer_cast<VideoContent> (*i)) {
+ continue;
}
-
- _sequencing_video = false;
+
+ (*i)->set_start (last);
+ last = (*i)->end ();
}
- ContentChanged (c, p);
+ _sequencing_video = false;
}
string
-Playlist::video_digest () const
+Playlist::video_identifier () const
{
string t;
for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) {
- if (!dynamic_pointer_cast<const VideoContent> (*i)) {
- continue;
- }
-
- t += (*i)->digest ();
- shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (*i);
- if (fc && fc->subtitle_stream()) {
- t += fc->subtitle_stream()->id;
+ shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (*i);
+ if (vc) {
+ t += vc->identifier ();
}
}