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
00142 Glib::ustring get_name(MessageType t);
00143 Glib::QueryQuark get_quark(MessageType t);
00144
00145 }
00146
00147 class Structure;
00148 class TagList;
00149
00166 class Message : public Gst::MiniObject
00167 {
00168 protected:
00169
00170 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00171
00172 public:
00173 typedef Message CppObjectType;
00174 typedef Message_Class CppClassType;
00175 typedef GstMessage BaseObjectType;
00176 typedef GstMessageClass BaseClassType;
00177
00178 private: friend class Message_Class;
00179 static CppClassType message_class_;
00180
00181 private:
00182
00183 Message(const Message&);
00184 Message& operator=(const Message&);
00185
00186 protected:
00187 explicit Message(GstMessage* castitem);
00188
00189 #endif
00190
00191 public:
00192 virtual ~Message();
00193
00194 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00195 static GType get_type() G_GNUC_CONST;
00196 static GType get_base_type() G_GNUC_CONST;
00197 #endif
00198
00200 GstMessage* gobj() { return reinterpret_cast<GstMessage*>(gobject_); }
00201
00203 const GstMessage* gobj() const { return reinterpret_cast<GstMessage*>(gobject_); }
00204
00206 GstMessage* gobj_copy();
00207
00208 private:
00209
00210
00211 public:
00217 static Glib::RefPtr<Message> wrap(GstMessage* message, bool take_copy=false);
00218
00222 Glib::RefPtr<Message> copy() const;
00223
00224
00232 const Structure get_structure() const;
00233
00238 Glib::RefPtr<Message> create_writable();
00239
00242 MessageType get_message_type() const;
00243
00247 ClockTime get_timestamp() const;
00248
00251 Glib::RefPtr<Gst::Object> get_source();
00252 Glib::RefPtr<const Gst::Object> get_source() const;
00253
00254
00255 public:
00256
00257 public:
00258
00259 #ifdef GLIBMM_VFUNCS_ENABLED
00260 #endif //GLIBMM_VFUNCS_ENABLED
00261
00262 protected:
00263
00264 #ifdef GLIBMM_VFUNCS_ENABLED
00265 #endif //GLIBMM_VFUNCS_ENABLED
00266
00267
00268 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00269 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00270
00271
00272 };
00273
00274
00275
00276
00277
00278
00279
00283 class MessageEos : public Message
00284 {
00285 public:
00286 explicit MessageEos(GstMessage* castitem);
00287
00295 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
00296 };
00297
00301 class MessageError : public Message
00302 {
00303 public:
00304 explicit MessageError(GstMessage* castitem);
00305
00316 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
00317
00325 void parse(Glib::Error& error, std::string& debug);
00326
00327
00334 Glib::Error parse();
00335
00342 std::string parse_debug();
00343 };
00344
00348 class MessageWarning : public Message
00349 {
00350 public:
00351 explicit MessageWarning(GstMessage* castitem);
00352
00361 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
00362
00370 void parse(Glib::Error& error, std::string& debug);
00371
00372
00379 Glib::Error parse();
00380
00387 std::string parse_debug();
00388 };
00389
00393 class MessageInfo : public Message
00394 {
00395 public:
00396 explicit MessageInfo(GstMessage* castitem);
00397
00407 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
00408
00416 void parse(Glib::Error& error, std::string& debug);
00417
00418
00425 Glib::Error parse();
00426
00433 std::string parse_debug();
00434 };
00435
00439 class MessageTag : public Message
00440 {
00441 public:
00442 explicit MessageTag(GstMessage* castitem);
00443
00451 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const TagList& taglist);
00452
00459 TagList parse();
00460
00461 };
00462
00466 class MessageBuffering : public Message
00467 {
00468 public:
00469 explicit MessageBuffering(GstMessage* castitem);
00470
00489 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, int percent);
00490
00495 int parse();
00496
00497
00507 void set_stats(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left);
00508
00509
00519 void parse_stats(BufferingMode& mode, int& avg_in, int& avg_out, gint64& buffering_left);
00520
00521
00526 BufferingMode parse_stats_buffering_mode();
00527
00532 int parse_stats_avg_in();
00533
00538 int parse_stats_avg_out();
00539
00545 gint64 parse_stats_buffering_left();
00546 };
00547
00551 class MessageStateChanged : public Message
00552 {
00553 public:
00554 explicit MessageStateChanged(GstMessage* castitem);
00555
00565 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, State oldstate, State newstate, State pending);
00566
00576 void parse(State& oldstate, State& newstate, State& pending);
00577
00578
00585 State parse();
00586
00593 State parse_old();
00594
00601 State parse_pending();
00602 };
00603
00607 class MessageStateDirty : public Message
00608 {
00609 public:
00610 explicit MessageStateDirty(GstMessage* castitem);
00611
00619 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
00620 };
00621
00625 class MessageClockProvide : public Message
00626 {
00627 public:
00628 explicit MessageClockProvide(GstMessage *message);
00629
00641 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock, bool ready);
00642
00651 void parse(Glib::RefPtr<Clock>& clock, bool& ready);
00652
00653
00661 Glib::RefPtr<Clock> parse();
00662
00669 bool parse_ready();
00670 };
00671
00675 class MessageClockLost : public Message
00676 {
00677 public:
00678 explicit MessageClockLost(GstMessage* castitem);
00679
00689 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock);
00690
00697 Glib::RefPtr<Clock> parse();
00698
00699 };
00700
00704 class MessageNewClock: public Message
00705 {
00706 public:
00707 explicit MessageNewClock(GstMessage* castitem);
00708
00716 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock);
00717
00725 Glib::RefPtr<Clock> parse();
00726
00727 };
00728
00732 class MessageApplication : public Message
00733 {
00734 public:
00735 explicit MessageApplication(GstMessage *message);
00736
00745 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Structure& structure);
00746
00754 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
00755 };
00756
00760 class MessageElement : public Message
00761 {
00762 public:
00763 explicit MessageElement(GstMessage* castitem);
00764
00775 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Structure& structure);
00776
00786 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
00787 };
00788
00792 class MessageCustom : public Message
00793 {
00794 public:
00795 explicit MessageCustom(GstMessage* castitem);
00796
00806 static Glib::RefPtr<Message> create(MessageType type, const Glib::RefPtr<Object>& src, Structure& structure);
00807
00816 static Glib::RefPtr<Message> create(MessageType type, const Glib::RefPtr<Object>& src);
00817 };
00818
00822 class MessageSegmentStart : public Message
00823 {
00824 public:
00825 explicit MessageSegmentStart(GstMessage* castitem);
00826
00837 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Format format, gint64 position);
00838
00846 void parse(Format& format, gint64& position);
00847
00848
00855 gint64 parse();
00856
00863 Format parse_format();
00864 };
00865
00869 class MessageSegmentDone : public Message
00870 {
00871 public:
00872 explicit MessageSegmentDone(GstMessage* castitem);
00873
00884 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Format format, gint64 position);
00885
00893 void parse(Format& format, gint64& position);
00894
00895
00902 gint64 parse();
00903
00910 Format parse_format();
00911 };
00912
00916 class MessageDuration : public Message
00917 {
00918 public:
00919 explicit MessageDuration(GstMessage* castitem);
00920
00934 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Format format, gint64 position);
00935
00946 void parse(Format& format, gint64& position);
00947
00948
00958 gint64 parse();
00959
00968 Format parse_format();
00969 };
00970
00974 class MessageLatency : public Message
00975 {
00976 public:
00977 explicit MessageLatency(GstMessage* castitem);
00978
00987 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
00988 };
00989
00993 class MessageAsyncStart : public Message
00994 {
00995 public:
00996 explicit MessageAsyncStart(GstMessage* castitem);
00997
01008 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, bool new_base_time);
01009
01019 bool parse();
01020
01021 };
01022
01026 class MessageAsyncDone : public Message
01027 {
01028 public:
01029 explicit MessageAsyncDone(GstMessage* castitem);
01030
01037 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
01038 };
01039
01040 }
01041
01042
01043 namespace Gst
01044 {
01050 Glib::RefPtr<Gst::Message> wrap(GstMessage* object, bool take_copy = false);
01051 }
01052
01053
01054 #endif
01055