Re: [FFmpeg-devel] [PATCH v2 4/4] avdevice/decklink: support for more duplex mode for Decklink 8K Pro

2021-08-08 Thread lance . lmwang
On Sat, Aug 07, 2021 at 08:02:05PM +0200, Marton Balint wrote:
> 
> 
> On Fri, 6 Aug 2021, lance.lmw...@gmail.com wrote:
> 
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> > doc/indevs.texi | 16 +++-
> > doc/outdevs.texi| 16 +++-
> > libavdevice/decklink_common.cpp |  8 
> > libavdevice/decklink_common.h   | 11 +++
> > libavdevice/decklink_dec_c.c| 10 ++
> > libavdevice/decklink_enc_c.c| 10 ++
> > 6 files changed, 69 insertions(+), 2 deletions(-)
> > 
> > diff --git a/doc/indevs.texi b/doc/indevs.texi
> > index b377924..af0380a 100644
> > --- a/doc/indevs.texi
> > +++ b/doc/indevs.texi
> > @@ -344,9 +344,23 @@ Defines number of audio channels to capture. Must be 
> > @samp{2}, @samp{8} or @samp
> > Defaults to @samp{2}.
> > 
> > @item duplex_mode
> > -Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or 
> > @samp{full}.
> > +Sets the decklink device duplex/profile mode. Must be @samp{unset}, 
> > @samp{half}, @samp{full},
> > +@samp{one_sub_device_full}, @samp{one_sub_device_half}, 
> > @samp{two_sub_device_full},
> > +@samp{four_sub_device_half}
> > Defaults to @samp{unset}.
> > 
> > +Note: DeckLink SDK 11.2 have replaced the duplex property by a profile 
> > property.
> 
> Why do you think it is 11.2? Accoring to the docs, it was changed in 11.0,
> and original code also had #defines for it and checked for 11.0 not 11.2.
> But your defines below check 11.2 when in fact they should check 11.0. Or am
> I missing something?

Sorry, it's my fault, when upgrade the sdk before, we use 11.2 and haven't use 
11.0.
I'll change to use 11.0. 

