std::shared_ptr
[dcpomatic.git] / src / lib / video_ring_buffers.cc
index 2fc39d53c663330794a263a8728ffa782a7888b9..1c08d44b3fff5fdba9a86bcebcc2b227729c0c91 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2016-2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -30,8 +30,9 @@ using std::make_pair;
 using std::cout;
 using std::pair;
 using std::string;
-using boost::shared_ptr;
+using std::shared_ptr;
 using boost::optional;
+using namespace dcpomatic;
 
 void
 VideoRingBuffers::put (shared_ptr<PlayerVideo> frame, DCPTime time)
@@ -73,23 +74,24 @@ VideoRingBuffers::clear ()
        _data.clear ();
 }
 
-optional<DCPTime>
-VideoRingBuffers::earliest () const
-{
-       boost::mutex::scoped_lock lm (_mutex);
-       if (_data.empty ()) {
-               return optional<DCPTime> ();
-       }
-
-       return _data.front().second;
-}
-
 pair<size_t, string>
 VideoRingBuffers::memory_used () const
 {
+       boost::mutex::scoped_lock lm (_mutex);
        size_t m = 0;
        for (list<pair<shared_ptr<PlayerVideo>, DCPTime> >::const_iterator i = _data.begin(); i != _data.end(); ++i) {
                m += i->first->memory_used();
        }
        return make_pair(m, String::compose("%1 frames", _data.size()));
 }
+
+
+void
+VideoRingBuffers::reset_metadata (shared_ptr<const Film> film, dcp::Size player_video_container_size)
+{
+       boost::mutex::scoped_lock lm (_mutex);
+       for (list<pair<shared_ptr<PlayerVideo>, DCPTime> >::const_iterator i = _data.begin(); i != _data.end(); ++i) {
+               i->first->reset_metadata (film, player_video_container_size);
+       }
+}
+