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
00048
00049 template <class CppType>
00050 class IteratorBasic;
00051
00057 enum QueryType
00058 {
00059 QUERY_NONE,
00060 QUERY_POSITION,
00061 QUERY_DURATION,
00062 QUERY_LATENCY,
00063 QUERY_JITTER,
00064 QUERY_RATE,
00065 QUERY_SEEKING,
00066 QUERY_SEGMENT,
00067 QUERY_CONVERT,
00068 QUERY_FORMATS,
00069 QUERY_BUFFERING,
00070 QUERY_CUSTOM
00071 };
00072
00073 }
00074
00075
00076 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00077 namespace Glib
00078 {
00079
00080 template <>
00081 class Value<Gst::QueryType> : public Glib::Value_Enum<Gst::QueryType>
00082 {
00083 public:
00084 static GType value_type() G_GNUC_CONST;
00085 };
00086
00087 }
00088 #endif
00089
00090
00091 namespace Gst
00092 {
00093
00097 enum BufferingMode
00098 {
00099 BUFFERING_STREAM,
00100 BUFFERING_DOWNLOAD,
00101 BUFFERING_TIMESHIFT,
00102 BUFFERING_LIVE
00103 };
00104
00105 }
00106
00107
00108 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00109 namespace Glib
00110 {
00111
00112 template <>
00113 class Value<Gst::BufferingMode> : public Glib::Value_Enum<Gst::BufferingMode>
00114 {
00115 public:
00116 static GType value_type() G_GNUC_CONST;
00117 };
00118
00119 }
00120 #endif
00121
00122
00123 namespace Gst
00124 {
00125
00126
00130 class QueryTypeDefinition
00131 {
00132 public:
00133 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00134 typedef QueryTypeDefinition CppObjectType;
00135 typedef GstQueryTypeDefinition BaseObjectType;
00136 #endif
00137
00138 private:
00139
00140
00141 public:
00143 QueryTypeDefinition();
00144
00149 QueryTypeDefinition(GstQueryTypeDefinition* castitem);
00150
00152 QueryType value;
00153
00155 Glib::ustring nick;
00156
00158 Glib::ustring description;
00159
00161 Glib::QueryQuark quark;
00162
00163
00164 };
00165
00166 namespace Enums
00167 {
00168
00174 Glib::ustring get_name(QueryType query);
00175
00176
00182 Glib::QueryQuark get_quark(QueryType query);
00183
00184
00185 }
00186
00209 class Query : public MiniObject
00210 {
00211 protected:
00212
00213 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00214
00215 public:
00216 typedef Query CppObjectType;
00217 typedef Query_Class CppClassType;
00218 typedef GstQuery BaseObjectType;
00219 typedef GstQueryClass BaseClassType;
00220
00221 private: friend class Query_Class;
00222 static CppClassType query_class_;
00223
00224 private:
00225
00226 Query(const Query&);
00227 Query& operator=(const Query&);
00228
00229 protected:
00230 explicit Query(GstQuery* castitem);
00231
00232 #endif
00233
00234 public:
00235 virtual ~Query();
00236
00237 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00238 static GType get_type() G_GNUC_CONST;
00239 static GType get_base_type() G_GNUC_CONST;
00240 #endif
00241
00243 GstQuery* gobj() { return reinterpret_cast<GstQuery*>(gobject_); }
00244
00246 const GstQuery* gobj() const { return reinterpret_cast<GstQuery*>(gobject_); }
00247
00249 GstQuery* gobj_copy();
00250
00251 private:
00252
00253
00254 public:
00260 static Glib::RefPtr<Gst::Query> wrap(GstQuery* query, bool take_copy=false);
00261
00265 Glib::RefPtr<Gst::Query> copy() const;
00266
00271 Glib::RefPtr<Gst::Query> create_writable();
00272
00273
00278 const Gst::Structure get_structure() const;
00279
00282 QueryType get_query_type() const;
00283
00284
00292 static QueryType register_query_type(const Glib::ustring& nick, const Glib::ustring& description);
00293
00299 static QueryType get_query_type(const Glib::ustring& nick);
00300
00301
00306 static bool query_types_contain(const Glib::ArrayHandle<QueryType>& types, QueryType type);
00307
00314 bool get_details(QueryType type, QueryTypeDefinition& def);
00315
00316
00321 static Gst::IteratorBasic<const Gst::QueryTypeDefinition> iterate_definitions();
00322
00323
00324 public:
00325
00326 public:
00327
00328 #ifdef GLIBMM_VFUNCS_ENABLED
00329 #endif //GLIBMM_VFUNCS_ENABLED
00330
00331 protected:
00332
00333 #ifdef GLIBMM_VFUNCS_ENABLED
00334 #endif //GLIBMM_VFUNCS_ENABLED
00335
00336
00337 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00338 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00339
00340
00341 };
00342
00343
00344
00345
00346
00347
00348
00351 class QueryApplication : public Query
00352 {
00353 public:
00354 explicit QueryApplication(GstQuery* query);
00355
00364 static Glib::RefPtr<Gst::Query> create(QueryType type, Gst::Structure& structure);
00365 };
00366
00369 class QueryConvert : public Query
00370 {
00371 public:
00372 explicit QueryConvert(GstQuery* query);
00373
00381 static Glib::RefPtr<Gst::Query> create(Format src_format, gint64 value, Format dest_format);
00382
00389 void set(Format src_format, gint64 src_value, Format dest_format, gint64 dest_value);
00390
00399 void parse(Format& src_format, gint64& src_value, Format& dest_format, gint64& dest_value);
00400
00406 void parse(Format& dest_format, gint64& dest_value);
00407
00411 Format parse_src_format();
00412
00416 gint64 parse_src_value();
00417
00422 Format parse_dest_format();
00423
00428 gint64 parse_dest_value();
00429 };
00430
00433 class QueryPosition : public Query
00434 {
00435 public:
00436 explicit QueryPosition(GstQuery* query);
00437
00444 static Glib::RefPtr<Gst::Query> create(Format format);
00445
00451 void set(Format format, gint64 position);
00452
00459 void parse(Format& format, gint64& position);
00460
00464 gint64 parse();
00465
00469 Format parse_format();
00470 };
00471
00474 class QueryDuration : public Query
00475 {
00476 public:
00477 explicit QueryDuration(GstQuery* query);
00478
00484 static Glib::RefPtr<Gst::Query> create(Format format);
00485
00491 void set(Format format, gint64 duration);
00492
00499 void parse(Format& format, gint64& duration);
00500
00504 gint64 parse();
00505
00509 Format parse_format();
00510 };
00511
00514 class QueryLatency : public Query
00515 {
00516 public:
00517 explicit QueryLatency(GstQuery* query);
00518
00524 static Glib::RefPtr<Gst::Query> create();
00525
00532 void set(bool live, ClockTime min_latency, ClockTime max_latency);
00533
00540 void parse(bool& live, ClockTime& min_latency, ClockTime& max_latency);
00541
00545 bool parse_live();
00546
00550 ClockTime parse_min();
00551
00555 ClockTime parse_max();
00556 };
00557
00560 class QuerySeeking : public Query
00561 {
00562 public:
00563 explicit QuerySeeking(GstQuery* query);
00564
00570 static Glib::RefPtr<Gst::Query> create(Format format);
00571
00579 void set(Format format, bool seeakable, gint64 segment_start, gint64 segment_end);
00580
00589 void parse(Format& format, bool& seekable, gint64& segment_start, gint64& segment_end);
00590
00594 Format parse_format();
00595
00599 bool parse_seekable();
00600
00604 gint64 parse_start();
00605
00609 gint64 parse_end();
00610 };
00611
00614 class QueryFormats : public Query
00615 {
00616 public:
00617 explicit QueryFormats(GstQuery* query);
00618
00622 static Glib::RefPtr<Gst::Query> create();
00623
00628 void set(const Glib::ArrayHandle<Format>& formats);
00629
00637 void set(int n_formats, const Glib::ArrayHandle<Format>& formats);
00638
00642 guint parse_length();
00643
00650 Format parse(guint nth);
00651 };
00652
00655 class QuerySegment : public Query
00656 {
00657 public:
00658 explicit QuerySegment(GstQuery* query);
00659
00665 static Glib::RefPtr<Gst::Query> create(Format format);
00666
00684 void set(double rate, Format format, gint64 start_value, gint64 stop_value);
00685
00695 void parse(double& rate, Format& format, gint64& start_value, gint64& stop_value);
00696
00701 double parse_rate();
00702
00707 Format parse_format();
00708
00713 gint64 parse_start();
00714
00719 gint64 parse_stop();
00720 };
00721
00724 class QueryBuffering : public Query
00725 {
00726 public:
00727 explicit QueryBuffering(GstQuery* query);
00728
00734 static Glib::RefPtr<Gst::Query> create(Format format);
00735
00741 void set(bool busy, int percent);
00742
00750 void parse(bool& busy, int& percent);
00751
00756 bool parse_busy();
00757
00762 int parse_percent();
00763
00770 void set(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left);
00771
00780 void parse(BufferingMode& mode, int& avg_in, int& avg_out, gint64 buffering_left);
00781
00785 BufferingMode parse_mode();
00786
00790 int parse_input_rate();
00791
00795 int parse_output_rate();
00796
00800 gint64 parse_time_left();
00801
00808 void set(Format format, gint64 start, gint64 stop, gint64 estimated_total);
00809
00819 void parse(Format& format, gint64& start, gint64& stop, gint64& estimated_total);
00820
00824 Format parse_format();
00825
00829 gint64 parse_start();
00830
00834 gint64 parse_stop();
00835
00839 gint64 parse_total_time();
00840 };
00841
00842 }
00843
00844
00845 namespace Gst
00846 {
00852 Glib::RefPtr<Gst::Query> wrap(GstQuery* object, bool take_copy = false);
00853 }
00854
00855
00856 #endif
00857