Merge branch 'master' into 0.11

Conflicts:
	gst/gstbuffer.h
	gst/gstcaps.c
	gst/gstcaps.h
	gst/gstevent.c
This commit is contained in:
Wim Taymans 2011-08-22 12:33:35 +02:00
commit 8170c34c94
11 changed files with 54 additions and 39 deletions

View file

@ -217,7 +217,7 @@ parse_debug_category (gchar * str, const gchar ** category)
} }
static gboolean static gboolean
parse_debug_level (gchar * str, gint * level) parse_debug_level (gchar * str, GstDebugLevel * level)
{ {
if (!str) if (!str)
return FALSE; return FALSE;
@ -227,7 +227,7 @@ parse_debug_level (gchar * str, gint * level)
if (str[0] != NUL && str[1] == NUL if (str[0] != NUL && str[1] == NUL
&& str[0] >= '0' && str[0] < '0' + GST_LEVEL_COUNT) { && str[0] >= '0' && str[0] < '0' + GST_LEVEL_COUNT) {
*level = str[0] - '0'; *level = (GstDebugLevel) (str[0] - '0');
return TRUE; return TRUE;
} }
@ -249,7 +249,7 @@ parse_debug_list (const gchar * list)
gchar **values = g_strsplit (*walk, ":", 2); gchar **values = g_strsplit (*walk, ":", 2);
if (values[0] && values[1]) { if (values[0] && values[1]) {
gint level; GstDebugLevel level;
const gchar *category; const gchar *category;
if (parse_debug_category (values[0], &category) if (parse_debug_category (values[0], &category)
@ -259,7 +259,7 @@ parse_debug_list (const gchar * list)
g_strfreev (values); g_strfreev (values);
} else { } else {
gint level; GstDebugLevel level;
if (parse_debug_level (*walk, &level)) if (parse_debug_level (*walk, &level))
gst_debug_set_default_threshold (level); gst_debug_set_default_threshold (level);
@ -909,9 +909,9 @@ parse_one_option (gint opt, const gchar * arg, GError ** err)
} }
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
case ARG_DEBUG_LEVEL:{ case ARG_DEBUG_LEVEL:{
gint tmp = 0; GstDebugLevel tmp = GST_LEVEL_NONE;
tmp = strtol (arg, NULL, 0); tmp = (GstDebugLevel) strtol (arg, NULL, 0);
if (tmp >= 0 && tmp < GST_LEVEL_COUNT) { if (tmp >= 0 && tmp < GST_LEVEL_COUNT) {
gst_debug_set_default_threshold (tmp); gst_debug_set_default_threshold (tmp);
} }

View file

@ -381,7 +381,7 @@ typedef enum {
* Combination of all possible fields that can be copied with * Combination of all possible fields that can be copied with
* gst_buffer_copy_into(). * gst_buffer_copy_into().
*/ */
#define GST_BUFFER_COPY_ALL (GST_BUFFER_COPY_METADATA | GST_BUFFER_COPY_MEMORY) #define GST_BUFFER_COPY_ALL ((GstBufferCopyFlags)(GST_BUFFER_COPY_METADATA | GST_BUFFER_COPY_MEMORY))
/* copies memory or metadata into newly allocated buffer */ /* copies memory or metadata into newly allocated buffer */
void gst_buffer_copy_into (GstBuffer *dest, GstBuffer *src, void gst_buffer_copy_into (GstBuffer *dest, GstBuffer *src,

View file

@ -1116,7 +1116,7 @@ gst_caps_can_intersect (const GstCaps * caps1, const GstCaps * caps2)
j = MIN (i, len1 - 1); j = MIN (i, len1 - 1);
/* subset index stays 0 until i reaches superset->structs->len, then it /* subset index stays 0 until i reaches superset->structs->len, then it
* counts up from 1 to subset->structs->len - 1 */ * counts up from 1 to subset->structs->len - 1 */
k = MAX (0, i - j); k = (i > j) ? (i - j) : 0; /* MAX (0, i - j) */
/* now run the diagonal line, end condition is the left or bottom /* now run the diagonal line, end condition is the left or bottom
* border */ * border */
@ -1187,7 +1187,7 @@ gst_caps_intersect_zig_zag (const GstCaps * caps1, const GstCaps * caps2)
j = MIN (i, len1 - 1); j = MIN (i, len1 - 1);
/* caps2 index stays 0 until i reaches GST_CAPS_LEN (caps1), then it counts /* caps2 index stays 0 until i reaches GST_CAPS_LEN (caps1), then it counts
* up from 1 to GST_CAPS_LEN (caps2) - 1 */ * up from 1 to GST_CAPS_LEN (caps2) - 1 */
k = MAX (0, i - j); k = (i > j) ? (i - j) : 0; /* MAX (0, i - j) */
/* now run the diagonal line, end condition is the left or bottom /* now run the diagonal line, end condition is the left or bottom
* border */ * border */

View file

@ -77,7 +77,7 @@ debug_dump_get_element_state (GstElement * element)
{ {
gchar *state_name = NULL; gchar *state_name = NULL;
const gchar *state_icons = "~0-=>"; const gchar *state_icons = "~0-=>";
GstState state = 0, pending = 0; GstState state = GST_STATE_VOID_PENDING, pending = GST_STATE_VOID_PENDING;
gst_element_get_state (element, &state, &pending, 0); gst_element_get_state (element, &state, &pending, 0);
if (pending == GST_STATE_VOID_PENDING) { if (pending == GST_STATE_VOID_PENDING) {

View file

@ -41,7 +41,10 @@
* Core and plug-in writers can add and remove pads with gst_element_add_pad() * Core and plug-in writers can add and remove pads with gst_element_add_pad()
* and gst_element_remove_pad(). * and gst_element_remove_pad().
* *
* A pad of an element can be retrieved by name with gst_element_get_pad(). * An existing pad of an element can be retrieved by name with
* gst_element_get_static_pad(). A new dynamic pad can be created using
* gst_element_request_pad() with a #GstPadTemplate or
* gst_element_get_request_pad() with the template name such as "src_%d".
* An iterator of all pads can be retrieved with gst_element_iterate_pads(). * An iterator of all pads can be retrieved with gst_element_iterate_pads().
* *
* Elements can be linked through their pads. * Elements can be linked through their pads.
@ -1022,8 +1025,8 @@ _gst_element_request_pad (GstElement * element, GstPadTemplate * templ,
* @element: a #GstElement to find a request pad of. * @element: a #GstElement to find a request pad of.
* @name: the name of the request #GstPad to retrieve. * @name: the name of the request #GstPad to retrieve.
* *
* Retrieves a pad from the element by name. This version only retrieves * Retrieves a pad from the element by name (e.g. "src_%d"). This version only
* request pads. The pad should be released with * retrieves request pads. The pad should be released with
* gst_element_release_request_pad(). * gst_element_release_request_pad().
* *
* This method is slow and will be deprecated in the future. New code should * This method is slow and will be deprecated in the future. New code should
@ -1129,6 +1132,8 @@ gst_element_get_request_pad (GstElement * element, const gchar * name)
* request. Can be %NULL. * request. Can be %NULL.
* *
* Retrieves a request pad from the element according to the provided template. * Retrieves a request pad from the element according to the provided template.
* Pad templates can be looked up using
* gst_element_factory_get_static_pad_templates().
* *
* If the @caps are specified and the element implements thew new * If the @caps are specified and the element implements thew new
* request_new_pad_full virtual method, the element will use them to select * request_new_pad_full virtual method, the element will use them to select
@ -1169,8 +1174,9 @@ gst_element_iterate_pad_list (GstElement * element, GList ** padlist)
* gst_element_iterate_pads: * gst_element_iterate_pads:
* @element: a #GstElement to iterate pads of. * @element: a #GstElement to iterate pads of.
* *
* Retrieves an iterattor of @element's pads. The iterator should * Retrieves an iterator of @element's pads. The iterator should
* be freed after usage. * be freed after usage. Also more specialized iterators exists such as
* gst_element_iterate_src_pads() or gst_element_iterate_sink_pads().
* *
* Returns: (transfer full): the #GstIterator of #GstPad. Unref each pad * Returns: (transfer full): the #GstIterator of #GstPad. Unref each pad
* after use. * after use.

View file

@ -151,7 +151,7 @@ typedef enum {
* Given a current state @cur and a target state @pending, calculate the next (intermediate) * Given a current state @cur and a target state @pending, calculate the next (intermediate)
* #GstState. * #GstState.
*/ */
#define GST_STATE_GET_NEXT(cur,pending) ((cur) + __GST_SIGN ((gint)(pending) - (gint)(cur))) #define GST_STATE_GET_NEXT(cur,pending) ((GstState)((cur) + __GST_SIGN ((gint)(pending) - (gint)(cur))))
/** /**
* GST_STATE_TRANSITION: * GST_STATE_TRANSITION:
* @cur: A current state * @cur: A current state

View file

@ -626,7 +626,7 @@ typedef struct
* @factory: a #GstElementFactory * @factory: a #GstElementFactory
* @type: a #GstElementFactoryListType * @type: a #GstElementFactoryListType
* *
* Check if @factory if of the given types. * Check if @factory is of the given types.
* *
* Returns: %TRUE if @factory is of @type. * Returns: %TRUE if @factory is of @type.
* *

View file

@ -309,13 +309,13 @@ gst_error_get_message (GQuark domain, gint code)
const gchar *message = NULL; const gchar *message = NULL;
if (domain == GST_CORE_ERROR) if (domain == GST_CORE_ERROR)
message = gst_error_get_core_error (code); message = gst_error_get_core_error ((GstCoreError) code);
else if (domain == GST_LIBRARY_ERROR) else if (domain == GST_LIBRARY_ERROR)
message = gst_error_get_library_error (code); message = gst_error_get_library_error ((GstLibraryError) code);
else if (domain == GST_RESOURCE_ERROR) else if (domain == GST_RESOURCE_ERROR)
message = gst_error_get_resource_error (code); message = gst_error_get_resource_error ((GstResourceError) code);
else if (domain == GST_STREAM_ERROR) else if (domain == GST_STREAM_ERROR)
message = gst_error_get_stream_error (code); message = gst_error_get_stream_error ((GstStreamError) code);
else { else {
g_warning ("No error messages for domain %s", g_quark_to_string (domain)); g_warning ("No error messages for domain %s", g_quark_to_string (domain));
return g_strdup_printf (_("No error message for domain %s."), return g_strdup_printf (_("No error message for domain %s."),

View file

@ -803,7 +803,7 @@ gst_event_parse_buffer_size (GstEvent * event, GstFormat * format,
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
if (format) if (format)
*format = *format = (GstFormat)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT))); GST_QUARK (FORMAT)));
if (minsize) if (minsize)
@ -919,7 +919,7 @@ gst_event_parse_qos (GstEvent * event, GstQOSType * type,
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
if (type) if (type)
*type = *type = (GstQOSType)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (TYPE))); GST_QUARK (TYPE)));
if (proportion) if (proportion)
@ -1047,15 +1047,15 @@ gst_event_parse_seek (GstEvent * event, gdouble * rate,
g_value_get_double (gst_structure_id_get_value (structure, g_value_get_double (gst_structure_id_get_value (structure,
GST_QUARK (RATE))); GST_QUARK (RATE)));
if (format) if (format)
*format = *format = (GstFormat)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT))); GST_QUARK (FORMAT)));
if (flags) if (flags)
*flags = *flags = (GstSeekFlags)
g_value_get_flags (gst_structure_id_get_value (structure, g_value_get_flags (gst_structure_id_get_value (structure,
GST_QUARK (FLAGS))); GST_QUARK (FLAGS)));
if (start_type) if (start_type)
*start_type = *start_type = (GstSeekType)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (CUR_TYPE))); GST_QUARK (CUR_TYPE)));
if (start) if (start)
@ -1063,7 +1063,7 @@ gst_event_parse_seek (GstEvent * event, gdouble * rate,
g_value_get_int64 (gst_structure_id_get_value (structure, g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (CUR))); GST_QUARK (CUR)));
if (stop_type) if (stop_type)
*stop_type = *stop_type = (GstSeekType)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (STOP_TYPE))); GST_QUARK (STOP_TYPE)));
if (stop) if (stop)
@ -1213,7 +1213,8 @@ gst_event_parse_step (GstEvent * event, GstFormat * format, guint64 * amount,
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
if (format) if (format)
*format = g_value_get_enum (gst_structure_id_get_value (structure, *format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT))); GST_QUARK (FORMAT)));
if (amount) if (amount)
*amount = g_value_get_uint64 (gst_structure_id_get_value (structure, *amount = g_value_get_uint64 (gst_structure_id_get_value (structure,

View file

@ -300,10 +300,14 @@ gst_object_ref_sink (gpointer object)
* *
* Make sure not to LOCK @oldobj because it might be unreffed * Make sure not to LOCK @oldobj because it might be unreffed
* which could cause a deadlock when it is disposed. * which could cause a deadlock when it is disposed.
*
* Since 0.10.36, this function operates atomically.
*/ */
void void
gst_object_replace (GstObject ** oldobj, GstObject * newobj) gst_object_replace (GstObject ** oldobj, GstObject * newobj)
{ {
GstObject *oldptr;
g_return_if_fail (oldobj != NULL); g_return_if_fail (oldobj != NULL);
g_return_if_fail (*oldobj == NULL || GST_IS_OBJECT (*oldobj)); g_return_if_fail (*oldobj == NULL || GST_IS_OBJECT (*oldobj));
g_return_if_fail (newobj == NULL || GST_IS_OBJECT (newobj)); g_return_if_fail (newobj == NULL || GST_IS_OBJECT (newobj));
@ -316,14 +320,14 @@ gst_object_replace (GstObject ** oldobj, GstObject * newobj)
newobj ? G_OBJECT (newobj)->ref_count : 0); newobj ? G_OBJECT (newobj)->ref_count : 0);
#endif #endif
if (G_LIKELY (*oldobj != newobj)) { if (newobj)
if (newobj) g_object_ref (newobj);
gst_object_ref (newobj); do {
if (*oldobj) oldptr = *oldobj;
gst_object_unref (*oldobj); } while (!g_atomic_pointer_compare_and_exchange ((void *) oldobj,
oldptr, newobj));
*oldobj = newobj; if (oldptr)
} g_object_unref (oldptr);
} }
/* dispose is called when the object has to release all links /* dispose is called when the object has to release all links

View file

@ -1586,7 +1586,7 @@ gst_base_parse_check_media (GstBaseParse * parse)
if (caps) if (caps)
gst_caps_unref (caps); gst_caps_unref (caps);
GST_DEBUG_OBJECT (parse, "media is video == %d", parse->priv->is_video); GST_DEBUG_OBJECT (parse, "media is video: %d", parse->priv->is_video);
} }
/* takes ownership of frame */ /* takes ownership of frame */
@ -1862,10 +1862,14 @@ gst_base_parse_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
parse->priv->close_segment = NULL; parse->priv->close_segment = NULL;
} }
if (G_UNLIKELY (parse->priv->pending_segment)) { if (G_UNLIKELY (parse->priv->pending_segment)) {
GstEvent *pending_segment;
pending_segment = parse->priv->pending_segment;
parse->priv->pending_segment = NULL;
GST_DEBUG_OBJECT (parse, "%s push pending segment", GST_DEBUG_OBJECT (parse, "%s push pending segment",
parse->priv->pad_mode == GST_ACTIVATE_PULL ? "loop" : "chain"); parse->priv->pad_mode == GST_ACTIVATE_PULL ? "loop" : "chain");
gst_pad_push_event (parse->srcpad, parse->priv->pending_segment); gst_pad_push_event (parse->srcpad, pending_segment);
parse->priv->pending_segment = NULL;
/* have caps; check identity */ /* have caps; check identity */
gst_base_parse_check_media (parse); gst_base_parse_check_media (parse);