summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/gst/gstreamer-sections.txt1
-rw-r--r--gst/gstevent.c15
-rw-r--r--gst/gstmessage.c48
-rw-r--r--gst/gstquery.c25
-rw-r--r--gst/gststructure.c35
-rw-r--r--gst/gststructure.h3
-rw-r--r--win32/common/libgstreamer.def1
7 files changed, 71 insertions, 57 deletions
diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt
index 25ea69ac4d..6c9fb4e87e 100644
--- a/docs/gst/gstreamer-sections.txt
+++ b/docs/gst/gstreamer-sections.txt
@@ -1995,6 +1995,7 @@ gst_structure_empty_new
gst_structure_id_empty_new
gst_structure_new
gst_structure_new_valist
+gst_structure_id_new
gst_structure_copy
gst_structure_free
gst_structure_get_name
diff --git a/gst/gstevent.c b/gst/gstevent.c
index 4c06bf9b68..bb90a3072f 100644
--- a/gst/gstevent.c
+++ b/gst/gstevent.c
@@ -602,8 +602,7 @@ gst_event_new_new_segment_full (gboolean update, gdouble rate,
if (stop != -1)
g_return_val_if_fail (start <= stop, NULL);
- structure = gst_structure_id_empty_new (GST_QUARK (EVENT_NEWSEGMENT));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (EVENT_NEWSEGMENT),
GST_QUARK (UPDATE), G_TYPE_BOOLEAN, update,
GST_QUARK (RATE), G_TYPE_DOUBLE, rate,
GST_QUARK (APPLIED_RATE), G_TYPE_DOUBLE, applied_rate,
@@ -734,8 +733,7 @@ gst_event_new_buffer_size (GstFormat format, gint64 minsize,
", maxsize %" G_GINT64_FORMAT ", async %d", gst_format_get_name (format),
minsize, maxsize, async);
- structure = gst_structure_id_empty_new (GST_QUARK (EVENT_BUFFER_SIZE));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (EVENT_BUFFER_SIZE),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (MINSIZE), G_TYPE_INT64, minsize,
GST_QUARK (MAXSIZE), G_TYPE_INT64, maxsize,
@@ -840,8 +838,7 @@ gst_event_new_qos (gdouble proportion, GstClockTimeDiff diff,
", timestamp %" GST_TIME_FORMAT, proportion,
diff, GST_TIME_ARGS (timestamp));
- structure = gst_structure_id_empty_new (GST_QUARK (EVENT_QOS));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (EVENT_QOS),
GST_QUARK (PROPORTION), G_TYPE_DOUBLE, proportion,
GST_QUARK (DIFF), G_TYPE_INT64, diff,
GST_QUARK (TIMESTAMP), G_TYPE_UINT64, timestamp, NULL);
@@ -953,8 +950,7 @@ gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags,
stop);
}
- structure = gst_structure_id_empty_new (GST_QUARK (EVENT_SEEK));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (EVENT_SEEK),
GST_QUARK (RATE), G_TYPE_DOUBLE, rate,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (FLAGS), GST_TYPE_SEEK_FLAGS, flags,
@@ -1062,8 +1058,7 @@ gst_event_new_latency (GstClockTime latency)
GST_CAT_INFO (GST_CAT_EVENT,
"creating latency event %" GST_TIME_FORMAT, GST_TIME_ARGS (latency));
- structure = gst_structure_id_empty_new (GST_QUARK (EVENT_LATENCY));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (EVENT_LATENCY),
GST_QUARK (LATENCY), G_TYPE_UINT64, latency, NULL);
event = gst_event_new_custom (GST_EVENT_LATENCY, structure);
diff --git a/gst/gstmessage.c b/gst/gstmessage.c
index 3bb8bb3337..3bc168a6cb 100644
--- a/gst/gstmessage.c
+++ b/gst/gstmessage.c
@@ -381,8 +381,7 @@ gst_message_new_error (GstObject * src, GError * error, const gchar * debug)
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_ERROR));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_ERROR),
GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
message = gst_message_new_custom (GST_MESSAGE_ERROR, src, structure);
@@ -409,8 +408,7 @@ gst_message_new_warning (GstObject * src, GError * error, const gchar * debug)
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_WARNING));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_WARNING),
GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
message = gst_message_new_custom (GST_MESSAGE_WARNING, src, structure);
@@ -439,9 +437,9 @@ gst_message_new_info (GstObject * src, GError * error, const gchar * debug)
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_INFO));
- gst_structure_id_set (structure, GST_QUARK (GERROR), GST_TYPE_G_ERROR,
- error, GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_INFO),
+ GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
+ GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
message = gst_message_new_custom (GST_MESSAGE_INFO, src, structure);
return message;
@@ -535,8 +533,7 @@ gst_message_new_buffering (GstObject * src, gint percent)
g_return_val_if_fail (percent >= 0 && percent <= 100, NULL);
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_BUFFERING));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_BUFFERING),
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent,
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM,
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, -1,
@@ -569,8 +566,7 @@ gst_message_new_state_changed (GstObject * src,
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_STATE));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_STATE),
GST_QUARK (OLD_STATE), GST_TYPE_STATE, (gint) oldstate,
GST_QUARK (NEW_STATE), GST_TYPE_STATE, (gint) newstate,
GST_QUARK (PENDING_STATE), GST_TYPE_STATE, (gint) pending, NULL);
@@ -625,8 +621,7 @@ gst_message_new_clock_provide (GstObject * src, GstClock * clock,
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_CLOCK_PROVIDE));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_CLOCK_PROVIDE),
GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock,
GST_QUARK (READY), G_TYPE_BOOLEAN, ready, NULL);
message = gst_message_new_custom (GST_MESSAGE_CLOCK_PROVIDE, src, structure);
@@ -656,8 +651,7 @@ gst_message_new_clock_lost (GstObject * src, GstClock * clock)
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_CLOCK_LOST));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_CLOCK_LOST),
GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock, NULL);
message = gst_message_new_custom (GST_MESSAGE_CLOCK_LOST, src, structure);
@@ -682,8 +676,7 @@ gst_message_new_new_clock (GstObject * src, GstClock * clock)
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_NEW_CLOCK));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_NEW_CLOCK),
GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock, NULL);
message = gst_message_new_custom (GST_MESSAGE_NEW_CLOCK, src, structure);
@@ -720,8 +713,7 @@ gst_message_new_structure_change (GstObject * src, GstStructureChangeType type,
g_return_val_if_fail (GST_PAD_DIRECTION (src) == GST_PAD_SRC, NULL);
g_return_val_if_fail (GST_IS_ELEMENT (owner), NULL);
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_STRUCTURE_CHANGE));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_STRUCTURE_CHANGE),
GST_QUARK (TYPE), GST_TYPE_STRUCTURE_CHANGE_TYPE, type,
GST_QUARK (OWNER), GST_TYPE_ELEMENT, owner,
GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy, NULL);
@@ -754,8 +746,7 @@ gst_message_new_segment_start (GstObject * src, GstFormat format,
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_SEGMENT_START));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_SEGMENT_START),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (POSITION), G_TYPE_INT64, position, NULL);
message = gst_message_new_custom (GST_MESSAGE_SEGMENT_START, src, structure);
@@ -785,8 +776,7 @@ gst_message_new_segment_done (GstObject * src, GstFormat format,
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_SEGMENT_DONE));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_SEGMENT_DONE),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (POSITION), G_TYPE_INT64, position, NULL);
message = gst_message_new_custom (GST_MESSAGE_SEGMENT_DONE, src, structure);
@@ -858,8 +848,7 @@ gst_message_new_duration (GstObject * src, GstFormat format, gint64 duration)
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_DURATION));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_DURATION),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (DURATION), G_TYPE_INT64, duration, NULL);
message = gst_message_new_custom (GST_MESSAGE_DURATION, src, structure);
@@ -888,8 +877,7 @@ gst_message_new_async_start (GstObject * src, gboolean new_base_time)
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_ASYNC_START));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_ASYNC_START),
GST_QUARK (NEW_BASE_TIME), G_TYPE_BOOLEAN, new_base_time, NULL);
message = gst_message_new_custom (GST_MESSAGE_ASYNC_START, src, structure);
@@ -962,8 +950,7 @@ gst_message_new_request_state (GstObject * src, GstState state)
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_REQUEST_STATE));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_REQUEST_STATE),
GST_QUARK (NEW_STATE), GST_TYPE_STATE, (gint) state, NULL);
message = gst_message_new_custom (GST_MESSAGE_REQUEST_STATE, src, structure);
@@ -1560,8 +1547,7 @@ gst_message_new_stream_status (GstObject * src, GstStreamStatusType type,
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (MESSAGE_STREAM_STATUS));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (MESSAGE_STREAM_STATUS),
GST_QUARK (TYPE), GST_TYPE_STREAM_STATUS_TYPE, (gint) type,
GST_QUARK (OWNER), GST_TYPE_ELEMENT, owner, NULL);
message = gst_message_new_custom (GST_MESSAGE_STREAM_STATUS, src, structure);
diff --git a/gst/gstquery.c b/gst/gstquery.c
index 0038e83296..acbc661578 100644
--- a/gst/gstquery.c
+++ b/gst/gstquery.c
@@ -387,8 +387,7 @@ gst_query_new_position (GstFormat format)
GstQuery *query;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (QUERY_POSITION));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (QUERY_POSITION),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (CURRENT), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
@@ -460,8 +459,7 @@ gst_query_new_duration (GstFormat format)
GstQuery *query;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (QUERY_DURATION));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (QUERY_DURATION),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (DURATION), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
@@ -535,8 +533,7 @@ gst_query_new_latency (void)
GstQuery *query;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (QUERY_LATENCY));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (QUERY_LATENCY),
GST_QUARK (LIVE), G_TYPE_BOOLEAN, FALSE,
GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (0),
GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (-1), NULL);
@@ -623,8 +620,7 @@ gst_query_new_convert (GstFormat src_format, gint64 value,
GstQuery *query;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (QUERY_CONVERT));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (QUERY_CONVERT),
GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format,
GST_QUARK (SRC_VALUE), G_TYPE_INT64, value,
GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format,
@@ -711,8 +707,7 @@ gst_query_new_segment (GstFormat format)
GstQuery *query;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (QUERY_SEGMENT));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (QUERY_SEGMENT),
GST_QUARK (RATE), G_TYPE_DOUBLE, (gdouble) 0.0,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (START_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
@@ -846,8 +841,7 @@ gst_query_new_seeking (GstFormat format)
GstQuery *query;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (QUERY_SEEKING));
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (QUERY_SEEKING),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, FALSE,
GST_QUARK (SEGMENT_START), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
@@ -1096,10 +1090,9 @@ gst_query_new_buffering (GstFormat format)
GstQuery *query;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (QUERY_BUFFERING));
/* by default, we configure the answer as no buffering with a 100% buffering
* progress */
- gst_structure_id_set (structure,
+ structure = gst_structure_id_new (GST_QUARK (QUERY_BUFFERING),
GST_QUARK (BUSY), G_TYPE_BOOLEAN, FALSE,
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, 100,
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM,
@@ -1306,8 +1299,8 @@ gst_query_new_uri (void)
GstQuery *query;
GstStructure *structure;
- structure = gst_structure_id_empty_new (GST_QUARK (QUERY_URI));
- gst_structure_id_set (structure, GST_QUARK (URI), G_TYPE_STRING, NULL, NULL);
+ structure = gst_structure_id_new (GST_QUARK (QUERY_URI),
+ GST_QUARK (URI), G_TYPE_STRING, NULL, NULL);
query = gst_query_new (GST_QUERY_URI, structure);
diff --git a/gst/gststructure.c b/gst/gststructure.c
index 13ffd220ca..3ac555523b 100644
--- a/gst/gststructure.c
+++ b/gst/gststructure.c
@@ -608,6 +608,41 @@ gst_structure_id_set_valist (GstStructure * structure,
}
}
+/**
+ * gst_structure_id_new:
+ * @name_quark: name of new structure
+ * @field_quark: the GQuark for the name of the field to set
+ * @...: variable arguments
+ *
+ * Creates a new #GstStructure with the given name as a GQuark, followed by
+ * fieldname quark, GType, argument(s) "triplets" in the same format as
+ * gst_structure_id_set(). Basically a convenience wrapper around
+ * gst_structure_id_empty_new() and gst_structure_id_set().
+ *
+ * The last variable argument must be NULL (or 0).
+ *
+ * Returns: a new #GstStructure
+ *
+ * Since: 0.10.24
+ */
+GstStructure *
+gst_structure_id_new (GQuark name_quark, GQuark field_quark, ...)
+{
+ GstStructure *s;
+ va_list varargs;
+
+ g_return_val_if_fail (name_quark != 0, NULL);
+ g_return_val_if_fail (field_quark != 0, NULL);
+
+ s = gst_structure_id_empty_new (name_quark);
+
+ va_start (varargs, field_quark);
+ gst_structure_id_set_valist (s, field_quark, varargs);
+ va_end (varargs);
+
+ return s;
+}
+
/* If the structure currently contains a field with the same name, it is
* replaced with the provided field. Otherwise, the field is added to the
* structure. The field's value is not deeply copied.
diff --git a/gst/gststructure.h b/gst/gststructure.h
index 0fc50315a7..ecefea284c 100644
--- a/gst/gststructure.h
+++ b/gst/gststructure.h
@@ -95,6 +95,9 @@ GstStructure * gst_structure_new (const gchar *
GstStructure * gst_structure_new_valist (const gchar * name,
const gchar * firstfield,
va_list varargs);
+GstStructure * gst_structure_id_new (GQuark name_quark,
+ GQuark field_quark,
+ ...);
GstStructure * gst_structure_copy (const GstStructure *structure);
void gst_structure_set_parent_refcount (GstStructure *structure,
gint *refcount);
diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def
index 3c76a32181..4374f20b70 100644
--- a/win32/common/libgstreamer.def
+++ b/win32/common/libgstreamer.def
@@ -877,6 +877,7 @@ EXPORTS
gst_structure_has_name
gst_structure_id_empty_new
gst_structure_id_get_value
+ gst_structure_id_new
gst_structure_id_set
gst_structure_id_set_valist
gst_structure_id_set_value