osxvideosink: fix support in VM's without hardware acceleration
authorAndoni Morales Alastruey <ylatuya@gmail.com>
Wed, 5 Jun 2013 15:02:49 +0000 (17:02 +0200)
committerAndoni Morales Alastruey <ylatuya@gmail.com>
Tue, 18 Jun 2013 08:41:37 +0000 (10:41 +0200)
sys/osxvideo/cocoawindow.m
sys/osxvideo/osxvideosink.m

index a3b2798..0491ab9 100644 (file)
@@ -379,7 +379,6 @@ const gchar* gst_keycode_to_keyname(gint16 keycode)
 - (id) initWithFrame:(NSRect) frame {
   NSOpenGLPixelFormat *fmt;
   NSOpenGLPixelFormatAttribute attribs[] = {
-    NSOpenGLPFAAccelerated,
     NSOpenGLPFANoRecovery,
     NSOpenGLPFADoubleBuffer,
     NSOpenGLPFAColorSize, 24,
index f235c8b..c75c681 100644 (file)
@@ -867,9 +867,14 @@ gst_osx_video_sink_get_type (void)
     gst_buffer_map (buf, &info, GST_MAP_READ);
     viewdata = (guint8 *) [osxvideosink->osxwindow->gstview getTextureBuffer];
 
-    memcpy (viewdata, info.data, info.size);
-    [osxvideosink->osxwindow->gstview displayTexture];
-    gst_buffer_unmap (buf, &info);
+    if (G_UNLIKELY (viewdata == NULL)) {
+      GST_ELEMENT_ERROR (osxvideosink, RESOURCE, WRITE,
+        ("Could not get a texture buffer"), (NULL));
+    } else {
+      memcpy (viewdata, info.data, info.size);
+      [osxvideosink->osxwindow->gstview displayTexture];
+      gst_buffer_unmap (buf, &info);
+    }
   }
 
   [object release];