mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
video: make composition_blend() return a boolean
Not that anyone will ever check that, and it's not clear what they're supposed to do if it fails, but at least it's there.
This commit is contained in:
parent
6757afc0bc
commit
91bbfbd819
2 changed files with 12 additions and 8 deletions
|
@ -478,25 +478,26 @@ gst_video_overlay_rectangle_needs_scaling (GstVideoOverlayRectangle * r)
|
||||||
*
|
*
|
||||||
* Since: 0.10.36
|
* Since: 0.10.36
|
||||||
*/
|
*/
|
||||||
void
|
gboolean
|
||||||
gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
|
gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
|
||||||
GstBuffer * video_buf)
|
GstBuffer * video_buf)
|
||||||
{
|
{
|
||||||
GstBlendVideoFormatInfo video_info, rectangle_info;
|
GstBlendVideoFormatInfo video_info, rectangle_info;
|
||||||
GstVideoFormat fmt;
|
GstVideoFormat fmt;
|
||||||
|
gboolean ret = TRUE;
|
||||||
guint n, num;
|
guint n, num;
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_VIDEO_OVERLAY_COMPOSITION (comp));
|
g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_COMPOSITION (comp), FALSE);
|
||||||
g_return_if_fail (GST_IS_BUFFER (video_buf));
|
g_return_val_if_fail (GST_IS_BUFFER (video_buf), FALSE);
|
||||||
g_return_if_fail (gst_buffer_is_writable (video_buf));
|
g_return_val_if_fail (gst_buffer_is_writable (video_buf), FALSE);
|
||||||
g_return_if_fail (GST_BUFFER_CAPS (video_buf) != NULL);
|
g_return_val_if_fail (GST_BUFFER_CAPS (video_buf) != NULL, FALSE);
|
||||||
|
|
||||||
if (!gst_video_format_parse_caps (GST_BUFFER_CAPS (video_buf), &fmt, &w, &h)) {
|
if (!gst_video_format_parse_caps (GST_BUFFER_CAPS (video_buf), &fmt, &w, &h)) {
|
||||||
gchar *str = gst_caps_to_string (GST_BUFFER_CAPS (video_buf));
|
gchar *str = gst_caps_to_string (GST_BUFFER_CAPS (video_buf));
|
||||||
g_warning ("%s: could not parse video buffer caps '%s'", GST_FUNCTION, str);
|
g_warning ("%s: could not parse video buffer caps '%s'", GST_FUNCTION, str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
video_blend_format_info_init (&video_info, GST_BUFFER_DATA (video_buf),
|
video_blend_format_info_init (&video_info, GST_BUFFER_DATA (video_buf),
|
||||||
|
@ -525,7 +526,8 @@ gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
|
||||||
rect->render_width);
|
rect->render_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!video_blend (&video_info, &rectangle_info, rect->x, rect->y)) {
|
ret = video_blend (&video_info, &rectangle_info, rect->x, rect->y);
|
||||||
|
if (!ret) {
|
||||||
GST_WARNING ("Could not blend overlay rectangle onto video buffer");
|
GST_WARNING ("Could not blend overlay rectangle onto video buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,6 +535,8 @@ gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
|
||||||
if (needs_scaling)
|
if (needs_scaling)
|
||||||
g_free (rectangle_info.pixels);
|
g_free (rectangle_info.pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -220,7 +220,7 @@ guint gst_video_overlay_composition_get_seqnum (GstVid
|
||||||
|
|
||||||
/* blend composition onto raw video buffer */
|
/* blend composition onto raw video buffer */
|
||||||
|
|
||||||
void gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
|
gboolean gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
|
||||||
GstBuffer * video_buf);
|
GstBuffer * video_buf);
|
||||||
|
|
||||||
/* attach/retrieve composition from buffers */
|
/* attach/retrieve composition from buffers */
|
||||||
|
|
Loading…
Reference in a new issue