video: allow frame copy where destination dimensions are smaller than source
authorAaron Boxer <boxerab@gmail.com>
Mon, 15 Jun 2020 13:46:17 +0000 (09:46 -0400)
committerAaron Boxer <boxerab@gmail.com>
Mon, 15 Jun 2020 13:46:17 +0000 (09:46 -0400)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/695>

gst-libs/gst/video/video-frame.c

index 6cef04a..05a1e97 100644 (file)
@@ -286,6 +286,9 @@ gst_video_frame_unmap (GstVideoFrame * frame)
  *
  * Copy the plane with index @plane from @src to @dest.
  *
+ * Note: Since: 1.18, @dest dimensions are allowed to be
+ * smaller than @src dimensions.
+ *
  * Returns: TRUE if the contents could be copied.
  */
 gboolean
@@ -309,8 +312,8 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src,
 
   finfo = dinfo->finfo;
 
-  g_return_val_if_fail (dinfo->width == sinfo->width
-      && dinfo->height == sinfo->height, FALSE);
+  g_return_val_if_fail (dinfo->width <= sinfo->width
+      && dinfo->height <= sinfo->height, FALSE);
   g_return_val_if_fail (finfo->n_planes > plane, FALSE);
 
   sp = src->data[plane];