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
00035 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00036 typedef struct _GstBus GstBus;
00037 typedef struct _GstBusClass GstBusClass;
00038 #endif
00039
00040
00041 namespace Gst
00042 { class Bus_Class; }
00043 namespace Gst
00044 {
00045
00046 class Message;
00047
00053 enum BusFlags
00054 {
00055 BUS_FLUSHING = GST_OBJECT_FLAG_LAST << 0,
00056 BUS_FLAG_LAST = GST_OBJECT_FLAG_LAST << 1
00057 };
00058
00059 }
00060
00061
00062 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00063 namespace Glib
00064 {
00065
00066 template <>
00067 class Value<Gst::BusFlags> : public Glib::Value_Enum<Gst::BusFlags>
00068 {
00069 public:
00070 static GType value_type() G_GNUC_CONST;
00071 };
00072
00073 }
00074 #endif
00075
00076
00077 namespace Gst
00078 {
00079
00080
00090 enum BusSyncReply
00091 {
00092 BUS_DROP,
00093 BUS_PASS,
00094 BUS_ASYNC
00095 };
00096
00097 }
00098
00099
00100 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00101 namespace Glib
00102 {
00103
00104 template <>
00105 class Value<Gst::BusSyncReply> : public Glib::Value_Enum<Gst::BusSyncReply>
00106 {
00107 public:
00108 static GType value_type() G_GNUC_CONST;
00109 };
00110
00111 }
00112 #endif
00113
00114
00115 namespace Gst
00116 {
00117
00118
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
00193
00194 static GType get_base_type() G_GNUC_CONST;
00195 #endif
00196
00198 GstBus* gobj() { return reinterpret_cast<GstBus*>(gobject_); }
00199
00201 const GstBus* gobj() const { return reinterpret_cast<GstBus*>(gobject_); }
00202
00204 GstBus* gobj_copy();
00205
00206 private:
00207
00208
00209 protected:
00210 Bus();
00211
00212 public:
00219 typedef sigc::slot< bool, const Glib::RefPtr<Gst::Bus>&, const Glib::RefPtr<Gst::Message>& > SlotMessage;
00220
00225 typedef sigc::slot< BusSyncReply, const Glib::RefPtr<Gst::Bus>&, const Glib::RefPtr<Gst::Message>& > SlotMessageSync;
00226
00232 static Glib::RefPtr<Bus> create();
00233
00234
00242 bool post(const Glib::RefPtr<Gst::Message>& message);
00243
00251 bool have_pending() const;
00252
00260 Glib::RefPtr<Gst::Message> peek();
00261
00269 Glib::RefPtr<const Gst::Message> peek() const;
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
00340 void set_flushing(bool flushing = true);
00341
00342
00343
00344
00345
00356 guint add_watch(const SlotMessage& slot, int priority = Glib::PRIORITY_DEFAULT);
00357
00358
00364 bool remove_watch(guint watch_id);
00365
00376 void set_sync_handler(const SlotMessageSync& slot);
00377
00378
00391 void disable_sync_message_emission();
00392
00411 void enable_sync_message_emission();
00412
00413
00428 void add_signal_watch(int priority = Glib::PRIORITY_DEFAULT);
00429
00430
00435 void remove_signal_watch();
00436
00476 Glib::RefPtr<Gst::Message> poll(MessageType message_type, ClockTimeDiff timeout);
00477
00478
00487 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Message>& > signal_message();
00488
00489
00501 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Message>& > signal_sync_message();
00502
00503
00504 public:
00505
00506 public:
00507
00508 #ifdef GLIBMM_VFUNCS_ENABLED
00509 #endif //GLIBMM_VFUNCS_ENABLED
00510
00511 protected:
00512
00513 #ifdef GLIBMM_VFUNCS_ENABLED
00514 #endif //GLIBMM_VFUNCS_ENABLED
00515
00516
00517 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00518 virtual void on_message(const Glib::RefPtr<Gst::Message>& message);
00519 virtual void on_sync_message(const Glib::RefPtr<Gst::Message>& message);
00520 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00521
00522
00523 };
00524
00525 }
00526
00527
00528 namespace Glib
00529 {
00538 Glib::RefPtr<Gst::Bus> wrap(GstBus* object, bool take_copy = false);
00539 }
00540
00541
00542 #endif
00543