2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wim.taymans@chello.be>
4 * 2005 Wim Taymans <wim@fluendo.com>
6 * gstquery.h: GstQuery API declaration
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
25 #ifndef __GST_QUERY_H__
26 #define __GST_QUERY_H__
30 #include <gst/gstiterator.h>
31 #include <gst/gstminiobject.h>
32 #include <gst/gststructure.h>
33 #include <gst/gstformat.h>
39 GST_QUERY_POSITION, /* get current/end position */
40 GST_QUERY_LATENCY, /* get current latency */
41 GST_QUERY_JITTER, /* not in draft-query, necessary? */
42 GST_QUERY_RATE, /* get current playback rate */
43 GST_QUERY_SEEKING, /* get seeking start/stop positions */
44 GST_QUERY_CONVERT, /* convert values */
45 GST_QUERY_FORMATS /* query supported formats for convert */
48 /* rate is relative to 1000000 */
49 #define GST_QUERY_TYPE_RATE_DEN G_GINT64_CONSTANT (1000000)
51 typedef struct _GstQueryTypeDefinition GstQueryTypeDefinition;
52 typedef struct _GstQuery GstQuery;
53 typedef struct _GstQueryClass GstQueryClass;
55 struct _GstQueryTypeDefinition
62 #define GST_TYPE_QUERY (gst_query_get_type())
63 #define GST_IS_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_QUERY))
64 #define GST_IS_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_QUERY))
65 #define GST_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_QUERY, GstQueryClass))
66 #define GST_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_QUERY, GstQuery))
67 #define GST_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_QUERY, GstQueryClass))
69 #define GST_QUERY_TYPE(query) (((GstQuery*)(query))->type)
73 GstMiniObject mini_object;
78 GstStructure *structure;
81 gpointer _gst_reserved[GST_PADDING];
84 struct _GstQueryClass {
85 GstMiniObjectClass mini_object_class;
88 gpointer _gst_reserved[GST_PADDING];
91 void _gst_query_initialize (void);
92 GType gst_query_get_type (void);
94 /* register a new query */
95 GstQueryType gst_query_type_register (const gchar *nick,
96 const gchar *description);
97 GstQueryType gst_query_type_get_by_nick (const gchar *nick);
99 /* check if a query is in an array of querys */
100 gboolean gst_query_types_contains (const GstQueryType *types,
103 /* query for query details */
104 G_CONST_RETURN GstQueryTypeDefinition*
105 gst_query_type_get_details (GstQueryType type);
106 GstIterator* gst_query_type_iterate_definitions (void);
109 #define gst_query_ref(msg) GST_QUERY (gst_mini_object_ref (GST_MINI_OBJECT (msg)))
110 #define gst_query_unref(msg) gst_mini_object_unref (GST_MINI_OBJECT (msg))
112 #define gst_query_copy(msg) GST_QUERY (gst_mini_object_copy (GST_MINI_OBJECT (msg)))
113 #define gst_query_make_writable(msg) GST_QUERY (gst_mini_object_make_writable (GST_MINI_OBJECT (msg)))
116 GstQuery* gst_query_new_position (GstFormat format);
117 void gst_query_set_position (GstQuery *query, GstFormat format,
118 gint64 cur, gint64 end);
119 void gst_query_parse_position (GstQuery *query, GstFormat *format,
120 gint64 *cur, gint64 *end);
122 GstQuery* gst_query_new_convert (GstFormat src_fmt, gint64 value, GstFormat dest_fmt);
123 void gst_query_set_convert (GstQuery *query, GstFormat src_format, gint64 src_value,
124 GstFormat dest_format, gint64 dest_value);
125 void gst_query_parse_convert (GstQuery *query, GstFormat *src_format, gint64 *src_value,
126 GstFormat *dest_format, gint64 *dest_value);
128 /* application specific query */
129 GstQuery * gst_query_new_application (GstQueryType type,
130 GstStructure *structure);
133 GstStructure * gst_query_get_structure (GstQuery *query);
137 #endif /* __GST_QUERY_H__ */