gl/download: fixup YUY2/UYVY download
authorMatthew Waters <ystreet00@gmail.com>
Wed, 21 May 2014 10:36:37 +0000 (20:36 +1000)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:31:41 +0000 (19:31 +0000)
Regression from 2da979831ec3b1a8d993eb6f2d3999c5810c4d67 as it did
not update the download code to reflect the change in texture format.

gst-libs/gst/gl/gstgldownload.c

index bef1e9e..d8aadf3 100644 (file)
@@ -245,8 +245,18 @@ _gst_gl_download_perform_with_data_unlocked (GstGLDownload * download,
   download->in_tex[0]->tex_id = texture_id;
 
   if (!download->out_tex[0]) {
-    gst_gl_memory_setup_wrapped (download->context, &download->info,
-        data, download->out_tex);
+    if (GST_VIDEO_INFO_FORMAT (&download->info) == GST_VIDEO_FORMAT_YUY2
+        || GST_VIDEO_INFO_FORMAT (&download->info) == GST_VIDEO_FORMAT_UYVY) {
+      download->out_tex[0] = gst_gl_memory_wrapped (download->context,
+          GST_VIDEO_GL_TEXTURE_TYPE_RGBA,
+          GST_VIDEO_INFO_COMP_WIDTH (&download->info, 1),
+          GST_VIDEO_INFO_HEIGHT (&download->info),
+          GST_VIDEO_INFO_PLANE_STRIDE (&download->info, 0), data[0], NULL,
+          NULL);
+    } else {
+      gst_gl_memory_setup_wrapped (download->context, &download->info,
+          data, download->out_tex);
+    }
   }
 
   for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&download->info); i++) {