video: allow frame copy destination to have dimensions smaller than source
authorAaron Boxer <aaron.boxer@collabora.com>
Tue, 16 Jun 2020 15:44:08 +0000 (11:44 -0400)
committerNicolas Dufresne <nicolas@ndufresne.ca>
Tue, 14 Jul 2020 16:39:05 +0000 (16:39 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/707>

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

index 05a1e97..74b548d 100644 (file)
@@ -398,6 +398,9 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src,
  *
  * Copy the contents 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
@@ -414,8 +417,8 @@ gst_video_frame_copy (GstVideoFrame * dest, const GstVideoFrame * src)
   dinfo = &dest->info;
 
   g_return_val_if_fail (dinfo->finfo->format == sinfo->finfo->format, FALSE);
-  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);
 
   n_planes = dinfo->finfo->n_planes;