- Main Page
- Modules
- Namespaces
- Classes
- Files

# event.h

Go to the documentation of this file.

    00001 // -*- c++ -*-
    00002 // Generated by gtkmmproc -- DO NOT MODIFY!
    00003 #ifndef _GSTREAMERMM_EVENT_H
    00004 #define _GSTREAMERMM_EVENT_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/gstevent.h>
    00029 #include <gstreamermm/wrap.h>
    00030 #include <gstreamermm/format.h>
    00031 #include <gstreamermm/clock.h>
    00032
    00033
    00034 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00035 typedef struct _GstEvent GstEvent;
    00036 typedef struct _GstEventClass GstEventClass;
    00037 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00038
    00039
    00040 namespace Gst
    00041 { class Event_Class; } // namespace Gst
    00042 namespace Gst
    00043 {
    00044
    00045 enum EventType
    00046 {
    00047   EVENT_UNKNOWN = GST_EVENT_UNKNOWN,
    00048   /* bidirectional events */
    00049   EVENT_FLUSH_START = GST_EVENT_FLUSH_START,
    00050   EVENT_FLUSH_STOP = GST_EVENT_FLUSH_STOP,
    00051   /* downstream serialized events */
    00052   EVENT_EOS = GST_EVENT_EOS,
    00053   EVENT_NEWSEGMENT = GST_EVENT_NEWSEGMENT,
    00054   EVENT_TAG = GST_EVENT_TAG,
    00055   EVENT_BUFFERSIZE = GST_EVENT_BUFFERSIZE,
    00056   /* upstream events */
    00057   EVENT_QOS = GST_EVENT_QOS,
    00058   EVENT_SEEK = GST_EVENT_SEEK,
    00059   EVENT_NAVIGATION = GST_EVENT_NAVIGATION,
    00060   EVENT_LATENCY = GST_EVENT_LATENCY,
    00061
    00062   /* custom events start here */
    00063   EVENT_CUSTOM_UPSTREAM = GST_EVENT_CUSTOM_UPSTREAM,
    00064   EVENT_CUSTOM_DOWNSTREAM = GST_EVENT_CUSTOM_DOWNSTREAM,
    00065   EVENT_CUSTOM_DOWNSTREAM_OOB = GST_EVENT_CUSTOM_DOWNSTREAM_OOB,
    00066   EVENT_CUSTOM_BOTH = GST_EVENT_CUSTOM_BOTH,
    00067   EVENT_CUSTOM_BOTH_OOB = GST_EVENT_CUSTOM_BOTH_OOB
    00068 };
    00069
    00075 enum SeekType
    00076 {
    00077   SEEK_TYPE_NONE,
    00078   SEEK_TYPE_CUR,
    00079   SEEK_TYPE_SET,
    00080   SEEK_TYPE_END
    00081 };
    00082
    00083 } // namespace Gst
    00084
    00085
    00086 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00087 namespace Glib
    00088 {
    00089
    00090 template <>
    00091 class Value<Gst::SeekType> : public Glib::Value_Enum<Gst::SeekType>
    00092 {
    00093 public:
    00094   static GType value_type() G_GNUC_CONST;
    00095 };
    00096
    00097 } // namespace Glib
    00098 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00099
    00100
    00101 namespace Gst
    00102 {
    00103
    00115 enum SeekFlags
    00116 {
    00117   SEEK_FLAG_NONE = 0,
    00118   SEEK_FLAG_FLUSH = 1 << 0,
    00119   SEEK_FLAG_ACCURATE = 1 << 1,
    00120   SEEK_FLAG_KEY_UNIT = 1 << 2,
    00121   SEEK_FLAG_SEGMENT = 1 << 3,
    00122   SEEK_FLAG_SKIP = 1 << 4
    00123 };
    00124
    00126 inline SeekFlags operator|(SeekFlags lhs, SeekFlags rhs)
    00127   { return static_cast<SeekFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
    00128
    00130 inline SeekFlags operator&(SeekFlags lhs, SeekFlags rhs)
    00131   { return static_cast<SeekFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
    00132
    00134 inline SeekFlags operator^(SeekFlags lhs, SeekFlags rhs)
    00135   { return static_cast<SeekFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
    00136
    00138 inline SeekFlags operator~(SeekFlags flags)
    00139   { return static_cast<SeekFlags>(~static_cast<unsigned>(flags)); }
    00140
    00142 inline SeekFlags& operator|=(SeekFlags& lhs, SeekFlags rhs)
    00143   { return (lhs = static_cast<SeekFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
    00144
    00146 inline SeekFlags& operator&=(SeekFlags& lhs, SeekFlags rhs)
    00147   { return (lhs = static_cast<SeekFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
    00148
    00150 inline SeekFlags& operator^=(SeekFlags& lhs, SeekFlags rhs)
    00151   { return (lhs = static_cast<SeekFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
    00152
    00153 } // namespace Gst
    00154
    00155
    00156 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00157 namespace Glib
    00158 {
    00159
    00160 template <>
    00161 class Value<Gst::SeekFlags> : public Glib::Value_Flags<Gst::SeekFlags>
    00162 {
    00163 public:
    00164   static GType value_type() G_GNUC_CONST;
    00165 };
    00166
    00167 } // namespace Glib
    00168 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00169
    00170
    00171 namespace Gst
    00172 {
    00173
    00185 enum EventTypeFlags
    00186 {
    00187   EVENT_TYPE_UPSTREAM = 1 << 0,
    00188   EVENT_TYPE_DOWNSTREAM = 1 << 1,
    00189   EVENT_TYPE_SERIALIZED = 1 << 2
    00190 };
    00191
    00193 inline EventTypeFlags operator|(EventTypeFlags lhs, EventTypeFlags rhs)
    00194   { return static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
    00195
    00197 inline EventTypeFlags operator&(EventTypeFlags lhs, EventTypeFlags rhs)
    00198   { return static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
    00199
    00201 inline EventTypeFlags operator^(EventTypeFlags lhs, EventTypeFlags rhs)
    00202   { return static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
    00203
    00205 inline EventTypeFlags operator~(EventTypeFlags flags)
    00206   { return static_cast<EventTypeFlags>(~static_cast<unsigned>(flags)); }
    00207
    00209 inline EventTypeFlags& operator|=(EventTypeFlags& lhs, EventTypeFlags rhs)
    00210   { return (lhs = static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
    00211
    00213 inline EventTypeFlags& operator&=(EventTypeFlags& lhs, EventTypeFlags rhs)
    00214   { return (lhs = static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
    00215
    00217 inline EventTypeFlags& operator^=(EventTypeFlags& lhs, EventTypeFlags rhs)
    00218   { return (lhs = static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
    00219
    00220 } // namespace Gst
    00221
    00222
    00223 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00224 namespace Glib
    00225 {
    00226
    00227 template <>
    00228 class Value<Gst::EventTypeFlags> : public Glib::Value_Flags<Gst::EventTypeFlags>
    00229 {
    00230 public:
    00231   static GType value_type() G_GNUC_CONST;
    00232 };
    00233
    00234 } // namespace Glib
    00235 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00236
    00237
    00238 namespace Gst
    00239 {
    00240
    00241
    00242 class Structure;
    00243 class TagList;
    00244
    00245 namespace Enums
    00246 {
    00247
    00253 Glib::ustring get_name(EventType type);
    00254
    00260 Glib::QueryQuark get_quark(EventType type);
    00261
    00266 EventTypeFlags get_flags(EventType type);
    00267
    00268 } //namespace Enums
    00269
    00301 class Event : public MiniObject
    00302 {
    00303 protected:
    00304
    00305 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00306
    00307 public:
    00308   typedef Event CppObjectType;
    00309   typedef Event_Class CppClassType;
    00310   typedef GstEvent BaseObjectType;
    00311   typedef GstEventClass BaseClassType;
    00312
    00313 private:  friend class Event_Class;
    00314   static CppClassType event_class_;
    00315
    00316 private:
    00317   // noncopyable
    00318   Event(const Event&);
    00319   Event& operator=(const Event&);
    00320
    00321 protected:
    00322   explicit Event(GstEvent* castitem);
    00323
    00324 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00325
    00326 public:
    00327   virtual ~Event();
    00328
    00329 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00330   static GType get_type()      G_GNUC_CONST;
    00331   static GType get_base_type() G_GNUC_CONST;
    00332 #endif
    00333
    00335   GstEvent*       gobj()       { return reinterpret_cast<GstEvent*>(gobject_); }
    00336
    00338   const GstEvent* gobj() const { return reinterpret_cast<GstEvent*>(gobject_); }
    00339
    00341   GstEvent* gobj_copy();
    00342
    00343 private:
    00344
    00345
    00346 public:
    00352   static Glib::RefPtr<Gst::Event> wrap(GstEvent* event, bool take_copy=false);
    00353
    00357   Glib::RefPtr<Gst::Event> copy() const;
    00358
    00359
    00367   const Gst::Structure get_structure() const;
    00368
    00376   bool has_name(const Glib::ustring& name) const;
    00377
    00382   Glib::RefPtr<Gst::Event> create_writable();
    00383
    00386   bool is_downstream() const;
    00387
    00390   bool is_serialized() const;
    00391
    00394   bool is_upstream() const;
    00395
    00398    EventType get_event_type() const;
    00399
    00403    ClockTime get_timestamp() const;
    00404
    00407    Glib::RefPtr<Gst::Object> get_source();
    00408   Glib::RefPtr<const Gst::Object> get_source() const;
    00409
    00410
    00411 public:
    00412
    00413 public:
    00414   //C++ methods used to invoke GTK+ virtual functions:
    00415 #ifdef GLIBMM_VFUNCS_ENABLED
    00416 #endif //GLIBMM_VFUNCS_ENABLED
    00417
    00418 protected:
    00419   //GTK+ Virtual Functions (override these to change behaviour):
    00420 #ifdef GLIBMM_VFUNCS_ENABLED
    00421 #endif //GLIBMM_VFUNCS_ENABLED
    00422
    00423   //Default Signal Handlers::
    00424 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
    00425 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
    00426
    00427
    00428 };
    00429
    00430 //TODO: Modify create methods of derived Event classes to return
    00431 //Glib::RefPtr<...> to the derived class and not just Gst::Event. Must deal
    00432 //with GstStructure immutability problem (bug #510301) first because casting
    00433 //Glib::RefPtrs references the objects which causes problems when GStreamer API
    00434 //tries to modify the GstStructures of the objects.
    00435
    00438 class EventFlushStart : public Event
    00439 {
    00440 public:
    00441   explicit EventFlushStart(GstEvent* event);
    00442
    00460   static Glib::RefPtr<Gst::Event> create();
    00461 };
    00462
    00465 class EventFlushStop : public Event
    00466 {
    00467 public:
    00468   explicit EventFlushStop(GstEvent* event);
    00469
    00483   static Glib::RefPtr<Gst::Event> create();
    00484 };
    00485
    00488 class EventEos : public Event
    00489 {
    00490 public:
    00491   explicit EventEos(GstEvent* event);
    00492
    00507   static Glib::RefPtr<Gst::Event> create();
    00508 };
    00509
    00512 class EventNewSegment : public Event
    00513 {
    00514 public:
    00515   explicit EventNewSegment(GstEvent* event);
    00516
    00557   static Glib::RefPtr<Gst::Event> create(bool update, double rate, Format format, gint64 strat, gint64 stop, gint64 position, double applied_rate=1.0);
    00558
    00569   void parse(bool& update, double& rate, Format& format, gint64& start, gint64& stop, gint64& position) const;
    00570
    00585   void parse(bool& update, double& rate, Format& format, gint64& start, gint64& stop, gint64& position, double& applied_rate) const;
    00586
    00587 };
    00588
    00591 class EventTag : public Event
    00592 {
    00593 public:
    00594   explicit EventTag(GstEvent* event);
    00595
    00600   static Glib::RefPtr<Gst::Event> create(const Gst::TagList& taglist);
    00601
    00605   Gst::TagList parse() const;
    00606
    00607 };
    00608
    00611 class EventBufferSize : public Event
    00612 {
    00613 public:
    00614   explicit EventBufferSize(GstEvent* event);
    00615
    00627   static Glib::RefPtr<Gst::Event> create(Format format, gint64 minsize, gint64 maxsize, bool async);
    00628
    00636   void parse(Format& format, gint64& minsize, gint64& maxsize, bool& async) const;
    00637
    00638 };
    00639
    00642 class EventQos : public Event
    00643 {
    00644 public:
    00645   explicit EventQos(GstEvent* event);
    00646
    00684   static Glib::RefPtr<Gst::Event> create(double proportion, ClockTimeDiff diff, ClockTime timestamp);
    00685
    00693   void parse(double& proportion, ClockTimeDiff& diff, ClockTime& timestamp) const;
    00694
    00695 };
    00696
    00699 class EventSeek : public Event
    00700 {
    00701 public:
    00702   explicit EventSeek(GstEvent* event);
    00703
    00744   static Glib::RefPtr<Gst::Event> create(double rate, Format format, SeekFlags flags, SeekType start_type, gint64 start, SeekType stop_type, gint64 stop);
    00745
    00758   void parse(double& rate, Format& format, SeekFlags& flags, SeekType& start_type, gint64& start, SeekType& stop_type, gint64& stop) const;
    00759
    00760 };
    00761
    00764 class EventNavigation : public Event
    00765 {
    00766 public:
    00767   explicit EventNavigation(GstEvent* event);
    00768
    00774   static Glib::RefPtr<Gst::Event> create(Gst::Structure& structure);
    00775 };
    00776
    00779 class EventLatency : public Event
    00780 {
    00781 public:
    00782   explicit EventLatency(GstEvent* event);
    00783
    00796   static Glib::RefPtr<Gst::Event> create(ClockTime latency);
    00797
    00802   void parse(ClockTime& latency) const;
    00803
    00804 };
    00805
    00806 } //namespace Gst
    00807
    00808
    00809 namespace Gst
    00810 {
    00816   Glib::RefPtr<Gst::Event> wrap(GstEvent* object, bool take_copy = false);
    00817 }
    00818
    00819
    00820 #endif /* _GSTREAMERMM_EVENT_H */
    00821