class DeckLinkCapture : public CaptureInterface, IDeckLinkInputCallback
{
public:
- DeckLinkCapture(IDeckLink *card, int card_index);
+ DeckLinkCapture(IDeckLink *card, int card_index); // Takes ownership of <card>.
~DeckLinkCapture();
// IDeckLinkInputCallback.
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
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
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;