00001
00002
00003 #ifndef _GSTREAMERMM_QUERY_H
00004 #define _GSTREAMERMM_QUERY_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <gst/gstquery.h>
00031 #include <gstreamermm/miniobject.h>
00032 #include <gstreamermm/structure.h>
00033 #include <gstreamermm/wrap.h>
00034 #include <gstreamermm/format.h>
00035
00036
00037 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00038 typedef struct _GstQuery GstQuery;
00039 typedef struct _GstQueryClass GstQueryClass;
00040 #endif
00041
00042
00043 namespace Gst
00044 { class Query_Class; }
00045 namespace Gst
00046 {
00047
00053 enum QueryType
00054 {
00055 QUERY_NONE,
00056 QUERY_POSITION,
00057 QUERY_DURATION,
00058 QUERY_LATENCY,
00059 QUERY_JITTER,
00060 QUERY_RATE,
00061 QUERY_SEEKING,
00062 QUERY_SEGMENT,
00063 QUERY_CONVERT,
00064 QUERY_FORMATS
00065 };
00066
00067 }
00068
00069
00070 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00071 namespace Glib
00072 {
00073
00074 template <>
00075 class Value<Gst::QueryType> : public Glib::Value_Enum<Gst::QueryType>
00076 {
00077 public:
00078 static GType value_type() G_GNUC_CONST;
00079 };
00080
00081 }
00082 #endif
00083
00084
00085 namespace Gst
00086 {
00087
00088
00089 Glib::ustring get_name(QueryType t);
00090 Glib::QueryQuark get_quark(QueryType t);
00091
00092 struct QueryTypeDefinition
00093 {
00094 QueryType value;
00095 Glib::ustring nick;
00096 Glib::ustring description;
00097 Glib::QueryQuark quark;
00098 };
00099
00100
00101 class Query : public MiniObject
00102 {
00103 protected:
00104
00105 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00106
00107 public:
00108 typedef Query CppObjectType;
00109 typedef Query_Class CppClassType;
00110 typedef GstQuery BaseObjectType;
00111 typedef GstQueryClass BaseClassType;
00112
00113 private: friend class Query_Class;
00114 static CppClassType query_class_;
00115
00116 private:
00117
00118 Query(const Query&);
00119 Query& operator=(const Query&);
00120
00121 protected:
00122 explicit Query(GstQuery* castitem);
00123
00124 #endif
00125
00126 public:
00127 virtual ~Query();
00128
00129 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00130 static GType get_type() G_GNUC_CONST;
00131 static GType get_base_type() G_GNUC_CONST;
00132 #endif
00133
00135 GstQuery* gobj() { return reinterpret_cast<GstQuery*>(gobject_); }
00136
00138 const GstQuery* gobj() const { return reinterpret_cast<GstQuery*>(gobject_); }
00139
00141 GstQuery* gobj_copy();
00142
00143 private:
00144
00145
00146 public:
00150 const Structure* get_structure();
00151
00152 public:
00153 QueryType get_query_type() const;
00154
00160 static Glib::RefPtr<Query> wrap(GstQuery* query, bool take_copy=false);
00161
00162
00170 static QueryType register_query_type(const Glib::ustring& nick, const Glib::ustring& description);
00171
00177 static QueryType get_query_type(const Glib::ustring& nick);
00178
00183 static bool query_types_contains(const Glib::ArrayHandle<QueryType>& types, QueryType type);
00184
00185 bool get_details(QueryType type, QueryTypeDefinition& def);
00186
00187
00188 public:
00189
00190 public:
00191
00192 #ifdef GLIBMM_VFUNCS_ENABLED
00193 #endif //GLIBMM_VFUNCS_ENABLED
00194
00195 protected:
00196
00197 #ifdef GLIBMM_VFUNCS_ENABLED
00198 #endif //GLIBMM_VFUNCS_ENABLED
00199
00200
00201 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00202 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00203
00204
00205 };
00206
00207 class QueryConvert : public Query
00208 {
00209 public:
00210 explicit QueryConvert(GstQuery* query);
00211
00212 static Glib::RefPtr<Query> create(Format src_format, gint64 value, Format dest_format);
00213 void set(Format src_format, gint64 src_value, Format dest_format, gint64 dest_value);
00214 void parse(Format& dest_format, gint64& dest_value);
00215 void parse(Format& src_format, gint64& src_value, Format& dest_format, gint64& dest_value);
00216 };
00217
00218 class QueryPosition : public Query
00219 {
00220 public:
00221 explicit QueryPosition(GstQuery* query);
00222
00223 static Glib::RefPtr<Query> create(Format format);
00224 void set(Format format, gint64 position);
00225 void parse(Format& format, gint64& position);
00226 };
00227
00228 class QueryDuration : public Query
00229 {
00230 public:
00231 explicit QueryDuration(GstQuery* query);
00232
00233 static Glib::RefPtr<Query> create(Format format);
00234 void set(Format format, gint64 duration);
00235 void parse(Format& format, gint64& duration);
00236 };
00237
00238 class QueryLatency : public Query
00239 {
00240 public:
00241 explicit QueryLatency(GstQuery* query);
00242
00243 static Glib::RefPtr<Query> create();
00244 void set(bool live, ClockTime min_latency, ClockTime max_latency);
00245 void parse(bool& live, ClockTime& min_latency, ClockTime& max_latency);
00246 };
00247
00248 class QuerySeeking : public Query
00249 {
00250 public:
00251 explicit QuerySeeking(GstQuery* query);
00252
00253 static Glib::RefPtr<Query> create(Format format);
00254 void set(Format format, bool seeakable, gint64 segment_start, gint64 segment_end);
00255 void parse(Format& format, bool& seekable, gint64& segment_start, gint64& segment_end);
00256 };
00257
00258 class QueryFormats : public Query
00259 {
00260 public:
00261 explicit QueryFormats(GstQuery* query);
00262
00263 static Glib::RefPtr<Query> create();
00264 void set(int n_formats, const va_list& varargs);
00265
00266 void parse(guint& n_formats);
00267 void parse(guint nth, Format& format);
00268 };
00269
00270 class QuerySegment : public Query
00271 {
00272 public:
00273 explicit QuerySegment(GstQuery* query);
00274
00275 static Glib::RefPtr<Query> create(Format format);
00276 void set(double rate, Format format, gint64 start_value, gint64 stop_value);
00277 void parse(double& rate, Format& format, gint64& start_value, gint64& stop_value);
00278 };
00279
00280 }
00281
00282
00283 namespace Gst
00284 {
00290 Glib::RefPtr<Gst::Query> wrap(GstQuery* object, bool take_copy = false);
00291 }
00292
00293
00294 #endif
00295