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
00029
00030 #include <gst/gstmessage.h>
00031 #include <gstreamermm/wrap.h>
00032 #include <gstreamermm/format.h>
00033 #include <gstreamermm/clock.h>
00034 #include <gstreamermm/query.h>
00035
00036
00037 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00038 typedef struct _GstMessage GstMessage;
00039 typedef struct _GstMessageClass GstMessageClass;
00040 #endif
00041
00042
00043 namespace Gst
00044 { class Message_Class; }
00045 namespace Gst
00046 {
00047
00061 enum MessageType
00062 {
00063 MESSAGE_UNKNOWN = 0,
00064 MESSAGE_EOS = 1 << 0,
00065 MESSAGE_ERROR = 1 << 1,
00066 MESSAGE_WARNING = 1 << 2,
00067 MESSAGE_INFO = 1 << 3,
00068 MESSAGE_TAG = 1 << 4,
00069 MESSAGE_BUFFERING = 1 << 5,
00070 MESSAGE_STATE_CHANGED = 1 << 6,
00071 MESSAGE_STATE_DIRTY = 1 << 7,
00072 MESSAGE_STEP_DONE = 1 << 8,
00073 MESSAGE_CLOCK_PROVIDE = 1 << 9,
00074 MESSAGE_CLOCK_LOST = 1 << 10,
00075 MESSAGE_NEW_CLOCK = 1 << 11,
00076 MESSAGE_STRUCTURE_CHANGE = 1 << 12,
00077 MESSAGE_STREAM_STATUS = 1 << 13,
00078 MESSAGE_APPLICATION = 1 << 14,
00079 MESSAGE_ELEMENT = 1 << 15,
00080 MESSAGE_SEGMENT_START = 1 << 16,
00081 MESSAGE_SEGMENT_DONE = 1 << 17,
00082 MESSAGE_DURATION = 1 << 18,
00083 MESSAGE_LATENCY = 1 << 19,
00084 MESSAGE_ASYNC_START = 1 << 20,
00085 MESSAGE_ASYNC_DONE = 1 << 21,
00086 MESSAGE_ANY = ~0
00087 };
00088
00090 inline MessageType operator|(MessageType lhs, MessageType rhs)
00091 { return static_cast<MessageType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00092
00094 inline MessageType operator&(MessageType lhs, MessageType rhs)
00095 { return static_cast<MessageType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00096
00098 inline MessageType operator^(MessageType lhs, MessageType rhs)
00099 { return static_cast<MessageType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00100
00102 inline MessageType operator~(MessageType flags)
00103 { return static_cast<MessageType>(~static_cast<unsigned>(flags)); }
00104
00106 inline MessageType& operator|=(MessageType& lhs, MessageType rhs)
00107 { return (lhs = static_cast<MessageType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00108
00110 inline MessageType& operator&=(MessageType& lhs, MessageType rhs)
00111 { return (lhs = static_cast<MessageType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00112
00114 inline MessageType& operator^=(MessageType& lhs, MessageType rhs)
00115 { return (lhs = static_cast<MessageType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00116
00117 }
00118
00119
00120 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00121 namespace Glib
00122 {
00123
00124 template <>
00125 class Value<Gst::MessageType> : public Glib::Value_Flags<Gst::MessageType>
00126 {
00127 public:
00128 static GType value_type() G_GNUC_CONST;
00129 };
00130
00131 }
00132 #endif
00133
00134
00135 namespace Gst
00136 {
00137
00138
00139 namespace Enums
00140 {
00141
00146 Glib::ustring get_name(MessageType type);
00147
00152 Glib::QueryQuark get_quark(MessageType type);
00153
00154 }
00155
00156 class Structure;
00157 class TagList;
00158
00175 class Message : public Gst::MiniObject
00176 {
00177 protected:
00178
00179 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00180
00181 public:
00182 typedef Message CppObjectType;
00183 typedef Message_Class CppClassType;
00184 typedef GstMessage BaseObjectType;
00185 typedef GstMessageClass BaseClassType;
00186
00187 private: friend class Message_Class;
00188 static CppClassType message_class_;
00189
00190 private:
00191
00192 Message(const Message&);
00193 Message& operator=(const Message&);
00194
00195 protected:
00196 explicit Message(GstMessage* castitem);
00197
00198 #endif
00199
00200 public:
00201 virtual ~Message();
00202
00203 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00204 static GType get_type() G_GNUC_CONST;
00205 static GType get_base_type() G_GNUC_CONST;
00206 #endif
00207
00209 GstMessage* gobj() { return reinterpret_cast<GstMessage*>(gobject_); }
00210
00212 const GstMessage* gobj() const { return reinterpret_cast<GstMessage*>(gobject_); }
00213
00215 GstMessage* gobj_copy();
00216
00217 private:
00218
00219
00220 public:
00226 static Glib::RefPtr<Gst::Message> wrap(GstMessage* message, bool take_copy=false);
00227
00231 Glib::RefPtr<Gst::Message> copy() const;
00232
00233
00241 const Gst::Structure get_structure() const;
00242
00247 Glib::RefPtr<Gst::Message> create_writable();
00248
00251 MessageType get_message_type() const;
00252
00256 ClockTime get_timestamp() const;
00257
00260 Glib::RefPtr<Gst::Object> get_source();
00261 Glib::RefPtr<const Gst::Object> get_source() const;
00262
00263
00264 public:
00265
00266 public:
00267
00268 #ifdef GLIBMM_VFUNCS_ENABLED
00269 #endif //GLIBMM_VFUNCS_ENABLED
00270
00271 protected:
00272
00273 #ifdef GLIBMM_VFUNCS_ENABLED
00274 #endif //GLIBMM_VFUNCS_ENABLED
00275
00276
00277 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00278 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00279
00280
00281 };
00282
00283
00284
00285
00286
00287
00288
00292 class MessageEos : public Message
00293 {
00294 public:
00295 explicit MessageEos(GstMessage* castitem);
00296
00304 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00305 };
00306
00310 class MessageError : public Message
00311 {
00312 public:
00313 explicit MessageError(GstMessage* castitem);
00314
00325 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00326
00334 void parse(Glib::Error& error, std::string& debug);
00335
00336
00343 Glib::Error parse();
00344
00351 std::string parse_debug();
00352 };
00353
00357 class MessageWarning : public Message
00358 {
00359 public:
00360 explicit MessageWarning(GstMessage* castitem);
00361
00370 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00371
00379 void parse(Glib::Error& error, std::string& debug);
00380
00381
00388 Glib::Error parse();
00389
00396 std::string parse_debug();
00397 };
00398
00402 class MessageInfo : public Message
00403 {
00404 public:
00405 explicit MessageInfo(GstMessage* castitem);
00406
00416 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00417
00425 void parse(Glib::Error& error, std::string& debug);
00426
00427
00434 Glib::Error parse();
00435
00442 std::string parse_debug();
00443 };
00444
00448 class MessageTag : public Message
00449 {
00450 public:
00451 explicit MessageTag(GstMessage* castitem);
00452
00460 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Gst::TagList& taglist);
00461
00468 Gst::TagList parse();
00469
00470 };
00471
00475 class MessageBuffering : public Message
00476 {
00477 public:
00478 explicit MessageBuffering(GstMessage* castitem);
00479
00498 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, int percent);
00499
00504 int parse();
00505
00506
00516 void set_stats(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left);
00517
00518
00528 void parse_stats(BufferingMode& mode, int& avg_in, int& avg_out, gint64& buffering_left);
00529
00530
00535 BufferingMode parse_stats_buffering_mode();
00536
00541 int parse_stats_avg_in();
00542
00547 int parse_stats_avg_out();
00548
00554 gint64 parse_stats_buffering_left();
00555 };
00556
00560 class MessageStateChanged : public Message
00561 {
00562 public:
00563 explicit MessageStateChanged(GstMessage* castitem);
00564
00574 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, State oldstate, State newstate, State pending);
00575
00585 void parse(State& oldstate, State& newstate, State& pending);
00586
00587
00594 State parse();
00595
00602 State parse_old();
00603
00610 State parse_pending();
00611 };
00612
00616 class MessageStateDirty : public Message
00617 {
00618 public:
00619 explicit MessageStateDirty(GstMessage* castitem);
00620
00628 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00629 };
00630
00634 class MessageClockProvide : public Message
00635 {
00636 public:
00637 explicit MessageClockProvide(GstMessage *message);
00638
00650 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock, bool ready);
00651
00660 void parse(Glib::RefPtr<Gst::Clock>& clock, bool& ready);
00661
00662
00670 Glib::RefPtr<Gst::Clock> parse();
00671
00678 bool parse_ready();
00679 };
00680
00684 class MessageClockLost : public Message
00685 {
00686 public:
00687 explicit MessageClockLost(GstMessage* castitem);
00688
00698 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock);
00699
00706 Glib::RefPtr<Gst::Clock> parse();
00707
00708 };
00709
00713 class MessageNewClock: public Message
00714 {
00715 public:
00716 explicit MessageNewClock(GstMessage* castitem);
00717
00725 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock);
00726
00734 Glib::RefPtr<Gst::Clock> parse();
00735
00736 };
00737
00741 class MessageApplication : public Message
00742 {
00743 public:
00744 explicit MessageApplication(GstMessage *message);
00745
00754 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
00755
00763 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00764 };
00765
00769 class MessageElement : public Message
00770 {
00771 public:
00772 explicit MessageElement(GstMessage* castitem);
00773
00784 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
00785
00795 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00796 };
00797
00801 class MessageCustom : public Message
00802 {
00803 public:
00804 explicit MessageCustom(GstMessage* castitem);
00805
00815 static Glib::RefPtr<Gst::Message> create(MessageType type, const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
00816
00825 static Glib::RefPtr<Gst::Message> create(MessageType type, const Glib::RefPtr<Gst::Object>& src);
00826 };
00827
00831 class MessageSegmentStart : public Message
00832 {
00833 public:
00834 explicit MessageSegmentStart(GstMessage* castitem);
00835
00846 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
00847
00855 void parse(Format& format, gint64& position);
00856
00857
00864 gint64 parse();
00865
00872 Format parse_format();
00873 };
00874
00878 class MessageSegmentDone : public Message
00879 {
00880 public:
00881 explicit MessageSegmentDone(GstMessage* castitem);
00882
00893 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
00894
00902 void parse(Format& format, gint64& position);
00903
00904
00911 gint64 parse();
00912
00919 Format parse_format();
00920 };
00921
00925 class MessageDuration : public Message
00926 {
00927 public:
00928 explicit MessageDuration(GstMessage* castitem);
00929
00943 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
00944
00955 void parse(Format& format, gint64& position);
00956
00957
00967 gint64 parse();
00968
00977 Format parse_format();
00978 };
00979
00983 class MessageLatency : public Message
00984 {
00985 public:
00986 explicit MessageLatency(GstMessage* castitem);
00987
00996 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00997 };
00998
01002 class MessageAsyncStart : public Message
01003 {
01004 public:
01005 explicit MessageAsyncStart(GstMessage* castitem);
01006
01017 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, bool new_base_time);
01018
01028 bool parse();
01029
01030 };
01031
01035 class MessageAsyncDone : public Message
01036 {
01037 public:
01038 explicit MessageAsyncDone(GstMessage* castitem);
01039
01046 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
01047 };
01048
01049 }
01050
01051
01052 namespace Gst
01053 {
01059 Glib::RefPtr<Gst::Message> wrap(GstMessage* object, bool take_copy = false);
01060 }
01061
01062
01063 #endif
01064