diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-03-21 10:12:09 +0100 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-04-10 14:58:16 +0200 |
commit | 13ca9f382cba888c4248956a76d7179f9f953cb5 (patch) | |
tree | f0050cf74081945f8f02ba99d6724efe3baca14f /tests/test-subpicture.c | |
parent | 51151e7aa1637d23880b7c051602970d76a9a45a (diff) | |
download | gst-vaapi-13ca9f382cba888c4248956a76d7179f9f953cb5.tar.gz |
tests: add support for GStreamer 1.0.
Diffstat (limited to 'tests/test-subpicture.c')
-rw-r--r-- | tests/test-subpicture.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/test-subpicture.c b/tests/test-subpicture.c index 24482746..be1ec583 100644 --- a/tests/test-subpicture.c +++ b/tests/test-subpicture.c @@ -53,15 +53,22 @@ static GOptionEntry g_options[] = { static void upload_subpicture(GstBuffer *buffer, const VideoSubpictureInfo *subinfo) { - guint32 * const dst = (guint32 *)GST_BUFFER_DATA(buffer); const guint32 * const src = subinfo->data; guint i, len = subinfo->data_size / 4; + GstMapInfo map_info; + guint32 *dst; + + if (!gst_buffer_map(buffer, &map_info, GST_MAP_WRITE)) + return; + dst = (guint32 *)map_info.data; /* Convert from RGBA source to ARGB */ for (i = 0; i < len; i++) { const guint32 rgba = src[i]; dst[i] = (rgba >> 8) | (rgba << 24); } + + gst_buffer_unmap(buffer, &map_info); } int @@ -120,9 +127,23 @@ main(int argc, char *argv[]) subrect.height = subinfo.height; subrect.width = subinfo.width; +#if GST_CHECK_VERSION(1,0,0) + { + GstVideoMeta * const vmeta = + gst_buffer_add_video_meta(buffer, GST_VIDEO_FRAME_FLAG_NONE, + GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, + subinfo.width, subinfo.height); + if (!vmeta) + g_error("could not create video meta"); + + overlay = gst_video_overlay_rectangle_new_raw(buffer, + subrect.x, subrect.y, subrect.width, subrect.height, flags); + } +#else overlay = gst_video_overlay_rectangle_new_argb(buffer, subinfo.width, subinfo.height, subinfo.width * 4, subrect.x, subrect.y, subrect.width, subrect.height, flags); +#endif if (!overlay) g_error("could not create video overlay"); gst_buffer_unref(buffer); |