Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. BlackMagic COM in Qt

BlackMagic COM in Qt

Scheduled Pinned Locked Moved 3rd Party Software
2 Posts 2 Posters 4.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wshirey
    wrote on last edited by
    #1

    I am trying to write a Qt Windows application that will utilize the BlackMagic Decklink SDK. This SDK uses COM for instantiating a class (IDeckLinkIterator) which provides access to all other classes.

    So far, I have used dumpcpp to create .h/.cpp files for API and successfully built the application.

    My .pro file looks like
    @
    QT += core gui activeqt
    CONFIG += qaxcontainer

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = decklink
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp
    decklinkapi.cpp

    HEADERS += mainwindow.h
    decklinkapi.h

    FORMS += mainwindow.ui

    TYPELIBS = $$system(dumpcpp -getfile {D864517A-EDD5-466D-867D-C819F1C052BB})
    isEmpty(TYPELIBS) {
    message("Decklink API type library not found!")
    }
    @

    Then to test the application I want to simply instantiate a class that tells me what version of the SDK I'm using. The Win32 code to do this is
    @
    IDeckLinkIterator* deckLinkIterator;
    IDeckLinkAPIInformation* deckLinkAPIInformation;
    IDeckLink* deckLink;
    int numDevices = 0;
    HRESULT result;

    // Initialize COM on this thread
    result = CoInitialize(NULL);

    // Create an IDeckLinkIterator object to enumerate all DeckLink cards in the system
    result = CoCreateInstance(CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL, IID_IDeckLinkIterator, (void**)&deckLinkIterator);

    // We can get the version of the API like this:
    result = deckLinkIterator->QueryInterface(IID_IDeckLinkAPIInformation, (void**)&deckLinkAPIInformation);
    if (result == S_OK)
    {
    LONGLONG deckLinkVersion;
    int dlVerMajor, dlVerMinor, dlVerPoint;

    // We can also use the BMDDeckLinkAPIVersion flag with GetString
    deckLinkAPIInformation->GetInt(BMDDeckLinkAPIVersion, &deckLinkVersion);

    dlVerMajor = (deckLinkVersion & 0xFF000000) >> 24;
    dlVerMinor = (deckLinkVersion & 0x00FF0000) >> 16;
    dlVerPoint = (deckLinkVersion & 0x0000FF00) >> 8;

    printf("DeckLinkAPI version: %d.%d.%d\n", dlVerMajor, dlVerMinor, dlVerPoint);

    deckLinkAPIInformation->Release();
    }

    // Enumerate all cards in this system
    while (deckLinkIterator->Next(&deckLink) == S_OK)
    {
    // get device
    }
    @

    How would I do that in Qt? My main problem is how to create objects.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcari
      wrote on last edited by
      #2

      Well, I am not sure what you want to achieve here with Qt.
      The Component Object Model is a Microsoft only technology, so there is no "cross-platform" way to deal with it: thus Qt is not COM enabled.
      The code you have is pretty much it. You can't instantiate the objects directly because they come from the COM API however you should be able to use them from a Qt GUI if that's what you want, after successfully instantiating them as you describe here.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved