Tidy up playback slightly.
authorCarl Hetherington <cth@carlh.net>
Tue, 24 Dec 2013 16:27:55 +0000 (16:27 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 24 Dec 2013 16:27:55 +0000 (16:27 +0000)
src/lib/decoder.cc
src/lib/player.cc

index 7f4973737faff0146f971f91c846cc4c8a5dabef..7102f2aa4cdad341e69c5db352a52d4b9b587d54 100644 (file)
@@ -38,15 +38,6 @@ Decoder::Decoder (shared_ptr<const Film> f)
 
 }
 
-class DecodedSorter
-{
-public:
-       bool operator() (shared_ptr<Decoded> a, shared_ptr<Decoded> b)
-       {
-               return a->dcp_time < b->dcp_time;
-       }
-};
-
 shared_ptr<Decoded>
 Decoder::peek ()
 {
index 3e282136fe604db7443564ba2034975353ab8c52..d08b7491de49b59a117afc60681ad802bb5a128f 100644 (file)
@@ -144,11 +144,14 @@ Player::pass ()
        if (dv && _video) {
                DCPTime const half_frame = TIME_HZ / (2 * _film->video_frame_rate ());
 
+               bool consume = true;
+
                if (_just_did_inaccurate_seek) {
+
                        /* Just emit; no subtlety */
                        emit_video (earliest_piece, dv);
-                       earliest_piece->decoder->consume ();
-               } else if (earliest_time > (_video_position + half_frame)) {
+                       
+               } else if (abs (dv->dcp_time - _video_position) > half_frame) {
 
                        /* See if we're inside some video content */
                        list<shared_ptr<Piece> >::iterator i = _pieces.begin();
@@ -164,18 +167,15 @@ Player::pass ()
                                emit_video (_last_incoming_video.weak_piece, _last_incoming_video.video);
                        }
 
-               } else {
+                       consume = false;
 
-                       if (
-                               abs (dv->dcp_time - _video_position) < half_frame &&
-                               !earliest_piece->content->trimmed (dv->dcp_time - earliest_piece->content->position ())
-                               ) {
+               } else if (abs (dv->dcp_time - _video_position) < half_frame) {
+                       emit_video (earliest_piece, dv);
+               }
 
-                               emit_video (earliest_piece, dv);
-                       }
-               
+               if (consume) {
                        earliest_piece->decoder->consume ();
-               }
+               }                       
 
        } else if (da && _audio) {
                if (!_just_did_inaccurate_seek && earliest_time > _audio_position) {