projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5282bd4
)
Fix audio analysis; make sure we don't decode video and let it pile up unwanted.
author
Carl Hetherington
<cth@carlh.net>
Mon, 19 Jan 2015 00:26:27 +0000
(
00:26
+0000)
committer
Carl Hetherington
<cth@carlh.net>
Mon, 19 Jan 2015 00:26:27 +0000
(
00:26
+0000)
src/lib/analyse_audio_job.cc
patch
|
blob
|
history
src/lib/ffmpeg_decoder.cc
patch
|
blob
|
history
src/lib/player.cc
patch
|
blob
|
history
src/lib/player.h
patch
|
blob
|
history
src/lib/video_decoder.cc
patch
|
blob
|
history
src/lib/video_decoder.h
patch
|
blob
|
history
diff --git
a/src/lib/analyse_audio_job.cc
b/src/lib/analyse_audio_job.cc
index 60b10e7b6e05ba69dc418894fa10b4ca8ef7781e..74c0125f3f6c2059d8af58820e9789eb79d1c584 100644
(file)
--- 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));
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);
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 ec4e33a6ec56599c3fa5bcd4836e597e5c47bee7..7c846349f466d225cd190601446a917bd0e02eab 100644
(file)
--- a/
src/lib/ffmpeg_decoder.cc
+++ b/
src/lib/ffmpeg_decoder.cc
@@
-154,7
+154,7
@@
FFmpegDecoder::pass ()
int const si = _packet.stream_index;
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 ();
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 4c9042743da95658426a4b1b789ea2f8a431a93d..9c7c6471d124342828b1fbe71466f0df7372d831 100644
(file)
--- 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)
, _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));
{
_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;
}
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 ())));
}
_pieces.push_back (shared_ptr<Piece> (new Piece (*i, decoder, frc.get ())));
}
@@
-608,3
+614,10
@@
Player::get_subtitle_fonts ()
return 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 b283481e2eeb2a284baa546f1dfbc052382fe8ab..01439a26f00e2c272c6adf8226f8e50643bb38f6 100644
(file)
--- 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_video_container_size (dcp::Size);
void set_approximate_size ();
+ void set_ignore_video ();
PlayerStatistics const & statistics () const;
PlayerStatistics const & statistics () const;
@@
-157,6
+158,8
@@
private:
boost::shared_ptr<Image> _black_image;
bool _approximate_size;
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;
PlayerStatistics _statistics;
diff --git
a/src/lib/video_decoder.cc
b/src/lib/video_decoder.cc
index cac5f27957d316d8ea3a6db53b9e1cce72e442bf..b7cf1641b57d6b999c7c62b3c05f405e1f7b7075 100644
(file)
--- 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)
: _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 ();
{
_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)
{
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.
*/
/* 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;
}
_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 4948cd8a0bc5afde2a250ea273e3187f110b0886..5381fb21ec72a83717ca9b6f7e3368532cb3d48b 100644
(file)
--- a/
src/lib/video_decoder.h
+++ b/
src/lib/video_decoder.h
@@
-49,6
+49,8
@@
public:
return _video_content;
}
return _video_content;
}
+ void set_ignore_video ();
+
#ifdef DCPOMATIC_DEBUG
int test_gaps;
#endif
#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;
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
};
#endif