Fix build with decklink sdk 11

This commit is contained in:
Daniel Bermond
2019-06-01 14:01:02 +00:00
parent 477324de05
commit af683dc76c
2 changed files with 134 additions and 1 deletions
+6 -1
View File
@@ -4,7 +4,7 @@
pkgname=ffmpeg-full pkgname=ffmpeg-full
_srcname=ffmpeg _srcname=ffmpeg
pkgver=4.1.3 pkgver=4.1.3
pkgrel=4 pkgrel=5
pkgdesc='Complete solution to record, convert and stream audio and video (all possible features including nvenc, qsv and libfdk-aac)' pkgdesc='Complete solution to record, convert and stream audio and video (all possible features including nvenc, qsv and libfdk-aac)'
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url='https://www.ffmpeg.org/' url='https://www.ffmpeg.org/'
@@ -48,6 +48,7 @@ provides=('libavcodec.so' 'libavdevice.so' 'libavfilter.so' 'libavformat.so'
'libswresample.so' 'ffmpeg') 'libswresample.so' 'ffmpeg')
conflicts=('ffmpeg') conflicts=('ffmpeg')
source=("https://ffmpeg.org/releases/ffmpeg-${pkgver}.tar.xz"{,.asc} source=("https://ffmpeg.org/releases/ffmpeg-${pkgver}.tar.xz"{,.asc}
'ffmpeg-full-decklink-sdk-11.patch'
'LICENSE') 'LICENSE')
source_x86_64=('ffmpeg-full-add-intel-svt-hevc.patch'::'https://raw.githubusercontent.com/OpenVisualCloud/SVT-HEVC/v1.3.0/ffmpeg_plugin/0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch' source_x86_64=('ffmpeg-full-add-intel-svt-hevc.patch'::'https://raw.githubusercontent.com/OpenVisualCloud/SVT-HEVC/v1.3.0/ffmpeg_plugin/0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch'
'ffmpeg-full-add-intel-svt-hevc-docs.patch'::'https://raw.githubusercontent.com/OpenVisualCloud/SVT-HEVC/v1.3.0/ffmpeg_plugin/0002-doc-Add-libsvt_hevc-encoder-docs.patch' 'ffmpeg-full-add-intel-svt-hevc-docs.patch'::'https://raw.githubusercontent.com/OpenVisualCloud/SVT-HEVC/v1.3.0/ffmpeg_plugin/0002-doc-Add-libsvt_hevc-encoder-docs.patch'
@@ -55,6 +56,7 @@ source_x86_64=('ffmpeg-full-add-intel-svt-hevc.patch'::'https://raw.githubuserco
'ffmpeg-full-add-intel-svt-vp9.patch'::'https://raw.githubusercontent.com/OpenVisualCloud/SVT-VP9/9c96f478e4a281f6019c8b0de39c2b7caba56371/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9-with-svt-hevc-av1.patch') 'ffmpeg-full-add-intel-svt-vp9.patch'::'https://raw.githubusercontent.com/OpenVisualCloud/SVT-VP9/9c96f478e4a281f6019c8b0de39c2b7caba56371/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9-with-svt-hevc-av1.patch')
sha256sums=('0c3020452880581a8face91595b239198078645e7d7184273b8bcc7758beb63d' sha256sums=('0c3020452880581a8face91595b239198078645e7d7184273b8bcc7758beb63d'
'SKIP' 'SKIP'
'96500257c72c664a9e7417d9aee3d0b2a4436f836e9733dcf1c9c30926b642df'
'04a7176400907fd7db0d69116b99de49e582a6e176b3bfb36a03e50a4cb26a36') '04a7176400907fd7db0d69116b99de49e582a6e176b3bfb36a03e50a4cb26a36')
sha256sums_x86_64=('cc8ba4ff56cdb38a59650203999c4c8c83fc40bdb905b87b678ff68a4538444d' sha256sums_x86_64=('cc8ba4ff56cdb38a59650203999c4c8c83fc40bdb905b87b678ff68a4538444d'
'516c5a1b3ab6dc444e2270a1bae90455838fc3b7e3a18de37d7d63e25e79493d' '516c5a1b3ab6dc444e2270a1bae90455838fc3b7e3a18de37d7d63e25e79493d'
@@ -73,6 +75,9 @@ prepare() {
patch -Np1 -i "${srcdir}/ffmpeg-full-add-intel-svt-av1.patch" patch -Np1 -i "${srcdir}/ffmpeg-full-add-intel-svt-av1.patch"
patch -Np1 -i "${srcdir}/ffmpeg-full-add-intel-svt-vp9.patch" patch -Np1 -i "${srcdir}/ffmpeg-full-add-intel-svt-vp9.patch"
fi fi
# fix build with decklink sdk 11
patch -Np1 -i "${srcdir}/ffmpeg-full-decklink-sdk-11.patch"
} }
build() { build() {
+128
View File
@@ -0,0 +1,128 @@
diff -Naurp a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
--- a/libavdevice/decklink_common.cpp 2019-04-01 11:16:31.000000000 +0000
+++ b/libavdevice/decklink_common.cpp 2019-04-19 19:12:28.000000000 +0000
@@ -81,9 +81,9 @@ static int decklink_get_attr_string(IDec
{
DECKLINK_STR tmp;
HRESULT hr;
- IDeckLinkAttributes *attr;
+ IDeckLinkProfileAttributes *attr;
*s = NULL;
- if (dl->QueryInterface(IID_IDeckLinkAttributes, (void **)&attr) != S_OK)
+ if (dl->QueryInterface(IID_IDeckLinkProfileAttributes, (void **)&attr) != S_OK)
return AVERROR_EXTERNAL;
hr = attr->GetString(cfg_id, &tmp);
attr->Release();
@@ -149,11 +149,28 @@ int ff_decklink_set_configs(AVFormatCont
if (ctx->duplex_mode) {
DECKLINK_BOOL duplex_supported = false;
+#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000
+ IDeckLinkProfileManager *manager = NULL;
+ if (ctx->dl->QueryInterface(IID_IDeckLinkProfileManager, (void **)&manager) == S_OK)
+ duplex_supported = true;
+#else
if (ctx->attr->GetFlag(BMDDeckLinkSupportsDuplexModeConfiguration, &duplex_supported) != S_OK)
duplex_supported = false;
+#endif
if (duplex_supported) {
+#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000
+ IDeckLinkProfile *profile = NULL;
+ BMDProfileID bmd_profile_id = ctx->duplex_mode == 2 ? bmdProfileOneSubDeviceFullDuplex : bmdProfileTwoSubDevicesHalfDuplex;
+ res = manager->GetProfile(bmd_profile_id, &profile);
+ if (res == S_OK) {
+ res = profile->SetActive();
+ profile->Release();
+ }
+ manager->Release();
+#else
res = ctx->cfg->SetInt(bmdDeckLinkConfigDuplexMode, ctx->duplex_mode == 2 ? bmdDuplexModeFull : bmdDuplexModeHalf);
+#endif
if (res != S_OK)
av_log(avctx, AV_LOG_WARNING, "Setting duplex mode failed.\n");
else
@@ -182,7 +199,11 @@ int ff_decklink_set_format(AVFormatConte
{
struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
+#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000
+ DECKLINK_BOOL support;
+#else
BMDDisplayModeSupport support;
+#endif
IDeckLinkDisplayModeIterator *itermode;
IDeckLinkDisplayMode *mode;
int i = 1;
@@ -243,6 +264,31 @@ int ff_decklink_set_format(AVFormatConte
if (ctx->bmd_mode == bmdModeUnknown)
return -1;
+
+#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000
+ if (direction == DIRECTION_IN) {
+ if (ctx->dli->DoesSupportVideoMode(ctx->video_input, ctx->bmd_mode, (BMDPixelFormat) cctx->raw_format,
+ bmdVideoInputFlagDefault,
+ &support) != S_OK)
+ return -1;
+ } else {
+ BMDDisplayMode actualMode = ctx->bmd_mode;
+ if (!ctx->supports_vanc || ctx->dlo->DoesSupportVideoMode(bmdVideoConnectionUnspecified, ctx->bmd_mode, ctx->raw_format,
+ bmdVideoOutputVANC,
+ &actualMode, &support) != S_OK || !support || ctx->bmd_mode != actualMode) {
+ /* Try without VANC enabled */
+ if (ctx->dlo->DoesSupportVideoMode(bmdVideoConnectionUnspecified, ctx->bmd_mode, ctx->raw_format,
+ bmdVideoOutputFlagDefault,
+ &actualMode, &support) != S_OK || !support || ctx->bmd_mode != actualMode) {
+ return -1;
+ }
+ ctx->supports_vanc = 0;
+ }
+
+ }
+ if (support)
+ return 0;
+#else
if (direction == DIRECTION_IN) {
if (ctx->dli->DoesSupportVideoMode(ctx->bmd_mode, (BMDPixelFormat) cctx->raw_format,
bmdVideoOutputFlagDefault,
@@ -264,6 +310,7 @@ int ff_decklink_set_format(AVFormatConte
}
if (support == bmdDisplayModeSupported)
return 0;
+#endif
return -1;
}
@@ -468,7 +515,7 @@ int ff_decklink_init_device(AVFormatCont
return AVERROR_EXTERNAL;
}
- if (ctx->dl->QueryInterface(IID_IDeckLinkAttributes, (void **)&ctx->attr) != S_OK) {
+ if (ctx->dl->QueryInterface(IID_IDeckLinkProfileAttributes, (void **)&ctx->attr) != S_OK) {
av_log(avctx, AV_LOG_ERROR, "Could not get attributes interface for '%s'\n", name);
ff_decklink_cleanup(avctx);
return AVERROR_EXTERNAL;
diff -Naurp a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
--- a/libavdevice/decklink_common.h 2019-04-01 11:16:31.000000000 +0000
+++ b/libavdevice/decklink_common.h 2019-04-19 19:12:28.000000000 +0000
@@ -24,6 +24,10 @@
#define AVDEVICE_DECKLINK_COMMON_H
#include <DeckLinkAPIVersion.h>
+#if BLACKMAGIC_DECKLINK_API_VERSION < 0x0b000000
+#define IID_IDeckLinkProfileAttributes IID_IDeckLinkAttributes
+#define IDeckLinkProfileAttributes IDeckLinkAttributes
+#endif
#include "libavutil/thread.h"
#include "decklink_common_c.h"
@@ -87,7 +91,7 @@ struct decklink_ctx {
IDeckLinkOutput *dlo;
IDeckLinkInput *dli;
IDeckLinkConfiguration *cfg;
- IDeckLinkAttributes *attr;
+ IDeckLinkProfileAttributes *attr;
decklink_output_callback *output_callback;
/* DeckLink mode information */