[vlc-commits] decklink: fix compilation with SDK 11.1 (fix #22276)

Francois Cartegnie git at videolan.org
Fri May 10 10:34:48 CEST 2019


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu May  9 10:38:01 2019 +0200| [774a96ae649ff66e4842c43c5a047b118dc411e4] | committer: Francois Cartegnie

decklink: fix compilation with SDK 11.1 (fix #22276)

provided deprecated api entries just does not work

(cherry picked from commit 10d6549f4eb577670cf657768bb0ad82ef6c69c1)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=774a96ae649ff66e4842c43c5a047b118dc411e4
---

 modules/access/decklink.cpp       |  9 +++++++--
 modules/video_output/decklink.cpp | 42 +++++++++++++++++++++++++++------------
 2 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/modules/access/decklink.cpp b/modules/access/decklink.cpp
index 04f0b469f4..c0ded3f051 100644
--- a/modules/access/decklink.cpp
+++ b/modules/access/decklink.cpp
@@ -35,6 +35,11 @@
 
 #include <DeckLinkAPI.h>
 #include <DeckLinkAPIDispatch.cpp>
+#include <DeckLinkAPIVersion.h>
+#if BLACKMAGIC_DECKLINK_API_VERSION < 0x0b010000
+ #define IID_IDeckLinkProfileAttributes IID_IDeckLinkAttributes
+ #define IDeckLinkProfileAttributes IDeckLinkAttributes
+#endif
 
 #include "sdi.h"
 
@@ -135,7 +140,7 @@ struct demux_sys_t
     /* We need to hold onto the IDeckLinkConfiguration object, or our settings will not apply.
        See section 2.4.15 of the Blackmagic DeckLink SDK documentation. */
     IDeckLinkConfiguration *config;
-    IDeckLinkAttributes *attributes;
+    IDeckLinkProfileAttributes *attributes;
 
     bool autodetect;
 
@@ -542,7 +547,7 @@ static int Open(vlc_object_t *p_this)
         goto finish;
     }
 
-    if (sys->card->QueryInterface(IID_IDeckLinkAttributes, (void**)&sys->attributes) != S_OK) {
+    if (sys->card->QueryInterface(IID_IDeckLinkProfileAttributes, (void**)&sys->attributes) != S_OK) {
         msg_Err(demux, "Failed to get attributes interface");
         goto finish;
     }
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index 1e50461087..23909b86c6 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -47,6 +47,11 @@
 
 #include <DeckLinkAPI.h>
 #include <DeckLinkAPIDispatch.cpp>
+#include <DeckLinkAPIVersion.h>
+#if BLACKMAGIC_DECKLINK_API_VERSION < 0x0b010000
+ #define IID_IDeckLinkProfileAttributes IID_IDeckLinkAttributes
+ #define IDeckLinkProfileAttributes IDeckLinkAttributes
+#endif
 
 #define FRAME_SIZE 1920
 #define CHANNELS_MAX 6
@@ -463,7 +468,7 @@ static picture_t * CreateNoSignalPicture(vlc_object_t *p_this, const video_forma
 static IDeckLinkDisplayMode * MatchDisplayMode(vout_display_t *vd,
                                                IDeckLinkOutput *output,
                                                const video_format_t *fmt,
-                                               BMDDisplayMode forcedmode = bmdDisplayModeNotSupported)
+                                               BMDDisplayMode forcedmode = bmdModeUnknown)
 {
     HRESULT result;
     IDeckLinkDisplayMode *p_selected = NULL;
@@ -507,7 +512,7 @@ static IDeckLinkDisplayMode * MatchDisplayMode(vout_display_t *vd,
                     continue;
                 }
 
-                if(forcedmode != bmdDisplayModeNotSupported && unlikely(!p_selected))
+                if(forcedmode != bmdModeUnknown && unlikely(!p_selected))
                 {
                     BMDDisplayMode modenl = htonl(forcedmode);
                     msg_Dbg(vd, "Forced mode '%4.4s'", (char *)&modenl);
@@ -518,7 +523,7 @@ static IDeckLinkDisplayMode * MatchDisplayMode(vout_display_t *vd,
                     continue;
                 }
 
-                if(p_selected == NULL && forcedmode == bmdDisplayModeNotSupported)
+                if(p_selected == NULL && forcedmode == bmdModeUnknown)
                 {
                     if(i_width >> i_div == p_mode->GetWidth() >> i_div &&
                        i_height >> i_div == p_mode->GetHeight() >> i_div)
@@ -564,9 +569,9 @@ static int OpenDecklink(vout_display_t *vd, decklink_sys_t *sys)
     IDeckLinkIterator *decklink_iterator = NULL;
     IDeckLinkDisplayMode *p_display_mode = NULL;
     IDeckLinkConfiguration *p_config = NULL;
-    IDeckLinkAttributes *p_attributes = NULL;
+    IDeckLinkProfileAttributes *p_attributes = NULL;
     IDeckLink *p_card = NULL;
-    BMDDisplayMode wanted_mode_id = bmdDisplayModeNotSupported;
+    BMDDisplayMode wanted_mode_id = bmdModeUnknown;
 
     vlc_mutex_lock(&sys->lock);
 
@@ -622,7 +627,7 @@ static int OpenDecklink(vout_display_t *vd, decklink_sys_t *sys)
 
     /* Read attributes */
 
-    result = p_card->QueryInterface(IID_IDeckLinkAttributes, (void**)&p_attributes);
+    result = p_card->QueryInterface(IID_IDeckLinkProfileAttributes, (void**)&p_attributes);
     CHECK("Could not get IDeckLinkAttributes");
 
     int64_t vconn;
@@ -662,6 +667,7 @@ static int OpenDecklink(vout_display_t *vd, decklink_sys_t *sys)
         BMDDisplayMode modenl = htonl(mode_id);
         msg_Dbg(vd, "Selected mode '%4.4s'", (char *) &modenl);
 
+        BMDPixelFormat pixelFormat = sys->video.tenbits ? bmdFormat10BitYUV : bmdFormat8BitYUV;
         BMDVideoOutputFlags flags = bmdVideoOutputVANC;
         if (mode_id == bmdModeNTSC ||
             mode_id == bmdModeNTSC2398 ||
@@ -669,15 +675,25 @@ static int OpenDecklink(vout_display_t *vd, decklink_sys_t *sys)
         {
             flags = bmdVideoOutputVITC;
         }
-
-        BMDDisplayModeSupport support;
-        IDeckLinkDisplayMode *resultMode;
-
+        bool supported;
+#if BLACKMAGIC_DECKLINK_API_VERSION < 0x0b010000
+        BMDDisplayModeSupport support = bmdDisplayModeNotSupported;
         result = sys->p_output->DoesSupportVideoMode(mode_id,
-                                                              sys->video.tenbits ? bmdFormat10BitYUV : bmdFormat8BitYUV,
-                                                              flags, &support, &resultMode);
+                                                pixelFormat,
+                                                flags,
+                                                &support,
+                                                NULL);
+        supported = (support != bmdDisplayModeNotSupported);
+#else
+        result = sys->p_output->DoesSupportVideoMode(vconn,
+                                                mode_id,
+                                                pixelFormat,
+                                                bmdSupportedVideoModeDefault,
+                                                NULL,
+                                                &supported);
+#endif
         CHECK("Does not support video mode");
-        if (support == bmdDisplayModeNotSupported)
+        if (!supported)
         {
             msg_Err(vd, "Video mode not supported");
             goto error;



More information about the vlc-commits mailing list