gstreamer 0.10.31: add 2 more patches (crop and pad_alloc)
authorKoen Kooi <koen@openembedded.org>
Thu, 16 Dec 2010 15:16:54 +0000 (16:16 +0100)
committerKoen Kooi <koen@openembedded.org>
Thu, 16 Dec 2010 15:16:54 +0000 (16:16 +0100)
0
Signed-off-by: Koen Kooi <koen@openembedded.org>
recipes/gstreamer/gstreamer/0001-add-GstQueryBuffers-query.patch [moved from recipes/gstreamer/gstreamer/query-buffers.patch with 99% similarity]
recipes/gstreamer/gstreamer/0002-gstevent-add-crop-event.patch [new file with mode: 0644]
recipes/gstreamer/gstreamer/0003-basetransform-don-t-do-unnecessary-pad_alloc.patch [new file with mode: 0644]
recipes/gstreamer/gstreamer_0.10.31.bb

@@ -1,7 +1,7 @@
 From 45ef073f7c7748376f11ae2dea372eea6dc3a04a Mon Sep 17 00:00:00 2001
 From: Rob Clark <rob@ti.com>
 Date: Wed, 19 May 2010 15:48:09 -0500
-Subject: [PATCH] add GstQueryBuffers query
+Subject: [PATCH 1/3] add GstQueryBuffers query
 
 This query is used by buffer allocator, for example a video sink element,
 to find out any minimum buffer requirements of upstream elements that uses
