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;
- }
-
- (*i)->set_start (last);
- last = (*i)->end ();
- }
-
- _sequencing_video = false;
+ if (p == ContentProperty::LENGTH) {
+ maybe_sequence_video ();
}
ContentChanged (c, p);
}
-string
-Playlist::audio_digest () const
+void
+Playlist::maybe_sequence_video ()
{
- string t;
+ if (!_sequence_video || _sequencing_video) {
+ return;
+ }
- for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) {
- if (!dynamic_pointer_cast<const AudioContent> (*i)) {
+ _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;
}
- t += (*i)->digest ();
-
- shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (*i);
- if (fc) {
- t += lexical_cast<string> (fc->audio_stream()->id);
- }
+ (*i)->set_start (last);
+ last = (*i)->end ();
}
-
- t += lexical_cast<string> (_loop);
-
- return md5_digest (t.c_str(), t.length());
+
+ _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 ();
}
}
list<FrameRateCandidate>::iterator i = candidates.begin();
while (i != candidates.end()) {
- float this_error = std::numeric_limits<float>::max ();
+ float this_error = 0;
for (ContentList::const_iterator j = _content.begin(); j != _content.end(); ++j) {
shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (*j);
if (!vc) {