]> git.sesse.net Git - nageru/blobdiff - nageru/decklink_output.h
Use AVFrame::duration instead of AVFrame::pkt_duration.
[nageru] / nageru / decklink_output.h
index 8213f498a9d0677df7fe77b928acc7dce8951825..4aa76beca45df780d86d758401319cdeb7063005 100644 (file)
@@ -12,6 +12,7 @@
 #include <mutex>
 #include <queue>
 #include <thread>
+#include <unordered_set>
 #include <vector>
 
 #include "DeckLinkAPI.h"
@@ -38,13 +39,14 @@ class QSurface;
 class DeckLinkOutput : public IDeckLinkVideoOutputCallback {
 public:
        DeckLinkOutput(movit::ResourcePool *resource_pool, QSurface *surface, unsigned width, unsigned height, unsigned card_index);
+       ~DeckLinkOutput();
 
        // The IDecklinkInput argument is to work around a bug
        // in the 11.7 and newer drivers against older SDKs,
        // where you get a freeze if querying an IDeckLinkInput interface
        // on an already-started card.
        bool set_device(IDeckLink *decklink, IDeckLinkInput *input_arg);
-       void start_output(uint32_t mode, int64_t base_pts);  // Mode comes from get_available_video_modes().
+       void start_output(uint32_t mode, int64_t base_pts, bool is_master_card);  // Mode comes from get_available_video_modes().
        void end_output();
 
        void send_frame(GLuint y_tex, GLuint cbcr_tex, movit::YCbCrLumaCoefficients ycbcr_coefficients, const std::vector<RefCountedFrame> &input_frames, int64_t pts, int64_t duration);
@@ -138,10 +140,10 @@ private:
        std::mutex frame_queue_mutex;
        std::queue<std::unique_ptr<Frame>> pending_video_frames;  // Under <frame_queue_mutex>.
        std::queue<std::unique_ptr<Frame>> frame_freelist;  // Under <frame_queue_mutex>.
-       std::deque<Frame *> scheduled_frames;  // Owned by the driver, so no unique_ptr. Under <frame_queue_mutex>.
+       std::unordered_set<Frame *> scheduled_frames;  // Owned by the driver, so no unique_ptr. Under <frame_queue_mutex>.
 
        std::condition_variable frame_queues_changed;
-       bool playback_initiated = false, playback_started = false;
+       bool playback_initiated = false, playback_started = false, is_master_card = false;
        int64_t base_pts, frame_duration;
        BMDDisplayModeFlags current_mode_flags = 0;
        bool last_frame_had_mode_mismatch = false;