gdkpixbufoverlay: handle setting NULL gdkpixbuf
authorMark Nauwelaerts <mnauw@users.sourceforge.net>
Sat, 7 Jan 2017 19:11:13 +0000 (20:11 +0100)
committerMark Nauwelaerts <mnauw@users.sourceforge.net>
Sun, 22 Jan 2017 09:18:27 +0000 (10:18 +0100)
... which is a clearer way to clear any current overlay, other than
fiddling with alpha or positioning properties to make it virtually go away.

ext/gdk_pixbuf/gstgdkpixbufoverlay.c

index b76509189ea0b15ab35aab133e830206e565d2d8..635dd5fe5d22dbec095184c26c3ff72a431c6002 100644 (file)
@@ -295,8 +295,13 @@ gst_gdk_pixbuf_overlay_set_property (GObject * object, guint property_id,
 
       if (overlay->pixbuf != NULL)
         g_object_unref (overlay->pixbuf);
-      overlay->pixbuf = g_object_ref (pixbuf);
-      gst_gdk_pixbuf_overlay_set_pixbuf (overlay, g_object_ref (pixbuf));
+      if (pixbuf) {
+        overlay->pixbuf = g_object_ref (pixbuf);
+        gst_gdk_pixbuf_overlay_set_pixbuf (overlay, g_object_ref (pixbuf));
+      } else {
+        overlay->pixbuf = NULL;
+        gst_buffer_replace (&overlay->pixels, NULL);
+      }
       break;
     }
     case PROP_OFFSET_X: