C++:无法读取内存

问题描述

我编写了一个小程序,可以使用 Blackmagic 的 DeckLink SDK 捕获视频和音频。当我运行程序时,我得到一个 "unable to read memory" error message。调试器还会通知deckLinkInput 变量为NULL。 我认为是ma​​in函数中的deckLink参数有问题,但我不知道如何解决这个问题。

我通过以下方式初始化构造函数

ControlVideo::ControlVideo(CComPtr<IDeckLink>& deckLink)
    : deckLink(deckLink),deckLinkInput(deckLink),referenceCounter(1) {

    if (!deckLinkInput) {
        throw std::runtime_error("No connected input device found.");
    }
}

在程序的函数中,我创建了一个新的类实例

int main() {
    CComPtr<IDeckLink>deckLink;

    //Create object with Smart Pointer
    auto ctrlVideo = std::make_unique<ControlVideo>(deckLink);
    ctrlVideo->listdisplayMode();
    ctrlVideo->startVideo(bmdModeHD1080p25,bmdFormat8BitYUV,bmdAudioSampleRate48kHz,bmdAudioSampleType16bitInteger,8,bmdVideoInputEnableFormatDetection);
    
    return 0;
}

你们中有人有想法吗?我是 C++ 新手...

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)