* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
* 2005 Wim Taymans <wim@fluendo.com>
+ * 2011 Wim Taymans <wim.taymans@gmail.com>
*
* gstquery.h: GstQuery API declaration
*
* 0.10.22.
* @GST_QUERY_URI: query the URI of the source or sink. Since 0.10.22.
* @GST_QUERY_ALLOCATION: the buffer allocation properties
+ * @GST_QUERY_SCHEDULING: the scheduling properties
+ * @GST_QUERY_ACCEPT_CAPS: the accept caps query
*
* Standard predefined Query types
*/
GST_QUERY_BUFFERING,
GST_QUERY_CUSTOM,
GST_QUERY_URI,
- GST_QUERY_ALLOCATION
+ GST_QUERY_ALLOCATION,
+ GST_QUERY_SCHEDULING,
+ GST_QUERY_ACCEPT_CAPS,
+ GST_QUERY_LAST
} GstQueryType;
/**
* GstQuery:
* @mini_object: The parent #GstMiniObject type
* @type: the #GstQueryType
- * @structure: the #GstStructure containing the query details.
*
* The #GstQuery structure.
*/
/*< public > *//* with COW */
GstQueryType type;
-
- GstStructure *structure;
-
- /*< private >*/
- gpointer _gst_reserved;
};
const gchar* gst_query_type_get_name (GstQueryType query);
/* query for query details */
-G_CONST_RETURN GstQueryTypeDefinition*
+const GstQueryTypeDefinition*
gst_query_type_get_details (GstQueryType type);
GstIterator* gst_query_type_iterate_definitions (void);
}
/**
+ * gst_query_is_writable:
+ * @q: a #GstQuery
+ *
+ * Tests if you can safely write data into a query's structure.
+ */
+#define gst_query_is_writable(q) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (q))
+/**
* gst_query_make_writable:
* @q: (transfer full): a #GstQuery to make writable
*
* Returns: (transfer full): a new writable query (possibly same as @q)
*/
#define gst_query_make_writable(q) GST_QUERY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (q)))
+/**
+ * gst_query_replace:
+ * @old_query: (inout) (transfer full): pointer to a pointer to a #GstQuery
+ * to be replaced.
+ * @new_query: (allow-none) (transfer none): pointer to a #GstQuery that will
+ * replace the query pointed to by @old_query.
+ *
+ * Modifies a pointer to a #GstQuery to point to a different #GstQuery. The
+ * modification is done atomically (so this is useful for ensuring thread safety
+ * in some cases), and the reference counts are updated appropriately (the old
+ * query is unreffed, the new one is reffed).
+ *
+ * Either @new_query or the #GstQuery pointed to by @old_query may be NULL.
+ */
+#define gst_query_replace(old_query,new_query) \
+ gst_mini_object_replace ((GstMiniObject **)(old_query), GST_MINI_OBJECT_CAST (new_query))
+
+
+/* application specific query */
+GstQuery * gst_query_new_custom (GstQueryType type, GstStructure *structure);
+const GstStructure *
+ gst_query_get_structure (GstQuery *query);
+GstStructure * gst_query_writable_structure (GstQuery *query);
/* position query */
GstQuery* gst_query_new_position (GstFormat format);
void gst_query_parse_segment (GstQuery *query, gdouble *rate, GstFormat *format,
gint64 *start_value, gint64 *stop_value);
-/* application specific query */
-GstQuery * gst_query_new_application (GstQueryType type,
- GstStructure *structure);
-GstStructure * gst_query_get_structure (GstQuery *query);
-
/* seeking query */
GstQuery* gst_query_new_seeking (GstFormat format);
void gst_query_set_seeking (GstQuery *query, GstFormat format,
GstQuery* gst_query_new_formats (void);
void gst_query_set_formats (GstQuery *query, gint n_formats, ...);
void gst_query_set_formatsv (GstQuery *query, gint n_formats, const GstFormat *formats);
-void gst_query_parse_formats_length (GstQuery *query, guint *n_formats);
-void gst_query_parse_formats_nth (GstQuery *query, guint nth, GstFormat *format);
+void gst_query_parse_n_formats (GstQuery *query, guint *n_formats);
+void gst_query_parse_nth_format (GstQuery *query, guint nth, GstFormat *format);
/* buffering query */
GstQuery* gst_query_new_buffering (GstFormat format);
void gst_query_parse_buffering_range (GstQuery *query, GstFormat *format,
gint64 *start, gint64 *stop,
gint64 *estimated_total);
-gboolean gst_query_add_buffering_range (GstQuery *query,
- gint64 start, gint64 stop);
-
-guint gst_query_get_n_buffering_ranges (GstQuery *query);
+gboolean gst_query_add_buffering_range (GstQuery *query,
+ gint64 start, gint64 stop);
+guint gst_query_get_n_buffering_ranges (GstQuery *query);
gboolean gst_query_parse_nth_buffering_range (GstQuery *query,
guint index, gint64 *start,
gint64 *stop);
/* allocation query */
GstQuery * gst_query_new_allocation (GstCaps *caps, gboolean need_pool);
-
-void gst_query_set_allocation (GstQuery *query, guint alignment, guint prefix,
- guint size, GstBufferPool *pool);
-void gst_query_parse_allocation (GstQuery *query, guint *alignment, guint *prefix,
- guint *size, GstBufferPool **pool);
-
-void gst_query_add_allocation_meta (GstQuery *query, const gchar *api);
-guint gst_query_get_n_allocation_meta (GstQuery *query);
-const gchar * gst_query_parse_allocation_meta (GstQuery *query, guint index);
-
+void gst_query_parse_allocation (GstQuery *query, GstCaps **caps, gboolean *need_pool);
+
+void gst_query_set_allocation_params (GstQuery *query, guint size, guint min_buffers,
+ guint max_buffers, guint prefix, guint alignment,
+ GstBufferPool *pool);
+void gst_query_parse_allocation_params (GstQuery *query, guint *size, guint *min_buffers,
+ guint *max_buffers, guint *prefix, guint *alignment,
+ GstBufferPool **pool);
+
+void gst_query_add_allocation_meta (GstQuery *query, const gchar *api);
+guint gst_query_get_n_allocation_metas (GstQuery *query);
+const gchar * gst_query_parse_nth_allocation_meta (GstQuery *query, guint index);
+gboolean gst_query_has_allocation_meta (GstQuery *query, const gchar *api);
+
+void gst_query_add_allocation_memory (GstQuery *query, const gchar *alloc);
+guint gst_query_get_n_allocation_memories (GstQuery *query);
+const gchar * gst_query_parse_nth_allocation_memory (GstQuery *query, guint index);
+
+/* scheduling query */
+GstQuery * gst_query_new_scheduling (void);
+
+void gst_query_set_scheduling (GstQuery *query, gboolean pull_mode,
+ gboolean random_access, gboolean sequential,
+ gint minsize, gint maxsize, gint align);
+void gst_query_parse_scheduling (GstQuery *query, gboolean *pull_mode,
+ gboolean *random_access, gboolean *sequential,
+ gint *minsize, gint *maxsize, gint *align);
+/* accept-caps query */
+GstQuery * gst_query_new_accept_caps (GstCaps *caps);
+void gst_query_parse_accept_caps (GstQuery *query, GstCaps **caps);
+void gst_query_set_accept_caps_result (GstQuery *query, gboolean result);
+void gst_query_parse_accept_caps_result (GstQuery *query, gboolean *result);
G_END_DECLS