summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2021-08-18 09:13:45 +0300
committerSebastian Dröge <sebastian@centricular.com>2021-08-18 09:13:45 +0300
commit751f68740f003827a1c27ade5a057b3b723edb71 (patch)
tree74cc5fe3f799aac7b7b14238da52be0ccb34aa65 /sys
parent86872b1b46ea2d861006b0f2048ee27f948c4f34 (diff)
downloadgstreamer-plugins-bad-751f68740f003827a1c27ade5a057b3b723edb71.tar.gz
decklinkvideosrc: Fix PAL/NTSC widescreen autodetection when switching back to non-widescreen
Previously it would only switch to widescreen but never back. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2469>
Diffstat (limited to 'sys')
-rw-r--r--sys/decklink/gstdecklinkvideosrc.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/sys/decklink/gstdecklinkvideosrc.cpp b/sys/decklink/gstdecklinkvideosrc.cpp
index 009ab8927..2385a2339 100644
--- a/sys/decklink/gstdecklinkvideosrc.cpp
+++ b/sys/decklink/gstdecklinkvideosrc.cpp
@@ -1265,6 +1265,11 @@ retry:
vf->input = self->input->input;
vf->input->AddRef ();
+ // Reset aspect ratio flag if the mode has changed. The new mode might not
+ // have AFD/Bar VANC.
+ if (self->caps_mode != f.mode) {
+ self->aspect_ratio_flag = -1;
+ }
// If we have a format that supports VANC and we are asked to extract CC,
// then do it here.
if ((self->output_cc || self->output_afd_bar)
@@ -1277,22 +1282,33 @@ retry:
// If there was AFD information with the aspect ratio flag set and the mode
// is auto then we have to switch from normal NTSC/PAL to the widescreen
// variants
- if (self->aspect_ratio_flag == 1 && self->mode == GST_DECKLINK_MODE_AUTO) {
+ if (self->aspect_ratio_flag != -1 && self->mode == GST_DECKLINK_MODE_AUTO) {
switch (f.mode) {
case GST_DECKLINK_MODE_NTSC:
- f.mode = GST_DECKLINK_MODE_NTSC_WIDESCREEN;
+ f.mode =
+ self->aspect_ratio_flag ==
+ 1 ? GST_DECKLINK_MODE_NTSC_WIDESCREEN : GST_DECKLINK_MODE_NTSC;
break;
case GST_DECKLINK_MODE_NTSC_P:
- f.mode = GST_DECKLINK_MODE_NTSC_P_WIDESCREEN;
+ f.mode =
+ self->aspect_ratio_flag ==
+ 1 ? GST_DECKLINK_MODE_NTSC_P_WIDESCREEN : GST_DECKLINK_MODE_NTSC_P;
break;
case GST_DECKLINK_MODE_NTSC2398:
- f.mode = GST_DECKLINK_MODE_NTSC2398_WIDESCREEN;
+ f.mode =
+ self->aspect_ratio_flag ==
+ 1 ? GST_DECKLINK_MODE_NTSC2398_WIDESCREEN :
+ GST_DECKLINK_MODE_NTSC2398;
break;
case GST_DECKLINK_MODE_PAL:
- f.mode = GST_DECKLINK_MODE_PAL_WIDESCREEN;
+ f.mode =
+ self->aspect_ratio_flag ==
+ 1 ? GST_DECKLINK_MODE_PAL_WIDESCREEN : GST_DECKLINK_MODE_PAL;
break;
case GST_DECKLINK_MODE_PAL_P:
- f.mode = GST_DECKLINK_MODE_PAL_P_WIDESCREEN;
+ f.mode =
+ self->aspect_ratio_flag ==
+ 1 ? GST_DECKLINK_MODE_PAL_P_WIDESCREEN : GST_DECKLINK_MODE_PAL_P;
break;
default:
break;