mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-02 00:32:43 +00:00
avfvideosrc: GL texture cache also supports YUY2 on macOS
BGRA gives black frames, and everything else fails to negotiate. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4134>
This commit is contained in:
parent
a8ed817d30
commit
3b9ce6cb54
1 changed files with 12 additions and 3 deletions
|
@ -1518,10 +1518,11 @@ GstCaps*
|
||||||
gst_av_capture_device_get_caps (AVCaptureDevice *device, AVCaptureVideoDataOutput *output, GstAVFVideoSourceOrientation orientation)
|
gst_av_capture_device_get_caps (AVCaptureDevice *device, AVCaptureVideoDataOutput *output, GstAVFVideoSourceOrientation orientation)
|
||||||
{
|
{
|
||||||
GstCaps *result_caps, *result_gl_caps;
|
GstCaps *result_caps, *result_gl_caps;
|
||||||
|
gboolean is_gl_format;
|
||||||
#if !HAVE_IOS
|
#if !HAVE_IOS
|
||||||
GstVideoFormat gl_format = GST_VIDEO_FORMAT_UYVY;
|
GstVideoFormat gl_formats[] = { GST_VIDEO_FORMAT_UYVY, GST_VIDEO_FORMAT_YUY2, 0 };
|
||||||
#else
|
#else
|
||||||
GstVideoFormat gl_format = GST_VIDEO_FORMAT_NV12;
|
GstVideoFormat gl_formats[] = { GST_VIDEO_FORMAT_NV12, 0 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result_caps = gst_caps_new_empty ();
|
result_caps = gst_caps_new_empty ();
|
||||||
|
@ -1564,7 +1565,15 @@ gst_av_capture_device_get_caps (AVCaptureDevice *device, AVCaptureVideoDataOutpu
|
||||||
caps = GST_AVF_FPS_RANGE_CAPS_NEW (gst_format, dimensions.width,
|
caps = GST_AVF_FPS_RANGE_CAPS_NEW (gst_format, dimensions.width,
|
||||||
dimensions.height, min_fps_n, min_fps_d, max_fps_n, max_fps_d);
|
dimensions.height, min_fps_n, min_fps_d, max_fps_n, max_fps_d);
|
||||||
|
|
||||||
if (gst_format != gl_format) {
|
is_gl_format = FALSE;
|
||||||
|
for (int i = 0; i < G_N_ELEMENTS (gl_formats); i++) {
|
||||||
|
if (gst_format == gl_formats[i]) {
|
||||||
|
is_gl_format = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_gl_format) {
|
||||||
gst_caps_append (result_caps, caps);
|
gst_caps_append (result_caps, caps);
|
||||||
} else {
|
} else {
|
||||||
gst_caps_append (result_caps, gst_caps_copy (caps));
|
gst_caps_append (result_caps, gst_caps_copy (caps));
|
||||||
|
|
Loading…
Reference in a new issue