[Pkg-gstreamer-commits] [gstreamer-vaapi] 75/176: plugins: factor out construction of GValue from GstVideoFormat.
Vincent Cheng
vcheng at moszumanska.debian.org
Tue Jun 3 08:09:29 UTC 2014
This is an automated email from the git hooks/post-receive script.
vcheng pushed a commit to branch upstream
in repository gstreamer-vaapi.
commit 528b5adc5a488cf3175b5334062bf18bb91a77e1
Author: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
Date: Sat Dec 21 06:41:34 2013 +0100
plugins: factor out construction of GValue from GstVideoFormat.
Add new helper functions to build GValues from GstVideoFormat:
- gst_vaapi_value_set_format():
build a GValue from the supplied video format
- gst_vaapi_value_set_format_list():
build a GValue list from the supplied array of video formats
---
gst/vaapi/gstvaapipluginutil.c | 43 +++++++++++++++++++++++++++++++++
gst/vaapi/gstvaapipluginutil.h | 9 +++++++
gst/vaapi/gstvaapipostproc.c | 54 +++++-------------------------------------
3 files changed, 58 insertions(+), 48 deletions(-)
diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c
index 33b74da..c4652b8 100644
--- a/gst/vaapi/gstvaapipluginutil.c
+++ b/gst/vaapi/gstvaapipluginutil.c
@@ -362,6 +362,49 @@ gst_vaapi_apply_composition (GstVaapiSurface * surface, GstBuffer * buffer)
}
gboolean
+gst_vaapi_value_set_format (GValue * value, GstVideoFormat format)
+{
+#if GST_CHECK_VERSION(1,0,0)
+ const gchar *str;
+
+ str = gst_video_format_to_string (format);
+ if (!str)
+ return FALSE;
+
+ g_value_init (value, G_TYPE_STRING);
+ g_value_set_string (value, str);
+#else
+ guint32 fourcc;
+
+ fourcc = gst_video_format_to_fourcc (format);
+ if (!fourcc)
+ return FALSE;
+
+ g_value_init (value, GST_TYPE_FOURCC);
+ gst_value_set_fourcc (value, fourcc);
+#endif
+ return TRUE;
+}
+
+gboolean
+gst_vaapi_value_set_format_list (GValue * value, GArray * formats)
+{
+ GValue v_format = G_VALUE_INIT;
+ guint i;
+
+ g_value_init (value, GST_TYPE_LIST);
+ for (i = 0; i < formats->len; i++) {
+ GstVideoFormat const format = g_array_index (formats, GstVideoFormat, i);
+
+ if (!gst_vaapi_value_set_format (&v_format, format))
+ continue;
+ gst_value_list_append_value (value, &v_format);
+ g_value_unset (&v_format);
+ }
+ return TRUE;
+}
+
+gboolean
gst_caps_set_interlaced (GstCaps * caps, GstVideoInfo * vip)
{
#if GST_CHECK_VERSION(1,0,0)
diff --git a/gst/vaapi/gstvaapipluginutil.h b/gst/vaapi/gstvaapipluginutil.h
index 31db3e4..3d04588 100644
--- a/gst/vaapi/gstvaapipluginutil.h
+++ b/gst/vaapi/gstvaapipluginutil.h
@@ -55,6 +55,15 @@ gst_vaapi_apply_composition (GstVaapiSurface * surface, GstBuffer * buffer);
} while (0)
#endif
+/* Helpers for GValue construction for video formats */
+G_GNUC_INTERNAL
+gboolean
+gst_vaapi_value_set_format (GValue * value, GstVideoFormat format);
+
+G_GNUC_INTERNAL
+gboolean
+gst_vaapi_value_set_format_list (GValue * value, GArray * formats);
+
/* Helpers to handle interlaced contents */
#if GST_CHECK_VERSION(1,0,0)
# define GST_CAPS_INTERLACED_MODES \
diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c
index 58fff7a..d84ca3c 100644
--- a/gst/vaapi/gstvaapipostproc.c
+++ b/gst/vaapi/gstvaapipostproc.c
@@ -826,57 +826,11 @@ ensure_allowed_sinkpad_caps(GstVaapiPostproc *postproc)
return TRUE;
}
-/* Build list of supported formats */
-static gboolean
-build_format_list_value(GArray *formats, GValue *out_value)
-{
- GValue v_format = { 0, };
- guint i;
-#if GST_CHECK_VERSION(1,0,0)
- const gchar *str;
-
- g_value_init(out_value, GST_TYPE_LIST);
-
- g_value_init(&v_format, G_TYPE_STRING);
- g_value_set_string(&v_format, "encoded");
- gst_value_list_append_value(out_value, &v_format);
-
- for (i = 0; i < formats->len; i++) {
- GstVideoFormat const format =
- g_array_index(formats, GstVideoFormat, i);
-
- str = gst_vaapi_video_format_to_string(format);
- if (!str)
- continue;
- g_value_set_string(&v_format, str);
- gst_value_list_append_value(out_value, &v_format);
- }
-#else
- guint32 fourcc;
-
- g_value_init(out_value, GST_TYPE_LIST);
- g_value_init(&v_format, GST_TYPE_FOURCC);
- for (i = 0; i < formats->len; i++) {
- GstVideoFormat const format =
- g_array_index(formats, GstVideoFormat, i);
-
- fourcc = gst_video_format_to_fourcc(format);
- if (!fourcc)
- continue;
- gst_value_set_fourcc(&v_format, fourcc);
- gst_value_list_append_value(out_value, &v_format);
- }
-#endif
-
- g_value_unset(&v_format);
- return TRUE;
-}
-
/* Fixup output caps so that to reflect the supported set of pixel formats */
static GstCaps *
expand_allowed_srcpad_caps(GstVaapiPostproc *postproc, GstCaps *caps)
{
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT, v_format = G_VALUE_INIT;
guint i, num_structures;
gboolean had_filter;
@@ -887,8 +841,12 @@ expand_allowed_srcpad_caps(GstVaapiPostproc *postproc, GstCaps *caps)
goto cleanup;
/* Reset "format" field for each structure */
- if (!build_format_list_value(postproc->filter_formats, &value))
+ if (!gst_vaapi_value_set_format_list(&value, postproc->filter_formats))
goto cleanup;
+ if (gst_vaapi_value_set_format(&v_format, GST_VIDEO_FORMAT_ENCODED)) {
+ gst_value_list_prepend_value(&value, &v_format);
+ g_value_unset(&v_format);
+ }
num_structures = gst_caps_get_size(caps);
for (i = 0; i < num_structures; i++) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gstreamer/gstreamer-vaapi.git
More information about the Pkg-gstreamer-commits
mailing list