- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# query.h

Go to the documentation of this file.

    00001 // -*- c++ -*-
    00002 // Generated by gtkmmproc -- DO NOT MODIFY!
    00003 #ifndef _GSTREAMERMM_QUERY_H
    00004 #define _GSTREAMERMM_QUERY_H
    00005
    00006
    00007 #include <glibmm.h>
    00008
    00009 /* gstreamermm - a C++ wrapper for gstreamer
    00010  *
    00011  * Copyright 2008 The gstreamermm Development Team
    00012  *
    00013  * This library is free software; you can redistribute it and/or
    00014  * modify it under the terms of the GNU Lesser General Public
    00015  * License as published by the Free Software Foundation; either
    00016  * version 2.1 of the License, or (at your option) any later version.
    00017  *
    00018  * This library is distributed in the hope that it will be useful,
    00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00021  * Lesser General Public License for more details.
    00022  *
    00023  * You should have received a copy of the GNU Lesser General Public
    00024  * License along with this library; if not, write to the Free
    00025  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00026  */
    00027
    00028 #include <gst/gstquery.h>
    00029 #include <gstreamermm/miniobject.h>
    00030 #include <gstreamermm/structure.h>
    00031 #include <gstreamermm/wrap.h>
    00032 #include <gstreamermm/format.h>
    00033
    00034
    00035 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00036 typedef struct _GstQuery GstQuery;
    00037 typedef struct _GstQueryClass GstQueryClass;
    00038 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00039
    00040
    00041 namespace Gst
    00042 { class Query_Class; } // namespace Gst
    00043 namespace Gst
    00044 {
    00045
    00046 //Gst::IteratorBasic<> forward declaration.
    00047 template <class CppType>
    00048 class IteratorBasic;
    00049
    00055 enum QueryType
    00056 {
    00057   QUERY_NONE,
    00058   QUERY_POSITION,
    00059   QUERY_DURATION,
    00060   QUERY_LATENCY,
    00061   QUERY_JITTER,
    00062   QUERY_RATE,
    00063   QUERY_SEEKING,
    00064   QUERY_SEGMENT,
    00065   QUERY_CONVERT,
    00066   QUERY_FORMATS,
    00067   QUERY_BUFFERING,
    00068   QUERY_CUSTOM,
    00069   QUERY_URI
    00070 };
    00071
    00072 } // namespace Gst
    00073
    00074
    00075 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00076 namespace Glib
    00077 {
    00078
    00079 template <>
    00080 class Value<Gst::QueryType> : public Glib::Value_Enum<Gst::QueryType>
    00081 {
    00082 public:
    00083   static GType value_type() G_GNUC_CONST;
    00084 };
    00085
    00086 } // namespace Glib
    00087 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00088
    00089
    00090 namespace Gst
    00091 {
    00092
    00096 enum BufferingMode
    00097 {
    00098   BUFFERING_STREAM,
    00099   BUFFERING_DOWNLOAD,
    00100   BUFFERING_TIMESHIFT,
    00101   BUFFERING_LIVE
    00102 };
    00103
    00104 } // namespace Gst
    00105
    00106
    00107 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00108 namespace Glib
    00109 {
    00110
    00111 template <>
    00112 class Value<Gst::BufferingMode> : public Glib::Value_Enum<Gst::BufferingMode>
    00113 {
    00114 public:
    00115   static GType value_type() G_GNUC_CONST;
    00116 };
    00117
    00118 } // namespace Glib
    00119 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00120
    00121
    00122 namespace Gst
    00123 {
    00124
    00125
    00129 class QueryTypeDefinition
    00130 {
    00131   public:
    00132 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00133   typedef QueryTypeDefinition CppObjectType;
    00134   typedef GstQueryTypeDefinition BaseObjectType;
    00135 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00136
    00137 private:
    00138
    00139
    00140 public:
    00142   QueryTypeDefinition();
    00143
    00148   QueryTypeDefinition(const GstQueryTypeDefinition* castitem);
    00149
    00151   QueryType             value;
    00152
    00154   Glib::ustring         nick;
    00155
    00157   Glib::ustring         description;
    00158
    00160   Glib::QueryQuark      quark;
    00161
    00162
    00163 };
    00164
    00165 namespace Enums
    00166 {
    00167
    00173 Glib::ustring get_name(QueryType query);
    00174
    00175
    00181 Glib::QueryQuark get_quark(QueryType query);
    00182
    00183
    00184 } //namespace Enums
    00185
    00208 class Query : public MiniObject
    00209 {
    00210 protected:
    00211
    00212 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00213
    00214 public:
    00215   typedef Query CppObjectType;
    00216   typedef Query_Class CppClassType;
    00217   typedef GstQuery BaseObjectType;
    00218   typedef GstQueryClass BaseClassType;
    00219
    00220 private:  friend class Query_Class;
    00221   static CppClassType query_class_;
    00222
    00223 private:
    00224   // noncopyable
    00225   Query(const Query&);
    00226   Query& operator=(const Query&);
    00227
    00228 protected:
    00229   explicit Query(GstQuery* castitem);
    00230
    00231 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00232
    00233 public:
    00234   virtual ~Query();
    00235
    00236 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00237   static GType get_type()      G_GNUC_CONST;
    00238   static GType get_base_type() G_GNUC_CONST;
    00239 #endif
    00240
    00242   GstQuery*       gobj()       { return reinterpret_cast<GstQuery*>(gobject_); }
    00243
    00245   const GstQuery* gobj() const { return reinterpret_cast<GstQuery*>(gobject_); }
    00246
    00248   GstQuery* gobj_copy();
    00249
    00250 private:
    00251
    00252
    00253 public:
    00259   static Glib::RefPtr<Gst::Query> wrap(GstQuery* query, bool take_copy=false);
    00260
    00264    Glib::RefPtr<Gst::Query> copy() const;
    00265
    00270    Glib::RefPtr<Gst::Query> create_writable();
    00271
    00272 // A copy is taken so that the original is not freed by the wrapper.
    00273
    00274
    00279   const Gst::Structure get_structure() const;
    00280
    00283    QueryType get_query_type() const;
    00284
    00285
    00293   static QueryType register_query_type(const Glib::ustring& nick, const Glib::ustring& description);
    00294
    00300   static QueryType get_query_type(const Glib::ustring& nick);
    00301
    00302
    00307   static bool query_types_contain(const Glib::ArrayHandle<const QueryType>& types, QueryType type);
    00308
    00315   bool get_details(QueryType type, QueryTypeDefinition& def) const;
    00316
    00317
    00322   static Gst::IteratorBasic<const Gst::QueryTypeDefinition> iterate_definitions();
    00323
    00324
    00325 public:
    00326
    00327 public:
    00328   //C++ methods used to invoke GTK+ virtual functions:
    00329 #ifdef GLIBMM_VFUNCS_ENABLED
    00330 #endif //GLIBMM_VFUNCS_ENABLED
    00331
    00332 protected:
    00333   //GTK+ Virtual Functions (override these to change behaviour):
    00334 #ifdef GLIBMM_VFUNCS_ENABLED
    00335 #endif //GLIBMM_VFUNCS_ENABLED
    00336
    00337   //Default Signal Handlers::
    00338 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
    00339 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
    00340
    00341
    00342 };
    00343
    00344 //TODO: Modify create methods of derived Query classes to return
    00345 //Glib::RefPtr<...> to the derived class and not just Gst::Query. Must deal
    00346 //with GstStructure immutability problem (bug #510301) first because casting
    00347 //Glib::RefPtrs references the objects which causes problems when GStreamer API
    00348 //tries to modify the GstStructures of the objects.
    00349
    00352 class QueryApplication : public Query
    00353 {
    00354 public:
    00355   explicit QueryApplication(GstQuery* query);
    00356
    00365   static Glib::RefPtr<Gst::Query> create(QueryType type, Gst::Structure& structure);
    00366 };
    00367
    00370 class QueryConvert : public Query
    00371 {
    00372 public:
    00373   explicit QueryConvert(GstQuery* query);
    00374
    00382   static Glib::RefPtr<Gst::Query> create(Format src_format, gint64 value, Format dest_format);
    00383
    00390   void set(Format src_format, gint64 src_value, Format dest_format, gint64 dest_value);
    00391
    00400   void parse(Format& src_format, gint64& src_value, Format& dest_format, gint64& dest_value) const;
    00401
    00407   void parse(Format& dest_format, gint64& dest_value) const;
    00408
    00412   Format parse_src_format() const;
    00413
    00417   gint64 parse_src_value() const;
    00418
    00423   Format parse_dest_format() const;
    00424
    00429   gint64 parse_dest_value() const;
    00430 };
    00431
    00434 class QueryPosition : public Query
    00435 {
    00436 public:
    00437   explicit QueryPosition(GstQuery* query);
    00438
    00445   static Glib::RefPtr<Gst::Query> create(Format format);
    00446
    00452   void set(Format format, gint64 position);
    00453
    00460   void parse(Format& format, gint64& position) const;
    00461
    00465   gint64 parse() const;
    00466
    00470   Format parse_format() const;
    00471 };
    00472
    00475 class QueryDuration : public Query
    00476 {
    00477 public:
    00478   explicit QueryDuration(GstQuery* query);
    00479
    00485   static Glib::RefPtr<Gst::Query> create(Format format);
    00486
    00492   void set(Format format, gint64 duration);
    00493
    00500   void parse(Format& format, gint64& duration) const;
    00501
    00505   gint64 parse() const;
    00506
    00510   Format parse_format() const;
    00511 };
    00512
    00515 class QueryLatency : public Query
    00516 {
    00517 public:
    00518   explicit QueryLatency(GstQuery* query);
    00519
    00525   static Glib::RefPtr<Gst::Query> create();
    00526
    00533   void set(bool live, ClockTime min_latency, ClockTime max_latency);
    00534
    00541   void parse(bool& live, ClockTime& min_latency, ClockTime& max_latency) const;
    00542
    00546   bool parse_live() const;
    00547
    00551   ClockTime parse_min() const;
    00552
    00556   ClockTime parse_max() const;
    00557 };
    00558
    00561 class QuerySeeking : public Query
    00562 {
    00563 public:
    00564   explicit QuerySeeking(GstQuery* query);
    00565
    00571   static Glib::RefPtr<Gst::Query> create(Format format);
    00572
    00580   void set(Format format, bool seeakable, gint64 segment_start, gint64 segment_end);
    00581
    00590   void parse(Format& format, bool& seekable, gint64& segment_start, gint64& segment_end) const;
    00591
    00595   Format parse_format() const;
    00596
    00600   bool parse_seekable() const;
    00601
    00605   gint64 parse_start() const;
    00606
    00610   gint64 parse_end() const;
    00611 };
    00612
    00615 class QueryFormats : public Query
    00616 {
    00617 public:
    00618   explicit QueryFormats(GstQuery* query);
    00619
    00623   static Glib::RefPtr<Gst::Query> create();
    00624
    00629   void set(const Glib::ArrayHandle<Format>& formats);
    00630
    00638   void set(int n_formats, const Glib::ArrayHandle<Format>& formats);
    00639
    00643   guint parse_length() const;
    00644
    00651   Format parse(guint nth) const;
    00652 };
    00653
    00656 class QuerySegment : public Query
    00657 {
    00658 public:
    00659   explicit QuerySegment(GstQuery* query);
    00660
    00666   static Glib::RefPtr<Gst::Query> create(Format format);
    00667
    00685   void set(double rate, Format format, gint64 start_value, gint64 stop_value);
    00686
    00696   void parse(double& rate, Format& format, gint64& start_value, gint64& stop_value) const;
    00697
    00702   double parse_rate() const;
    00703
    00708   Format parse_format() const;
    00709
    00714   gint64 parse_start() const;
    00715
    00720   gint64 parse_stop() const;
    00721 };
    00722
    00725 class QueryBuffering : public Query
    00726 {
    00727 public:
    00728   explicit QueryBuffering(GstQuery* query);
    00729
    00735   static Glib::RefPtr<Gst::Query> create(Format format);
    00736
    00742   void set(bool busy, int percent);
    00743
    00751   void parse(bool& busy, int& percent) const;
    00752
    00757   bool parse_busy() const;
    00758
    00763   int parse_percent() const;
    00764
    00771   void set(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left);
    00772
    00781   void parse(BufferingMode& mode, int& avg_in, int& avg_out, gint64 buffering_left) const;
    00782
    00786   BufferingMode parse_mode() const;
    00787
    00791   int parse_input_rate() const;
    00792
    00796   int parse_output_rate() const;
    00797
    00801   gint64 parse_time_left() const;
    00802
    00809   void set(Format format, gint64 start, gint64 stop, gint64 estimated_total);
    00810
    00820   void parse(Format& format, gint64& start, gint64& stop, gint64& estimated_total) const;
    00821
    00825   Format parse_format() const;
    00826
    00830   gint64 parse_start() const;
    00831
    00835   gint64 parse_stop() const;
    00836
    00840   gint64 parse_total_time() const;
    00841 };
    00842
    00843 } //namespace Gst
    00844
    00845
    00846 namespace Gst
    00847 {
    00853   Glib::RefPtr<Gst::Query> wrap(GstQuery* object, bool take_copy = false);
    00854 }
    00855
    00856
    00857 #endif /* _GSTREAMERMM_QUERY_H */
    00858