From 835f6d87949bac726991380030be54eb84bad2f8 Mon Sep 17 00:00:00 2001 From: Daniel Diaz Date: Fri, 14 Jan 2011 17:51:49 -0600 Subject: Add ebuild for gstreamer. This includes TI patches required for GstOpenMAX and V4L2. Signed-off-by: Daniel Diaz --- media-libs/gstreamer/Manifest | 7 + ...0.10.32-0001-gst-launch-add-loop-argument.patch | 54 +++++ ...to-make-it-possible-to-LD_PRELOAD-libttif.patch | 262 +++++++++++++++++++++ ...st-0.10.32-0003-add-GstQueryBuffers-query.patch | 258 ++++++++++++++++++++ .../gst-0.10.32-0004-Add-GstEventCrop-event.patch | 161 +++++++++++++ ...etransform-don-t-do-unnecessary-pad_alloc.patch | 52 ++++ .../gstreamer/gstreamer-0.10.32_p20110127.ebuild | 68 ++++++ 7 files changed, 862 insertions(+) create mode 100644 media-libs/gstreamer/Manifest create mode 100644 media-libs/gstreamer/files/gst-0.10.32-0001-gst-launch-add-loop-argument.patch create mode 100644 media-libs/gstreamer/files/gst-0.10.32-0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch create mode 100644 media-libs/gstreamer/files/gst-0.10.32-0003-add-GstQueryBuffers-query.patch create mode 100644 media-libs/gstreamer/files/gst-0.10.32-0004-Add-GstEventCrop-event.patch create mode 100644 media-libs/gstreamer/files/gst-0.10.32-0005-basetransform-don-t-do-unnecessary-pad_alloc.patch create mode 100644 media-libs/gstreamer/gstreamer-0.10.32_p20110127.ebuild diff --git a/media-libs/gstreamer/Manifest b/media-libs/gstreamer/Manifest new file mode 100644 index 0000000..82ecc0c --- /dev/null +++ b/media-libs/gstreamer/Manifest @@ -0,0 +1,7 @@ +AUX gst-0.10.32-0001-gst-launch-add-loop-argument.patch 2042 RMD160 13e1dbf1e7b19d2a065ad2e2e60aa35214461c02 SHA1 178ebe1b011a8bf216b9a1ea42e9f3492d6020fa SHA256 2904a8fa9c847d5608328b52ef9d76e90d9fb88161a3fd5ac07a67c7df1b6dbb +AUX gst-0.10.32-0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch 10451 RMD160 97c13f0ebf4b62615e053f37484797a3cc53df66 SHA1 235c410bc00f247ad2f6f250d5f042dcae891c49 SHA256 a6dcd34798f6b327f2681cb37ac1ef105e260f365bf50791197b43a55fa00b00 +AUX gst-0.10.32-0003-add-GstQueryBuffers-query.patch 8548 RMD160 534925365ec7d7ddcffcf72d1f5de13697b1e608 SHA1 11a7aa6257d0d301636957e5e3f946db21201fa5 SHA256 1a8daee3c8f53a7aa566384d1e327120e05aed095c15e9b34a4f9f29a971779f +AUX gst-0.10.32-0004-Add-GstEventCrop-event.patch 6061 RMD160 99498d853d4bed0cd3dffe4baa25feed743fce7e SHA1 3096b37936659c522e3f8e16d310092d7cadf666 SHA256 f6b568bb9e903d3135f88a0442be89e5376f8475e633fe7d9cb7cda7482da5a3 +AUX gst-0.10.32-0005-basetransform-don-t-do-unnecessary-pad_alloc.patch 2278 RMD160 726964b4a12f6b1fe928796e977f59019224e354 SHA1 d7d5239ecb93d353edbb67bd5aa050c91ff084b3 SHA256 e7fc825d541621980f46b3a58bc5d208c2e2facd60bdc70c0c45207c1e88cf7c +DIST gstreamer-0.10.32.tar.bz2 3529980 RMD160 447fa2b8b4c622a628763805cb65006d54919e54 SHA1 95477044ed23cf94669e56ea43607de05c2a0cb3 SHA256 3bf4e46a186ee9a1f5e212aaf651d67cffb4f5f05345a7c99ae71d5d992be133 +EBUILD gstreamer-0.10.32_p20110127.ebuild 2181 RMD160 66581f42aabf63a23753081fdf29f6111406673f SHA1 1c2f9201a7883c127d3c10e3ce0a5b05db23927b SHA256 1c64a6fd9859e1347caa039eab89034808981646477dc68eec08b1801206bb38 diff --git a/media-libs/gstreamer/files/gst-0.10.32-0001-gst-launch-add-loop-argument.patch b/media-libs/gstreamer/files/gst-0.10.32-0001-gst-launch-add-loop-argument.patch new file mode 100644 index 0000000..bc592ed --- /dev/null +++ b/media-libs/gstreamer/files/gst-0.10.32-0001-gst-launch-add-loop-argument.patch @@ -0,0 +1,54 @@ +From 23dbd4ce2e492152a4d21b8043f353d224dfe355 Mon Sep 17 00:00:00 2001 +From: Rob Clark +Date: Sat, 13 Feb 2010 15:29:13 -0600 +Subject: [PATCH 1/5] gst-launch: add --loop argument + +if --loop is specified, automatically seek to beginning of clip when EOS is received +--- + tools/gst-launch.c | 16 +++++++++++++++- + 1 files changed, 15 insertions(+), 1 deletions(-) + +diff --git a/tools/gst-launch.c b/tools/gst-launch.c +index 10b7fae..d5b17f8 100644 +--- a/tools/gst-launch.c ++++ b/tools/gst-launch.c +@@ -716,6 +716,7 @@ main (int argc, char *argv[]) + gboolean no_sigusr_handler = FALSE; + gboolean trace = FALSE; + gboolean eos_on_shutdown = FALSE; ++ gboolean loop = FALSE; + gchar *savefile = NULL; + gchar *exclude_args = NULL; + #ifndef GST_DISABLE_OPTION_PARSING +@@ -742,6 +743,8 @@ main (int argc, char *argv[]) + N_("Print alloc trace (if enabled at compile time)"), NULL}, + {"eos-on-shutdown", 'e', 0, G_OPTION_ARG_NONE, &eos_on_shutdown, + N_("Force EOS on sources before shutting the pipeline down"), NULL}, ++ {"loop", 'l', 0, G_OPTION_ARG_NONE, &loop, ++ N_("Repeat clip in loop without rebuilding pipeline"), NULL}, + GST_TOOLS_GOPTION_VERSION, + {NULL} + }; +@@ -926,7 +929,18 @@ main (int argc, char *argv[]) + } + + tfthen = gst_util_get_timestamp (); +- caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING); ++ do { ++ caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING); ++ if (loop && (caught_error == ELR_NO_ERROR)) { ++ PRINT (_("Looping ...\n")); ++ gst_element_seek (pipeline, 1.0, ++ GST_FORMAT_TIME, ++ GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, ++ GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); ++ } else { ++ break; ++ } ++ } while (TRUE); + if (eos_on_shutdown && caught_error == ELR_INTERRUPT) { + PRINT (_("EOS on shutdown enabled -- Forcing EOS on the pipeline\n")); + waiting_eos = TRUE; +-- +1.7.1 + diff --git a/media-libs/gstreamer/files/gst-0.10.32-0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch b/media-libs/gstreamer/files/gst-0.10.32-0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch new file mode 100644 index 0000000..724bd58 --- /dev/null +++ b/media-libs/gstreamer/files/gst-0.10.32-0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch @@ -0,0 +1,262 @@ +From ac55210758bdd06fe0dec6ef67a60a96a86b39f4 Mon Sep 17 00:00:00 2001 +From: Rob Clark +Date: Sun, 4 Apr 2010 09:14:34 -0500 +Subject: [PATCH 2/5] Changes to make it possible to LD_PRELOAD libttif + +1) if GST_USING_PRINTF_EXTENSION, then prepend the fmt string with "<%P> " and +pass object as a normal arg. When using TTIF, you want the whole fmt string, +including the object name prefix, to be constant. This way, only the fmt +string pointer needs to be logged. +2) GstDebugTraceLocation: small optimization to stash __FILE__, __LINE__, and +GST_FUNCTION together and pass as a single ptr.. the optimization is probably +lost in the noise with the default printf() based traces, but makes more of a +difference with faster trace systems +--- + gst/gstinfo.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++----- + gst/gstinfo.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- + 2 files changed, 123 insertions(+), 11 deletions(-) + +diff --git a/gst/gstinfo.c b/gst/gstinfo.c +index 3688120..dfa8650 100644 +--- a/gst/gstinfo.c ++++ b/gst/gstinfo.c +@@ -494,6 +494,31 @@ gst_path_basename (const gchar * file_name) + #endif + + /** ++ * gst_debug_log2: ++ * @category: category to log ++ * @level: level of the message is in ++ * @location: the file, function name, and line number of the location that ++ * emitted the message ++ * @object: the object this message relates to or NULL if none ++ * @format: a printf style format string ++ * @...: optional arguments for the format ++ * ++ * Logs the given message using the currently registered debugging handlers. ++ */ ++void ++gst_debug_log2 (GstDebugCategory * category, GstDebugLevel level, ++ const GstDebugTraceLocation * location, ++ GObject * object, const gchar * format, ...) ++{ ++ va_list var_args; ++ ++ va_start (var_args, format); ++ gst_debug_log_valist2 (category, level, location, object, format, var_args); ++ va_end (var_args); ++} ++ ++ ++/** + * gst_debug_log_valist: + * @category: category to log + * @level: level of the message is in +@@ -512,13 +537,39 @@ gst_debug_log_valist (GstDebugCategory * category, GstDebugLevel level, + const gchar * file, const gchar * function, gint line, + GObject * object, const gchar * format, va_list args) + { ++ GstDebugTraceLocation location = { ++ .file = file, ++ .function = function, ++ .line = line ++ }; ++ gst_debug_log_valist2 (category, level, &location, object, format, args); ++} ++ ++/** ++ * gst_debug_log_valist2: ++ * @category: category to log ++ * @level: level of the message is in ++ * @location: the file, function name, and line number of the location that ++ * emitted the message ++ * @object: the object this message relates to or NULL if none ++ * @format: a printf style format string ++ * @args: optional arguments for the format ++ * ++ * Logs the given message using the currently registered debugging handlers. ++ */ ++void ++gst_debug_log_valist2 (GstDebugCategory * category, GstDebugLevel level, ++ const GstDebugTraceLocation * location, ++ GObject * object, const gchar * format, va_list args) ++{ + GstDebugMessage message; + LogFuncEntry *entry; + GSList *handler; + + g_return_if_fail (category != NULL); +- g_return_if_fail (file != NULL); +- g_return_if_fail (function != NULL); ++ g_return_if_fail (location != NULL); ++ g_return_if_fail (location->file != NULL); ++ g_return_if_fail (location->function != NULL); + g_return_if_fail (format != NULL); + + /* The predefined macro __FILE__ is always the exact path given to the +@@ -536,8 +587,9 @@ gst_debug_log_valist (GstDebugCategory * category, GstDebugLevel level, + while (handler) { + entry = handler->data; + handler = g_slist_next (handler); +- entry->func (category, level, file, function, line, object, &message, +- entry->user_data); ++ // TODO: change GstLogFunction and pass GstDebugTraceLocation ptr instead.. ++ entry->func (category, level, location->file, location->function, ++ location->line, object, &message, entry->user_data); + } + g_free (message.message); + va_end (message.arguments); +@@ -610,7 +662,7 @@ gst_info_structure_to_string (GstStructure * s) + return gst_structure_to_string (s); + } + +-static gchar * ++gchar * + gst_debug_print_object (gpointer ptr) + { + GObject *object = (GObject *) ptr; +@@ -708,7 +760,7 @@ gst_debug_print_object (gpointer ptr) + + #ifdef HAVE_PRINTF_EXTENSION + +-static gchar * ++gchar * + gst_debug_print_segment (gpointer ptr) + { + GstSegment *segment = (GstSegment *) ptr; +diff --git a/gst/gstinfo.h b/gst/gstinfo.h +index 7c2d86f..24ca706 100644 +--- a/gst/gstinfo.h ++++ b/gst/gstinfo.h +@@ -177,6 +177,8 @@ struct _GstDebugCategory { + + const gchar * name; + const gchar * description; ++ ++ void *ext; /**< for use by LD_PRELOADED trace extension */ + }; + + /********** some convenience macros for debugging **********/ +@@ -260,6 +262,14 @@ typedef void (*GstLogFunction) (GstDebugCategory * category, + /* FIXME 0.11: move this into private headers */ + void _gst_debug_init (void); + ++typedef struct { ++ const gchar *file; ++ const gchar *function; ++ const gint line; ++} GstDebugTraceLocation; ++ ++#define GST_DEBUG_TRACE_LOCATION() \ ++ { __FILE__, GST_FUNCTION, __LINE__ } + + #ifdef GST_USING_PRINTF_EXTENSION + +@@ -273,6 +283,13 @@ void gst_debug_log (GstDebugCategory * category, + const gchar * format, + ...) G_GNUC_NO_INSTRUMENT; + ++void gst_debug_log2 (GstDebugCategory * category, ++ GstDebugLevel level, ++ const GstDebugTraceLocation *location, ++ GObject * object, ++ const gchar * format, ++ ...) G_GNUC_NO_INSTRUMENT; ++ + #else /* GST_USING_PRINTF_EXTENSION */ + + void gst_debug_log (GstDebugCategory * category, +@@ -284,6 +301,13 @@ void gst_debug_log (GstDebugCategory * category, + const gchar * format, + ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT; + ++void gst_debug_log2 (GstDebugCategory * category, ++ GstDebugLevel level, ++ const GstDebugTraceLocation *location, ++ GObject * object, ++ const gchar * format, ++ ...) G_GNUC_PRINTF (5, 6) G_GNUC_NO_INSTRUMENT; ++ + #endif /* GST_USING_PRINTF_EXTENSION */ + + void gst_debug_log_valist (GstDebugCategory * category, +@@ -321,8 +345,21 @@ G_CONST_RETURN gchar * + _gst_debug_nameof_funcptr (GstDebugFuncPtr func) G_GNUC_NO_INSTRUMENT; + + ++void gst_debug_log_valist2 (GstDebugCategory * category, ++ GstDebugLevel level, ++ const GstDebugTraceLocation *location, ++ GObject * object, ++ const gchar * format, ++ va_list args) G_GNUC_NO_INSTRUMENT; ++ + const gchar * gst_debug_message_get (GstDebugMessage * message); + ++gchar * gst_debug_print_object (gpointer ptr); ++ ++#ifdef HAVE_PRINTF_EXTENSION ++gchar * gst_debug_print_segment (gpointer ptr); ++#endif ++ + void gst_debug_log_default (GstDebugCategory * category, + GstDebugLevel level, + const gchar * file, +@@ -495,19 +532,41 @@ GST_EXPORT GstDebugLevel __gst_debug_min; + * debugging messages. You will probably want to use one of the ones described + * below. + */ ++#if defined(GST_USING_PRINTF_EXTENSION) && defined(G_HAVE_GNUC_VARARGS) ++#define GST_CAT_LEVEL_LOG_obj(cat,level,object,str,args...) G_STMT_START{ \ ++ if (G_UNLIKELY (level <= __gst_debug_min)) { \ ++ const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION(); \ ++ gst_debug_log2 ((cat), (level), &loc, NULL, "%"GST_PTR_FORMAT" "str, \ ++ (object), ##args ); \ ++ } \ ++}G_STMT_END ++#define GST_CAT_LEVEL_LOG_noobj(cat,level,object,str,args...) G_STMT_START{\ ++ if (G_UNLIKELY (level <= __gst_debug_min)) { \ ++ const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION(); \ ++ gst_debug_log2 ((cat), (level), &loc, NULL, (str), ##args ); \ ++ } \ ++}G_STMT_END ++#else ++# define GST_CAT_LEVEL_LOG_obj GST_CAT_LEVEL_LOG ++# define GST_CAT_LEVEL_LOG_noobj GST_CAT_LEVEL_LOG ++#endif ++ ++ + #ifdef G_HAVE_ISO_VARARGS + #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \ +- if (G_UNLIKELY (level <= __gst_debug_min)) { \ +- gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \ +- (GObject *) (object), __VA_ARGS__); \ ++ if (G_UNLIKELY (level <= __gst_debug_min)) { \ ++ const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION(); \ ++ gst_debug_log2 ((cat), (level), &loc, (GObject *) (object), \ ++ __VA_ARGS__); \ + } \ + }G_STMT_END + #else /* G_HAVE_GNUC_VARARGS */ + #ifdef G_HAVE_GNUC_VARARGS + #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \ + if (G_UNLIKELY (level <= __gst_debug_min)) { \ +- gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \ +- (GObject *) (object), ##args ); \ ++ const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION(); \ ++ gst_debug_log2 ((cat), (level), &loc, (GObject *) (object), \ ++ ##args ); \ + } \ + }G_STMT_END + #else /* no variadic macros, use inline */ +@@ -1244,6 +1303,7 @@ GST_TRACE (const char *format, ...) + + #if defined(__GNUC__) && __GNUC__ >= 3 + # pragma GCC poison gst_debug_log ++# pragma GCC poison gst_debug_log2 + # pragma GCC poison gst_debug_log_valist + # pragma GCC poison _gst_debug_category_new + #endif +-- +1.7.1 + diff --git a/media-libs/gstreamer/files/gst-0.10.32-0003-add-GstQueryBuffers-query.patch b/media-libs/gstreamer/files/gst-0.10.32-0003-add-GstQueryBuffers-query.patch new file mode 100644 index 0000000..4c54083 --- /dev/null +++ b/media-libs/gstreamer/files/gst-0.10.32-0003-add-GstQueryBuffers-query.patch @@ -0,0 +1,258 @@ +From 7f071cf72491a9f60c886f4779c7d14d924bc43d Mon Sep 17 00:00:00 2001 +From: Rob Clark +Date: Wed, 19 May 2010 15:48:09 -0500 +Subject: [PATCH 3/5] 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 +pad_alloc() to allocate buffers. For example, some cameras may have need +for additional padding/boarder around the frame (for vstab), or some video +decoders may have requirements for a certain minimum number of buffers (so +they can hold refs to reference-frames) +--- + gst/gstquark.c | 3 +- + gst/gstquark.h | 7 ++- + gst/gstquery.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + gst/gstquery.h | 16 ++++++- + 4 files changed, 164 insertions(+), 3 deletions(-) + +diff --git a/gst/gstquark.c b/gst/gstquark.c +index 4073eb4..58badca 100644 +--- a/gst/gstquark.c ++++ b/gst/gstquark.c +@@ -49,7 +49,8 @@ static const gchar *_quark_strings[] = { + "GstQueryURI", "GstEventStep", "GstMessageStepDone", "amount", "flush", + "intermediate", "GstMessageStepStart", "active", "eos", "sink-message", + "message", "GstMessageQOS", "running-time", "stream-time", "jitter", +- "quality", "processed", "dropped", "buffering-ranges" ++ "quality", "processed", "dropped", "buffering-ranges", "GstQueryBuffers", ++ "caps", "count", "width", "height" + }; + + GQuark _priv_gst_quark_table[GST_QUARK_MAX]; +diff --git a/gst/gstquark.h b/gst/gstquark.h +index c95d9cd..f4c8e0f 100644 +--- a/gst/gstquark.h ++++ b/gst/gstquark.h +@@ -127,8 +127,13 @@ typedef enum _GstQuarkId + GST_QUARK_PROCESSED = 98, + GST_QUARK_DROPPED = 99, + GST_QUARK_BUFFERING_RANGES = 100, ++ GST_QUARK_QUERY_BUFFERS = 101, ++ GST_QUARK_CAPS = 102, ++ GST_QUARK_COUNT = 103, ++ GST_QUARK_WIDTH = 104, ++ GST_QUARK_HEIGHT = 105, + +- GST_QUARK_MAX = 101 ++ GST_QUARK_MAX = 106 + } GstQuarkId; + + extern GQuark _priv_gst_quark_table[GST_QUARK_MAX]; +diff --git a/gst/gstquery.c b/gst/gstquery.c +index 9373175..4823ff0 100644 +--- a/gst/gstquery.c ++++ b/gst/gstquery.c +@@ -96,6 +96,7 @@ static GstQueryTypeDefinition standard_definitions[] = { + {GST_QUERY_BUFFERING, "buffering", "Buffering status", 0}, + {GST_QUERY_CUSTOM, "custom", "Custom query", 0}, + {GST_QUERY_URI, "uri", "URI of the source or sink", 0}, ++ {GST_QUERY_BUFFERS, "buffers", "Minimum buffer requirements", 0}, + {0, NULL, NULL, 0} + }; + +@@ -1480,3 +1481,143 @@ gst_query_parse_uri (GstQuery * query, gchar ** uri) + *uri = g_value_dup_string (gst_structure_id_get_value (query->structure, + GST_QUARK (URI))); + } ++ ++/** ++ * gst_query_new_buffers: ++ * @caps: the #GstCaps for the buffers that are going to be allocated ++ * ++ * Constructs a new buffer requirements query object to query buffer ++ * requirements for a particular caps. Use gst_query_unref() when done ++ * with it. ++ * ++ * Returns: A #GstQuery ++ */ ++GstQuery * ++gst_query_new_buffers (GstCaps * caps) ++{ ++ GstQuery *query; ++ GstStructure *structure; ++ ++ /* XXX could add size here, for linear (non YUV/RGB) buffers? But I'm not ++ * entirely sure what is the use-case for that.. it should be easy enough ++ * to add more optional reply fields later ++ */ ++ structure = gst_structure_id_new (GST_QUARK (QUERY_BUFFERS), ++ GST_QUARK (CAPS), GST_TYPE_CAPS, caps, ++ GST_QUARK (COUNT), G_TYPE_INT, -1, ++ GST_QUARK (WIDTH), G_TYPE_INT, -1, ++ GST_QUARK (HEIGHT), G_TYPE_INT, -1, NULL); ++ ++ query = gst_query_new (GST_QUERY_BUFFERS, structure); ++ ++ return query; ++} ++ ++/** ++ * gst_query_set_buffers_count: ++ * @count: minimum number of buffers required ++ * ++ * Answer a buffers query by setting the minimum number of buffers required. ++ * If there is no minimum buffer count requirement, don't set this field in ++ * the query. ++ */ ++void ++gst_query_set_buffers_count (GstQuery * query, gint count) ++{ ++ GstStructure *structure; ++ ++ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS); ++ ++ structure = gst_query_get_structure (query); ++ gst_structure_id_set (structure, GST_QUARK (COUNT), G_TYPE_INT, count, NULL); ++} ++ ++/** ++ * gst_query_set_buffers_dimensions: ++ * @width: minimum buffer width ++ * @height: minimum buffer height ++ * ++ * Answer a buffers query by setting the minimum buffer dimensions required. ++ * If there is no minimum buffer dimensions (beyond the width/height specified ++ * in the #GstCaps), don't set this field in the query. ++ */ ++void ++gst_query_set_buffers_dimensions (GstQuery * query, gint width, gint height) ++{ ++ GstStructure *structure; ++ ++ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS); ++ ++ structure = gst_query_get_structure (query); ++ gst_structure_id_set (structure, ++ GST_QUARK (WIDTH), G_TYPE_INT, width, ++ GST_QUARK (HEIGHT), G_TYPE_INT, height, NULL); ++} ++ ++/** ++ * gst_query_parse_buffers_caps: ++ * @query: a #GstQuery ++ * @caps: the storage for the #GstCaps pointer, or NULL ++ * ++ * Parse a buffers query. ++ */ ++void ++gst_query_parse_buffers_caps (GstQuery * query, const GstCaps ** caps) ++{ ++ GstStructure *structure; ++ ++ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS); ++ ++ structure = gst_query_get_structure (query); ++ if (caps) ++ *caps = gst_value_get_caps (gst_structure_id_get_value (structure, ++ GST_QUARK (CAPS))); ++} ++ ++/** ++ * gst_query_parse_buffers_count: ++ * @query: a #GstQuery ++ * @count: the storage for minimum number of buffers, or NULL ++ * ++ * Parse a buffers query answer to see the minimum number of buffers ++ * required. A returned value of -1 means there is no minimum requirement ++ */ ++void ++gst_query_parse_buffers_count (GstQuery * query, gint * count) ++{ ++ GstStructure *structure; ++ ++ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS); ++ ++ structure = gst_query_get_structure (query); ++ if (count) ++ *count = g_value_get_int (gst_structure_id_get_value (structure, ++ GST_QUARK (COUNT))); ++} ++ ++/** ++ * gst_query_parse_buffers_dimensions: ++ * @query: a #GstQuery ++ * @width: the storage for minimum width, or NULL ++ * @height: the storage for minimum height, or NULL ++ * ++ * Parse a buffers query answer to see the minimum buffer dimensions required. ++ * A returned value of -1 for either dimension means there is no minimum ++ * requirement in that axis ++ */ ++void ++gst_query_parse_buffers_dimensions (GstQuery * query, gint * width, ++ gint * height) ++{ ++ GstStructure *structure; ++ ++ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS); ++ ++ structure = gst_query_get_structure (query); ++ 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/gstquery.h b/gst/gstquery.h +index 09d0225..ae1f5cd 100644 +--- a/gst/gstquery.h ++++ b/gst/gstquery.h +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + + G_BEGIN_DECLS + +@@ -51,6 +52,9 @@ G_BEGIN_DECLS + * @GST_QUERY_CUSTOM: a custom application or element defined query. Since + * 0.10.22. + * @GST_QUERY_URI: query the URI of the source or sink. Since 0.10.22. ++ * @GST_QUERY_BUFFERS: query the upstream users of pad_alloc()'d buffers to ++ * find any particular requirements about buffer size (padding) or numbers of ++ * buffers. Since ?.?.?. + * + * Standard predefined Query types + */ +@@ -69,7 +73,8 @@ typedef enum { + GST_QUERY_FORMATS, + GST_QUERY_BUFFERING, + GST_QUERY_CUSTOM, +- GST_QUERY_URI ++ GST_QUERY_URI, ++ GST_QUERY_BUFFERS + } GstQueryType; + + /** +@@ -336,6 +341,15 @@ GstQuery * gst_query_new_uri (void); + void gst_query_parse_uri (GstQuery *query, gchar **uri); + void gst_query_set_uri (GstQuery *query, const gchar *uri); + ++/* buffer requirements query */ ++GstQuery * gst_query_new_buffers (GstCaps * caps); ++void gst_query_set_buffers_count (GstQuery * query, gint count); ++void gst_query_set_buffers_dimensions (GstQuery * query, gint width, gint height); ++void gst_query_parse_buffers_caps (GstQuery * query, const GstCaps ** caps); ++void gst_query_parse_buffers_count (GstQuery * query, gint * count); ++void gst_query_parse_buffers_dimensions (GstQuery * query, gint * width, gint * height); ++ ++ + G_END_DECLS + + #endif /* __GST_QUERY_H__ */ +-- +1.7.1 + 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 +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 + diff --git a/media-libs/gstreamer/files/gst-0.10.32-0005-basetransform-don-t-do-unnecessary-pad_alloc.patch b/media-libs/gstreamer/files/gst-0.10.32-0005-basetransform-don-t-do-unnecessary-pad_alloc.patch new file mode 100644 index 0000000..27c7daa --- /dev/null +++ b/media-libs/gstreamer/files/gst-0.10.32-0005-basetransform-don-t-do-unnecessary-pad_alloc.patch @@ -0,0 +1,52 @@ +From 45650b7b1dfcaaa2b165a6d263b6dc74449c501c Mon Sep 17 00:00:00 2001 +From: Rob Clark +Date: Wed, 26 May 2010 14:42:40 -0500 +Subject: [PATCH 5/5] 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 57192ab..1416b8e 100644 +--- a/libs/gst/base/gstbasetransform.c ++++ b/libs/gst/base/gstbasetransform.c +@@ -2188,14 +2188,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.7.1 + diff --git a/media-libs/gstreamer/gstreamer-0.10.32_p20110127.ebuild b/media-libs/gstreamer/gstreamer-0.10.32_p20110127.ebuild new file mode 100644 index 0000000..f6879a1 --- /dev/null +++ b/media-libs/gstreamer/gstreamer-0.10.32_p20110127.ebuild @@ -0,0 +1,68 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=2 + +inherit eutils multilib versionator + +# Create a major/minor combo for our SLOT and executables suffix +PV_MAJ_MIN=$(get_version_component_range '1-2') + +DESCRIPTION="Streaming media framework" +HOMEPAGE="http://gstreamer.sourceforge.net" +MY_P=${P%%_*} +SRC_URI="http://${PN}.freedesktop.org/src/${PN}/${MY_P}.tar.bz2" +S="${WORKDIR}/${MY_P}" + +LICENSE="LGPL-2" +SLOT=${PV_MAJ_MIN} +KEYWORDS="~alpha ~amd64 arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="+introspection nls test" + +RDEPEND=">=dev-libs/glib-2.20:2 + dev-libs/libxml2 + introspection? ( >=dev-libs/gobject-introspection-0.6.3 ) + !