- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# 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,
    00595     Format format, gint64 strat, gint64 stop, gint64 position,
    00596     double applied_rate=1.0);
    00597
    00608   void parse(bool& update, double& rate, Format& format, gint64& start,
    00609     gint64& stop, gint64& position) const;
    00610
    00611
    00626   void parse(bool& update, double& rate, Format& format, gint64& start,
    00627     gint64& stop, gint64& position, double& applied_rate) const;
    00628
    00629
    00636   gint64 parse() const;
    00637
    00645   bool parse_update() const;
    00646
    00654   double parse_rate() const;
    00655
    00663   Format parse_format() const;
    00664
    00672   gint64 parse_start() const;
    00673
    00681   gint64 parse_stop() const;
    00682
    00690   double parse_applied_rate() const;
    00691 };
    00692
    00695 class EventTag : public Event
    00696 {
    00697 public:
    00698   explicit EventTag(GstEvent* event);
    00699
    00704   static Glib::RefPtr<Gst::Event> create(const Gst::TagList& taglist);
    00705
    00709   Gst::TagList parse() const;
    00710
    00711 };
    00712
    00715 class EventBufferSize : public Event
    00716 {
    00717 public:
    00718   explicit EventBufferSize(GstEvent* event);
    00719
    00731   static Glib::RefPtr<Gst::Event> create(Format format, gint64 minsize,
    00732     gint64 maxsize, bool async);
    00733
    00741   void parse(Format& format, gint64& minsize, gint64& maxsize, bool& async)
    00742     const;
    00743
    00744
    00749   gint64 parse() const;
    00750
    00755   Gst::Format parse_format() const;
    00756
    00761   gint64 parse_max_size() const;
    00762
    00767   bool parse_async() const;
    00768 };
    00769
    00772 class EventQos : public Event
    00773 {
    00774 public:
    00775   explicit EventQos(GstEvent* event);
    00776
    00814   static Glib::RefPtr<Gst::Event> create(double proportion,
    00815     ClockTimeDiff diff, ClockTime timestamp);
    00816
    00824   void parse(double& proportion, ClockTimeDiff& diff, ClockTime& timestamp) const;
    00825
    00826
    00832   double parse() const;
    00833
    00839   ClockTimeDiff parse_diff() const;
    00840
    00845   ClockTime parse_timestamp() const;
    00846 };
    00847
    00850 class EventSeek : public Event
    00851 {
    00852 public:
    00853   explicit EventSeek(GstEvent* event);
    00854
    00895   static Glib::RefPtr<Gst::Event> create(double rate, Format format,
    00896     SeekFlags flags, SeekType start_type, gint64 start, SeekType stop_type,
    00897     gint64 stop);
    00898
    00911   void parse(double& rate, Format& format, SeekFlags& flags,
    00912     SeekType& start_type, gint64& start, SeekType& stop_type,
    00913     gint64& stop) const;
    00914
    00915
    00919   gint64 parse() const;
    00920
    00924   double parse_rate() const;
    00925
    00929   Format parse_format() const;
    00930
    00934   SeekFlags parse_flags() const;
    00935
    00939   SeekType parse_start_type() const;
    00940
    00944   SeekType parse_stop_type() const;
    00945
    00949   gint64 parse_stop() const;
    00950 };
    00951
    00954 class EventNavigation : public Event
    00955 {
    00956 public:
    00957   explicit EventNavigation(GstEvent* event);
    00958
    00964   static Glib::RefPtr<Gst::Event> create(Gst::Structure& structure);
    00965 };
    00966
    00969 class EventLatency : public Event
    00970 {
    00971 public:
    00972   explicit EventLatency(GstEvent* event);
    00973
    00986   static Glib::RefPtr<Gst::Event> create(ClockTime latency);
    00987
    00992   ClockTime parse() const;
    00993
    00994 };
    00995
    00998 class EventStep : public Event
    00999 {
    01000 public:
    01001   explicit EventStep(GstEvent* event);
    01002
    01026   static Glib::RefPtr<Gst::Event> create(Gst::Format format, guint64 amount,
    01027     double rate, bool flush, bool intermediate);
    01028
    01037   void parse(Gst::Format& format, guint64& amount, double& rate,
    01038     bool& flush, bool& intermediate) const;
    01039
    01040
    01044   guint64 parse() const;
    01045
    01049   Gst::Format parse_format() const;
    01050
    01054   double parse_rate() const;
    01055
    01059   bool parse_flush() const;
    01060
    01064   bool parse_intermediate() const;
    01065 };
    01066
    01067 } //namespace Gst
    01068
    01069
    01070 namespace Gst
    01071 {
    01077   Glib::RefPtr<Gst::Event> wrap(GstEvent* object, bool take_copy = false);
    01078 }
    01079
    01080
    01081 #endif /* _GSTREAMERMM_EVENT_H */
    01082