X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=core%2Fframe%2Fframe.h;h=640a6589e3027cea195813d7da3f95e792816026;hb=1678432d8cabef093a58e27791f68499c031dba9;hp=820dd831534d43c1ff1457a14576ceda95288b7f;hpb=48527235348a8aa17faa6047db20b056bb5bd6ab;p=casparcg diff --git a/core/frame/frame.h b/core/frame/frame.h index 820dd8315..640a6589e 100644 --- a/core/frame/frame.h +++ b/core/frame/frame.h @@ -1,129 +1,133 @@ -#pragma once - -#undef BOOST_PARAMETER_MAX_ARITY -#define BOOST_PARAMETER_MAX_ARITY 7 - -#include "../video_format.h" - -#include -#include -#include - -#include -#include - -#include - -#include -#include - -FORWARD1(boost, template class shared_future); - -namespace caspar { namespace core { - -typedef std::vector> audio_buffer; - -class mutable_frame sealed -{ - mutable_frame(const mutable_frame&); - mutable_frame& operator=(const mutable_frame&); -public: - - // Static Members - - // Constructors - - explicit mutable_frame(std::vector> image_buffers, - audio_buffer audio_buffer, - const void* tag, - const struct pixel_format_desc& desc, - double frame_rate, - core::field_mode field_mode); - ~mutable_frame(); - - // Methods - - mutable_frame(mutable_frame&& other); - mutable_frame& operator=(mutable_frame&& other); - - void swap(mutable_frame& other); - - // Properties - - const struct pixel_format_desc& pixel_format_desc() const; - - const array& image_data(std::size_t index = 0) const; - const core::audio_buffer& audio_data() const; - - array& image_data(std::size_t index = 0); - core::audio_buffer& audio_data(); - - double frame_rate() const; - core::field_mode field_mode() const; - - std::size_t width() const; - std::size_t height() const; - - const void* stream_tag() const; - const void* data_tag() const; - -private: - struct impl; - spl::unique_ptr impl_; -}; - -class const_frame sealed -{ -public: - - // Static Members - - static const const_frame& empty(); - - // Constructors - - explicit const_frame(const void* tag = nullptr); - explicit const_frame(boost::shared_future> image, - audio_buffer audio_buffer, - const void* tag, - const struct pixel_format_desc& desc, - double frame_rate, - core::field_mode field_mode); - 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); - - // Properties - - const struct pixel_format_desc& pixel_format_desc() const; - - array image_data(int index = 0) const; - const core::audio_buffer& audio_data() const; - - double frame_rate() const; - core::field_mode field_mode() const; - - std::size_t width() const; - std::size_t height() const; - std::size_t size() const; - - const void* stream_tag() const; - const void* data_tag() 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_; -}; - -}} \ No newline at end of file +#pragma once + +#undef BOOST_PARAMETER_MAX_ARITY +#define BOOST_PARAMETER_MAX_ARITY 7 + +#include "../fwd.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +FORWARD1(boost, template class shared_future); + +namespace caspar { namespace core { + +typedef caspar::array audio_buffer; +typedef cache_aligned_vector 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> 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& image_data(std::size_t index = 0) const; + const core::mutable_audio_buffer& audio_data() const; + + array& 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_; +}; + +class const_frame final +{ + struct impl; +public: + + // Static Members + + static const const_frame& empty(); + + // Constructors + + explicit const_frame(const void* tag = nullptr); + explicit const_frame(std::shared_future> 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(const const_frame::impl&); + 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 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; + const_frame with_geometry(const frame_geometry& g) const; + 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: + spl::shared_ptr impl_; +}; + +}}