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/enums.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:
00212
00216 Structure get_structure() const;
00217
00218 public:
00224 static Glib::RefPtr<Message> wrap(GstMessage* message, bool take_copy=false);
00225
00226 MessageType get_message_type() const;
00227 ClockTime get_timestamp() const;
00228 Glib::RefPtr<Gst::Object> get_source();
00229 Glib::RefPtr<const Gst::Object> get_source() const;
00230
00231
00232 public:
00233
00234 public:
00235
00236 #ifdef GLIBMM_VFUNCS_ENABLED
00237 #endif //GLIBMM_VFUNCS_ENABLED
00238
00239 protected:
00240
00241 #ifdef GLIBMM_VFUNCS_ENABLED
00242 #endif //GLIBMM_VFUNCS_ENABLED
00243
00244
00245 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00246 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00247
00248
00249 };
00250
00251
00252
00253
00254
00255
00256
00257 class MessageApplication : public Message
00258 {
00259 public:
00260 explicit MessageApplication(GstMessage *message);
00261
00262 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Structure& structure);
00263 };
00264
00265 class MessageClockProvide : public Message
00266 {
00267 public:
00268 explicit MessageClockProvide(GstMessage *message);
00269
00270 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock, bool ready);
00271
00272
00273 void parse(Glib::RefPtr<Clock>& clock, bool& ready);
00274 };
00275
00276 class MessageClockLost : public Message
00277 {
00278 public:
00279 explicit MessageClockLost(GstMessage* castitem);
00280
00281 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock);
00282
00283
00284 void parse(Glib::RefPtr<Clock>& clock);
00285 };
00286
00287 class MessageCustom : public Message
00288 {
00289 public:
00290 explicit MessageCustom(GstMessage* castitem);
00291
00292 static Glib::RefPtr<Message> create(MessageType type, const Glib::RefPtr<Object>& src, Structure& structure);
00293 };
00294
00295 class MessageElement : public Message
00296 {
00297 public:
00298 explicit MessageElement(GstMessage* castitem);
00299
00300 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Structure& structure);
00301 };
00302
00303 class MessageEos : public Message
00304 {
00305 public:
00306 explicit MessageEos(GstMessage* castitem);
00307
00308 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
00309 };
00310
00311 class MessageError : public Message
00312 {
00313 public:
00314 explicit MessageError(GstMessage* castitem);
00315
00316 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
00317
00318
00319 void parse(Glib::Error& error, std::string& debug);
00320 void parse(Glib::Error& error);
00321 };
00322
00323 class MessageInfo : public Message
00324 {
00325 public:
00326 explicit MessageInfo(GstMessage* castitem);
00327
00328 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
00329
00330
00331 void parse(Glib::Error& error, std::string& debug);
00332 void parse(Glib::Error& error);
00333 };
00334
00335 class MessageNewClock: public Message
00336 {
00337 public:
00338 explicit MessageNewClock(GstMessage* castitem);
00339
00340 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock);
00341
00342
00343 void parse(Glib::RefPtr<Clock>& clock);
00344 };
00345
00346 class MessageSegmentDone : public Message
00347 {
00348 public:
00349 explicit MessageSegmentDone(GstMessage* castitem);
00350
00351 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Format format, gint64 position);
00352
00353
00354 void parse(Format& format, gint64& position);
00355 };
00356
00357 class MessageSegmentStart : public Message
00358 {
00359 public:
00360 explicit MessageSegmentStart(GstMessage* castitem);
00361
00362 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Format format, gint64 position);
00363
00364
00365 void parse(Format& format, gint64& position);
00366 };
00367
00368 class MessageStateChanged : public Message
00369 {
00370 public:
00371 explicit MessageStateChanged(GstMessage* castitem);
00372
00373 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, State oldstate, State newstate, State pending);
00374
00375
00376 void parse(State& oldstate, State& newstate, State& pending);
00377 };
00378
00379 class MessageTag : public Message
00380 {
00381 public:
00382 explicit MessageTag(GstMessage* castitem);
00383
00384 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const TagList& taglist);
00385
00386
00387 void parse(TagList& taglist);
00388 };
00389
00390 class MessageBuffering : public Message
00391 {
00392 public:
00393 explicit MessageBuffering(GstMessage* castitem);
00394
00395 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, int percent);
00396
00397
00398 void parse(int& percent);
00399 };
00400
00401 class MessageWarning : public Message
00402 {
00403 public:
00404 explicit MessageWarning(GstMessage* castitem);
00405
00406 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
00407
00408
00409 void parse(Glib::Error& error, std::string& debug);
00410 };
00411
00412 class MessageDuration : public Message
00413 {
00414 public:
00415 explicit MessageDuration(GstMessage* castitem);
00416
00417 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Format format, gint64 position);
00418
00419
00420 void parse(Format& format, gint64& position);
00421 };
00422
00423 class MessageStateDirty : public Message
00424 {
00425 public:
00426 explicit MessageStateDirty(GstMessage* castitem);
00427
00428 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
00429 };
00430
00431 class MessageAsyncStart : public Message
00432 {
00433 public:
00434 explicit MessageAsyncStart(GstMessage* castitem);
00435
00436 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, bool new_base_time);
00437
00438
00439 void parse(bool& new_base_time);
00440 };
00441
00442 class MessageAsyncDone : public Message
00443 {
00444 public:
00445 explicit MessageAsyncDone(GstMessage* castitem);
00446
00447 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
00448 };
00449
00450 class MessageLatency : public Message
00451 {
00452 public:
00453 explicit MessageLatency(GstMessage* castitem);
00454
00455 static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
00456 };
00457
00458 }
00459
00460
00461 namespace Gst
00462 {
00468 Glib::RefPtr<Gst::Message> wrap(GstMessage* object, bool take_copy = false);
00469 }
00470
00471
00472 #endif
00473