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
00084 enum BusSyncReply
00085 {
00086 BUS_DROP,
00087 BUS_PASS,
00088 BUS_ASYNC
00089 };
00090
00091 }
00092
00093
00094 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00095 namespace Glib
00096 {
00097
00098 template <>
00099 class Value<Gst::BusSyncReply> : public Glib::Value_Enum<Gst::BusSyncReply>
00100 {
00101 public:
00102 static GType value_type() G_GNUC_CONST;
00103 };
00104
00105 }
00106 #endif
00107
00108
00109 namespace Gst
00110 {
00111
00112
00113
00114
00156 class Bus : public Object
00157 {
00158
00159 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00160
00161 public:
00162 typedef Bus CppObjectType;
00163 typedef Bus_Class CppClassType;
00164 typedef GstBus BaseObjectType;
00165 typedef GstBusClass BaseClassType;
00166
00167 private: friend class Bus_Class;
00168 static CppClassType bus_class_;
00169
00170 private:
00171
00172 Bus(const Bus&);
00173 Bus& operator=(const Bus&);
00174
00175 protected:
00176 explicit Bus(const Glib::ConstructParams& construct_params);
00177 explicit Bus(GstBus* castitem);
00178
00179 #endif
00180
00181 public:
00182 virtual ~Bus();
00183
00184 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00185 static GType get_type() G_GNUC_CONST;
00186 static GType get_base_type() G_GNUC_CONST;
00187 #endif
00188
00190 GstBus* gobj() { return reinterpret_cast<GstBus*>(gobject_); }
00191
00193 const GstBus* gobj() const { return reinterpret_cast<GstBus*>(gobject_); }
00194
00196 GstBus* gobj_copy();
00197
00198 private:
00199
00200
00201 protected:
00202 Bus();
00203
00204 public:
00211 typedef sigc::slot< bool, const Glib::RefPtr<Bus>&, const Glib::RefPtr<Message>& > SlotMessage;
00212
00217 typedef sigc::slot< BusSyncReply, const Glib::RefPtr<Bus>&, const Glib::RefPtr<Message>& > SlotMessageSync;
00218
00224 static Glib::RefPtr<Bus> create();
00225
00226
00234 bool post(const Glib::RefPtr<Message>& message);
00235
00243 bool have_pending() const;
00244
00245
00253 Glib::RefPtr<Message> peek();
00254
00262 Glib::RefPtr<const Message> peek() const;
00263
00264
00272 Glib::RefPtr<Message> pop();
00273
00288 Glib::RefPtr<Message> pop(MessageType message_type);
00289
00305 Glib::RefPtr<Message> pop(ClockTime timeout);
00306
00325 Glib::RefPtr<Message> pop(ClockTime timeout, MessageType message_type);
00326
00327
00335 void set_flushing(bool flushing = true);
00336
00347 guint add_watch(const SlotMessage& slot, int priority = Glib::PRIORITY_DEFAULT);
00348
00354 bool remove_watch(guint watch_id);
00355
00366 void set_sync_handler(const SlotMessageSync& slot);
00367
00368
00381 void disable_sync_message_emission();
00382
00401 void enable_sync_message_emission();
00402
00414 void add_signal_watch(int priority = Glib::PRIORITY_DEFAULT);
00415
00420 void remove_signal_watch();
00421
00461 Glib::RefPtr<Message> poll(MessageType message_type, ClockTimeDiff timeout);
00462
00463
00472 Glib::SignalProxy1< void,const Glib::RefPtr<Message>& > signal_message();
00473
00474
00486 Glib::SignalProxy1< void,const Glib::RefPtr<Message>& > signal_sync_message();
00487
00488
00489 public:
00490
00491 public:
00492
00493 #ifdef GLIBMM_VFUNCS_ENABLED
00494 #endif //GLIBMM_VFUNCS_ENABLED
00495
00496 protected:
00497
00498 #ifdef GLIBMM_VFUNCS_ENABLED
00499 #endif //GLIBMM_VFUNCS_ENABLED
00500
00501
00502 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00503 virtual void on_message(const Glib::RefPtr<Message>& message);
00504 virtual void on_sync_message(const Glib::RefPtr<Message>& message);
00505 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00506
00507
00508 };
00509
00510 }
00511
00512
00513 namespace Glib
00514 {
00523 Glib::RefPtr<Gst::Bus> wrap(GstBus* object, bool take_copy = false);
00524 }
00525
00526
00527 #endif
00528