using std::cout;
using std::pair;
using std::make_pair;
+using std::string;
using boost::weak_ptr;
using boost::shared_ptr;
using boost::bind;
/** Maximum video readahead in frames; should never be reached unless there are bugs in Player */
#define MAXIMUM_VIDEO_READAHEAD 24
/** Minimum audio readahead in frames */
-#define MINIMUM_AUDIO_READAHEAD (48000*5)
+#define MINIMUM_AUDIO_READAHEAD (48000 * MINIMUM_VIDEO_READAHEAD / 24)
/** Minimum audio readahead in frames; should never be reached unless there are bugs in Player */
-#define MAXIMUM_AUDIO_READAHEAD (48000*60)
+#define MAXIMUM_AUDIO_READAHEAD (48000 * MAXIMUM_VIDEO_READAHEAD / 24)
#define LOG_WARNING(...) _log->log (String::compose(__VA_ARGS__), LogEntry::TYPE_WARNING);
boost::mutex::scoped_lock lm (_mutex);
_disable_audio = true;
}
+
+pair<size_t, string>
+Butler::memory_used () const
+{
+ /* XXX: should also look at _audio.memory_used() */
+ return _video.memory_used();
+}
void disable_audio ();
+ std::pair<size_t, std::string> memory_used () const;
+
private:
void thread ();
void video (boost::shared_ptr<PlayerVideo> video, DCPTime time);
return shared_ptr<Image> (new Image (image, true));
}
+
+size_t
+Image::memory_used () const
+{
+ size_t m = 0;
+ for (int i = 0; i < planes(); ++i) {
+ m += _stride[i] * sample_size(i).height;
+ }
+ return m;
+}
return _pixel_format;
}
+ size_t memory_used () const;
+
static boost::shared_ptr<Image> ensure_aligned (boost::shared_ptr<Image> image);
private:
*/
virtual void prepare (boost::optional<dcp::Size> = boost::optional<dcp::Size>()) const {}
virtual AVPixelFormat pixel_format () const = 0;
+ virtual size_t memory_used () const = 0;
};
boost::shared_ptr<ImageProxy> image_proxy_factory (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket);
{
}
+
+size_t
+J2KImageProxy::memory_used () const
+{
+ size_t m = _data.size();
+ if (_decompressed) {
+ /* 3 components, 16-bits per pixel */
+ m += 3 * 2 * _decompressed->size().width * _decompressed->size().height;
+ }
+ return m;
+}
return _size;
}
+ size_t memory_used () const;
+
private:
friend struct client_server_test_j2k;
{
return AV_PIX_FMT_RGB24;
}
+
+size_t
+MagickImageProxy::memory_used () const
+{
+ size_t m = _blob.length();
+ if (_image) {
+ m += _image->memory_used();
+ }
+ return m;
+}
void send_binary (boost::shared_ptr<Socket>) const;
bool same (boost::shared_ptr<const ImageProxy> other) const;
AVPixelFormat pixel_format () const;
+ size_t memory_used () const;
private:
Magick::Blob _blob;
{
_in->prepare (_inter_size);
}
+
+size_t
+PlayerVideo::memory_used () const
+{
+ return _in->memory_used();
+}
bool same (boost::shared_ptr<const PlayerVideo> other) const;
+ size_t memory_used () const;
+
private:
boost::shared_ptr<const ImageProxy> _in;
Crop _crop;
{
return _image->pixel_format ();
}
+
+size_t
+RawImageProxy::memory_used () const
+{
+ return _image->memory_used ();
+}
void send_binary (boost::shared_ptr<Socket>) const;
bool same (boost::shared_ptr<const ImageProxy>) const;
AVPixelFormat pixel_format () const;
+ size_t memory_used () const;
private:
boost::shared_ptr<Image> _image;
#include "video_ring_buffers.h"
#include "player_video.h"
+#include "compose.hpp"
#include <boost/foreach.hpp>
#include <list>
#include <iostream>
using std::make_pair;
using std::cout;
using std::pair;
+using std::string;
using boost::shared_ptr;
using boost::optional;
return _data.front().second;
}
+
+pair<size_t, string>
+VideoRingBuffers::memory_used () const
+{
+ 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()));
+}
bool empty () const;
boost::optional<DCPTime> earliest () const;
+ std::pair<size_t, std::string> memory_used () const;
+
private:
mutable boost::mutex _mutex;
std::list<std::pair<boost::shared_ptr<PlayerVideo>, DCPTime> > _data;