gstreamermm: query.h Source File

- Main Page
- Modules
- Namespaces
- Classes
- Files

# 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(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
    00277   const Gst::Structure get_structure() const;
    00278
    00281    QueryType get_query_type() const;
    00282
    00283
    00291   static QueryType register_query_type(const Glib::ustring& nick, const Glib::ustring& description);
    00292
    00298   static QueryType get_query_type(const Glib::ustring& nick);
    00299
    00300
    00305   static bool query_types_contain(const Glib::ArrayHandle<const QueryType>& types, QueryType type);
    00306
    00313   bool get_details(QueryType type, QueryTypeDefinition& def) const;
    00314
    00315
    00320   static Gst::IteratorBasic<const Gst::QueryTypeDefinition> iterate_definitions();
    00321
    00322
    00323 public:
    00324
    00325 public:
    00326   //C++ methods used to invoke GTK+ virtual functions:
    00327 #ifdef GLIBMM_VFUNCS_ENABLED
    00328 #endif //GLIBMM_VFUNCS_ENABLED
    00329
    00330 protected:
    00331   //GTK+ Virtual Functions (override these to change behaviour):
    00332 #ifdef GLIBMM_VFUNCS_ENABLED
    00333 #endif //GLIBMM_VFUNCS_ENABLED
    00334
    00335   //Default Signal Handlers::
    00336 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
    00337 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
    00338
    00339
    00340 };
    00341
    00342 //TODO: Modify create methods of derived Query classes to return
    00343 //Glib::RefPtr<...> to the derived class and not just Gst::Query. Must deal
    00344 //with GstStructure immutability problem (bug #510301) first because casting
    00345 //Glib::RefPtrs references the objects which causes problems when GStreamer API
    00346 //tries to modify the GstStructures of the objects.
    00347
    00350 class QueryApplication : public Query
    00351 {
    00352 public:
    00353   explicit QueryApplication(GstQuery* query);
    00354
    00363   static Glib::RefPtr<Gst::Query> create(QueryType type, Gst::Structure& structure);
    00364 };
    00365
    00368 class QueryConvert : public Query
    00369 {
    00370 public:
    00371   explicit QueryConvert(GstQuery* query);
    00372
    00380   static Glib::RefPtr<Gst::Query> create(Format src_format, gint64 value, Format dest_format);
    00381
    00388   void set(Format src_format, gint64 src_value, Format dest_format, gint64 dest_value);
    00389
    00398   void parse(Format& src_format, gint64& src_value, Format& dest_format, gint64& dest_value) const;
    00399
    00405   void parse(Format& dest_format, gint64& dest_value) const;
    00406
    00410   Format parse_src_format() const;
    00411
    00415   gint64 parse_src_value() const;
    00416
    00421   Format parse_dest_format() const;
    00422
    00427   gint64 parse_dest_value() const;
    00428 };
    00429
    00432 class QueryPosition : public Query
    00433 {
    00434 public:
    00435   explicit QueryPosition(GstQuery* query);
    00436
    00443   static Glib::RefPtr<Gst::Query> create(Format format);
    00444
    00450   void set(Format format, gint64 position);
    00451
    00458   void parse(Format& format, gint64& position) const;
    00459
    00463   gint64 parse() const;
    00464
    00468   Format parse_format() const;
    00469 };
    00470
    00473 class QueryDuration : public Query
    00474 {
    00475 public:
    00476   explicit QueryDuration(GstQuery* query);
    00477
    00483   static Glib::RefPtr<Gst::Query> create(Format format);
    00484
    00490   void set(Format format, gint64 duration);
    00491
    00498   void parse(Format& format, gint64& duration) const;
    00499
    00503   gint64 parse() const;
    00504
    00508   Format parse_format() const;
    00509 };
    00510
    00513 class QueryLatency : public Query
    00514 {
    00515 public:
    00516   explicit QueryLatency(GstQuery* query);
    00517
    00523   static Glib::RefPtr<Gst::Query> create();
    00524
    00531   void set(bool live, ClockTime min_latency, ClockTime max_latency);
    00532
    00539   void parse(bool& live, ClockTime& min_latency, ClockTime& max_latency) const;
    00540
    00544   bool parse_live() const;
    00545
    00549   ClockTime parse_min() const;
    00550
    00554   ClockTime parse_max() const;
    00555 };
    00556
    00559 class QuerySeeking : public Query
    00560 {
    00561 public:
    00562   explicit QuerySeeking(GstQuery* query);
    00563
    00569   static Glib::RefPtr<Gst::Query> create(Format format);
    00570
    00578   void set(Format format, bool seeakable, gint64 segment_start, gint64 segment_end);
    00579
    00588   void parse(Format& format, bool& seekable, gint64& segment_start, gint64& segment_end) const;
    00589
    00593   Format parse_format() const;
    00594
    00598   bool parse_seekable() const;
    00599
    00603   gint64 parse_start() const;
    00604
    00608   gint64 parse_end() const;
    00609 };
    00610
    00613 class QueryFormats : public Query
    00614 {
    00615 public:
    00616   explicit QueryFormats(GstQuery* query);
    00617
    00621   static Glib::RefPtr<Gst::Query> create();
    00622
    00627   void set(const Glib::ArrayHandle<Format>& formats);
    00628
    00636   void set(int n_formats, const Glib::ArrayHandle<Format>& formats);
    00637
    00641   guint parse_length() const;
    00642
    00649   Format parse(guint nth) const;
    00650 };
    00651
    00654 class QuerySegment : public Query
    00655 {
    00656 public:
    00657   explicit QuerySegment(GstQuery* query);
    00658
    00664   static Glib::RefPtr<Gst::Query> create(Format format);
    00665
    00683   void set(double rate, Format format, gint64 start_value, gint64 stop_value);
    00684
    00694   void parse(double& rate, Format& format, gint64& start_value, gint64& stop_value) const;
    00695
    00700   double parse_rate() const;
    00701
    00706   Format parse_format() const;
    00707
    00712   gint64 parse_start() const;
    00713
    00718   gint64 parse_stop() const;
    00719 };
    00720
    00723 class QueryBuffering : public Query
    00724 {
    00725 public:
    00726   explicit QueryBuffering(GstQuery* query);
    00727
    00733   static Glib::RefPtr<Gst::Query> create(Format format);
    00734
    00740   void set(bool busy, int percent);
    00741
    00749   void parse(bool& busy, int& percent) const;
    00750
    00755   bool parse_busy() const;
    00756
    00761   int parse_percent() const;
    00762
    00769   void set(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left);
    00770
    00779   void parse(BufferingMode& mode, int& avg_in, int& avg_out, gint64 buffering_left) const;
    00780
    00784   BufferingMode parse_mode() const;
    00785
    00789   int parse_input_rate() const;
    00790
    00794   int parse_output_rate() const;
    00795
    00799   gint64 parse_time_left() const;
    00800
    00807   void set(Format format, gint64 start, gint64 stop, gint64 estimated_total);
    00808
    00818   void parse(Format& format, gint64& start, gint64& stop, gint64& estimated_total) const;
    00819
    00823   Format parse_format() const;
    00824
    00828   gint64 parse_start() const;
    00829
    00833   gint64 parse_stop() const;
    00834
    00838   gint64 parse_total_time() const;
    00839 };
    00840
    00841 } //namespace Gst
    00842
    00843
    00844 namespace Gst
    00845 {
    00851   Glib::RefPtr<Gst::Query> wrap(GstQuery* object, bool take_copy = false);
    00852 }
    00853
    00854
    00855 #endif /* _GSTREAMERMM_QUERY_H */
    00856