00001
00002
00003 #ifndef _GSTREAMERMM_BUS_H
00004 #define _GSTREAMERMM_BUS_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <gst/gstbus.h>
00031 #include <gstreamermm/object.h>
00032 #include <gstreamermm/clock.h>
00033 #include <gstreamermm/message.h>
00034
00035
00036 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00037 typedef struct _GstBus GstBus;
00038 typedef struct _GstBusClass GstBusClass;
00039 #endif
00040
00041
00042 namespace Gst
00043 { class Bus_Class; }
00044 namespace Gst
00045 {
00046
00047 class Message;
00048
00054 enum BusFlags
00055 {
00056 BUS_FLUSHING = GST_OBJECT_FLAG_LAST << 0,
00057 BUS_FLAG_LAST = GST_OBJECT_FLAG_LAST << 1
00058 };
00059
00060 }
00061
00062
00063 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00064 namespace Glib
00065 {
00066
00067 template <>
00068 class Value<Gst::BusFlags> : public Glib::Value_Enum<Gst::BusFlags>
00069 {
00070 public:
00071 static GType value_type() G_GNUC_CONST;
00072 };
00073
00074 }
00075 #endif
00076
00077
00078 namespace Gst
00079 {
00080
00081
00091 enum BusSyncReply
00092 {
00093 BUS_DROP,
00094 BUS_PASS,
00095 BUS_ASYNC
00096 };
00097
00098 }
00099
00100
00101 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00102 namespace Glib
00103 {
00104
00105 template <>
00106 class Value<Gst::BusSyncReply> : public Glib::Value_Enum<Gst::BusSyncReply>
00107 {
00108 public:
00109 static GType value_type() G_GNUC_CONST;
00110 };
00111
00112 }
00113 #endif
00114
00115
00116 namespace Gst
00117 {
00118
00119
00162 class Bus : public Object
00163 {
00164
00165 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00166
00167 public:
00168 typedef Bus CppObjectType;
00169 typedef Bus_Class CppClassType;
00170 typedef GstBus BaseObjectType;
00171 typedef GstBusClass BaseClassType;
00172
00173 private: friend class Bus_Class;
00174 static CppClassType bus_class_;
00175
00176 private:
00177
00178 Bus(const Bus&);
00179 Bus& operator=(const Bus&);
00180
00181 protected:
00182 explicit Bus(const Glib::ConstructParams& construct_params);
00183 explicit Bus(GstBus* castitem);
00184
00185 #endif
00186
00187 public:
00188 virtual ~Bus();
00189
00190 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00191 static GType get_type() G_GNUC_CONST;
00192 static GType get_base_type() G_GNUC_CONST;
00193 #endif
00194
00196 GstBus* gobj() { return reinterpret_cast<GstBus*>(gobject_); }
00197
00199 const GstBus* gobj() const { return reinterpret_cast<GstBus*>(gobject_); }
00200
00202 GstBus* gobj_copy();
00203
00204 private:
00205
00206
00207 protected:
00208 Bus();
00209
00210 public:
00217 typedef sigc::slot< bool, const Glib::RefPtr<Gst::Bus>&, const Glib::RefPtr<Gst::Message>& > SlotMessage;
00218
00223 typedef sigc::slot< BusSyncReply, const Glib::RefPtr<Gst::Bus>&, const Glib::RefPtr<Gst::Message>& > SlotMessageSync;
00224
00230 static Glib::RefPtr<Bus> create();
00231
00232
00240 bool post(const Glib::RefPtr<Gst::Message>& message);
00241
00249 bool have_pending() const;
00250
00251
00259 Glib::RefPtr<Gst::Message> peek();
00260
00268 Glib::RefPtr<const Gst::Message> peek() const;
00269
00270
00278 Glib::RefPtr<Gst::Message> pop();
00279
00294 Glib::RefPtr<Gst::Message> pop(MessageType message_type);
00295
00311 Glib::RefPtr<Gst::Message> pop(ClockTime timeout);
00312
00331 Glib::RefPtr<Gst::Message> pop(ClockTime timeout, MessageType message_type);
00332
00333
00341 void set_flushing(bool flushing = true);
00342
00353 guint add_watch(const SlotMessage& slot, int priority = Glib::PRIORITY_DEFAULT);
00354
00355
00361 bool remove_watch(guint watch_id);
00362
00373 void set_sync_handler(const SlotMessageSync& slot);
00374
00375
00388 void disable_sync_message_emission();
00389
00408 void enable_sync_message_emission();
00409
00410
00422 void add_signal_watch(int priority = Glib::PRIORITY_DEFAULT);
00423
00424
00429 void remove_signal_watch();
00430
00470 Glib::RefPtr<Gst::Message> poll(MessageType message_type, ClockTimeDiff timeout);
00471
00472
00481 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Message>& > signal_message();
00482
00483
00495 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Message>& > signal_sync_message();
00496
00497
00498 public:
00499
00500 public:
00501
00502 #ifdef GLIBMM_VFUNCS_ENABLED
00503 #endif //GLIBMM_VFUNCS_ENABLED
00504
00505 protected:
00506
00507 #ifdef GLIBMM_VFUNCS_ENABLED
00508 #endif //GLIBMM_VFUNCS_ENABLED
00509
00510
00511 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00512 virtual void on_message(const Glib::RefPtr<Gst::Message>& message);
00513 virtual void on_sync_message(const Glib::RefPtr<Gst::Message>& message);
00514 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00515
00516
00517 };
00518
00519 }
00520
00521
00522 namespace Glib
00523 {
00532 Glib::RefPtr<Gst::Bus> wrap(GstBus* object, bool take_copy = false);
00533 }
00534
00535
00536 #endif
00537