summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2015-12-14 12:26:01 +1100
committerMatthew Waters <matthew@centricular.com>2015-12-14 13:55:16 +1100
commit51636b451c389d8a6fb48c37934dfbc39d7b8b70 (patch)
tree503ecedda3388fb8d75e68ca9bcaac49f7ea9fbf /gst-libs
parent3591c6bfa0dec3041cf41d75ffbc86bf120737f7 (diff)
downloadgstreamer-plugins-bad-51636b451c389d8a6fb48c37934dfbc39d7b8b70.tar.gz
gl: add convenience function for the start of a video frame
Get's the start of the video frame based on a GstVideoInfo and GstVideoAlignment.
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/gl/gstglutils.c19
-rw-r--r--gst-libs/gst/gl/gstglutils.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/gst-libs/gst/gl/gstglutils.c b/gst-libs/gst/gl/gstglutils.c
index a57bbda0d..080c17b40 100644
--- a/gst-libs/gst/gl/gstglutils.c
+++ b/gst-libs/gst/gl/gstglutils.c
@@ -904,6 +904,25 @@ gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
return plane_size;
}
+/* find the difference between the start of the plane and where the video
+ * data starts in the plane */
+gsize
+gst_gl_get_plane_start (GstVideoInfo * info, GstVideoAlignment * valign,
+ guint plane)
+{
+ gsize plane_start;
+ gint i;
+
+ /* find the start of the plane data including padding */
+ plane_start = 0;
+ for (i = 0; i < plane; i++) {
+ plane_start += gst_gl_get_plane_data_size (info, valign, i);
+ }
+
+ /* offset between the plane data start and where the video frame starts */
+ return (GST_VIDEO_INFO_PLANE_OFFSET (info, plane)) - plane_start;
+}
+
GstCaps *
gst_gl_caps_replace_all_caps_features (const GstCaps * caps,
const gchar * feature_name)
diff --git a/gst-libs/gst/gl/gstglutils.h b/gst-libs/gst/gl/gstglutils.h
index ee606e061..3c8460b79 100644
--- a/gst-libs/gst/gl/gstglutils.h
+++ b/gst-libs/gst/gl/gstglutils.h
@@ -106,6 +106,8 @@ gboolean gst_gl_run_query (GstElement * element,
GstQuery * query, GstPadDirection direction);
gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
guint plane);
+gsize gst_gl_get_plane_start (GstVideoInfo * info, GstVideoAlignment * valign,
+ guint plane);
GstCaps * gst_gl_caps_replace_all_caps_features (const GstCaps * caps,
const gchar * feature_name);