> 
> Thanks,
> Marton
> 
> > +For the DeckLink Duo 2 and DeckLink Quad 2, a profile is shared between 
> > any 2
> > +sub-devices that utilize the same connectors. For the DeckLink 8K Pro, a 
> > profile
> > +is shared between all 4 sub-devices. So DeckLink 8K Pro support four 
> > profiles.
> > +
> > +Valid profile mode for DeckLink 8K Pro(Updated DeckLink SDK to >= 11.2):
> > +@samp{one_sub_device_full}, @samp{one_sub_device_half}, 
> > @samp{two_sub_device_full},
> > +@samp{four_sub_device_half}
> > +
> > +Valid profile mode for DeckLink Quad 2 and DeckLink Duo 2:
> > +@samp{half}, @samp{full}
> > +
> > @item timecode_format
> > Timecode type to include in the frame and video stream metadata. Must be
> > @samp{none}, @samp{rp188vitc}, @samp{rp188vitc2}, @samp{rp188ltc},
> > diff --git a/doc/outdevs.texi b/doc/outdevs.texi
> > index dee9de3..76a9d7d 100644
> > --- a/doc/outdevs.texi
> > +++ b/doc/outdevs.texi
> > @@ -198,9 +198,23 @@ Amount of time to preroll video in seconds.
> > Defaults to @option{0.5}.
> > 
> > @item duplex_mode
> > -Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or 
> > @samp{full}.
> > +Sets the decklink device duplex/profile mode. Must be @samp{unset}, 
> > @samp{half}, @samp{full},
> > +@samp{one_sub_device_full}, @samp{one_sub_device_half}, 
> > @samp{two_sub_device_full},
> > +@samp{four_sub_device_half}
> > Defaults to @samp{unset}.
> > 
> > +Note: DeckLink SDK 11.2 have replaced the duplex property by a profile 
> > property.
> > +For the DeckLink Duo 2 and DeckLink Quad 2, a profile is shared between 
> > any 2
> > +sub-devices that utilize the same connectors. For the DeckLink 8K Pro, a 
> > profile
> > +is shared between all 4 sub-devices. So DeckLink 8K Pro support four 
> > profiles.
> > +
> > +Valid profile mode for DeckLink 8K Pro(Updated DeckLink SDK to >= 11.2):
> > +@samp{one_sub_device_full}, @samp{one_sub_device_half}, 
> > @samp{two_sub_device_full},
> > +@samp{four_sub_device_half}
> > +
> > +Valid profile mode for DeckLink Quad 2 and DeckLink Duo 2:
> > +@samp{half}, @samp{full}
> > +
> > @item timing_offset
> > Sets the genlock timing pixel offset on the used output.
> > Defaults to @samp{unset}.
> > diff --git a/libavdevice/decklink_common.cpp 
> > b/libavdevice/decklink_common.cpp
> > index 46e9768..de7d2f4 100644
> > --- a/libavdevice/decklink_common.cpp
> > +++ b/libavdevice/decklink_common.cpp
> > @@ -182,7 +182,11 @@ int ff_decklink_set_configs(AVFormatContext *avctx,
> > if (duplex_supported) {
> > #if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b00
> > IDeckLinkProfile *profile = NULL;
> > +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b02
> > +BMDProfileID bmd_profile_id = 
> > decklink_profile_id_map[ctx->duplex_mode];
> > +#else
> > BMDProfileID bmd_profile_id = ctx->duplex_mode == 2 ? 
> > bmdProfileOneSubDeviceFullDuplex : bmdProfileTwoSubDevicesHalfDuplex;
> > +#endif
> > res = manager->GetProfile(bmd_profile_id, &profile);
> > if (res == S_OK) {
> > res = profile->SetActive();
> > @@ -195,7 +199,11 @@ int ff_decklink_set_configs(AVFormatContext *avctx,
> > if (res != S_OK)
> > av_log(avctx, AV_LOG_WARNING, "Setting duplex mode 
> > failed.\n");
>

Re: [FFmpeg-devel] [PATCH v2 4/4] avdevice/decklink: support for more duplex mode for Decklink 8K Pro

2021-08-07 Thread Marton Balint




On Fri, 6 Aug 2021, lance.lmw...@gmail.com wrote:


From: Limin Wang 

Signed-off-by: Limin Wang 
---
doc/indevs.texi | 16 +++-
doc/outdevs.texi| 16 +++-
libavdevice/decklink_common.cpp |  8 
libavdevice/decklink_common.h   | 11 +++
libavdevice/decklink_dec_c.c| 10 ++
libavdevice/decklink_enc_c.c| 10 ++
6 files changed, 69 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index b377924..af0380a 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -344,9 +344,23 @@ Defines number of audio channels to capture. Must be 
@samp{2}, @samp{8} or @samp
Defaults to @samp{2}.

@item duplex_mode
-Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or 
@samp{full}.
+Sets the decklink device duplex/profile mode. Must be @samp{unset}, 
@samp{half}, @samp{full},
+@samp{one_sub_device_full}, @samp{one_sub_device_half}, 
@samp{two_sub_device_full},
+@samp{four_sub_device_half}
Defaults to @samp{unset}.

+Note: DeckLink SDK 11.2 have replaced the duplex property by a profile 
property.


Why do you think it is 11.2? Accoring to the docs, it was changed in 11.0, 
and original code also had #defines for it and checked for 11.0 not 11.2. 
But your defines below check 11.2 when in fact they should check 11.0. Or 
am I missing something?


Thanks,
Marton


+For the DeckLink Duo 2 and DeckLink Quad 2, a profile is shared between any 2
+sub-devices that utilize the same connectors. For the DeckLink 8K Pro, a 
profile
+is shared between all 4 sub-devices. So DeckLink 8K Pro support four profiles.
+
+Valid profile mode for DeckLink 8K Pro(Updated DeckLink SDK to >= 11.2):
+@samp{one_sub_device_full}, @samp{one_sub_device_half}, 
@samp{two_sub_device_full},
+@samp{four_sub_device_half}
+
+Valid profile mode for DeckLink Quad 2 and DeckLink Duo 2:
+@samp{half}, @samp{full}
+
@item timecode_format
Timecode type to include in the frame and video stream metadata. Must be
@samp{none}, @samp{rp188vitc}, @samp{rp188vitc2}, @samp{rp188ltc},
diff --git a/doc/outdevs.texi b/doc/outdevs.texi
index dee9de3..76a9d7d 100644
--- a/doc/outdevs.texi
+++ b/doc/outdevs.texi
@@ -198,9 +198,23 @@ Amount of time to preroll video in seconds.
Defaults to @option{0.5}.

@item duplex_mode
-Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or 
@samp{full}.
+Sets the decklink device duplex/profile mode. Must be @samp{unset}, 
@samp{half}, @samp{full},
+@samp{one_sub_device_full}, @samp{one_sub_device_half}, 
@samp{two_sub_device_full},
+@samp{four_sub_device_half}
Defaults to @samp{unset}.

+Note: DeckLink SDK 11.2 have replaced the duplex property by a profile 
property.
+For the DeckLink Duo 2 and DeckLink Quad 2, a profile is shared between any 2
+sub-devices that utilize the same connectors. For the DeckLink 8K Pro, a 
profile
+is shared between all 4 sub-devices. So DeckLink 8K Pro support four profiles.
+
+Valid profile mode for DeckLink 8K Pro(Updated DeckLink SDK to >= 11.2):
+@samp{one_sub_device_full}, @samp{one_sub_device_half}, 
@samp{two_sub_device_full},
+@samp{four_sub_device_half}
+
+Valid profile mode for DeckLink Quad 2 and DeckLink Duo 2:
+@samp{half}, @samp{full}
+
@item timing_offset
Sets the genlock timing pixel offset on the used output.
Defaults to @samp{unset}.
diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index 46e9768..de7d2f4 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -182,7 +182,11 @@ int ff_decklink_set_configs(AVFormatContext *avctx,
if (duplex_supported) {
#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b00
IDeckLinkProfile *profile = NULL;
+#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b02
+BMDProfileID bmd_profile_id = 
decklink_profile_id_map[ctx->duplex_mode];
+#else
BMDProfileID bmd_profile_id = ctx->duplex_mode == 2 ? 
bmdProfileOneSubDeviceFullDuplex : bmdProfileTwoSubDevicesHalfDuplex;
+#endif
res = manager->GetProfile(bmd_profile_id, &profile);
if (res == S_OK) {
res = profile->SetActive();
@@ -195,7 +199,11 @@ int ff_decklink_set_configs(AVFormatContext *avctx,
if (res != S_OK)
av_log(avctx, AV_LOG_WARNING, "Setting duplex mode failed.\n");
else
+#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b02
+av_log(avctx, AV_LOG_VERBOSE, "Successfully set duplex mode to %s duplex.\n", 
ctx->duplex_mode == 2  || ctx->duplex_mode == 4 ? "full" : "half");
+#else
av_log(avctx, AV_LOG_VERBOSE, "Successfully set duplex mode to %s duplex.\n", 
ctx->duplex_mode == 2 ? "full" : "half");
+#endif
} else {
av_log(avctx, AV_LOG_WARNING, "Unable to set duplex mode, because it is 
not supported.\n");
}
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
index ad8b33c..a2d6509 100644
--- a/libavdevice/de