]> git.sesse.net Git - casparcg/blobdiff - core/frame/frame.h
[general] Abstracted the concept of a key only frame so that readers of const_frame...
[casparcg] / core / frame / frame.h
index 4667c0a2a1402470ef5138e3502fc8f9e189e713..fff5382c845a715e34cecb93380e2dd107852be5 100644 (file)
@@ -3,13 +3,14 @@
 #undef BOOST_PARAMETER_MAX_ARITY
 #define BOOST_PARAMETER_MAX_ARITY 7
 
-#include "../video_format.h"
+#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 cache_aligned_vector<int32_t> audio_buffer;
+
+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:        
+public:
 
        // Static Members
 
        // Constructors
 
-       explicit mutable_frame(std::vector<array<std::uint8_t>> image_buffers, 
-                                               audio_buffer audio_buffer, 
-                                               const void* tag, 
-                                               const struct pixel_format_desc& desc);
+       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
@@ -43,26 +46,28 @@ public:
        mutable_frame& operator=(mutable_frame&& other);
 
        void swap(mutable_frame& other);
-                       
+
        // Properties
-                       
-       const struct pixel_format_desc& pixel_format_desc() const;
+
+       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::audio_buffer& audio_data() const;
+       const core::mutable_audio_buffer& audio_data() const;
 
        array<std::uint8_t>& image_data(std::size_t index = 0);
-       core::audio_buffer& audio_data();
-       
+       core::mutable_audio_buffer& audio_data();
+
        std::size_t width() const;
        std::size_t height() const;
-                                                               
+
        const void* stream_tag() const;
-       const void* data_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_;
@@ -70,7 +75,7 @@ private:
 
 class const_frame final
 {
-public:        
+public:
 
        // Static Members
 
@@ -79,10 +84,11 @@ public:
        // Constructors
 
        explicit const_frame(const void* tag = nullptr);
-       explicit const_frame(std::shared_future<array<const std::uint8_t>> image, 
-                                               audio_buffer audio_buffer, 
-                                               const void* tag, 
-                                               const struct pixel_format_desc& desc);
+       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();
 
@@ -92,32 +98,35 @@ public:
        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 struct pixel_format_desc& pixel_format_desc() const;
+
+       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 void* data_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_;
 };
 
-}}
\ No newline at end of file
+}}