summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-01-19 00:26:27 +0000
committerCarl Hetherington <cth@carlh.net>2015-01-19 00:26:27 +0000
commit54c0378137091de604b8c0d6d98959b55b0cddb6 (patch)
treebc591c0e59c5cc2ba1054c1fcc612bf73e8d6eaf /src
parent5282bd42dbe7f9c114abc6f648cb65ef52c35cf4 (diff)
Fix audio analysis; make sure we don't decode video and let it pile up unwanted.
Diffstat (limited to 'src')
-rw-r--r--src/lib/analyse_audio_job.cc1
-rw-r--r--src/lib/ffmpeg_decoder.cc2
-rw-r--r--src/lib/player.cc13
-rw-r--r--src/lib/player.h3
-rw-r--r--src/lib/video_decoder.cc12
-rw-r--r--src/lib/video_decoder.h5
6 files changed, 35 insertions, 1 deletions
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc
index 60b10e7b6..74c0125f3 100644
--- a/src/lib/analyse_audio_job.cc
+++ b/src/lib/analyse_audio_job.cc
@@ -60,6 +60,7 @@ AnalyseAudioJob::run ()
shared_ptr<Playlist> playlist (new Playlist);
playlist->add (content);
shared_ptr<Player> player (new Player (_film, playlist));
+ player->set_ignore_video ();
int64_t const len = _film->length().frames (_film->audio_frame_rate());
_samples_per_point = max (int64_t (1), len / _num_points);
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index ec4e33a6e..7c846349f 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -154,7 +154,7 @@ FFmpegDecoder::pass ()
int const si = _packet.stream_index;
- if (si == _video_stream) {
+ if (si == _video_stream && !_ignore_video) {
decode_video_packet ();
} else if (_ffmpeg_content->audio_stream() && _ffmpeg_content->audio_stream()->uses_index (_format_context, si)) {
decode_audio_packet ();
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 4c9042743..9c7c6471d 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -73,6 +73,7 @@ Player::Player (shared_ptr<const Film> f, shared_ptr<const Playlist> p)
, _playlist (p)
, _have_valid_pieces (false)
, _approximate_size (false)
+ , _ignore_video (false)
{
_playlist_changed_connection = _playlist->Changed.connect (bind (&Player::playlist_changed, this));
_playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Player::content_changed, this, _1, _2, _3));
@@ -173,6 +174,11 @@ Player::setup_pieces ()
frc = best_overlap_frc;
}
+ shared_ptr<VideoDecoder> vd = dynamic_pointer_cast<VideoDecoder> (decoder);
+ if (vd && _ignore_video) {
+ vd->set_ignore_video ();
+ }
+
_pieces.push_back (shared_ptr<Piece> (new Piece (*i, decoder, frc.get ())));
}
@@ -608,3 +614,10 @@ Player::get_subtitle_fonts ()
return fonts;
}
+
+/** Set this player never to produce any video data */
+void
+Player::set_ignore_video ()
+{
+ _ignore_video = true;
+}
diff --git a/src/lib/player.h b/src/lib/player.h
index b283481e2..01439a26f 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -93,6 +93,7 @@ public:
void set_video_container_size (dcp::Size);
void set_approximate_size ();
+ void set_ignore_video ();
PlayerStatistics const & statistics () const;
@@ -157,6 +158,8 @@ private:
boost::shared_ptr<Image> _black_image;
bool _approximate_size;
+ /** true if the player should ignore all video; i.e. never produce any */
+ bool _ignore_video;
PlayerStatistics _statistics;
diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc
index cac5f2795..b7cf1641b 100644
--- a/src/lib/video_decoder.cc
+++ b/src/lib/video_decoder.cc
@@ -42,6 +42,7 @@ VideoDecoder::VideoDecoder (shared_ptr<const VideoContent> c)
: _video_content (c)
#endif
, _last_seek_accurate (true)
+ , _ignore_video (false)
{
_black_image.reset (new Image (PIX_FMT_RGB24, _video_content->video_size(), true));
_black_image->make_black ();
@@ -233,6 +234,10 @@ VideoDecoder::fill_3d (VideoFrame from, VideoFrame to, Eyes eye)
void
VideoDecoder::video (shared_ptr<const ImageProxy> image, VideoFrame frame)
{
+ if (_ignore_video) {
+ return;
+ }
+
/* We may receive the same frame index twice for 3D, and we need to know
when that happens.
*/
@@ -315,3 +320,10 @@ VideoDecoder::seek (ContentTime s, bool accurate)
_last_seek_time = s;
_last_seek_accurate = accurate;
}
+
+/** Set this player never to produce any video data */
+void
+VideoDecoder::set_ignore_video ()
+{
+ _ignore_video = true;
+}
diff --git a/src/lib/video_decoder.h b/src/lib/video_decoder.h
index 4948cd8a0..5381fb21e 100644
--- a/src/lib/video_decoder.h
+++ b/src/lib/video_decoder.h
@@ -49,6 +49,8 @@ public:
return _video_content;
}
+ void set_ignore_video ();
+
#ifdef DCPOMATIC_DEBUG
int test_gaps;
#endif
@@ -68,6 +70,9 @@ protected:
boost::shared_ptr<Image> _black_image;
boost::optional<ContentTime> _last_seek_time;
bool _last_seek_accurate;
+
+ /** true if this decoder should ignore all video; i.e. never produce any */
+ bool _ignore_video;
};
#endif