projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Various fixes to push audio vaguely in the right direction.
[dcpomatic.git]
/
src
/
lib
/
decoder.cc
diff --git
a/src/lib/decoder.cc
b/src/lib/decoder.cc
index 53a0c31e140d6ceab0a3d2f222fe419bda88237b..ee03a1579c59bfe399927fb76a85e316fba21edb 100644
(file)
--- a/
src/lib/decoder.cc
+++ b/
src/lib/decoder.cc
@@
-1,79
+1,57
@@
/*
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012
-2016
Carl Hetherington <cth@carlh.net>
- This program is free software; you can redistribute it and/or modify
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
This program
is distributed in the hope that it will be useful,
+
DCP-o-matic
is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
*/
*/
-/** @file src/decoder.cc
- * @brief Parent class for decoders of content.
- */
-
-#include "film.h"
#include "decoder.h"
#include "decoder.h"
-#include "decoded.h"
-
-#include "i18n.h"
+#include "video_decoder.h"
+#include "audio_decoder.h"
+#include "subtitle_decoder.h"
+#include <boost/optional.hpp>
+#include <iostream>
using std::cout;
using std::cout;
-using boost::
shared_ptr
;
+using boost::
optional
;
-/** @param f Film.
- * @param o Decode options.
- */
-Decoder::Decoder (shared_ptr<const Film> f)
- : _film (f)
- , _done (false)
+ContentTime
+Decoder::position () const
{
{
+ optional<ContentTime> pos;
-}
-
-struct DecodedSorter
-{
- bool operator() (shared_ptr<Decoded> a, shared_ptr<Decoded> b)
- {
- return a->dcp_time < b->dcp_time;
+ if (video && (!pos || video->position() < *pos)) {
+ pos = video->position();
}
}
-};
-shared_ptr<Decoded>
-Decoder::peek ()
-{
- while (!_done && _pending.empty ()) {
- _done = pass ();
+ if (audio && (!pos || audio->position() < *pos)) {
+ pos = audio->position();
}
}
- if (
_done && _pending.empty (
)) {
-
return shared_ptr<Decoded>
();
+ if (
subtitle && (!pos || subtitle->position() < *pos
)) {
+
pos = subtitle->position
();
}
}
- _pending.sort (DecodedSorter ());
- return _pending.front ();
+ return pos.get_value_or(ContentTime());
}
void
}
void
-Decoder::
consume (
)
+Decoder::
seek (ContentTime time, bool accurate
)
{
{
- if (
!_pending.empty ()
) {
-
_pending.pop_front
();
+ if (
audio
) {
+
audio->seek
();
}
}
}
}
-
-void
-Decoder::seek (ContentTime, bool)
-{
- _pending.clear ();
- _done = false;
-}