Apply FFmpeg palette fix to examination too; fix build with old FFmpeg.
[dcpomatic.git] / src / lib / audio_ring_buffers.cc
index 21c4b6a5c1084123c71d82706653615e96aab709..cd7f4f597fbfaf8f35ebcd5e998f3e20edccb72d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2016-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2019 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -31,6 +31,7 @@ using std::pair;
 using std::list;
 using boost::shared_ptr;
 using boost::optional;
+using namespace dcpomatic;
 
 AudioRingBuffers::AudioRingBuffers ()
        : _used_in_head (0)
@@ -103,6 +104,16 @@ AudioRingBuffers::get (float* out, int channels, int frames)
        return time;
 }
 
+optional<DCPTime>
+AudioRingBuffers::peek () const
+{
+       boost::mutex::scoped_lock lm (_mutex);
+       if (_buffers.empty()) {
+               return optional<DCPTime>();
+       }
+       return _buffers.front().second;
+}
+
 void
 AudioRingBuffers::clear ()
 {