mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 01:31:03 +00:00
decklink: reinstate some hardcoded colorimetry handling
Needed when we don't yet have an open device and are doing negotiation. colorimetry=bt601 is only actually supported by decklink for PAL and NTSC formats. All other formats use bt709 or above. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7742>
This commit is contained in:
parent
2832aab78a
commit
9046e60aa7
5 changed files with 29 additions and 38 deletions
File diff suppressed because one or more lines are too long
|
@ -353,12 +353,14 @@ gst_decklink_audio_channels_get_type (void)
|
||||||
return (GType) id;
|
return (GType) id;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NTSC 10, 11, false
|
#define COLORSPACE_NOT_REC601 (BMDDisplayModeFlags) (bmdDisplayModeColorspaceRec709 | bmdDisplayModeColorspaceRec2020)
|
||||||
#define PAL 12, 11, true
|
|
||||||
#define NTSC_WS 40, 33, false
|
#define NTSC 10, 11, false, bmdDisplayModeColorspaceRec601
|
||||||
#define PAL_WS 16, 11, true
|
#define PAL 12, 11, true, bmdDisplayModeColorspaceRec601
|
||||||
#define HD 1, 1, true
|
#define NTSC_WS 40, 33, false, bmdDisplayModeColorspaceRec601
|
||||||
#define UHD 1, 1, true
|
#define PAL_WS 16, 11, true, bmdDisplayModeColorspaceRec601
|
||||||
|
#define HD 1, 1, true, COLORSPACE_NOT_REC601
|
||||||
|
#define UHD 1, 1, true, COLORSPACE_NOT_REC601
|
||||||
|
|
||||||
static const GstDecklinkMode modes[] = {
|
static const GstDecklinkMode modes[] = {
|
||||||
{bmdModeNTSC, 720, 486, 30000, 1001, true, NTSC}, // default is ntsc
|
{bmdModeNTSC, 720, 486, 30000, 1001, true, NTSC}, // default is ntsc
|
||||||
|
@ -1053,9 +1055,6 @@ gst_decklink_pixel_format_get_caps (BMDPixelFormat f, gboolean input)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
BMDDisplayModeFlags mode_flags =
|
|
||||||
bmdDisplayModeColorspaceRec601 | bmdDisplayModeColorspaceRec709 |
|
|
||||||
bmdDisplayModeColorspaceRec2020;
|
|
||||||
BMDDynamicRange dynamic_range =
|
BMDDynamicRange dynamic_range =
|
||||||
(BMDDynamicRange) (bmdDynamicRangeSDR | bmdDynamicRangeHDRStaticPQ |
|
(BMDDynamicRange) (bmdDynamicRangeSDR | bmdDynamicRangeHDRStaticPQ |
|
||||||
bmdDynamicRangeHDRStaticHLG);
|
bmdDynamicRangeHDRStaticHLG);
|
||||||
|
@ -1063,7 +1062,7 @@ gst_decklink_pixel_format_get_caps (BMDPixelFormat f, gboolean input)
|
||||||
caps = gst_caps_new_empty ();
|
caps = gst_caps_new_empty ();
|
||||||
for (i = 1; i < (int) G_N_ELEMENTS (modes); i++) {
|
for (i = 1; i < (int) G_N_ELEMENTS (modes); i++) {
|
||||||
GstCaps *format_caps =
|
GstCaps *format_caps =
|
||||||
gst_decklink_mode_get_caps ((GstDecklinkModeEnum) i, mode_flags, f,
|
gst_decklink_mode_get_caps ((GstDecklinkModeEnum) i, modes[i].mode_flags, f,
|
||||||
dynamic_range, input);
|
dynamic_range, input);
|
||||||
caps = gst_caps_merge (caps, format_caps);
|
caps = gst_caps_merge (caps, format_caps);
|
||||||
}
|
}
|
||||||
|
@ -1081,7 +1080,7 @@ gst_decklink_mode_get_template_caps (gboolean input)
|
||||||
for (i = 1; i < (int) G_N_ELEMENTS (modes); i++)
|
for (i = 1; i < (int) G_N_ELEMENTS (modes); i++)
|
||||||
caps =
|
caps =
|
||||||
gst_caps_merge (caps,
|
gst_caps_merge (caps,
|
||||||
gst_decklink_mode_get_caps_all_formats ((GstDecklinkModeEnum) i, -1,
|
gst_decklink_mode_get_caps_all_formats ((GstDecklinkModeEnum) i, modes[i].mode_flags,
|
||||||
(BMDDynamicRange) -1, input));
|
(BMDDynamicRange) -1, input));
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
|
@ -1091,9 +1090,6 @@ const GstDecklinkMode *
|
||||||
gst_decklink_find_mode_and_format_for_caps (GstCaps * caps,
|
gst_decklink_find_mode_and_format_for_caps (GstCaps * caps,
|
||||||
BMDPixelFormat * format)
|
BMDPixelFormat * format)
|
||||||
{
|
{
|
||||||
BMDDisplayModeFlags mode_flags =
|
|
||||||
bmdDisplayModeColorspaceRec601 | bmdDisplayModeColorspaceRec709 |
|
|
||||||
bmdDisplayModeColorspaceRec2020;
|
|
||||||
int i;
|
int i;
|
||||||
GstCaps *mode_caps;
|
GstCaps *mode_caps;
|
||||||
|
|
||||||
|
@ -1103,7 +1099,7 @@ gst_decklink_find_mode_and_format_for_caps (GstCaps * caps,
|
||||||
|
|
||||||
for (i = 1; i < (int) G_N_ELEMENTS (modes); i++) {
|
for (i = 1; i < (int) G_N_ELEMENTS (modes); i++) {
|
||||||
mode_caps =
|
mode_caps =
|
||||||
gst_decklink_mode_get_caps ((GstDecklinkModeEnum) i, mode_flags, *format,
|
gst_decklink_mode_get_caps ((GstDecklinkModeEnum) i, modes[i].mode_flags, *format,
|
||||||
(BMDDynamicRange) -1, FALSE);
|
(BMDDynamicRange) -1, FALSE);
|
||||||
if (gst_caps_can_intersect (caps, mode_caps)) {
|
if (gst_caps_can_intersect (caps, mode_caps)) {
|
||||||
gst_caps_unref (mode_caps);
|
gst_caps_unref (mode_caps);
|
||||||
|
@ -1912,9 +1908,9 @@ init_devices (gpointer data)
|
||||||
if (mode_enum != (GstDecklinkModeEnum) - 1) {
|
if (mode_enum != (GstDecklinkModeEnum) - 1) {
|
||||||
GstStructure *generic = gst_decklink_mode_get_generic_structure (mode_enum);
|
GstStructure *generic = gst_decklink_mode_get_generic_structure (mode_enum);
|
||||||
BMDDisplayModeFlags flags = mode->GetFlags ();
|
BMDDisplayModeFlags flags = mode->GetFlags ();
|
||||||
|
const GstDecklinkMode *gst_mode = gst_decklink_get_mode (mode_enum);
|
||||||
|
|
||||||
if ((supported & SUPPORT_COLORSPACE) ||
|
if (gst_mode->mode_flags & flags & bmdDisplayModeColorspaceRec601) {
|
||||||
(flags & bmdDisplayModeColorspaceRec601)) {
|
|
||||||
GstStructure *s = gst_structure_copy (generic);
|
GstStructure *s = gst_structure_copy (generic);
|
||||||
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt601",
|
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt601",
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1922,8 +1918,7 @@ init_devices (gpointer data)
|
||||||
gst_caps_merge_structure (video_input_caps, s);
|
gst_caps_merge_structure (video_input_caps, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((supported & SUPPORT_COLORSPACE) ||
|
if (gst_mode->mode_flags & flags & bmdDisplayModeColorspaceRec709) {
|
||||||
(flags & bmdDisplayModeColorspaceRec709)) {
|
|
||||||
GstStructure *s = gst_structure_copy (generic);
|
GstStructure *s = gst_structure_copy (generic);
|
||||||
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt709",
|
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt709",
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1931,8 +1926,8 @@ init_devices (gpointer data)
|
||||||
gst_caps_merge_structure (video_input_caps, s);
|
gst_caps_merge_structure (video_input_caps, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((supported & SUPPORT_COLORSPACE) ||
|
if ((supported & SUPPORT_COLORSPACE) &&
|
||||||
(flags & bmdDisplayModeColorspaceRec2020)) {
|
(gst_mode->mode_flags & bmdDisplayModeColorspaceRec2020)) {
|
||||||
GstStructure *s = gst_structure_copy (generic);
|
GstStructure *s = gst_structure_copy (generic);
|
||||||
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt2020",
|
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt2020",
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -2003,9 +1998,9 @@ init_devices (gpointer data)
|
||||||
if (mode_enum != (GstDecklinkModeEnum) - 1) {
|
if (mode_enum != (GstDecklinkModeEnum) - 1) {
|
||||||
GstStructure *generic = gst_decklink_mode_get_generic_structure (mode_enum);
|
GstStructure *generic = gst_decklink_mode_get_generic_structure (mode_enum);
|
||||||
BMDDisplayModeFlags flags = mode->GetFlags ();
|
BMDDisplayModeFlags flags = mode->GetFlags ();
|
||||||
|
const GstDecklinkMode *mode = gst_decklink_get_mode (mode_enum);
|
||||||
|
|
||||||
if ((supported & SUPPORT_COLORSPACE) ||
|
if (mode->mode_flags & flags & bmdDisplayModeColorspaceRec601) {
|
||||||
(flags & bmdDisplayModeColorspaceRec601)) {
|
|
||||||
GstStructure *s = gst_structure_copy (generic);
|
GstStructure *s = gst_structure_copy (generic);
|
||||||
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt601",
|
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt601",
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -2013,8 +2008,7 @@ init_devices (gpointer data)
|
||||||
gst_caps_merge_structure (video_input_caps, s);
|
gst_caps_merge_structure (video_input_caps, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((supported & SUPPORT_COLORSPACE) ||
|
if (mode->mode_flags & flags & bmdDisplayModeColorspaceRec709) {
|
||||||
(flags & bmdDisplayModeColorspaceRec601)) {
|
|
||||||
GstStructure *s = gst_structure_copy (generic);
|
GstStructure *s = gst_structure_copy (generic);
|
||||||
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt709",
|
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt709",
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -2022,8 +2016,8 @@ init_devices (gpointer data)
|
||||||
gst_caps_merge_structure (video_input_caps, s);
|
gst_caps_merge_structure (video_input_caps, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((supported & SUPPORT_COLORSPACE) ||
|
if ((supported & SUPPORT_COLORSPACE) &&
|
||||||
(flags & bmdDisplayModeColorspaceRec2020)) {
|
(mode->mode_flags & bmdDisplayModeColorspaceRec709)) {
|
||||||
GstStructure *s = gst_structure_copy (generic);
|
GstStructure *s = gst_structure_copy (generic);
|
||||||
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt2020",
|
gst_structure_set (s, "colorimetry", G_TYPE_STRING, "bt2020",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -531,6 +531,7 @@ struct _GstDecklinkMode {
|
||||||
int par_n;
|
int par_n;
|
||||||
int par_d;
|
int par_d;
|
||||||
gboolean tff;
|
gboolean tff;
|
||||||
|
BMDDisplayModeFlags mode_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
const GstDecklinkMode * gst_decklink_get_mode (GstDecklinkModeEnum e);
|
const GstDecklinkMode * gst_decklink_get_mode (GstDecklinkModeEnum e);
|
||||||
|
|
|
@ -1239,12 +1239,10 @@ gst_decklink_video_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
static BMDDisplayModeFlags
|
static BMDDisplayModeFlags
|
||||||
display_mode_flags (GstDecklinkVideoSink * self, GstDecklinkModeEnum e)
|
display_mode_flags (GstDecklinkVideoSink * self, GstDecklinkModeEnum e)
|
||||||
{
|
{
|
||||||
BMDDisplayModeFlags display_flags =
|
const GstDecklinkMode *gst_mode = gst_decklink_get_mode (e);
|
||||||
bmdDisplayModeColorspaceRec601 | bmdDisplayModeColorspaceRec709 |
|
BMDDisplayModeFlags display_flags = gst_mode->mode_flags;
|
||||||
bmdDisplayModeColorspaceRec2020;
|
|
||||||
|
|
||||||
if (self->output && self->output->output) {
|
if (self->output && self->output->output) {
|
||||||
const GstDecklinkMode *gst_mode = gst_decklink_get_mode (e);
|
|
||||||
IDeckLinkDisplayMode *display_mode = nullptr;
|
IDeckLinkDisplayMode *display_mode = nullptr;
|
||||||
bool supports_colorspace = false;
|
bool supports_colorspace = false;
|
||||||
|
|
||||||
|
@ -1254,7 +1252,7 @@ display_mode_flags (GstDecklinkVideoSink * self, GstDecklinkModeEnum e)
|
||||||
if (!supports_colorspace) {
|
if (!supports_colorspace) {
|
||||||
self->output->output->GetDisplayMode (gst_mode->mode, &display_mode);
|
self->output->output->GetDisplayMode (gst_mode->mode, &display_mode);
|
||||||
if (display_mode) {
|
if (display_mode) {
|
||||||
display_flags = display_mode->GetFlags ();
|
display_flags &= display_mode->GetFlags ();
|
||||||
display_mode->Release();
|
display_mode->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -837,9 +837,7 @@ static BMDDisplayModeFlags
|
||||||
display_mode_flags (GstDecklinkVideoSrc * self, const GstDecklinkMode * gst_mode,
|
display_mode_flags (GstDecklinkVideoSrc * self, const GstDecklinkMode * gst_mode,
|
||||||
gboolean fixed)
|
gboolean fixed)
|
||||||
{
|
{
|
||||||
BMDDisplayModeFlags display_flags =
|
BMDDisplayModeFlags display_flags = gst_mode->mode_flags;
|
||||||
bmdDisplayModeColorspaceRec601 | bmdDisplayModeColorspaceRec709 |
|
|
||||||
bmdDisplayModeColorspaceRec2020;
|
|
||||||
|
|
||||||
if (self->input && self->input->input) {
|
if (self->input && self->input->input) {
|
||||||
IDeckLinkDisplayMode *display_mode = nullptr;
|
IDeckLinkDisplayMode *display_mode = nullptr;
|
||||||
|
@ -851,7 +849,7 @@ display_mode_flags (GstDecklinkVideoSrc * self, const GstDecklinkMode * gst_mode
|
||||||
if (!supports_colorspace || fixed) {
|
if (!supports_colorspace || fixed) {
|
||||||
self->input->input->GetDisplayMode (gst_mode->mode, &display_mode);
|
self->input->input->GetDisplayMode (gst_mode->mode, &display_mode);
|
||||||
if (display_mode) {
|
if (display_mode) {
|
||||||
display_flags = display_mode->GetFlags ();
|
display_flags &= display_mode->GetFlags ();
|
||||||
display_mode->Release();
|
display_mode->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue