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 #include <gst/gstbus.h>
00029 #include <gstreamermm/object.h>
00030 #include <gstreamermm/clock.h>
00031 #include <gstreamermm/message.h>
00032
00033
00034 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00035 typedef struct _GstBus GstBus;
00036 typedef struct _GstBusClass GstBusClass;
00037 #endif
00038
00039
00040 namespace Gst
00041 { class Bus_Class; }
00042 namespace Gst
00043 {
00044
00045 class Message;
00046
00052 enum BusFlags
00053 {
00054 BUS_FLUSHING = GST_OBJECT_FLAG_LAST << 0,
00055 BUS_FLAG_LAST = GST_OBJECT_FLAG_LAST << 1
00056 };
00057
00058 }
00059
00060
00061 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00062 namespace Glib
00063 {
00064
00065 template <>
00066 class Value<Gst::BusFlags> : public Glib::Value_Enum<Gst::BusFlags>
00067 {
00068 public:
00069 static GType value_type() G_GNUC_CONST;
00070 };
00071
00072 }
00073 #endif
00074
00075
00076 namespace Gst
00077 {
00078
00079
00089 enum BusSyncReply
00090 {
00091 BUS_DROP,
00092 BUS_PASS,
00093 BUS_ASYNC
00094 };
00095
00096 }
00097
00098
00099 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00100 namespace Glib
00101 {
00102
00103 template <>
00104 class Value<Gst::BusSyncReply> : public Glib::Value_Enum<Gst::BusSyncReply>
00105 {
00106 public:
00107 static GType value_type() G_GNUC_CONST;
00108 };
00109
00110 }
00111 #endif
00112
00113
00114 namespace Gst
00115 {
00116
00117
00160 class Bus : public Object
00161 {
00162
00163 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00164
00165 public:
00166 typedef Bus CppObjectType;
00167 typedef Bus_Class CppClassType;
00168 typedef GstBus BaseObjectType;
00169 typedef GstBusClass BaseClassType;
00170
00171 private: friend class Bus_Class;
00172 static CppClassType bus_class_;
00173
00174 private:
00175
00176 Bus(const Bus&);
00177 Bus& operator=(const Bus&);
00178
00179 protected:
00180 explicit Bus(const Glib::ConstructParams& construct_params);
00181 explicit Bus(GstBus* castitem);
00182
00183 #endif
00184
00185 public:
00186 virtual ~Bus();
00187
00188 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00189 static GType get_type() G_GNUC_CONST;
00190 static GType get_base_type() G_GNUC_CONST;
00191 #endif
00192
00194 GstBus* gobj() { return reinterpret_cast<GstBus*>(gobject_); }
00195
00197 const GstBus* gobj() const { return reinterpret_cast<GstBus*>(gobject_); }
00198
00200 GstBus* gobj_copy();
00201
00202 private:
00203
00204
00205 protected:
00206 Bus();
00207
00208 public:
00215 typedef sigc::slot< bool, const Glib::RefPtr<Gst::Bus>&, const Glib::RefPtr<Gst::Message>& > SlotMessage;
00216
00221 typedef sigc::slot< BusSyncReply, const Glib::RefPtr<Gst::Bus>&, const Glib::RefPtr<Gst::Message>& > SlotMessageSync;
00222
00228 static Glib::RefPtr<Bus> create();
00229
00230
00238 bool post(const Glib::RefPtr<Gst::Message>& message);
00239
00247 bool have_pending() const;
00248
00256 Glib::RefPtr<Gst::Message> peek();
00257
00265 Glib::RefPtr<const Gst::Message> peek() const;
00266
00274 Glib::RefPtr<Gst::Message> pop();
00275
00290 Glib::RefPtr<Gst::Message> pop(MessageType message_type);
00291
00307 Glib::RefPtr<Gst::Message> pop(ClockTime timeout);
00308
00327 Glib::RefPtr<Gst::Message> pop(ClockTime timeout, MessageType message_type);
00328
00336 void set_flushing(bool flushing = true);
00337
00348 guint add_watch(const SlotMessage& slot, int priority = Glib::PRIORITY_DEFAULT);
00349
00350
00356 bool remove_watch(guint watch_id);
00357
00368 void set_sync_handler(const SlotMessageSync& slot);
00369
00370
00383 void disable_sync_message_emission();
00384
00403 void enable_sync_message_emission();
00404
00405
00420 void add_signal_watch(int priority = Glib::PRIORITY_DEFAULT);
00421
00422
00427 void remove_signal_watch();
00428
00468 Glib::RefPtr<Gst::Message> poll(MessageType message_type, ClockTimeDiff timeout);
00469
00470
00479 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Message>& > signal_message();
00480
00481
00493 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Message>& > signal_sync_message();
00494
00495
00496 public:
00497
00498 public:
00499
00500 #ifdef GLIBMM_VFUNCS_ENABLED
00501 #endif //GLIBMM_VFUNCS_ENABLED
00502
00503 protected:
00504
00505 #ifdef GLIBMM_VFUNCS_ENABLED
00506 #endif //GLIBMM_VFUNCS_ENABLED
00507
00508
00509 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00510 virtual void on_message(const Glib::RefPtr<Gst::Message>& message);
00511 virtual void on_sync_message(const Glib::RefPtr<Gst::Message>& message);
00512 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00513
00514
00515 };
00516
00517 }
00518
00519
00520 namespace Glib
00521 {
00530 Glib::RefPtr<Gst::Bus> wrap(GstBus* object, bool take_copy = false);
00531 }
00532
00533
00534 #endif
00535