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 // A copy is taken so that the original is not freed by the wrapper.
00360  
00361 
00369   const Gst::Structure get_structure() const;
00370 
00371   
00379   bool has_name(const Glib::ustring& name) const;
00380 
00381   
00400   guint32 get_seqnum() const;
00401   
00413   void set_seqnum(guint32 seqnum);
00414 
00419   Glib::RefPtr<Gst::Event> create_writable();
00420 
00423   bool is_downstream() const;
00424 
00427   bool is_serialized() const;
00428 
00431   bool is_upstream() const;
00432 
00435    EventType get_event_type() const;
00436  
00440    ClockTime get_timestamp() const;
00441  
00444    Glib::RefPtr<Gst::Object> get_source();
00445   Glib::RefPtr<const Gst::Object> get_source() const;
00446  
00447 
00448 public:
00449 
00450 public:
00451   //C++ methods used to invoke GTK+ virtual functions:
00452 #ifdef GLIBMM_VFUNCS_ENABLED
00453 #endif //GLIBMM_VFUNCS_ENABLED
00454 
00455 protected:
00456   //GTK+ Virtual Functions (override these to change behaviour):
00457 #ifdef GLIBMM_VFUNCS_ENABLED
00458 #endif //GLIBMM_VFUNCS_ENABLED
00459 
00460   //Default Signal Handlers::
00461 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00462 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00463 
00464 
00465 };
00466 
00467 //TODO: Modify create methods of derived Event classes to return
00468 //Glib::RefPtr<...> to the derived class and not just Gst::Event. Must deal
00469 //with GstStructure immutability problem (bug #510301) first because casting
00470 //Glib::RefPtrs references the objects which causes problems when GStreamer API
00471 //tries to modify the GstStructures of the objects.
00472 
00475 class EventFlushStart : public Event
00476 {
00477 public:
00478   explicit EventFlushStart(GstEvent* event);
00479 
00497   static Glib::RefPtr<Gst::Event> create();
00498 };
00499 
00502 class EventFlushStop : public Event
00503 {
00504 public:
00505   explicit EventFlushStop(GstEvent* event);
00506 
00520   static Glib::RefPtr<Gst::Event> create();
00521 };
00522 
00525 class EventEos : public Event
00526 {
00527 public:
00528   explicit EventEos(GstEvent* event);
00529 
00544   static Glib::RefPtr<Gst::Event> create();
00545 };
00546 
00549 class EventNewSegment : public Event
00550 {
00551 public:
00552   explicit EventNewSegment(GstEvent* event);
00553 
00594   static Glib::RefPtr<Gst::Event> create(bool update, double rate, Format format, gint64 strat, gint64 stop, gint64 position, double applied_rate=1.0);
00595 
00606   void parse(bool& update, double& rate, Format& format, gint64& start, gint64& stop, gint64& position) const;
00607 
00622   void parse(bool& update, double& rate, Format& format, gint64& start, gint64& stop, gint64& position, double& applied_rate) const;
00623   
00624 };
00625 
00628 class EventTag : public Event
00629 {
00630 public:
00631   explicit EventTag(GstEvent* event);
00632 
00637   static Glib::RefPtr<Gst::Event> create(const Gst::TagList& taglist);
00638 
00642   Gst::TagList parse() const;
00643   
00644 };
00645 
00648 class EventBufferSize : public Event
00649 {
00650 public:
00651   explicit EventBufferSize(GstEvent* event);
00652 
00664   static Glib::RefPtr<Gst::Event> create(Format format, gint64 minsize, gint64 maxsize, bool async);
00665 
00673   void parse(Format& format, gint64& minsize, gint64& maxsize, bool& async) const;
00674   
00675 };
00676 
00679 class EventQos : public Event
00680 {
00681 public:
00682   explicit EventQos(GstEvent* event);
00683 
00721   static Glib::RefPtr<Gst::Event> create(double proportion, ClockTimeDiff diff, ClockTime timestamp);
00722 
00730   void parse(double& proportion, ClockTimeDiff& diff, ClockTime& timestamp) const;
00731   
00732 };
00733 
00736 class EventSeek : public Event
00737 {
00738 public:
00739   explicit EventSeek(GstEvent* event);
00740 
00781   static Glib::RefPtr<Gst::Event> create(double rate, Format format, SeekFlags flags, SeekType start_type, gint64 start, SeekType stop_type, gint64 stop);
00782 
00795   void parse(double& rate, Format& format, SeekFlags& flags, SeekType& start_type, gint64& start, SeekType& stop_type, gint64& stop) const;
00796   
00797 };
00798 
00801 class EventNavigation : public Event
00802 {
00803 public:
00804   explicit EventNavigation(GstEvent* event);
00805 
00811   static Glib::RefPtr<Gst::Event> create(Gst::Structure& structure);
00812 };
00813 
00816 class EventLatency : public Event
00817 {
00818 public:
00819   explicit EventLatency(GstEvent* event);
00820 
00833   static Glib::RefPtr<Gst::Event> create(ClockTime latency);
00834 
00839   void parse(ClockTime& latency) const;
00840   
00841 };
00842 
00843 } //namespace Gst
00844 
00845 
00846 namespace Gst
00847 {
00853   Glib::RefPtr<Gst::Event> wrap(GstEvent* object, bool take_copy = false);
00854 }
00855 
00856 
00857 #endif /* _GSTREAMERMM_EVENT_H */
00858 

Generated on Wed Aug 19 15:53:19 2009 for gstreamermm by  doxygen 1.5.4