+2004-01-29 Benjamin Otte <in7y118@public.uni-hamburg.de>
+
+ * 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 <ds@schleef.org>
* docs/random/ds/element-checklist: Notes about gst_caps_to_string()
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
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);
#include <gst/gst.h>
-#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,
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);
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:
}
}
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)) {
* 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);
}
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);
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);
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;
}
{
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:
}
}
+/**
+ * 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
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,
* 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
* 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
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);