00001
00002
00003 #ifndef _GSTREAMERMM_MESSAGE_H
00004 #define _GSTREAMERMM_MESSAGE_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/gstmessage.h>
00029 #include <gstreamermm/wrap.h>
00030 #include <gstreamermm/format.h>
00031 #include <gstreamermm/clock.h>
00032 #include <gstreamermm/query.h>
00033
00034
00035 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00036 typedef struct _GstMessage GstMessage;
00037 typedef struct _GstMessageClass GstMessageClass;
00038 #endif
00039
00040
00041 namespace Gst
00042 { class Message_Class; }
00043 namespace Gst
00044 {
00045
00059 enum MessageType
00060 {
00061 MESSAGE_UNKNOWN = 0,
00062 MESSAGE_EOS = 1 << 0,
00063 MESSAGE_ERROR = 1 << 1,
00064 MESSAGE_WARNING = 1 << 2,
00065 MESSAGE_INFO = 1 << 3,
00066 MESSAGE_TAG = 1 << 4,
00067 MESSAGE_BUFFERING = 1 << 5,
00068 MESSAGE_STATE_CHANGED = 1 << 6,
00069 MESSAGE_STATE_DIRTY = 1 << 7,
00070 MESSAGE_STEP_DONE = 1 << 8,
00071 MESSAGE_CLOCK_PROVIDE = 1 << 9,
00072 MESSAGE_CLOCK_LOST = 1 << 10,
00073 MESSAGE_NEW_CLOCK = 1 << 11,
00074 MESSAGE_STRUCTURE_CHANGE = 1 << 12,
00075 MESSAGE_STREAM_STATUS = 1 << 13,
00076 MESSAGE_APPLICATION = 1 << 14,
00077 MESSAGE_ELEMENT = 1 << 15,
00078 MESSAGE_SEGMENT_START = 1 << 16,
00079 MESSAGE_SEGMENT_DONE = 1 << 17,
00080 MESSAGE_DURATION = 1 << 18,
00081 MESSAGE_LATENCY = 1 << 19,
00082 MESSAGE_ASYNC_START = 1 << 20,
00083 MESSAGE_ASYNC_DONE = 1 << 21,
00084 MESSAGE_REQUEST_STATE = 1 << 22,
00085 MESSAGE_ANY = ~0
00086 };
00087
00089 inline MessageType operator|(MessageType lhs, MessageType rhs)
00090 { return static_cast<MessageType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00091
00093 inline MessageType operator&(MessageType lhs, MessageType rhs)
00094 { return static_cast<MessageType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00095
00097 inline MessageType operator^(MessageType lhs, MessageType rhs)
00098 { return static_cast<MessageType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00099
00101 inline MessageType operator~(MessageType flags)
00102 { return static_cast<MessageType>(~static_cast<unsigned>(flags)); }
00103
00105 inline MessageType& operator|=(MessageType& lhs, MessageType rhs)
00106 { return (lhs = static_cast<MessageType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00107
00109 inline MessageType& operator&=(MessageType& lhs, MessageType rhs)
00110 { return (lhs = static_cast<MessageType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00111
00113 inline MessageType& operator^=(MessageType& lhs, MessageType rhs)
00114 { return (lhs = static_cast<MessageType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00115
00116 }
00117
00118
00119 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00120 namespace Glib
00121 {
00122
00123 template <>
00124 class Value<Gst::MessageType> : public Glib::Value_Flags<Gst::MessageType>
00125 {
00126 public:
00127 static GType value_type() G_GNUC_CONST;
00128 };
00129
00130 }
00131 #endif
00132
00133
00134 namespace Gst
00135 {
00136
00137
00138 namespace Enums
00139 {
00140
00145 Glib::ustring get_name(MessageType type);
00146
00151 Glib::QueryQuark get_quark(MessageType type);
00152
00153 }
00154
00155 class Structure;
00156 class TagList;
00157
00174 class Message : public Gst::MiniObject
00175 {
00176 protected:
00177
00178 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00179
00180 public:
00181 typedef Message CppObjectType;
00182 typedef Message_Class CppClassType;
00183 typedef GstMessage BaseObjectType;
00184 typedef GstMessageClass BaseClassType;
00185
00186 private: friend class Message_Class;
00187 static CppClassType message_class_;
00188
00189 private:
00190
00191 Message(const Message&);
00192 Message& operator=(const Message&);
00193
00194 protected:
00195 explicit Message(GstMessage* castitem);
00196
00197 #endif
00198
00199 public:
00200 virtual ~Message();
00201
00202 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00203 static GType get_type() G_GNUC_CONST;
00204 static GType get_base_type() G_GNUC_CONST;
00205 #endif
00206
00208 GstMessage* gobj() { return reinterpret_cast<GstMessage*>(gobject_); }
00209
00211 const GstMessage* gobj() const { return reinterpret_cast<GstMessage*>(gobject_); }
00212
00214 GstMessage* gobj_copy();
00215
00216 private:
00217
00218
00219 public:
00225 static Glib::RefPtr<Gst::Message> wrap(GstMessage* message, bool take_copy=false);
00226
00230 Glib::RefPtr<Gst::Message> copy() const;
00231
00232
00233
00234
00242 const Gst::Structure get_structure() const;
00243
00248 Glib::RefPtr<Gst::Message> create_writable();
00249
00250
00269 guint32 get_seqnum() const;
00270
00282 void set_seqnum(guint32 seqnum);
00283
00286 MessageType get_message_type() const;
00287
00291 ClockTime get_timestamp() const;
00292
00295 Glib::RefPtr<Gst::Object> get_source();
00296 Glib::RefPtr<const Gst::Object> get_source() const;
00297
00298
00299 public:
00300
00301 public:
00302
00303 #ifdef GLIBMM_VFUNCS_ENABLED
00304 #endif //GLIBMM_VFUNCS_ENABLED
00305
00306 protected:
00307
00308 #ifdef GLIBMM_VFUNCS_ENABLED
00309 #endif //GLIBMM_VFUNCS_ENABLED
00310
00311
00312 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00313 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00314
00315
00316 };
00317
00318
00319
00320
00321
00322
00323
00327 class MessageEos : public Message
00328 {
00329 public:
00330 explicit MessageEos(GstMessage* castitem);
00331
00339 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00340 };
00341
00345 class MessageError : public Message
00346 {
00347 public:
00348 explicit MessageError(GstMessage* castitem);
00349
00360 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00361
00369 void parse(Glib::Error& error, std::string& debug) const;
00370
00371
00378 Glib::Error parse() const;
00379
00386 std::string parse_debug() const;
00387 };
00388
00392 class MessageWarning : public Message
00393 {
00394 public:
00395 explicit MessageWarning(GstMessage* castitem);
00396
00405 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00406
00414 void parse(Glib::Error& error, std::string& debug) const;
00415
00416
00423 Glib::Error parse() const;
00424
00431 std::string parse_debug() const;
00432 };
00433
00437 class MessageInfo : public Message
00438 {
00439 public:
00440 explicit MessageInfo(GstMessage* castitem);
00441
00451 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00452
00460 void parse(Glib::Error& error, std::string& debug) const;
00461
00462
00469 Glib::Error parse() const;
00470
00477 std::string parse_debug() const;
00478 };
00479
00483 class MessageTag : public Message
00484 {
00485 public:
00486 explicit MessageTag(GstMessage* castitem);
00487
00495 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Gst::TagList& taglist);
00496
00503 Gst::TagList parse() const;
00504
00505 };
00506
00510 class MessageBuffering : public Message
00511 {
00512 public:
00513 explicit MessageBuffering(GstMessage* castitem);
00514
00533 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, int percent);
00534
00539 int parse() const;
00540
00541
00551 void set_stats(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left);
00552
00553
00563 void parse_stats(BufferingMode& mode, int& avg_in, int& avg_out, gint64& buffering_left) const;
00564
00565
00570 BufferingMode parse_stats_buffering_mode() const;
00571
00576 int parse_stats_avg_in() const;
00577
00582 int parse_stats_avg_out() const;
00583
00589 gint64 parse_stats_buffering_left() const;
00590 };
00591
00595 class MessageStateChanged : public Message
00596 {
00597 public:
00598 explicit MessageStateChanged(GstMessage* castitem);
00599
00609 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, State oldstate, State newstate, State pending);
00610
00620 void parse(State& oldstate, State& newstate, State& pending) const;
00621
00622
00629 State parse() const;
00630
00637 State parse_old() const;
00638
00645 State parse_pending() const;
00646 };
00647
00651 class MessageStateDirty : public Message
00652 {
00653 public:
00654 explicit MessageStateDirty(GstMessage* castitem);
00655
00663 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00664 };
00665
00669 class MessageClockProvide : public Message
00670 {
00671 public:
00672 explicit MessageClockProvide(GstMessage *message);
00673
00685 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock, bool ready);
00686
00695 void parse(Glib::RefPtr<Gst::Clock>& clock, bool& ready) const;
00696
00697
00705 Glib::RefPtr<Gst::Clock> parse();
00706
00714 Glib::RefPtr<const Gst::Clock> parse() const;
00715
00722 bool parse_ready() const;
00723 };
00724
00728 class MessageClockLost : public Message
00729 {
00730 public:
00731 explicit MessageClockLost(GstMessage* castitem);
00732
00742 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock);
00743
00750 Glib::RefPtr<Gst::Clock> parse();
00751
00752
00759 Glib::RefPtr<const Gst::Clock> parse() const;
00760 };
00761
00765 class MessageNewClock: public Message
00766 {
00767 public:
00768 explicit MessageNewClock(GstMessage* castitem);
00769
00777 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock);
00778
00786 Glib::RefPtr<Gst::Clock> parse();
00787
00788
00796 Glib::RefPtr<const Gst::Clock> parse() const;
00797 };
00798
00802 class MessageApplication : public Message
00803 {
00804 public:
00805 explicit MessageApplication(GstMessage *message);
00806
00815 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
00816
00824 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00825 };
00826
00830 class MessageElement : public Message
00831 {
00832 public:
00833 explicit MessageElement(GstMessage* castitem);
00834
00845 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
00846
00856 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00857 };
00858
00862 class MessageCustom : public Message
00863 {
00864 public:
00865 explicit MessageCustom(GstMessage* castitem);
00866
00876 static Glib::RefPtr<Gst::Message> create(MessageType type, const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
00877
00886 static Glib::RefPtr<Gst::Message> create(MessageType type, const Glib::RefPtr<Gst::Object>& src);
00887 };
00888
00892 class MessageSegmentStart : public Message
00893 {
00894 public:
00895 explicit MessageSegmentStart(GstMessage* castitem);
00896
00907 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
00908
00916 void parse(Format& format, gint64& position) const;
00917
00918
00925 gint64 parse() const;
00926
00933 Format parse_format() const;
00934 };
00935
00939 class MessageSegmentDone : public Message
00940 {
00941 public:
00942 explicit MessageSegmentDone(GstMessage* castitem);
00943
00954 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
00955
00963 void parse(Format& format, gint64& position) const;
00964
00965
00972 gint64 parse() const;
00973
00980 Format parse_format() const;
00981 };
00982
00986 class MessageDuration : public Message
00987 {
00988 public:
00989 explicit MessageDuration(GstMessage* castitem);
00990
01004 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
01005
01016 void parse(Format& format, gint64& position) const;
01017
01018
01028 gint64 parse() const;
01029
01038 Format parse_format() const;
01039 };
01040
01044 class MessageLatency : public Message
01045 {
01046 public:
01047 explicit MessageLatency(GstMessage* castitem);
01048
01057 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
01058 };
01059
01063 class MessageAsyncStart : public Message
01064 {
01065 public:
01066 explicit MessageAsyncStart(GstMessage* castitem);
01067
01078 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, bool new_base_time);
01079
01089 bool parse() const;
01090
01091 };
01092
01096 class MessageAsyncDone : public Message
01097 {
01098 public:
01099 explicit MessageAsyncDone(GstMessage* castitem);
01100
01107 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
01108 };
01109
01110 }
01111
01112
01113 namespace Gst
01114 {
01120 Glib::RefPtr<Gst::Message> wrap(GstMessage* object, bool take_copy = false);
01121 }
01122
01123
01124 #endif
01125