]> git.sesse.net Git - nageru/blobdiff - decklink_capture.h
Release Nageru 1.3.2.
[nageru] / decklink_capture.h
index 69ab08e3cd48285e399c4a57d0bf5af932060003..bfb6d0e1774c2c4b0cfe59f7c19019ff13d08a22 100644 (file)
@@ -17,7 +17,7 @@ class IDeckLinkDisplayMode;
 class DeckLinkCapture : public CaptureInterface, IDeckLinkInputCallback
 {
 public:
-       DeckLinkCapture(IDeckLink *card, int card_index);
+       DeckLinkCapture(IDeckLink *card, int card_index);  // Takes ownership of <card>.
        ~DeckLinkCapture();
 
        // IDeckLinkInputCallback.
@@ -36,6 +36,9 @@ public:
        void set_video_frame_allocator(FrameAllocator *allocator) override
        {
                video_frame_allocator = allocator;
+               if (owned_video_frame_allocator.get() != allocator) {
+                       owned_video_frame_allocator.reset();
+               }
        }
 
        FrameAllocator *get_video_frame_allocator() override
@@ -47,6 +50,9 @@ public:
        void set_audio_frame_allocator(FrameAllocator *allocator) override
        {
                audio_frame_allocator = allocator;
+               if (owned_audio_frame_allocator.get() != allocator) {
+                       owned_audio_frame_allocator.reset();
+               }
        }
 
        FrameAllocator *get_audio_frame_allocator() override
@@ -75,6 +81,9 @@ public:
        void start_bm_capture() override;
        void stop_dequeue_thread() override;
 
+       // TODO: Can the API communicate this to us somehow, for e.g. Thunderbolt cards?
+       bool get_disconnected() const override { return false; }
+
        std::map<uint32_t, VideoMode> get_available_video_modes() const override { return video_modes; }
        void set_video_mode(uint32_t video_mode_id) override;
        uint32_t get_current_video_mode() const override { return current_video_mode; }
@@ -102,10 +111,13 @@ private:
 
        FrameAllocator *video_frame_allocator = nullptr;
        FrameAllocator *audio_frame_allocator = nullptr;
+       std::unique_ptr<FrameAllocator> owned_video_frame_allocator;
+       std::unique_ptr<FrameAllocator> owned_audio_frame_allocator;
        frame_callback_t frame_callback = nullptr;
 
        IDeckLinkConfiguration *config = nullptr;
 
+       IDeckLink *card = nullptr;
        IDeckLinkInput *input = nullptr;
        BMDTimeValue frame_duration;
        BMDTimeScale time_scale;