diff --git a/recipes/gstreamer/gstreamer/0002-gstevent-add-crop-event.patch b/recipes/gstreamer/gstreamer/0002-gstevent-add-crop-event.patch
new file mode 100644 (file)
index 0000000..44a3f7a
--- /dev/null
@@ -0,0 +1,199 @@
+From a3f0f0da45500e89fa005bd078b2a31ce7c8b9a1 Mon Sep 17 00:00:00 2001
+From: Rob Clark <rob@ti.com>
+Date: Mon, 24 May 2010 16:49:20 -0500
+Subject: [PATCH 2/3] gstevent: add crop event
+
+This replaces vstab event, and includes width/height as well.
+
+Note vstab event remains as wrapper for crop event for now for
+compatibility.  But once other trees are updated, vstab event
+should be removed and the patch squashed with this.
+
+Signed-off-by: Daniel Diaz <ddiaz@ti.com>
+---
+ gst/gstevent.c |   92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ gst/gstevent.h |   15 +++++++++
+ gst/gstquark.c |    2 +-
+ gst/gstquark.h |    5 ++-
+ 4 files changed, 112 insertions(+), 2 deletions(-)
+
+diff --git a/gst/gstevent.c b/gst/gstevent.c
+index 3c1b0b9..96add3c 100644
+--- a/gst/gstevent.c
++++ b/gst/gstevent.c
+@@ -116,6 +116,7 @@ static GstEventQuarks event_quarks[] = {
+   {GST_EVENT_TAG, "tag", 0},
+   {GST_EVENT_BUFFERSIZE, "buffersize", 0},
+   {GST_EVENT_SINK_MESSAGE, "sink-message", 0},
++  {GST_EVENT_CROP, "crop", 0},
+   {GST_EVENT_QOS, "qos", 0},
+   {GST_EVENT_SEEK, "seek", 0},
+   {GST_EVENT_NAVIGATION, "navigation", 0},
+@@ -1236,3 +1237,94 @@ gst_event_parse_sink_message (GstEvent * event, GstMessage ** msg)
+         GST_MESSAGE (gst_value_dup_mini_object (gst_structure_id_get_value
+             (structure, GST_QUARK (MESSAGE))));
+ }
++
++/**
++ * gst_event_new_vstab:
++ * @top:  the new offset to top of sub-image
++ * @left:  the new offset to left of sub-image
++ *
++ * Create a new vstab event.
++ */
++GstEvent *
++gst_event_new_vstab (gint top, gint left)
++{
++  return gst_event_new_crop (top, left, -1, -1);
++}
++
++/**
++ * gst_event_parse_vstab:
++ * @event: The event to query
++ * @top: A pointer to store top offset in
++ * @left: A pointer to store left offset in
++ *
++ * Parse the vstab event.
++ */
++void
++gst_event_parse_vstab (GstEvent * event, gint * top, gint * left)
++{
++  gst_event_parse_crop (event, top, left, NULL, NULL);
++}
++
++/* TODO remove vstab event functions.. use crop instead.. */
++
++/**
++ * gst_event_new_crop:
++ * @top:  the new offset to top of sub-image
++ * @left:  the new offset to left of sub-image
++ * @width:  the new width
++ * @height:  the new height
++ *
++ * Create a new vstab event.
++ */
++GstEvent *
++gst_event_new_crop (gint top, gint left, gint width, gint height)
++{
++  GstEvent *event;
++  GstStructure *structure;
++
++  GST_CAT_INFO (GST_CAT_EVENT, "creating crop event: %d,%d %dx%d",
++      top, left, width, height);
++
++  structure = gst_structure_id_new (GST_QUARK (EVENT_CROP),
++      GST_QUARK (TOP), G_TYPE_INT, top,
++      GST_QUARK (LEFT), G_TYPE_INT, left,
++      GST_QUARK (WIDTH), G_TYPE_INT, width,
++      GST_QUARK (HEIGHT), G_TYPE_INT, height, NULL);
++  event = gst_event_new_custom (GST_EVENT_CROP, structure);
++
++  return event;
++}
++
++/**
++ * gst_event_parse_vstab:
++ * @event: The event to query
++ * @top: A pointer to store top offset in
++ * @left: A pointer to store left offset in
++ * @width: A pointer to store width in
++ * @height: A pointer to store height in
++ *
++ * Parse the vstab event.
++ */
++void
++gst_event_parse_crop (GstEvent * event, gint * top, gint * left,
++    gint * width, gint * height)
++{
++  const GstStructure *structure;
++
++  g_return_if_fail (GST_IS_EVENT (event));
++  g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_CROP);
++
++  structure = gst_event_get_structure (event);
++  if (top)
++    *top = g_value_get_int (gst_structure_id_get_value (structure,
++            GST_QUARK (TOP)));
++  if (left)
++    *left = g_value_get_int (gst_structure_id_get_value (structure,
++            GST_QUARK (LEFT)));
++  if (width)
++    *width = g_value_get_int (gst_structure_id_get_value (structure,
++            GST_QUARK (WIDTH)));
++  if (height)
++    *height = g_value_get_int (gst_structure_id_get_value (structure,
++            GST_QUARK (HEIGHT)));
++}
+diff --git a/gst/gstevent.h b/gst/gstevent.h
+index 7ee460d..e600e25 100644
+--- a/gst/gstevent.h
++++ b/gst/gstevent.h
+@@ -93,6 +93,9 @@ typedef enum {
+  * @GST_EVENT_SINK_MESSAGE: An event that sinks turn into a message. Used to
+  *                          send messages that should be emitted in sync with
+  *                          rendering.
++ * @GST_EVENT_VSTAB: An event that can set horizontal (pan/scan) and vertical
++ *                   (tilt/scan) offset within a larger image.  This event
++ *                   precedes the buffer to which it applies.
+  * @GST_EVENT_QOS: A quality message. Used to indicate to upstream elements
+  *                 that the downstream elements are being starved of or
+  *                 flooded with data.
+@@ -133,6 +136,8 @@ typedef enum {
+   GST_EVENT_TAG                   = GST_EVENT_MAKE_TYPE (7, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
+   GST_EVENT_BUFFERSIZE            = GST_EVENT_MAKE_TYPE (8, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
+   GST_EVENT_SINK_MESSAGE          = GST_EVENT_MAKE_TYPE (9, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
++  GST_EVENT_CROP                  = GST_EVENT_MAKE_TYPE (10, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
++  GST_EVENT_VSTAB                 = GST_EVENT_CROP,
+   /* upstream events */
+   GST_EVENT_QOS                   = GST_EVENT_MAKE_TYPE (15, FLAG(UPSTREAM)),
+   GST_EVENT_SEEK                  = GST_EVENT_MAKE_TYPE (16, FLAG(UPSTREAM)),
+@@ -483,6 +488,16 @@ GstEvent*       gst_event_new_step              (GstFormat format, guint64 amoun
+ void            gst_event_parse_step            (GstEvent *event, GstFormat *format, guint64 *amount,
+                                                  gdouble *rate, gboolean *flush, gboolean *intermediate);
++/* vstab event */
++GstEvent *      gst_event_new_vstab             (gint top, gint left);
++void            gst_event_parse_vstab           (GstEvent * event, gint * top, gint * left);
++
++/* crop event */
++GstEvent *      gst_event_new_crop              (gint top, gint left, gint width, gint height);
++void            gst_event_parse_crop            (GstEvent * event, gint * top, gint * left,
++                                                 gint * width, gint * height);
++
++
+ G_END_DECLS
+ #endif /* __GST_EVENT_H__ */
+diff --git a/gst/gstquark.c b/gst/gstquark.c
+index 58badca..f8716cc 100644
+--- a/gst/gstquark.c
++++ b/gst/gstquark.c
+@@ -50,7 +50,7 @@ static const gchar *_quark_strings[] = {
+   "intermediate", "GstMessageStepStart", "active", "eos", "sink-message",
+   "message", "GstMessageQOS", "running-time", "stream-time", "jitter",
+   "quality", "processed", "dropped", "buffering-ranges", "GstQueryBuffers",
+-  "caps", "count", "width", "height"
++  "caps", "count", "width", "height", "GstEventCrop", "top", "left"
+ };
+ GQuark _priv_gst_quark_table[GST_QUARK_MAX];
+diff --git a/gst/gstquark.h b/gst/gstquark.h
+index f4c8e0f..6eeb77f 100644
+--- a/gst/gstquark.h
++++ b/gst/gstquark.h
+@@ -132,8 +132,11 @@ typedef enum _GstQuarkId
+   GST_QUARK_COUNT = 103,
+   GST_QUARK_WIDTH = 104,
+   GST_QUARK_HEIGHT = 105,
++  GST_QUARK_EVENT_CROP = 106,
++  GST_QUARK_TOP = 107,
++  GST_QUARK_LEFT = 108,
+-  GST_QUARK_MAX = 106
++  GST_QUARK_MAX = 109
+ } GstQuarkId;
+ extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];
+-- 
+1.6.6.1
+
diff --git a/recipes/gstreamer/gstreamer/0003-basetransform-don-t-do-unnecessary-pad_alloc.patch b/recipes/gstreamer/gstreamer/0003-basetransform-don-t-do-unnecessary-pad_alloc.patch
new file mode 100644 (file)
index 0000000..114b908
--- /dev/null
@@ -0,0 +1,52 @@
+From 380ca4382237afe8535ab8c3c44e64adb4d73e71 Mon Sep 17 00:00:00 2001
+From: Rob Clark <rob@ti.com>
+Date: Wed, 26 May 2010 14:42:40 -0500
+Subject: [PATCH 3/3] basetransform: don't do unnecessary pad_alloc()
+
+Don't allocate a buffer in passthrough mode.
+---
+ libs/gst/base/gstbasetransform.c |   28 ++++++++++++++++++++--------
+ 1 files changed, 20 insertions(+), 8 deletions(-)
+
+diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c
+index 62731c5..dfc61a8 100644
+--- a/libs/gst/base/gstbasetransform.c
++++ b/libs/gst/base/gstbasetransform.c
+@@ -2182,14 +2182,26 @@ gst_base_transform_handle_buffer (GstBaseTransform * trans, GstBuffer * inbuf,
+ no_qos:
+-  /* first try to allocate an output buffer based on the currently negotiated
+-   * format. While we call pad-alloc we could renegotiate the srcpad format or
+-   * have a new suggestion for upstream buffer-alloc. 
+-   * In any case, outbuf will contain a buffer suitable for doing the configured
+-   * transform after this function. */
+-  ret = gst_base_transform_prepare_output_buffer (trans, inbuf, outbuf);
+-  if (G_UNLIKELY (ret != GST_FLOW_OK))
+-    goto no_buffer;
++  if (trans->passthrough) {
++    /* I'm not yet sure if we should bypass allocating output buffer in case of
++     * passthrough, or if I should override the prepare_output_buffer vmethod..
++     * I think the argument for always doing buffer allocation is to give a
++     * chance for upstream caps-renegotiation.. except I think the existing
++     * gst_base_transform_buffer_alloc() which itself does a pad_alloc() should
++     * be sufficient..
++     */
++    GST_DEBUG_OBJECT (trans, "reuse input buffer");
++    *outbuf = inbuf;
++  } else {
++    /* first try to allocate an output buffer based on the currently negotiated
++     * format. While we call pad-alloc we could renegotiate the srcpad format or
++     * have a new suggestion for upstream buffer-alloc.
++     * In any case, outbuf will contain a buffer suitable for doing the configured
++     * transform after this function. */
++    ret = gst_base_transform_prepare_output_buffer (trans, inbuf, outbuf);
++    if (G_UNLIKELY (ret != GST_FLOW_OK))
++      goto no_buffer;
++  }
+   /* now perform the needed transform */
+   if (trans->passthrough) {
+-- 
+1.6.6.1
+
index 4084e42..8b8eb77 100644 (file)
@@ -1,11 +1,15 @@
 require gstreamer.inc
 
-PR = "r1"
+PR = "r2"
 
 SRC_URI[archive.md5sum] = "a21fb08bdb578d972c7c14e77da8fbb6"
 SRC_URI[archive.sha256sum] = "7f737e6d047c1ebeb4e1e0725fc377c5d9f12ee89186de7960be3cbba709ab84"
 
-SRC_URI += "file://query-buffers.patch"
+SRC_URI += " \
+             file://0001-add-GstQueryBuffers-query.patch \
+             file://0002-gstevent-add-crop-event.patch \
+             file://0003-basetransform-don-t-do-unnecessary-pad_alloc.patch \
+"
 
 EXTRA_OECONF += "ac_cv_func_register_printf_function=no"