X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=decklink_output.h;h=d5e743aa2e801cc91d1156f082c2fe15e34a17ef;hb=e0dd9e22b11a7e812b9ff708370426c564ac8005;hp=7bc9850d1ba8d5bd25ba016dedd6ba756ec235d9;hpb=134f9d70a4cd03dc1105d9d94b6003fedcef4760;p=nageru diff --git a/decklink_output.h b/decklink_output.h index 7bc9850..d5e743a 100644 --- a/decklink_output.h +++ b/decklink_output.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -41,11 +42,23 @@ public: void send_frame(GLuint y_tex, GLuint cbcr_tex, const std::vector &input_frames, int64_t pts, int64_t duration); void send_audio(int64_t pts, const std::vector &samples); - void wait_for_frame(int64_t pts, int *dropped_frames, int64_t *frame_duration, bool *is_preroll); + + // NOTE: The returned timestamp is undefined for preroll. + // Otherwise, it is the timestamp of the output frame as it should have been, + // even if we're overshooting. E.g. at 50 fps (0.02 spf), assuming the + // last frame was at t=0.980: + // + // If we're at t=0.999, we wait until t=1.000 and return that. + // If we're at t=1.001, we return t=1.000 immediately (small overshoot). + // If we're at t=1.055, we drop two frames and return t=1.040 immediately. + void wait_for_frame(int64_t pts, int *dropped_frames, int64_t *frame_duration, bool *is_preroll, std::chrono::steady_clock::time_point *frame_timestamp); // Analogous to CaptureInterface. Will only return modes that have the right width/height. std::map get_available_video_modes() const { return video_modes; } + // If the given mode is supported, return it. If not, pick some “best” valid mode. + uint32_t pick_video_mode(uint32_t mode) const; + // IUnknown. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) override; ULONG STDMETHODCALLTYPE AddRef() override;