gst/gstevent.*: New event for future idea.
authorWim Taymans <wim.taymans@gmail.com>
Fri, 7 Oct 2005 18:02:14 +0000 (18:02 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 7 Oct 2005 18:02:14 +0000 (18:02 +0000)
Original commit message from CVS:
* gst/gstevent.c: (gst_event_new_buffersize),
(gst_event_parse_buffersize):
* gst/gstevent.h:
New event for future idea.

ChangeLog
gst/gstevent.c
gst/gstevent.h

index ab043c3..2b1c9f8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-10-07  Wim Taymans  <wim@fluendo.com>
+
+       * gst/gstevent.c: (gst_event_new_buffersize),
+       (gst_event_parse_buffersize):
+       * gst/gstevent.h:
+       New event for future idea.
+
 2005-10-07  Andy Wingo  <wingo@pobox.com>
 
        * gst/gstelement.c (gst_element_post_message): Doc update.
index 31b3bd4..60d56cf 100644 (file)
@@ -469,6 +469,56 @@ gst_event_new_filler (void)
   return gst_event_new (GST_EVENT_FILLER);
 }
 
+/* buffersize event */
+/**
+ * gst_event_new_buffersize:
+ *
+ * Create a new buffersize event. The event is sent downstream and notifies
+ * elements that they should provide a buffer of the specified dimensions.
+ *
+ * When the async flag is set, a thread boundary is prefered.
+ *
+ * Returns: a new #GstEvent
+ */
+GstEvent *
+gst_event_new_buffersize (GstFormat format, gint64 minsize,
+    gint64 maxsize, gboolean async)
+{
+  GST_CAT_INFO (GST_CAT_EVENT,
+      "creating buffersize format %d, minsize %" G_GINT64_FORMAT
+      ", maxsize %" G_GINT64_FORMAT ", async %d", format,
+      minsize, maxsize, async);
+
+  return gst_event_new_custom (GST_EVENT_BUFFERSIZE,
+      gst_structure_new ("GstEventBufferSize",
+          "format", GST_TYPE_FORMAT, format,
+          "minsize", G_TYPE_INT64, minsize,
+          "maxsize", G_TYPE_INT64, maxsize,
+          "async", G_TYPE_BOOLEAN, async, NULL));
+}
+
+void
+gst_event_parse_buffersize (GstEvent * event, GstFormat * format,
+    gint64 * minsize, gint64 * maxsize, gboolean * async)
+{
+  const GstStructure *structure;
+
+  g_return_if_fail (GST_IS_EVENT (event));
+  g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_BUFFERSIZE);
+
+  structure = gst_event_get_structure (event);
+  if (format)
+    *format = g_value_get_enum (gst_structure_get_value (structure, "format"));
+  if (minsize)
+    *minsize =
+        g_value_get_int64 (gst_structure_get_value (structure, "minsize"));
+  if (maxsize)
+    *maxsize =
+        g_value_get_int64 (gst_structure_get_value (structure, "maxsize"));
+  if (async)
+    *async = g_value_get_boolean (gst_structure_get_value (structure, "async"));
+}
+
 /**
  * gst_event_new_qos:
  * @proportion: the proportion of the qos message
index e915773..8581bb2 100644 (file)
@@ -56,6 +56,7 @@ G_BEGIN_DECLS
  * @GST_EVENT_NEWSEGMENT: A new media segment follows in the dataflow.
  * @GST_EVENT_TAG: A new set of metadata tags has been found in the stream.
  * @GST_EVENT_FILLER: Filler for sparse data streams.
+ * @GST_EVENT_BUFFERSIZE: Notification of buffering requirements
  * @GST_EVENT_QOS: A quality message. Used to indicate to upstream elements
  *                 that the downstream elements are being starved of or
  *                 flooded with data.
@@ -88,10 +89,11 @@ typedef enum {
   GST_EVENT_NEWSEGMENT         = GST_EVENT_MAKE_TYPE (4, GST_EVDIR_DS | GST_EVSER),
   GST_EVENT_TAG                        = GST_EVENT_MAKE_TYPE (5, GST_EVDIR_DS | GST_EVSER),
   GST_EVENT_FILLER             = GST_EVENT_MAKE_TYPE (6, GST_EVDIR_DS | GST_EVSER),
+  GST_EVENT_BUFFERSIZE         = GST_EVENT_MAKE_TYPE (7, GST_EVDIR_DS | GST_EVSER),
   /* upstream events */
-  GST_EVENT_QOS                        = GST_EVENT_MAKE_TYPE (7, GST_EVDIR_US),
-  GST_EVENT_SEEK               = GST_EVENT_MAKE_TYPE (8, GST_EVDIR_US),
-  GST_EVENT_NAVIGATION         = GST_EVENT_MAKE_TYPE (9, GST_EVDIR_US),
+  GST_EVENT_QOS                        = GST_EVENT_MAKE_TYPE (8, GST_EVDIR_US),
+  GST_EVENT_SEEK               = GST_EVENT_MAKE_TYPE (9, GST_EVDIR_US),
+  GST_EVENT_NAVIGATION         = GST_EVENT_MAKE_TYPE (10, GST_EVDIR_US),
 
   /* custom events start here */
   GST_EVENT_CUSTOM_UP          = GST_EVENT_MAKE_TYPE (32, GST_EVDIR_US),
@@ -269,6 +271,11 @@ void               gst_event_parse_tag             (GstEvent *event, GstTagList **taglist);
 /* FIXME: FILLER events need to be fully specified and implemented */
 GstEvent *     gst_event_new_filler            (void);
 
+/* buffer */
+GstEvent *     gst_event_new_buffersize        (GstFormat format, gint64 minsize, gint64 maxsize, 
+                                                gboolean async);
+void           gst_event_parse_buffersize      (GstEvent *event, GstFormat *format, gint64 *minsize, 
+                                                gint64 *maxsize, gboolean *async);
 
 /* QOS events */
 /* FIXME: QOS events need to be fully specified and implemented */