projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.carlh.net/home/carl/git/dcpomatic
[dcpomatic.git]
/
src
/
lib
/
decoder.cc
diff --git
a/src/lib/decoder.cc
b/src/lib/decoder.cc
index 50356da788e84c018f175e6c611a6d5a6313f52b..0d4f4babfa9db0831650529ae4ead927260dc7f3 100644
(file)
--- a/
src/lib/decoder.cc
+++ b/
src/lib/decoder.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2012-201
5
Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-201
6
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
This file is part of DCP-o-matic.
@@
-19,42
+19,43
@@
*/
#include "decoder.h"
*/
#include "decoder.h"
+#include "video_decoder.h"
+#include "audio_decoder.h"
+#include "subtitle_decoder.h"
+#include <boost/optional.hpp>
#include <iostream>
using std::cout;
using boost::optional;
#include <iostream>
using std::cout;
using boost::optional;
-void
-Decoder::maybe_seek (optional<ContentTime>& position, ContentTime time, bool accurate)
+/** @return Earliest time of content that the next pass() will emit */
+ContentTime
+Decoder::position () const
{
{
- if (!position) {
- /* A seek has just happened */
- return;
- }
+ optional<ContentTime> pos;
- if (time >= *position && time < (*position + ContentTime::from_seconds(1))) {
- /* No need to seek: caller should just pass() */
- return;
+ if (video && !video->ignore() && (!pos || video->position() < *pos)) {
+ pos = video->position();
}
}
- position.reset ();
-
seek (time, accurate
);
-}
+ if (audio && !audio->ignore() && (!pos || audio->position() < *pos)) {
+
pos = audio->position(
);
+
}
-void
-Decoder::maybe_seek_video (ContentTime time, bool accurate)
-{
- maybe_seek (_video_position, time, accurate);
-}
+ if (subtitle && !subtitle->ignore() && (!pos || subtitle->position() < *pos)) {
+ pos = subtitle->position();
+ }
-void
-Decoder::maybe_seek_audio (ContentTime time, bool accurate)
-{
- maybe_seek (_audio_position, time, accurate);
+ return pos.get_value_or(ContentTime());
}
void
}
void
-Decoder::
maybe_seek_subtitle (ContentTime time, bool accurate
)
+Decoder::
seek (ContentTime, bool
)
{
{
- maybe_seek (_subtitle_position, time, accurate);
+ if (audio) {
+ audio->seek ();
+ }
+ if (subtitle) {
+ subtitle->seek ();
+ }
}
}