diff options
Diffstat (limited to 'media-libs/gstreamer/files/gst-0.10.32-0004-Add-GstEventCrop-event.patch')
-rw-r--r-- | media-libs/gstreamer/files/gst-0.10.32-0004-Add-GstEventCrop-event.patch | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/media-libs/gstreamer/files/gst-0.10.32-0004-Add-GstEventCrop-event.patch b/media-libs/gstreamer/files/gst-0.10.32-0004-Add-GstEventCrop-event.patch new file mode 100644 index 0000000..0730dd4 --- /dev/null +++ b/media-libs/gstreamer/files/gst-0.10.32-0004-Add-GstEventCrop-event.patch @@ -0,0 +1,161 @@ +From 20378daaef4f4adb36d879879d6ab6d007a82636 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Mon, 24 May 2010 16:49:20 -0500 +Subject: [PATCH 4/5] Add GstEventCrop event + +This event can be used to set cropping / region-of-interest to take effect +on the following buffer. +--- + gst/gstevent.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + gst/gstevent.h | 11 +++++++++ + gst/gstquark.c | 2 +- + gst/gstquark.h | 5 +++- + 4 files changed, 79 insertions(+), 2 deletions(-) + +diff --git a/gst/gstevent.c b/gst/gstevent.c +index 6d2cc8b..d04df79 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}, +@@ -1231,3 +1232,65 @@ gst_event_parse_sink_message (GstEvent * event, GstMessage ** msg) + GST_MESSAGE (gst_value_dup_mini_object (gst_structure_id_get_value + (event->structure, GST_QUARK (MESSAGE)))); + } ++ ++/** ++ * 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 crop 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_crop: ++ * @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 crop 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 9568514..ae08829 100644 +--- a/gst/gstevent.h ++++ b/gst/gstevent.h +@@ -93,6 +93,10 @@ 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_CROP: An event that can set horizontal (pan/scan) and vertical ++ * (tilt/scan) offset and width/height 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 +137,7 @@ 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)), + /* upstream events */ + GST_EVENT_QOS = GST_EVENT_MAKE_TYPE (15, FLAG(UPSTREAM)), + GST_EVENT_SEEK = GST_EVENT_MAKE_TYPE (16, FLAG(UPSTREAM)), +@@ -484,6 +489,12 @@ 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); + ++/* 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.7.1 + |