From: Benjamin Otte Date: Thu, 29 Jan 2004 02:24:52 +0000 (+0000) Subject: docs/random/mimetypes: update docs for audio/x-raw-float. Add "buffer-frames=0 means... X-Git-Tag: BRANCH-RELEASE-0_7_4-ROOT~63 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=807937481e2305da12a4bc5e846e0879fe0b7ed7;p=platform%2Fupstream%2Fgstreamer.git docs/random/mimetypes: update docs for audio/x-raw-float. Add "buffer-frames=0 means undefined" Original commit message from CVS: 2004-01-29 Benjamin Otte * docs/random/mimetypes: update docs for audio/x-raw-float. Add "buffer-frames=0 means undefined" * gst/elements/gstfilesrc.c: (gst_filesrc_set_location): make it only work in NULL. * gst/gstcaps.c: don't posion NULL caps * gst/gstelement.c: (gst_element_set_time): add debugging statement * gst/gstelement.c: (gst_element_emit_found_tag), (gst_element_found_tag_func), (gst_element_found_tags): * gst/gstelement.h: These functions take const taglists * gst/gstpad.c: (gst_pad_proxy_getcaps): fix memleak * gst/gstpad.c: (gst_pad_event_default): make more effort on handling discont and clocks, g_warn if everything fails * gst/gststructure.c: (gst_structure_remove_fields), (gst_structure_remove_fields_valist): * gst/gststructure.h: add gst_structure_remove_fields(_valist) * gst/gsttag.c: fix doc glitch --- diff --git a/ChangeLog b/ChangeLog index 99a0011..21cbed1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2004-01-29 Benjamin Otte + + * docs/random/mimetypes: + update docs for audio/x-raw-float. Add "buffer-frames=0 means + undefined" + * gst/elements/gstfilesrc.c: (gst_filesrc_set_location): + make it only work in NULL. + * gst/gstcaps.c: + don't posion NULL caps + * gst/gstelement.c: (gst_element_set_time): + add debugging statement + * gst/gstelement.c: (gst_element_emit_found_tag), + (gst_element_found_tag_func), (gst_element_found_tags): + * gst/gstelement.h: + These functions take const taglists + * gst/gstpad.c: (gst_pad_proxy_getcaps): + fix memleak + * gst/gstpad.c: (gst_pad_event_default): + make more effort on handling discont and clocks, g_warn if everything + fails + * gst/gststructure.c: (gst_structure_remove_fields), + (gst_structure_remove_fields_valist): + * gst/gststructure.h: + add gst_structure_remove_fields(_valist) + * gst/gsttag.c: + fix doc glitch + 2004-01-28 David Schleef * docs/random/ds/element-checklist: Notes about gst_caps_to_string() diff --git a/docs/random/mimetypes b/docs/random/mimetypes index 27e14e1..60e9762 100644 --- a/docs/random/mimetypes +++ b/docs/random/mimetypes @@ -357,9 +357,10 @@ Preface - (optional) properties for all audio formats: 2 - Raw Audio (floating point format) mimetype: audio/x-raw-float - properties: 'depth' = X (INT) <- 32=float, 64=double + properties: 'width' = X (INT) <- 32=float, 64=double 'endianness' = 1234/4321 (INT) <- use G_BIG/LITTLE_ENDIAN! 'buffer-frames' = (INT) + number of samples per buffer, 0 means undefined With regards to the signal: 0.0 represents no signal, +/- 1.0 is 0 dB. 3 - Alaw Raw Audio diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index 3dceef1..b0f7a25 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -257,7 +257,7 @@ static gboolean gst_filesrc_set_location (GstFileSrc *src, const gchar *location) { /* the element must be stopped in order to do this */ - if (GST_STATE (src) == GST_STATE_PLAYING) + if (GST_STATE (src) != GST_STATE_NULL) return FALSE; if (src->filename) g_free (src->filename); diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 681b0d7..e2cab93 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -24,16 +24,20 @@ #include -#define CAPS_POISON(caps) do{ \ - GstCaps *_newcaps = gst_caps_copy (caps); \ - gst_caps_free(caps); \ - caps = _newcaps; \ -} while (0) -#define STRUCTURE_POISON(structure) do{ \ - GstStructure *_newstruct = gst_structure_copy (structure); \ - gst_structure_free(structure); \ - structure = _newstruct; \ -} while (0) +#define CAPS_POISON(caps) G_STMT_START{ \ + if (caps) { \ + GstCaps *_newcaps = gst_caps_copy (caps); \ + gst_caps_free(caps); \ + caps = _newcaps; \ + } \ +} G_STMT_END +#define STRUCTURE_POISON(structure) G_STMT_START{ \ + if (structure) { \ + GstStructure *_newstruct = gst_structure_copy (structure); \ + gst_structure_free(structure); \ + structure = _newstruct; \ + } \ +} G_STMT_END static void _gst_caps_transform_to_string (const GValue *src_value, diff --git a/gst/gstelement.c b/gst/gstelement.c index 77a176f..11cb6b5 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -69,7 +69,7 @@ static void gst_element_dispose (GObject *object); static GstElementStateReturn gst_element_change_state (GstElement *element); static void gst_element_error_func (GstElement* element, GstElement *source, GError *error, gchar *debug); -static void gst_element_found_tag_func (GstElement* element, GstElement *source, GstTagList *tag_list); +static void gst_element_found_tag_func (GstElement* element, GstElement *source, const GstTagList *tag_list); #ifndef GST_DISABLE_LOADSAVE static xmlNodePtr gst_element_save_thyself (GstObject *object, xmlNodePtr parent); @@ -896,7 +896,8 @@ gst_element_set_time (GstElement *element, GstClockTime time) break; case GST_STATE_PLAYING: event_time = gst_clock_get_event_time (element->clock); - GST_LOG_OBJECT (element, "clock time %llu: setting element time to %llu", event_time, time); + GST_CAT_LOG_OBJECT (GST_CAT_CLOCK, element, + "clock time %llu: setting element time to %llu", event_time, time); element->base_time = event_time - time; break; default: @@ -3193,14 +3194,14 @@ gst_element_set_loop_function (GstElement *element, } } static inline void -gst_element_emit_found_tag (GstElement* element, GstElement *source, GstTagList *tag_list) +gst_element_emit_found_tag (GstElement* element, GstElement *source, const GstTagList *tag_list) { gst_object_ref (GST_OBJECT (element)); g_signal_emit (element, gst_element_signals[FOUND_TAG], 0, source, tag_list); gst_object_unref (GST_OBJECT (element)); } static void -gst_element_found_tag_func (GstElement* element, GstElement *source, GstTagList *tag_list) +gst_element_found_tag_func (GstElement* element, GstElement *source, const GstTagList *tag_list) { /* tell the parent */ if (GST_OBJECT_PARENT (element)) { @@ -3220,7 +3221,7 @@ gst_element_found_tag_func (GstElement* element, GstElement *source, GstTagList * not when you handle an event. */ void -gst_element_found_tags (GstElement *element, GstTagList *tag_list) +gst_element_found_tags (GstElement *element, const GstTagList *tag_list) { gst_element_emit_found_tag (element, element, tag_list); } diff --git a/gst/gstelement.h b/gst/gstelement.h index 13eb2f4..67ec0b9 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -204,7 +204,7 @@ struct _GstElementClass { void (*pad_removed) (GstElement *element, GstPad *pad); void (*error) (GstElement *element, GstElement *source, GError *error, gchar *debug); void (*eos) (GstElement *element); - void (*found_tag) (GstElement *element, GstElement *source, GstTagList *tag_list); + void (*found_tag) (GstElement *element, GstElement *source, const GstTagList *tag_list); /* local pointers for get/set */ void (*set_property) (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); @@ -359,7 +359,7 @@ gboolean gst_element_convert (GstElement *element, GstFormat src_format, gint64 src_value, GstFormat *dest_format, gint64 *dest_value); -void gst_element_found_tags (GstElement *element, GstTagList *tag_list); +void gst_element_found_tags (GstElement *element, const GstTagList *tag_list); void gst_element_found_tags_for_pad (GstElement *element, GstPad *pad, GstClockTime timestamp, GstTagList *list); diff --git a/gst/gstpad.c b/gst/gstpad.c index e287621..9b35439 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2118,8 +2118,10 @@ gst_pad_proxy_getcaps (GstPad *pad) GstCaps *temp; if (otherpad != pad) { - temp = gst_caps_intersect (caps, gst_pad_get_allowed_caps (otherpad)); + GstCaps *allowed = gst_pad_get_allowed_caps (otherpad); + temp = gst_caps_intersect (caps, allowed); gst_caps_free (caps); + gst_caps_free (allowed); caps = temp; } @@ -3508,10 +3510,21 @@ gst_pad_event_default (GstPad *pad, GstEvent *event) { guint64 time; - if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &time)) { - if (gst_element_requires_clock (element) && element->clock) { + if (gst_element_requires_clock (element) && element->clock) { + if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &time)) { gst_element_set_time (element, time); - } + } else { + GstFormat format = GST_FORMAT_TIME; + guint i; + for (i = 0; i < event->event_data.discont.noffsets; i++) { + if (gst_pad_convert (pad, event->event_data.discont.offsets[i].format, + event->event_data.discont.offsets[i].value, &format, &time)) { + gst_element_set_time (element, time); + } else if (i == event->event_data.discont.noffsets) { + g_warning ("can't adjust clock to new time when time not provided"); + } + } + } } } case GST_EVENT_FLUSH: diff --git a/gst/gststructure.c b/gst/gststructure.c index 9a629f7..43f18a8 100644 --- a/gst/gststructure.c +++ b/gst/gststructure.c @@ -586,6 +586,53 @@ gst_structure_remove_field(GstStructure *structure, const gchar *fieldname) } /** + * gst_structure_remove_fields: + * @structure: a #GstStructure + * @fieldname: the name of the field to remove + * @...: NULL-terminated list of more fieldnames to remove + * + * Removes the field with the given names. If a field does not exist, the + * argument is ignored. + */ +void +gst_structure_remove_fields(GstStructure *structure, const gchar *fieldname, ...) +{ + va_list varargs; + + g_return_if_fail (structure != NULL); + g_return_if_fail (fieldname != NULL); + + va_start(varargs, fieldname); + + gst_structure_remove_fields_valist (structure, fieldname, varargs); + + va_end(varargs); +} + +/** + * gst_structure_remove_fields_valist: + * @structure: a #GstStructure + * @fieldname: the name of the field to remove + * @varargs: NULL-terminated list of more fieldnames to remove + * + * Removes the field with the given names. If a field does not exist, the + * argument is ignored. + */ +void +gst_structure_remove_fields_valist(GstStructure *structure, + const gchar *fieldname, va_list varargs) +{ + gchar *field = (gchar *) fieldname; + g_return_if_fail (structure != NULL); + g_return_if_fail (fieldname != NULL); + + while (field) { + gst_structure_remove_field (structure, field); + field = va_arg (varargs, char *); + } +} + +/** * gst_structure_remove_all_fields: * @structure: a #GstStructure * diff --git a/gst/gststructure.h b/gst/gststructure.h index 675b6b7..dc5c1a3 100644 --- a/gst/gststructure.h +++ b/gst/gststructure.h @@ -67,6 +67,10 @@ G_CONST_RETURN GValue *gst_structure_id_get_value(const GstStructure *structure, G_CONST_RETURN GValue *gst_structure_get_value(const GstStructure *structure, const gchar *field); void gst_structure_remove_field(GstStructure *structure, const gchar *field); +void gst_structure_remove_fields(GstStructure *structure, + const gchar *fieldname, ...); +void gst_structure_remove_fields_valist(GstStructure *structure, + const gchar *fieldname, va_list varargs); void gst_structure_remove_all_fields(GstStructure *structure); GType gst_structure_get_field_type(const GstStructure *structure, diff --git a/gst/gsttag.c b/gst/gsttag.c index e0bbed0..0ba4683 100644 --- a/gst/gsttag.c +++ b/gst/gsttag.c @@ -275,7 +275,6 @@ gst_tag_lookup (GQuark entry) * with that name is already registered, that one is used. * The old registration may have used a different type however. So don't rely * on your supplied values. - * If you know the type is already registered, use gst_tag_lookup instead. * This function takes ownership of all supplied variables. */ void diff --git a/gst/gsttaglist.c b/gst/gsttaglist.c index e0bbed0..0ba4683 100644 --- a/gst/gsttaglist.c +++ b/gst/gsttaglist.c @@ -275,7 +275,6 @@ gst_tag_lookup (GQuark entry) * with that name is already registered, that one is used. * The old registration may have used a different type however. So don't rely * on your supplied values. - * If you know the type is already registered, use gst_tag_lookup instead. * This function takes ownership of all supplied variables. */ void diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index 3dceef1..b0f7a25 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -257,7 +257,7 @@ static gboolean gst_filesrc_set_location (GstFileSrc *src, const gchar *location) { /* the element must be stopped in order to do this */ - if (GST_STATE (src) == GST_STATE_PLAYING) + if (GST_STATE (src) != GST_STATE_NULL) return FALSE; if (src->filename) g_free (src->filename);