-#pragma once\r
-\r
-#include "../video_format.h"\r
-\r
-#include <common/spl/memory.h>\r
-#include <common/forward.h>\r
-\r
-#include <boost/range.hpp>\r
-#include <boost/any.hpp>\r
-\r
-#include <tbb/cache_aligned_allocator.h>\r
-\r
-#include <cstddef>\r
-#include <stdint.h>\r
-\r
-FORWARD1(boost, template<typename> class shared_future);\r
-\r
-namespace caspar { namespace core {\r
-\r
-class const_array\r
-{\r
-public:\r
-\r
- // Static Members\r
-\r
- // Constructors\r
-\r
- template<typename T>\r
- explicit const_array(const uint8_t* ptr, std::size_t size, T&& storage)\r
- : ptr_(ptr)\r
- , size_(size)\r
- , storage_(new boost::any(std::forward<T>(storage)))\r
- {\r
- }\r
- \r
- const_array(const const_array& other)\r
- : ptr_(other.ptr_)\r
- , size_(other.size_)\r
- , storage_(other.storage_)\r
- {\r
- }\r
-\r
- const_array(const_array&& other)\r
- : ptr_(other.ptr_)\r
- , size_(other.size_)\r
- , storage_(std::move(other.storage_))\r
- {\r
- }\r
-\r
- // Methods\r
-\r
- const_array& operator=(const_array other)\r
- {\r
- other.swap(*this);\r
- return *this;\r
- }\r
-\r
- void swap(const_array& other)\r
- {\r
- std::swap(ptr_, other.ptr_);\r
- std::swap(size_, other.size_);\r
- std::swap(storage_, other.storage_);\r
- }\r
-\r
- // Properties\r
- \r
- const uint8_t* begin() const {return ptr_;} \r
- const uint8_t* data() const {return ptr_;}\r
- const uint8_t* end() const {return ptr_ + size_;}\r
- std::size_t size() const {return size_;}\r
- bool empty() const {return size() == 0;}\r
- \r
-private:\r
- const uint8_t* ptr_;\r
- std::size_t size_;\r
- spl::shared_ptr<boost::any> storage_;\r
-};\r
-\r
-class mutable_array\r
-{\r
- mutable_array(const mutable_array&);\r
- mutable_array& operator=(const mutable_array&);\r
-public:\r
-\r
- // Static Members\r
-\r
- // Constructors\r
- \r
- template<typename T>\r
- explicit mutable_array(uint8_t* ptr, std::size_t size, T&& storage)\r
- : ptr_(ptr)\r
- , size_(size)\r
- , storage_(new boost::any(std::forward<T>(storage)))\r
- {\r
- }\r
-\r
- mutable_array(mutable_array&& other)\r
- : ptr_(other.ptr_)\r
- , size_(other.size_)\r
- , storage_(std::move(other.storage_))\r
- {\r
- }\r
-\r
- // Methods\r
-\r
- mutable_array& operator=(mutable_array&& other)\r
- {\r
- ptr_ = other.ptr_;\r
- size_ = other.size_;\r
- storage_ = std::move(other.storage_);\r
- return *this;\r
- }\r
-\r
- // Properties\r
- \r
- uint8_t* begin() {return ptr_;} \r
- uint8_t* data() {return ptr_;}\r
- uint8_t* end() {return ptr_ + size_;} \r
- const uint8_t* begin() const {return ptr_;} \r
- const uint8_t* data() const {return ptr_;}\r
- const uint8_t* end() const {return ptr_ + size_;}\r
- std::size_t size() const {return size_;}\r
- bool empty() const {return size() == 0;}\r
- const boost::any& storage() const {return *storage_;}\r
-private:\r
- uint64_t id_;\r
- uint8_t* ptr_;\r
- std::size_t size_;\r
- spl::unique_ptr<boost::any> storage_;\r
-};\r
-\r
-typedef std::vector<int32_t, tbb::cache_aligned_allocator<int32_t>> audio_buffer;\r
-\r
-class const_frame sealed\r
-{\r
-public: \r
-\r
- // Static Members\r
-\r
- static const const_frame& empty();\r
-\r
- // Constructors\r
-\r
- explicit const_frame(const void* tag = nullptr);\r
- explicit const_frame(boost::shared_future<const_array> image, \r
- audio_buffer audio_buffer, \r
- const void* tag, \r
- const struct pixel_format_desc& desc, \r
- double frame_rate, \r
- core::field_mode field_mode);\r
- ~const_frame();\r
-\r
- // Methods\r
-\r
- const_frame(const_frame&& other);\r
- const_frame& operator=(const_frame&& other);\r
- const_frame(const const_frame&);\r
- const_frame& operator=(const const_frame& other);\r
- \r
- // Properties\r
- \r
- const struct pixel_format_desc& pixel_format_desc() const;\r
-\r
- const_array image_data() const;\r
- const core::audio_buffer& audio_data() const;\r
- \r
- double frame_rate() const;\r
- core::field_mode field_mode() const;\r
-\r
- std::size_t width() const;\r
- std::size_t height() const;\r
- std::size_t size() const;\r
- \r
- const void* tag() const;\r
-\r
- bool operator==(const const_frame& other);\r
- bool operator!=(const const_frame& other);\r
- \r
-private:\r
- struct impl;\r
- spl::shared_ptr<impl> impl_;\r
-};\r
-\r
-class mutable_frame sealed\r
-{\r
- mutable_frame(const mutable_frame&);\r
- mutable_frame& operator=(const mutable_frame&);\r
-public: \r
-\r
- // Static Members\r
-\r
- // Constructors\r
-\r
- explicit mutable_frame(std::vector<mutable_array> image_buffers, \r
- audio_buffer audio_buffer, \r
- const void* tag, \r
- const struct pixel_format_desc& desc, \r
- double frame_rate, \r
- core::field_mode field_mode);\r
- ~mutable_frame();\r
-\r
- // Methods\r
-\r
- mutable_frame(mutable_frame&& other);\r
- mutable_frame& operator=(mutable_frame&& other);\r
-\r
- void swap(mutable_frame& other);\r
- \r
- // Properties\r
- \r
- const struct pixel_format_desc& pixel_format_desc() const;\r
-\r
- const mutable_array& image_data(std::size_t index = 0) const;\r
- const core::audio_buffer& audio_data() const;\r
-\r
- mutable_array& image_data(std::size_t index = 0);\r
- core::audio_buffer& audio_data();\r
- \r
- double frame_rate() const;\r
- core::field_mode field_mode() const;\r
-\r
- std::size_t width() const;\r
- std::size_t height() const;\r
- \r
- const void* tag() const;\r
- \r
-private:\r
- struct impl;\r
- spl::unique_ptr<impl> impl_;\r
-};\r
-}}
\ No newline at end of file
+#pragma once
+
+#undef BOOST_PARAMETER_MAX_ARITY
+#define BOOST_PARAMETER_MAX_ARITY 7
+
+#include "../fwd.h"
+
+#include <common/memory.h>
+#include <common/forward.h>
+#include <common/array.h>
+#include <common/future_fwd.h>
+#include <common/cache_aligned_vector.h>
+#include <common/timer.h>
+
+#include <cstddef>
+#include <cstdint>
+
+FORWARD1(boost, template<typename> class shared_future);
+
+namespace caspar { namespace core {
+
+typedef caspar::array<const int32_t> audio_buffer;
+typedef cache_aligned_vector<int32_t> mutable_audio_buffer;
+class frame_geometry;
+
+class mutable_frame final
+{
+ mutable_frame(const mutable_frame&);
+ mutable_frame& operator=(const mutable_frame&);
+public:
+
+ // Static Members
+
+ // Constructors
+
+ explicit mutable_frame(std::vector<array<std::uint8_t>> image_buffers,
+ mutable_audio_buffer audio_data,
+ const void* tag,
+ const pixel_format_desc& desc,
+ const audio_channel_layout& channel_layout);
+ ~mutable_frame();
+
+ // Methods
+
+ mutable_frame(mutable_frame&& other);
+ mutable_frame& operator=(mutable_frame&& other);
+
+ void swap(mutable_frame& other);
+
+ // Properties
+
+ const core::pixel_format_desc& pixel_format_desc() const;
+ const core::audio_channel_layout& audio_channel_layout() const;
+
+ const array<std::uint8_t>& image_data(std::size_t index = 0) const;
+ const core::mutable_audio_buffer& audio_data() const;
+
+ array<std::uint8_t>& image_data(std::size_t index = 0);
+ core::mutable_audio_buffer& audio_data();
+
+ std::size_t width() const;
+ std::size_t height() const;
+
+ const void* stream_tag() const;
+
+ const core::frame_geometry& geometry() const;
+ void set_geometry(const frame_geometry& g);
+
+ caspar::timer since_created() const;
+
+private:
+ struct impl;
+ spl::unique_ptr<impl> impl_;
+};
+
+class const_frame final
+{
+public:
+
+ // Static Members
+
+ static const const_frame& empty();
+
+ // Constructors
+
+ explicit const_frame(const void* tag = nullptr);
+ explicit const_frame(std::shared_future<array<const std::uint8_t>> image,
+ audio_buffer audio_data,
+ const void* tag,
+ const pixel_format_desc& desc,
+ const audio_channel_layout& channel_layout);
+ const_frame(mutable_frame&& other);
+ ~const_frame();
+
+ // Methods
+
+ const_frame(const_frame&& other);
+ const_frame& operator=(const_frame&& other);
+ const_frame(const const_frame&);
+ const_frame& operator=(const const_frame& other);
+
+ const_frame key_only() const;
+
+ // Properties
+
+ const core::pixel_format_desc& pixel_format_desc() const;
+ const core::audio_channel_layout& audio_channel_layout() const;
+
+ array<const std::uint8_t> image_data(int index = 0) const;
+ const core::audio_buffer& audio_data() const;
+
+ std::size_t width() const;
+ std::size_t height() const;
+ std::size_t size() const;
+
+ const void* stream_tag() const;
+
+ const core::frame_geometry& geometry() const;
+ void set_geometry(const frame_geometry& g);
+ int64_t get_age_millis() const;
+
+ bool operator==(const const_frame& other);
+ bool operator!=(const const_frame& other);
+ bool operator<(const const_frame& other);
+ bool operator>(const const_frame& other);
+
+private:
+ struct impl;
+ spl::shared_ptr<impl> impl_;
+};
+
+}}