mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
decklink: fix 10 bit RGB (r210) format auto detection
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2391 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4332>
This commit is contained in:
parent
cd827e790a
commit
8d4916df84
5 changed files with 35 additions and 10 deletions
File diff suppressed because one or more lines are too long
|
@ -171,8 +171,8 @@ gst_decklink_video_format_get_type (void)
|
||||||
{GST_DECKLINK_VIDEO_FORMAT_10BIT_YUV, "bmdFormat10BitYUV", "10bit-yuv"},
|
{GST_DECKLINK_VIDEO_FORMAT_10BIT_YUV, "bmdFormat10BitYUV", "10bit-yuv"},
|
||||||
{GST_DECKLINK_VIDEO_FORMAT_8BIT_ARGB, "bmdFormat8BitARGB", "8bit-argb"},
|
{GST_DECKLINK_VIDEO_FORMAT_8BIT_ARGB, "bmdFormat8BitARGB", "8bit-argb"},
|
||||||
{GST_DECKLINK_VIDEO_FORMAT_8BIT_BGRA, "bmdFormat8BitBGRA", "8bit-bgra"},
|
{GST_DECKLINK_VIDEO_FORMAT_8BIT_BGRA, "bmdFormat8BitBGRA", "8bit-bgra"},
|
||||||
|
{GST_DECKLINK_VIDEO_FORMAT_10BIT_RGB, "bmdFormat10BitRGB", "10bit-rgb"},
|
||||||
/* Not yet supported:
|
/* Not yet supported:
|
||||||
{GST_DECKLINK_VIDEO_FORMAT_10BIT_RGB, "bmdFormat10BitRGB", "10bit-rgb"},
|
|
||||||
{GST_DECKLINK_VIDEO_FORMAT_12BIT_RGB, "bmdFormat12BitRGB", "12bit-rgb"},
|
{GST_DECKLINK_VIDEO_FORMAT_12BIT_RGB, "bmdFormat12BitRGB", "12bit-rgb"},
|
||||||
{GST_DECKLINK_VIDEO_FORMAT_12BIT_RGBLE, "bmdFormat12BitRGBLE", "12bit-rgble"},
|
{GST_DECKLINK_VIDEO_FORMAT_12BIT_RGBLE, "bmdFormat12BitRGBLE", "12bit-rgble"},
|
||||||
{GST_DECKLINK_VIDEO_FORMAT_10BIT_RGBXLE, "bmdFormat10BitRGBXLE", "10bit-rgbxle"},
|
{GST_DECKLINK_VIDEO_FORMAT_10BIT_RGBXLE, "bmdFormat10BitRGBXLE", "10bit-rgbxle"},
|
||||||
|
@ -455,8 +455,8 @@ static const struct
|
||||||
{bmdFormat10BitYUV, 4, GST_VIDEO_FORMAT_v210},
|
{bmdFormat10BitYUV, 4, GST_VIDEO_FORMAT_v210},
|
||||||
{bmdFormat8BitARGB, 4, GST_VIDEO_FORMAT_ARGB},
|
{bmdFormat8BitARGB, 4, GST_VIDEO_FORMAT_ARGB},
|
||||||
{bmdFormat8BitBGRA, 4, GST_VIDEO_FORMAT_BGRA},
|
{bmdFormat8BitBGRA, 4, GST_VIDEO_FORMAT_BGRA},
|
||||||
|
{bmdFormat10BitRGB, 4, GST_VIDEO_FORMAT_r210},
|
||||||
/* Not yet supported
|
/* Not yet supported
|
||||||
{bmdFormat10BitRGB, FIXME, FIXME},
|
|
||||||
{bmdFormat12BitRGB, FIXME, FIXME},
|
{bmdFormat12BitRGB, FIXME, FIXME},
|
||||||
{bmdFormat12BitRGBLE, FIXME, FIXME},
|
{bmdFormat12BitRGBLE, FIXME, FIXME},
|
||||||
{bmdFormat10BitRGBXLE, FIXME, FIXME},
|
{bmdFormat10BitRGBXLE, FIXME, FIXME},
|
||||||
|
@ -881,6 +881,8 @@ gst_decklink_mode_get_structure (GstDecklinkModeEnum e, BMDPixelFormat f,
|
||||||
gst_structure_set (s, "format", G_TYPE_STRING, "BGRA", NULL);
|
gst_structure_set (s, "format", G_TYPE_STRING, "BGRA", NULL);
|
||||||
break;
|
break;
|
||||||
case bmdFormat10BitRGB: /* 'r210' Big-endian RGB 10-bit per component with SMPTE video levels (64-960). Packed as 2:10:10:10 */
|
case bmdFormat10BitRGB: /* 'r210' Big-endian RGB 10-bit per component with SMPTE video levels (64-960). Packed as 2:10:10:10 */
|
||||||
|
gst_structure_set (s, "format", G_TYPE_STRING, "r210", NULL);
|
||||||
|
break;
|
||||||
case bmdFormat12BitRGB: /* 'R12B' Big-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component */
|
case bmdFormat12BitRGB: /* 'R12B' Big-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component */
|
||||||
case bmdFormat12BitRGBLE: /* 'R12L' Little-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component */
|
case bmdFormat12BitRGBLE: /* 'R12L' Little-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component */
|
||||||
case bmdFormat10BitRGBXLE: /* 'R10l' Little-endian 10-bit RGB with SMPTE video levels (64-940) */
|
case bmdFormat10BitRGBXLE: /* 'R10l' Little-endian 10-bit RGB with SMPTE video levels (64-940) */
|
||||||
|
@ -1108,13 +1110,18 @@ public:
|
||||||
GST_INFO ("Video input format changed");
|
GST_INFO ("Video input format changed");
|
||||||
|
|
||||||
/* Detect input format */
|
/* Detect input format */
|
||||||
if ((formatFlags & bmdDetectedVideoInputRGB444)
|
if (formatFlags & bmdDetectedVideoInputRGB444) {
|
||||||
&& (formatFlags & bmdDetectedVideoInput8BitDepth)) {
|
if (formatFlags & bmdDetectedVideoInput10BitDepth) {
|
||||||
/* Cannot detect ARGB vs BGRA, so assume ARGB unless user sets BGRA */
|
pixelFormat = bmdFormat10BitRGB;
|
||||||
if (m_input->format == bmdFormat8BitBGRA) {
|
} else if (formatFlags & bmdDetectedVideoInput8BitDepth) {
|
||||||
pixelFormat = bmdFormat8BitBGRA;
|
/* Cannot detect ARGB vs BGRA, so assume ARGB unless user sets BGRA */
|
||||||
|
if (m_input->format == bmdFormat8BitBGRA) {
|
||||||
|
pixelFormat = bmdFormat8BitBGRA;
|
||||||
|
} else {
|
||||||
|
pixelFormat = bmdFormat8BitARGB;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pixelFormat = bmdFormat8BitARGB;
|
GST_ERROR ("Not implemented depth");
|
||||||
}
|
}
|
||||||
} else if (formatFlags & bmdDetectedVideoInputYCbCr422) {
|
} else if (formatFlags & bmdDetectedVideoInputYCbCr422) {
|
||||||
if (formatFlags & bmdDetectedVideoInput10BitDepth) {
|
if (formatFlags & bmdDetectedVideoInput10BitDepth) {
|
||||||
|
|
|
@ -303,11 +303,20 @@ typedef enum {
|
||||||
GST_DECKLINK_VIDEO_FORMAT_10BIT_YUV, /* bmdFormat10BitYUV */
|
GST_DECKLINK_VIDEO_FORMAT_10BIT_YUV, /* bmdFormat10BitYUV */
|
||||||
GST_DECKLINK_VIDEO_FORMAT_8BIT_ARGB, /* bmdFormat8BitARGB */
|
GST_DECKLINK_VIDEO_FORMAT_8BIT_ARGB, /* bmdFormat8BitARGB */
|
||||||
GST_DECKLINK_VIDEO_FORMAT_8BIT_BGRA, /* bmdFormat8BitBGRA */
|
GST_DECKLINK_VIDEO_FORMAT_8BIT_BGRA, /* bmdFormat8BitBGRA */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstDecklinkVideoFormat::10bit-rgb:
|
||||||
|
*
|
||||||
|
* Since: 1.22.2
|
||||||
|
*/
|
||||||
GST_DECKLINK_VIDEO_FORMAT_10BIT_RGB, /* bmdFormat10BitRGB */
|
GST_DECKLINK_VIDEO_FORMAT_10BIT_RGB, /* bmdFormat10BitRGB */
|
||||||
|
/* Not yet supported */
|
||||||
|
#if 0
|
||||||
GST_DECKLINK_VIDEO_FORMAT_12BIT_RGB, /* bmdFormat12BitRGB */
|
GST_DECKLINK_VIDEO_FORMAT_12BIT_RGB, /* bmdFormat12BitRGB */
|
||||||
GST_DECKLINK_VIDEO_FORMAT_12BIT_RGBLE, /* bmdFormat12BitRGBLE */
|
GST_DECKLINK_VIDEO_FORMAT_12BIT_RGBLE, /* bmdFormat12BitRGBLE */
|
||||||
GST_DECKLINK_VIDEO_FORMAT_10BIT_RGBXLE, /* bmdFormat10BitRGBXLE */
|
GST_DECKLINK_VIDEO_FORMAT_10BIT_RGBXLE, /* bmdFormat10BitRGBXLE */
|
||||||
GST_DECKLINK_VIDEO_FORMAT_10BIT_RGBX, /* bmdFormat10BitRGBX */
|
GST_DECKLINK_VIDEO_FORMAT_10BIT_RGBX, /* bmdFormat10BitRGBX */
|
||||||
|
#endif
|
||||||
} GstDecklinkVideoFormat;
|
} GstDecklinkVideoFormat;
|
||||||
#define GST_TYPE_DECKLINK_VIDEO_FORMAT (gst_decklink_video_format_get_type ())
|
#define GST_TYPE_DECKLINK_VIDEO_FORMAT (gst_decklink_video_format_get_type ())
|
||||||
GType gst_decklink_video_format_get_type (void);
|
GType gst_decklink_video_format_get_type (void);
|
||||||
|
|
|
@ -387,6 +387,8 @@ public:
|
||||||
return bmdFormat8BitARGB;
|
return bmdFormat8BitARGB;
|
||||||
case GST_VIDEO_FORMAT_BGRA:
|
case GST_VIDEO_FORMAT_BGRA:
|
||||||
return bmdFormat8BitBGRA;
|
return bmdFormat8BitBGRA;
|
||||||
|
case GST_VIDEO_FORMAT_r210:
|
||||||
|
return bmdFormat10BitRGB;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
@ -776,6 +778,7 @@ gst_decklink_video_sink_set_property (GObject * object, guint property_id,
|
||||||
case GST_DECKLINK_VIDEO_FORMAT_10BIT_YUV:
|
case GST_DECKLINK_VIDEO_FORMAT_10BIT_YUV:
|
||||||
case GST_DECKLINK_VIDEO_FORMAT_8BIT_ARGB:
|
case GST_DECKLINK_VIDEO_FORMAT_8BIT_ARGB:
|
||||||
case GST_DECKLINK_VIDEO_FORMAT_8BIT_BGRA:
|
case GST_DECKLINK_VIDEO_FORMAT_8BIT_BGRA:
|
||||||
|
case GST_DECKLINK_VIDEO_FORMAT_10BIT_RGB:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GST_ELEMENT_WARNING (GST_ELEMENT (self), CORE, NOT_IMPLEMENTED,
|
GST_ELEMENT_WARNING (GST_ELEMENT (self), CORE, NOT_IMPLEMENTED,
|
||||||
|
|
|
@ -483,6 +483,7 @@ gst_decklink_video_src_set_property (GObject * object, guint property_id,
|
||||||
switch (self->video_format) {
|
switch (self->video_format) {
|
||||||
case GST_DECKLINK_VIDEO_FORMAT_8BIT_YUV:
|
case GST_DECKLINK_VIDEO_FORMAT_8BIT_YUV:
|
||||||
case GST_DECKLINK_VIDEO_FORMAT_10BIT_YUV:
|
case GST_DECKLINK_VIDEO_FORMAT_10BIT_YUV:
|
||||||
|
case GST_DECKLINK_VIDEO_FORMAT_10BIT_RGB:
|
||||||
case GST_DECKLINK_VIDEO_FORMAT_8BIT_ARGB:
|
case GST_DECKLINK_VIDEO_FORMAT_8BIT_ARGB:
|
||||||
case GST_DECKLINK_VIDEO_FORMAT_8BIT_BGRA:
|
case GST_DECKLINK_VIDEO_FORMAT_8BIT_BGRA:
|
||||||
self->caps_format =
|
self->caps_format =
|
||||||
|
|
Loading…
Reference in a new issue