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_STEP_START = 1 << 23,
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
00141 enum StructureChangeType
00142 {
00143 STRUCTURE_CHANGE_TYPE_PAD_LINK,
00144 STRUCTURE_CHANGE_TYPE_PAD_UNLINK
00145 };
00146
00147 }
00148
00149
00150 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00151 namespace Glib
00152 {
00153
00154 template <>
00155 class Value<Gst::StructureChangeType> : public Glib::Value_Enum<Gst::StructureChangeType>
00156 {
00157 public:
00158 static GType value_type() G_GNUC_CONST;
00159 };
00160
00161 }
00162 #endif
00163
00164
00165 namespace Gst
00166 {
00167
00168
00172 enum StreamStatusType
00173 {
00174 STREAM_STATUS_TYPE_CREATE = 0,
00175 STREAM_STATUS_TYPE_ENTER = 1,
00176 STREAM_STATUS_TYPE_LEAVE = 2,
00177 STREAM_STATUS_TYPE_DESTROY = 3,
00178 STREAM_STATUS_TYPE_START = 8,
00179 STREAM_STATUS_TYPE_PAUSE = 9,
00180 STREAM_STATUS_TYPE_STOP = 10
00181 };
00182
00183 }
00184
00185
00186 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00187 namespace Glib
00188 {
00189
00190 template <>
00191 class Value<Gst::StreamStatusType> : public Glib::Value_Enum<Gst::StreamStatusType>
00192 {
00193 public:
00194 static GType value_type() G_GNUC_CONST;
00195 };
00196
00197 }
00198 #endif
00199
00200
00201 namespace Gst
00202 {
00203
00204
00205 namespace Enums
00206 {
00207
00212 Glib::ustring get_name(MessageType type);
00213
00218 Glib::QueryQuark get_quark(MessageType type);
00219
00220 }
00221
00222 class Element;
00223 class Pad;
00224 class Structure;
00225 class TagList;
00226
00243 class Message : public Gst::MiniObject
00244 {
00245 protected:
00246
00247 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00248
00249 public:
00250 typedef Message CppObjectType;
00251 typedef Message_Class CppClassType;
00252 typedef GstMessage BaseObjectType;
00253 typedef GstMessageClass BaseClassType;
00254
00255 private: friend class Message_Class;
00256 static CppClassType message_class_;
00257
00258 private:
00259
00260 Message(const Message&);
00261 Message& operator=(const Message&);
00262
00263 protected:
00264 explicit Message(GstMessage* castitem);
00265
00266 #endif
00267
00268 public:
00269 virtual ~Message();
00270
00271 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00272 static GType get_type() G_GNUC_CONST;
00273 static GType get_base_type() G_GNUC_CONST;
00274 #endif
00275
00277 GstMessage* gobj() { return reinterpret_cast<GstMessage*>(gobject_); }
00278
00280 const GstMessage* gobj() const { return reinterpret_cast<GstMessage*>(gobject_); }
00281
00283 GstMessage* gobj_copy();
00284
00285 private:
00286
00287
00288 public:
00294 static Glib::RefPtr<Gst::Message> wrap(GstMessage* message, bool take_copy=false);
00295
00299 Glib::RefPtr<Gst::Message> copy() const;
00300
00301
00302
00303
00311 const Gst::Structure get_structure() const;
00312
00317 Glib::RefPtr<Gst::Message> create_writable();
00318
00319
00338 guint32 get_seqnum() const;
00339
00351 void set_seqnum(guint32 seqnum);
00352
00355 MessageType get_message_type() const;
00356
00360 ClockTime get_timestamp() const;
00361
00364 Glib::RefPtr<Gst::Object> get_source();
00365 Glib::RefPtr<const Gst::Object> get_source() const;
00366
00367
00368 public:
00369
00370 public:
00371
00372 #ifdef GLIBMM_VFUNCS_ENABLED
00373 #endif //GLIBMM_VFUNCS_ENABLED
00374
00375 protected:
00376
00377 #ifdef GLIBMM_VFUNCS_ENABLED
00378 #endif //GLIBMM_VFUNCS_ENABLED
00379
00380
00381 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00382 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00383
00384
00385 };
00386
00387
00388
00389
00390
00391
00392
00396 class MessageEos : public Message
00397 {
00398 public:
00399 explicit MessageEos(GstMessage* castitem);
00400
00408 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00409 };
00410
00414 class MessageError : public Message
00415 {
00416 public:
00417 explicit MessageError(GstMessage* castitem);
00418
00429 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00430
00438 void parse(Glib::Error& error, std::string& debug) const;
00439
00440
00447 Glib::Error parse() const;
00448
00455 std::string parse_debug() const;
00456 };
00457
00461 class MessageWarning : public Message
00462 {
00463 public:
00464 explicit MessageWarning(GstMessage* castitem);
00465
00474 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00475
00483 void parse(Glib::Error& error, std::string& debug) const;
00484
00485
00492 Glib::Error parse() const;
00493
00500 std::string parse_debug() const;
00501 };
00502
00506 class MessageInfo : public Message
00507 {
00508 public:
00509 explicit MessageInfo(GstMessage* castitem);
00510
00520 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Glib::Error& error, const std::string& debug);
00521
00529 void parse(Glib::Error& error, std::string& debug) const;
00530
00531
00538 Glib::Error parse() const;
00539
00546 std::string parse_debug() const;
00547 };
00548
00552 class MessageTag : public Message
00553 {
00554 public:
00555 explicit MessageTag(GstMessage* castitem);
00556
00564 static Glib::RefPtr<Gst::Message>
00565 create(const Glib::RefPtr<Gst::Object>& src, const Gst::TagList& taglist);
00566
00577 static Glib::RefPtr<Gst::Message>
00578 create(const Glib::RefPtr<Gst::Object>& src,
00579 const Glib::RefPtr<Gst::Pad>& pad, const Gst::TagList& taglist);
00580
00590 void parse(Glib::RefPtr<Gst::Pad>& pad, Gst::TagList& tag_list) const;
00591
00598 Gst::TagList parse() const;
00599
00600
00609 Glib::RefPtr<Gst::Pad> parse_pad() const;
00610
00611 };
00612
00616 class MessageBuffering : public Message
00617 {
00618 public:
00619 explicit MessageBuffering(GstMessage* castitem);
00620
00639 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, int percent);
00640
00645 int parse() const;
00646
00647
00657 void set_stats(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left);
00658
00659
00669 void parse_stats(BufferingMode& mode, int& avg_in, int& avg_out, gint64& buffering_left) const;
00670
00671
00676 BufferingMode parse_stats_buffering_mode() const;
00677
00682 int parse_stats_avg_in() const;
00683
00688 int parse_stats_avg_out() const;
00689
00695 gint64 parse_stats_buffering_left() const;
00696 };
00697
00701 class MessageStateChanged : public Message
00702 {
00703 public:
00704 explicit MessageStateChanged(GstMessage* castitem);
00705
00715 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, State oldstate, State newstate, State pending);
00716
00726 void parse(State& oldstate, State& newstate, State& pending) const;
00727
00728
00735 State parse() const;
00736
00743 State parse_old() const;
00744
00751 State parse_pending() const;
00752 };
00753
00757 class MessageStateDirty : public Message
00758 {
00759 public:
00760 explicit MessageStateDirty(GstMessage* castitem);
00761
00769 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
00770 };
00771
00775 class MessageStepDone : public Message
00776 {
00777 public:
00778 explicit MessageStepDone(GstMessage* castitem);
00779
00799 static Glib::RefPtr<Gst::Message>
00800 create(const Glib::RefPtr<Gst::Object>& src, Gst::Format format,
00801 guint64 amount, double rate, bool flush, bool intermediate,
00802 guint64 duration, bool eos);
00803
00818 void parse(Gst::Format& format, guint64& amount, double& rate, bool& flush,
00819 bool& intermediate, guint64& duration, bool& eos) const;
00820
00821
00825 guint64 parse() const;
00826
00830 Gst::Format parse_format() const;
00831
00835 guint64 parse_amount() const;
00836
00840 double parse_rate() const;
00841
00845 bool parse_flush() const;
00846
00850 bool parse_intermediate() const;
00851
00855 bool parse_eos() const;
00856 };
00857
00861 class MessageClockProvide : public Message
00862 {
00863 public:
00864 explicit MessageClockProvide(GstMessage *message);
00865
00877 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock, bool ready);
00878
00887 void parse(Glib::RefPtr<Gst::Clock>& clock, bool& ready) const;
00888
00889
00897 Glib::RefPtr<Gst::Clock> parse();
00898
00906 Glib::RefPtr<const Gst::Clock> parse() const;
00907
00914 bool parse_ready() const;
00915 };
00916
00920 class MessageClockLost : public Message
00921 {
00922 public:
00923 explicit MessageClockLost(GstMessage* castitem);
00924
00934 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock);
00935
00942 Glib::RefPtr<Gst::Clock> parse();
00943
00944
00951 Glib::RefPtr<const Gst::Clock> parse() const;
00952 };
00953
00957 class MessageNewClock: public Message
00958 {
00959 public:
00960 explicit MessageNewClock(GstMessage* castitem);
00961
00969 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock);
00970
00978 Glib::RefPtr<Gst::Clock> parse();
00979
00980
00988 Glib::RefPtr<const Gst::Clock> parse() const;
00989 };
00990
00994 class MessageApplication : public Message
00995 {
00996 public:
00997 explicit MessageApplication(GstMessage *message);
00998
01007 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
01008
01016 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
01017 };
01018
01022 class MessageElement : public Message
01023 {
01024 public:
01025 explicit MessageElement(GstMessage* castitem);
01026
01037 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
01038
01048 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
01049 };
01050
01054 class MessageCustom : public Message
01055 {
01056 public:
01057 explicit MessageCustom(GstMessage* castitem);
01058
01068 static Glib::RefPtr<Gst::Message> create(MessageType type, const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure);
01069
01078 static Glib::RefPtr<Gst::Message> create(MessageType type, const Glib::RefPtr<Gst::Object>& src);
01079 };
01080
01084 class MessageSegmentStart : public Message
01085 {
01086 public:
01087 explicit MessageSegmentStart(GstMessage* castitem);
01088
01099 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
01100
01108 void parse(Format& format, gint64& position) const;
01109
01110
01117 gint64 parse() const;
01118
01125 Format parse_format() const;
01126 };
01127
01131 class MessageSegmentDone : public Message
01132 {
01133 public:
01134 explicit MessageSegmentDone(GstMessage* castitem);
01135
01146 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
01147
01155 void parse(Format& format, gint64& position) const;
01156
01157
01164 gint64 parse() const;
01165
01172 Format parse_format() const;
01173 };
01174
01178 class MessageDuration : public Message
01179 {
01180 public:
01181 explicit MessageDuration(GstMessage* castitem);
01182
01196 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position);
01197
01208 void parse(Format& format, gint64& position) const;
01209
01210
01220 gint64 parse() const;
01221
01230 Format parse_format() const;
01231 };
01232
01236 class MessageLatency : public Message
01237 {
01238 public:
01239 explicit MessageLatency(GstMessage* castitem);
01240
01249 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
01250 };
01251
01255 class MessageAsyncStart : public Message
01256 {
01257 public:
01258 explicit MessageAsyncStart(GstMessage* castitem);
01259
01270 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src, bool new_base_time);
01271
01281 bool parse() const;
01282
01283 };
01284
01288 class MessageAsyncDone : public Message
01289 {
01290 public:
01291 explicit MessageAsyncDone(GstMessage* castitem);
01292
01299 static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
01300 };
01301
01305 class MessageStepStart : public Message
01306 {
01307 public:
01308 explicit MessageStepStart(GstMessage* castitem);
01309
01332 static Glib::RefPtr<Gst::Message>
01333 create(const Glib::RefPtr<Gst::Object>& src, bool active,
01334 Gst::Format format, guint64 amount, double rate, bool flush,
01335 bool intermediate);
01336
01350 void parse(bool& active, Gst::Format& format, guint64& amount, double& rate,
01351 bool& flush, bool& intermediate) const;
01352
01353
01357 guint64 parse() const;
01358
01362 bool parse_active() const;
01363
01367 Gst::Format parse_format() const;
01368
01372 double parse_rate() const;
01373
01377 bool parse_flush() const;
01378
01382 bool parse_intermediate() const;
01383 };
01384
01388 class MessageStructureChange : public Message
01389 {
01390 public:
01391 explicit MessageStructureChange(GstMessage* castitem);
01392
01407 static Glib::RefPtr<Gst::Message>
01408 create(const Glib::RefPtr<Gst::Object>& src,
01409 Gst::StructureChangeType type, const Glib::RefPtr<Gst::Element>& owner,
01410 bool busy);
01411
01422 void parse(Gst::StructureChangeType& type,
01423 Glib::RefPtr<Gst::Element>& owner, bool& busy) const;
01424
01425
01433 Gst::StructureChangeType parse() const;
01434
01442 Glib::RefPtr<Gst::Element> parse_owner() const;
01443
01451 bool parse_busy() const;
01452 };
01453
01457 class MessageRequestState : public Message
01458 {
01459 public:
01460 explicit MessageRequestState(GstMessage* castitem);
01461
01472 static Glib::RefPtr<Gst::Message>
01473 create(const Glib::RefPtr<Gst::Object>& src, Gst::State state);
01474
01480 Gst::State parse() const;
01481
01482 };
01483
01487 class MessageStreamStatus : public Message
01488 {
01489 public:
01490 explicit MessageStreamStatus(GstMessage* castitem);
01491
01500 static Glib::RefPtr<Gst::Message>
01501 create(const Glib::RefPtr<Gst::Object>& src, Gst::StreamStatusType type,
01502 const Glib::RefPtr<Gst::Element>& owner);
01503
01510 void set_object(const Glib::RefPtr<Gst::Object>& object);
01511
01512
01518 Glib::RefPtr<Gst::Object> get_object() const;
01519
01520
01532 void parse(Gst::StreamStatusType& type, Glib::RefPtr<Gst::Element>& owner) const;
01533
01534
01543 Gst::StreamStatusType parse() const;
01544
01554 Glib::RefPtr<Gst::Element> parse_owner() const;
01555 };
01556
01557 }
01558
01559
01560 namespace Gst
01561 {
01567 Glib::RefPtr<Gst::Message> wrap(GstMessage* object, bool take_copy = false);
01568 }
01569
01570
01571 #endif
01572