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_ANY = ~0
00085 };
00086
00088 inline MessageType operator|(MessageType lhs, MessageType rhs)
00089 { return static_cast<MessageType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00090
00092 inline MessageType operator&(MessageType lhs, MessageType rhs)
00093 { return static_cast<MessageType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00094
00096 inline MessageType operator^(MessageType lhs, MessageType rhs)
00097 { return static_cast<MessageType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00098
00100 inline MessageType operator~(MessageType flags)
00101 { return static_cast<MessageType>(~static_cast<unsigned>(flags)); }
00102
00104 inline MessageType& operator|=(MessageType& lhs, MessageType rhs)
00105 { return (lhs = static_cast<MessageType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00106
00108 inline MessageType& operator&=(MessageType& lhs, MessageType rhs)
00109 { return (lhs = static_cast<MessageType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00110
00112 inline MessageType& operator^=(MessageType& lhs, MessageType rhs)
00113 { return (lhs = static_cast<MessageType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00114
00115 }
00116
00117
00118 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00119 namespace Glib
00120 {
00121
00122 template <>
00123 class Value<Gst::MessageType> : public Glib::Value_Flags<Gst::MessageType>
00124 {
00125 public:
00126 static GType value_type() G_GNUC_CONST;
00127 };
00128
00129 }
00130 #endif
00131
00132
00133 namespace Gst
00134 {
00135
00136
00137 namespace Enums
00138 {
00139
00144 Glib::ustring get_name(MessageType type);
00145
00150 Glib::QueryQuark get_quark(MessageType type);
00151
00152 }
00153
00154 class Structure;
00155 class TagList;
00156
00173 class Message : public Gst::MiniObject
00174 {
00175 protected:
00176
00177 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00178
00179 public:
00180 typedef Message CppObjectType;
00181 typedef Message_Class CppClassType;
00182 typedef GstMessage BaseObjectType;
00183 typedef GstMessageClass BaseClassType;
00184
00185 private: friend class Message_Class;
00186 static CppClassType message_class_;
00187
00188 private:
00189
00190 Message(const Message&);
00191 Message& operator=(const Message&);
00192
00193 protected:
00194 explicit Message(GstMessage* castitem);
00195
00196 #endif
00197
00198 public:
00199 virtual ~Message();
00200
00201 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00202 static GType get_type() G_GNUC_CONST;
00203 static GType get_base_type() G_GNUC_CONST;
00204 #endif
00205
00207 GstMessage* gobj() { return reinterpret_cast<GstMessage*>(gobject_); }
00208
00210 const GstMessage* gobj() const { return reinterpret_cast<GstMessage*>(gobject_); }
00211
00213 GstMessage* gobj_copy();
00214
00215 private:
00216
00217
00218 public:
00224 static Glib::RefPtr<Gst::Message> wrap(GstMessage* message, bool take_copy=false);
00225
00229 Glib::RefPtr<Gst::Message> copy() const;
00230
00231
00239 const Gst::Structure get_structure() const;
00240
00245 Glib::RefPtr<Gst::Message> create_writable();
00246
00249 MessageType get_message_type() const;
00250
00254 ClockTime get_timestamp() const;
00255
00258 Glib::RefPtr<Gst::Object> get_source();
00259 Glib::RefPtr<const Gst::Object> get_source() const;
00260
00261
00262 public:
00263
00264 public:
00265
00266 #ifdef GLIBMM_VFUNCS_ENABLED
00267 #endif //GLIBMM_VFUNCS_ENABLED
00268
00269 protected:
00270
00271 #ifdef GLIBMM_VFUNCS_ENABLED
00272 #endif //GLIBMM_VFUNCS_ENABLED
00273
00274
00275 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00276 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00277
00278
00279 };
00280
00281
00282
00283
00284
00285
00286
00290 class MessageEos : public Message
00291 {
00292 public:
00293 explicit MessageEos(GstMessage* castitem);
00294
00302 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00303 };
00304
00308 class MessageError : public Message
00309 {
00310 public:
00311 explicit MessageError(GstMessage* castitem);
00312
00323 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00324
00332 void parse(Glib::Error& error, std::string& debug) const;
00333
00334
00341 Glib::Error parse() const;
00342
00349 std::string parse_debug() const;
00350 };
00351
00355 class MessageWarning : public Message
00356 {
00357 public:
00358 explicit MessageWarning(GstMessage* castitem);
00359
00368 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00369
00377 void parse(Glib::Error& error, std::string& debug) const;
00378
00379
00386 Glib::Error parse() const;
00387
00394 std::string parse_debug() const;
00395 };
00396
00400 class MessageInfo : public Message
00401 {
00402 public:
00403 explicit MessageInfo(GstMessage* castitem);
00404
00414 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00415
00423 void parse(Glib::Error& error, std::string& debug) const;
00424
00425
00432 Glib::Error parse() const;
00433
00440 std::string parse_debug() const;
00441 };
00442
00446 class MessageTag : public Message
00447 {
00448 public:
00449 explicit MessageTag(GstMessage* castitem);
00450
00458 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Gst::TagList& taglist);
00459
00466 Gst::TagList parse() const;
00467
00468 };
00469
00473 class MessageBuffering : public Message
00474 {
00475 public:
00476 explicit MessageBuffering(GstMessage* castitem);
00477
00496 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, int percent);
00497
00502 int parse() const;
00503
00504
00514 void set_stats(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left);
00515
00516
00526 void parse_stats(BufferingMode& mode, int& avg_in, int& avg_out, gint64& buffering_left) const;
00527
00528
00533 BufferingMode parse_stats_buffering_mode() const;
00534
00539 int parse_stats_avg_in() const;
00540
00545 int parse_stats_avg_out() const;
00546
00552 gint64 parse_stats_buffering_left() const;
00553 };
00554
00558 class MessageStateChanged : public Message
00559 {
00560 public:
00561 explicit MessageStateChanged(GstMessage* castitem);
00562
00572 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, State oldstate, State newstate, State pending);
00573
00583 void parse(State& oldstate, State& newstate, State& pending) const;
00584
00585
00592 State parse() const;
00593
00600 State parse_old() const;
00601
00608 State parse_pending() const;
00609 };
00610
00614 class MessageStateDirty : public Message
00615 {
00616 public:
00617 explicit MessageStateDirty(GstMessage* castitem);
00618
00626 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00627 };
00628
00632 class MessageClockProvide : public Message
00633 {
00634 public:
00635 explicit MessageClockProvide(GstMessage *message);
00636
00648 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock, bool ready);
00649
00658 void parse(Glib::RefPtr<Gst::Clock>& clock, bool& ready) const;
00659
00660
00668 Glib::RefPtr<Gst::Clock> parse();
00669
00677 Glib::RefPtr<const Gst::Clock> parse() const;
00678
00685 bool parse_ready() const;
00686 };
00687
00691 class MessageClockLost : public Message
00692 {
00693 public:
00694 explicit MessageClockLost(GstMessage* castitem);
00695
00705 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock);
00706
00713 Glib::RefPtr<Gst::Clock> parse();
00714
00715
00722 Glib::RefPtr<const Gst::Clock> parse() const;
00723 };
00724
00728 class MessageNewClock: public Message
00729 {
00730 public:
00731 explicit MessageNewClock(GstMessage* castitem);
00732
00740 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock);
00741
00749 Glib::RefPtr<Gst::Clock> parse();
00750
00751
00759 Glib::RefPtr<const Gst::Clock> parse() const;
00760 };
00761
00765 class MessageApplication : public Message
00766 {
00767 public:
00768 explicit MessageApplication(GstMessage *message);
00769
00778 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
00779
00787 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00788 };
00789
00793 class MessageElement : public Message
00794 {
00795 public:
00796 explicit MessageElement(GstMessage* castitem);
00797
00808 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
00809
00819 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00820 };
00821
00825 class MessageCustom : public Message
00826 {
00827 public:
00828 explicit MessageCustom(GstMessage* castitem);
00829
00839 static Glib::RefPtr<Gst::Message> create(MessageType type, const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
00840
00849 static Glib::RefPtr<Gst::Message> create(MessageType type, const Glib::RefPtr<Gst::Object>& src);
00850 };
00851
00855 class MessageSegmentStart : public Message
00856 {
00857 public:
00858 explicit MessageSegmentStart(GstMessage* castitem);
00859
00870 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
00871
00879 void parse(Format& format, gint64& position) const;
00880
00881
00888 gint64 parse() const;
00889
00896 Format parse_format() const;
00897 };
00898
00902 class MessageSegmentDone : public Message
00903 {
00904 public:
00905 explicit MessageSegmentDone(GstMessage* castitem);
00906
00917 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
00918
00926 void parse(Format& format, gint64& position) const;
00927
00928
00935 gint64 parse() const;
00936
00943 Format parse_format() const;
00944 };
00945
00949 class MessageDuration : public Message
00950 {
00951 public:
00952 explicit MessageDuration(GstMessage* castitem);
00953
00967 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
00968
00979 void parse(Format& format, gint64& position) const;
00980
00981
00991 gint64 parse() const;
00992
01001 Format parse_format() const;
01002 };
01003
01007 class MessageLatency : public Message
01008 {
01009 public:
01010 explicit MessageLatency(GstMessage* castitem);
01011
01020 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
01021 };
01022
01026 class MessageAsyncStart : public Message
01027 {
01028 public:
01029 explicit MessageAsyncStart(GstMessage* castitem);
01030
01041 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, bool new_base_time);
01042
01052 bool parse() const;
01053
01054 };
01055
01059 class MessageAsyncDone : public Message
01060 {
01061 public:
01062 explicit MessageAsyncDone(GstMessage* castitem);
01063
01070 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
01071 };
01072
01073 }
01074
01075
01076 namespace Gst
01077 {
01083 Glib::RefPtr<Gst::Message> wrap(GstMessage* object, bool take_copy = false);
01084 }
01085
01086
01087 #endif
01088