projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More cycle-breaking of shared_ptr for decoder / player.
[dcpomatic.git]
/
src
/
lib
/
player.cc
diff --git
a/src/lib/player.cc
b/src/lib/player.cc
index a84117a4e4ce0cb14821bcfea050d3818c4e242b..09f1f55a32cdc3a909448d37642278d59b5961ea 100644
(file)
--- a/
src/lib/player.cc
+++ b/
src/lib/player.cc
@@
-75,7
+75,7
@@
Player::pass ()
bool done = true;
bool done = true;
- if (_video_decoder < _video_decoders.size ()) {
+ if (_video
&& _video
_decoder < _video_decoders.size ()) {
/* Run video decoder; this may also produce audio */
/* Run video decoder; this may also produce audio */
@@
-87,7
+87,9
@@
Player::pass ()
done = false;
}
done = false;
}
- } else if (!_video && _playlist->audio_from() == Playlist::AUDIO_FFMPEG && _sequential_audio_decoder < _audio_decoders.size ()) {
+ }
+
+ if (!_video && _audio && _playlist->audio_from() == Playlist::AUDIO_FFMPEG && _sequential_audio_decoder < _audio_decoders.size ()) {
/* We're not producing video, so we may need to run FFmpeg content to get the audio */
/* We're not producing video, so we may need to run FFmpeg content to get the audio */
@@
-99,8
+101,10
@@
Player::pass ()
done = false;
}
done = false;
}
- }
else if (_playlist->audio_from() == Playlist::AUDIO_SNDFILE) {
+ }
+ if (_audio && _playlist->audio_from() == Playlist::AUDIO_SNDFILE) {
+
/* We're getting audio from SndfileContent */
for (vector<shared_ptr<AudioDecoder> >::iterator i = _audio_decoders.begin(); i != _audio_decoders.end(); ++i) {
/* We're getting audio from SndfileContent */
for (vector<shared_ptr<AudioDecoder> >::iterator i = _audio_decoders.begin(); i != _audio_decoders.end(); ++i) {
@@
-130,13
+134,13
@@
Player::set_progress (shared_ptr<Job> job)
}
void
}
void
-Player::process_video (shared_ptr<Image> i, bool same, shared_ptr<Subtitle> s, double t)
+Player::process_video (shared_ptr<
const
Image> i, bool same, shared_ptr<Subtitle> s, double t)
{
Video (i, same, s, _video_start[_video_decoder] + t);
}
void
{
Video (i, same, s, _video_start[_video_decoder] + t);
}
void
-Player::process_audio (weak_ptr<const AudioContent> c, shared_ptr<AudioBuffers> b, double t)
+Player::process_audio (weak_ptr<const AudioContent> c, shared_ptr<
const
AudioBuffers> b, double t)
{
AudioMapping mapping = _film->audio_mapping ();
if (!_audio_buffers) {
{
AudioMapping mapping = _film->audio_mapping ();
if (!_audio_buffers) {
@@
-172,19
+176,21
@@
Player::seek (double t)
_have_valid_decoders = true;
}
_have_valid_decoders = true;
}
+ if (_video_decoders.empty ()) {
+ return true;
+ }
+
/* Find the decoder that contains this position */
_video_decoder = 0;
/* Find the decoder that contains this position */
_video_decoder = 0;
- while (
_video_decoder < _video_decoders.size ()
) {
- if (t < _video_start[_video_decoder]) {
- assert (_video_decoder);
+ while (
1
) {
+ ++_video_decoder;
+ if (_video_decoder >= _video_decoders.size () || t < _video_start[_video_decoder]) {
--_video_decoder;
--_video_decoder;
+ t -= _video_start[_video_decoder];
break;
}
break;
}
-
- t -= _video_start[_video_decoder];
- ++_video_decoder;
}
}
-
+
if (_video_decoder < _video_decoders.size()) {
_video_decoders[_video_decoder]->seek (t);
} else {
if (_video_decoder < _video_decoders.size()) {
_video_decoders[_video_decoder]->seek (t);
} else {