summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-01-10 22:06:29 +0000
committerCarl Hetherington <cth@carlh.net>2019-01-10 22:06:29 +0000
commitf0957fd41d1915b8046dc0c2aeb662e1e8c288c7 (patch)
tree64611679c867ec419759f29da10fa3060133c544 /src
parent70684e31a96bd7d4c7b09d525902959345b76526 (diff)
Only fill video gaps if they are at least half a frame in length.
Fixes lack of image (sometimes) when trimming drop-frame content.
Diffstat (limited to 'src')
-rw-r--r--src/lib/dcpomatic_time.h4
-rw-r--r--src/lib/player.cc68
2 files changed, 40 insertions, 32 deletions
diff --git a/src/lib/dcpomatic_time.h b/src/lib/dcpomatic_time.h
index c687569ec..a09dd93e9 100644
--- a/src/lib/dcpomatic_time.h
+++ b/src/lib/dcpomatic_time.h
@@ -113,6 +113,10 @@ public:
return *this;
}
+ Time<S, O> operator/ (int o) const {
+ return Time<S, O> (_t / o);
+ }
+
/** Round up to the nearest sampling interval
* at some sampling rate.
* @param r Sampling rate.
diff --git a/src/lib/player.cc b/src/lib/player.cc
index f80adcbf4..7156e3122 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -756,40 +756,44 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
if (_last_video_time) {
DCPTime fill_from = max (*_last_video_time, piece->content->position());
- LastVideoMap::const_iterator last = _last_video.find (wp);
- if (_film->three_d()) {
- Eyes fill_to_eyes = video.eyes;
- if (fill_to_eyes == EYES_BOTH) {
- fill_to_eyes = EYES_LEFT;
- }
- if (fill_to == piece->content->end(_film)) {
- /* Don't fill after the end of the content */
- fill_to_eyes = EYES_LEFT;
- }
- DCPTime j = fill_from;
- Eyes eyes = _last_video_eyes.get_value_or(EYES_LEFT);
- if (eyes == EYES_BOTH) {
- eyes = EYES_LEFT;
- }
- while (j < fill_to || eyes != fill_to_eyes) {
- if (last != _last_video.end()) {
- shared_ptr<PlayerVideo> copy = last->second->shallow_copy();
- copy->set_eyes (eyes);
- emit_video (copy, j);
- } else {
- emit_video (black_player_video_frame(eyes), j);
+
+ /* Fill if we have more than half a frame to do */
+ if ((fill_to - fill_from) > one_video_frame() / 2) {
+ LastVideoMap::const_iterator last = _last_video.find (wp);
+ if (_film->three_d()) {
+ Eyes fill_to_eyes = video.eyes;
+ if (fill_to_eyes == EYES_BOTH) {
+ fill_to_eyes = EYES_LEFT;
}
- if (eyes == EYES_RIGHT) {
- j += one_video_frame();
+ if (fill_to == piece->content->end(_film)) {
+ /* Don't fill after the end of the content */
+ fill_to_eyes = EYES_LEFT;
}
- eyes = increment_eyes (eyes);
- }
- } else {
- for (DCPTime j = fill_from; j < fill_to; j += one_video_frame()) {
- if (last != _last_video.end()) {
- emit_video (last->second, j);
- } else {
- emit_video (black_player_video_frame(EYES_BOTH), j);
+ DCPTime j = fill_from;
+ Eyes eyes = _last_video_eyes.get_value_or(EYES_LEFT);
+ if (eyes == EYES_BOTH) {
+ eyes = EYES_LEFT;
+ }
+ while (j < fill_to || eyes != fill_to_eyes) {
+ if (last != _last_video.end()) {
+ shared_ptr<PlayerVideo> copy = last->second->shallow_copy();
+ copy->set_eyes (eyes);
+ emit_video (copy, j);
+ } else {
+ emit_video (black_player_video_frame(eyes), j);
+ }
+ if (eyes == EYES_RIGHT) {
+ j += one_video_frame();
+ }
+ eyes = increment_eyes (eyes);
+ }
+ } else {
+ for (DCPTime j = fill_from; j < fill_to; j += one_video_frame()) {
+ if (last != _last_video.end()) {
+ emit_video (last->second, j);
+ } else {
+ emit_video (black_player_video_frame(EYES_BOTH), j);
+ }
}
}
}