summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-09-03 22:41:40 +0100
committerCarl Hetherington <cth@carlh.net>2017-09-03 22:41:40 +0100
commit4b2cf0764a4091b9466f90e6dbbeb029e04bc2be (patch)
treedf2833faa1f301b0a8a05a08d68dd922cac51d51 /src/lib
parent257f36fea6aed378c3060c1789294b68b317a456 (diff)
Restore correct setup of fast resampler when the player is set to fast.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/audio_decoder.cc6
-rw-r--r--src/lib/audio_decoder.h4
-rw-r--r--src/lib/dcp_content.cc4
-rw-r--r--src/lib/dcp_decoder.cc4
-rw-r--r--src/lib/dcp_decoder.h2
-rw-r--r--src/lib/decoder_factory.cc6
-rw-r--r--src/lib/decoder_factory.h3
-rw-r--r--src/lib/ffmpeg_decoder.cc4
-rw-r--r--src/lib/ffmpeg_decoder.h2
-rw-r--r--src/lib/player.cc5
10 files changed, 24 insertions, 16 deletions
diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc
index 16a03a8e9..5df4047db 100644
--- a/src/lib/audio_decoder.cc
+++ b/src/lib/audio_decoder.cc
@@ -37,9 +37,10 @@ using std::pair;
using boost::shared_ptr;
using boost::optional;
-AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, shared_ptr<Log> log)
+AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, shared_ptr<Log> log, bool fast)
: DecoderPart (parent, log)
, _content (content)
+ , _fast (fast)
{
/* Set up _positions so that we have one for each stream */
BOOST_FOREACH (AudioStreamPtr i, content->streams ()) {
@@ -82,6 +83,9 @@ AudioDecoder::emit (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data,
);
resampler.reset (new Resampler (stream->frame_rate(), _content->resampled_frame_rate(), stream->channels()));
+ if (_fast) {
+ resampler->set_fast ();
+ }
_resamplers[stream] = resampler;
}
}
diff --git a/src/lib/audio_decoder.h b/src/lib/audio_decoder.h
index 359540d6f..ba1520ef5 100644
--- a/src/lib/audio_decoder.h
+++ b/src/lib/audio_decoder.h
@@ -44,7 +44,7 @@ class Resampler;
class AudioDecoder : public boost::enable_shared_from_this<AudioDecoder>, public DecoderPart
{
public:
- AudioDecoder (Decoder* parent, boost::shared_ptr<const AudioContent> content, boost::shared_ptr<Log> log);
+ AudioDecoder (Decoder* parent, boost::shared_ptr<const AudioContent> content, boost::shared_ptr<Log> log, bool fast);
ContentTime position () const;
void emit (AudioStreamPtr stream, boost::shared_ptr<const AudioBuffers>, ContentTime);
@@ -63,6 +63,8 @@ private:
/** Frame after the last one that was emitted from Data for each AudioStream */
std::map<AudioStreamPtr, Frame> _positions;
std::map<AudioStreamPtr, boost::shared_ptr<Resampler> > _resamplers;
+
+ bool _fast;
};
#endif
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index 18f88b3d3..fd0925935 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -493,7 +493,7 @@ DCPContent::can_reference_audio (list<string>& why_not) const
{
shared_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (shared_from_this(), film()->log()));
+ decoder.reset (new DCPDecoder (shared_from_this(), film()->log(), false));
} catch (dcp::DCPReadError) {
/* We couldn't read the DCP, so it's probably missing */
return false;
@@ -514,7 +514,7 @@ DCPContent::can_reference_subtitle (list<string>& why_not) const
{
shared_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (shared_from_this(), film()->log()));
+ decoder.reset (new DCPDecoder (shared_from_this(), film()->log(), false));
} catch (dcp::DCPReadError) {
/* We couldn't read the DCP, so it's probably missing */
return false;
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc
index ef40f2ec7..59a85e051 100644
--- a/src/lib/dcp_decoder.cc
+++ b/src/lib/dcp_decoder.cc
@@ -50,13 +50,13 @@ using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::optional;
-DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, shared_ptr<Log> log)
+DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, shared_ptr<Log> log, bool fast)
: DCP (c)
, _decode_referenced (false)
{
video.reset (new VideoDecoder (this, c, log));
if (c->audio) {
- audio.reset (new AudioDecoder (this, c->audio, log));
+ audio.reset (new AudioDecoder (this, c->audio, log, fast));
}
if (c->subtitle) {
subtitle.reset (new SubtitleDecoder (this, c->subtitle, log));
diff --git a/src/lib/dcp_decoder.h b/src/lib/dcp_decoder.h
index aa76b83d6..6ec9de684 100644
--- a/src/lib/dcp_decoder.h
+++ b/src/lib/dcp_decoder.h
@@ -39,7 +39,7 @@ struct dcp_subtitle_within_dcp_test;
class DCPDecoder : public DCP, public Decoder
{
public:
- DCPDecoder (boost::shared_ptr<const DCPContent>, boost::shared_ptr<Log> log);
+ DCPDecoder (boost::shared_ptr<const DCPContent>, boost::shared_ptr<Log> log, bool fast);
std::list<boost::shared_ptr<dcp::Reel> > reels () const {
return _reels;
diff --git a/src/lib/decoder_factory.cc b/src/lib/decoder_factory.cc
index b661d494b..b675f9473 100644
--- a/src/lib/decoder_factory.cc
+++ b/src/lib/decoder_factory.cc
@@ -37,16 +37,16 @@ using boost::shared_ptr;
using boost::dynamic_pointer_cast;
shared_ptr<Decoder>
-decoder_factory (shared_ptr<const Content> content, shared_ptr<Log> log)
+decoder_factory (shared_ptr<const Content> content, shared_ptr<Log> log, bool fast)
{
shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (content);
if (fc) {
- return shared_ptr<Decoder> (new FFmpegDecoder (fc, log));
+ return shared_ptr<Decoder> (new FFmpegDecoder (fc, log, fast));
}
shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (content);
if (dc) {
- return shared_ptr<Decoder> (new DCPDecoder (dc, log));
+ return shared_ptr<Decoder> (new DCPDecoder (dc, log, fast));
}
shared_ptr<const ImageContent> ic = dynamic_pointer_cast<const ImageContent> (content);
diff --git a/src/lib/decoder_factory.h b/src/lib/decoder_factory.h
index 43100d4d9..52a53afd2 100644
--- a/src/lib/decoder_factory.h
+++ b/src/lib/decoder_factory.h
@@ -22,5 +22,6 @@ class ImageDecoder;
extern boost::shared_ptr<Decoder> decoder_factory (
boost::shared_ptr<const Content> content,
- boost::shared_ptr<Log> log
+ boost::shared_ptr<Log> log,
+ bool fast
);
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 5e2cb8638..378b59901 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -78,7 +78,7 @@ using boost::optional;
using boost::dynamic_pointer_cast;
using dcp::Size;
-FFmpegDecoder::FFmpegDecoder (shared_ptr<const FFmpegContent> c, shared_ptr<Log> log)
+FFmpegDecoder::FFmpegDecoder (shared_ptr<const FFmpegContent> c, shared_ptr<Log> log, bool fast)
: FFmpeg (c)
, _log (log)
, _have_current_subtitle (false)
@@ -94,7 +94,7 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<const FFmpegContent> c, shared_ptr<Log>
}
if (c->audio) {
- audio.reset (new AudioDecoder (this, c->audio, log));
+ audio.reset (new AudioDecoder (this, c->audio, log, fast));
}
if (c->subtitle) {
diff --git a/src/lib/ffmpeg_decoder.h b/src/lib/ffmpeg_decoder.h
index 993d1dd0e..3a38f4475 100644
--- a/src/lib/ffmpeg_decoder.h
+++ b/src/lib/ffmpeg_decoder.h
@@ -45,7 +45,7 @@ struct ffmpeg_pts_offset_test;
class FFmpegDecoder : public FFmpeg, public Decoder
{
public:
- FFmpegDecoder (boost::shared_ptr<const FFmpegContent>, boost::shared_ptr<Log>);
+ FFmpegDecoder (boost::shared_ptr<const FFmpegContent>, boost::shared_ptr<Log> log, bool fast);
bool pass ();
void seek (ContentTime time, bool);
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 7d3f381ed..11369b682 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -109,7 +109,7 @@ Player::setup_pieces ()
continue;
}
- shared_ptr<Decoder> decoder = decoder_factory (i, _film->log());
+ shared_ptr<Decoder> decoder = decoder_factory (i, _film->log(), _fast);
FrameRateChange frc (i->active_video_frame_rate(), _film->video_frame_rate());
if (!decoder) {
@@ -425,6 +425,7 @@ Player::set_always_burn_subtitles (bool burn)
_always_burn_subtitles = burn;
}
+/** Sets up the player to be faster, possibly at the expense of quality */
void
Player::set_fast ()
{
@@ -452,7 +453,7 @@ Player::get_reel_assets ()
scoped_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (j, _film->log()));
+ decoder.reset (new DCPDecoder (j, _film->log(), false));
} catch (...) {
return a;
}