[gstreamermm] Gst::Message: wrap missing Message classes
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] Gst::Message: wrap missing Message classes
- Date: Sat, 28 Feb 2015 18:49:40 +0000 (UTC)
commit 2819eda9df7dd85a66293a2390645e3fa3a60b1b
Author: Marcin Kolny <marcin kolny gmail com>
Date: Sat Feb 28 18:26:19 2015 +0100
Gst::Message: wrap missing Message classes
* gstreamer/src/message.{ccg|hg}: wrap method MessageDurationChanged,
MessageQos, MessageStreamStart, MessageHaveContext,
MessageNeedContext, MessageResetTime, MessageToc, MessageProgress.
Fix *_create methods in existing classes(don't take copy on creating
new message).
* tests/Makefile.am: add message test to a build.
* tests/regression/test-regression-seekonstartup.cc:
* tests/test-bus.cc: apply interface changes in tests.
* tools/m4/convert_gst.m4: convert ProgressType enum.
gstreamer/src/message.ccg | 237 ++++++++++---
gstreamer/src/message.hg | 382 ++++++++++++++++++---
tests/Makefile.am | 3 +-
tests/regression/test-regression-seekonstartup.cc | 3 +-
tests/test-bus.cc | 3 +-
tests/test-message.cc | 16 +
tools/m4/convert_gst.m4 | 1 +
7 files changed, 543 insertions(+), 102 deletions(-)
---
diff --git a/gstreamer/src/message.ccg b/gstreamer/src/message.ccg
index 630cfcb..ab616fc 100644
--- a/gstreamer/src/message.ccg
+++ b/gstreamer/src/message.ccg
@@ -52,7 +52,7 @@ Glib::RefPtr<Gst::MessageEos>
MessageEos::create(const Glib::RefPtr<Gst::Object>& src)
{
GstMessage* message = gst_message_new_eos(Glib::unwrap(src));
- return Gst::wrap_msg_derived<Gst::MessageEos>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageEos>(message, false);
}
Glib::RefPtr<Gst::MessageError>
@@ -61,7 +61,7 @@ Glib::RefPtr<Gst::MessageError>
{
GstMessage* message = gst_message_new_error(Glib::unwrap(src), error.gobj(),
reinterpret_cast<const gchar*>(debug.c_str()));
- return Gst::wrap_msg_derived<Gst::MessageError>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageError>(message, false);
}
void MessageError::parse(Glib::Error& error, std::string& debug) const
@@ -109,7 +109,7 @@ Glib::RefPtr<Gst::MessageWarning>
{
GstMessage* message = gst_message_new_warning(Glib::unwrap(src),
error.gobj(), reinterpret_cast<const gchar*>(debug.c_str()));
- return Gst::wrap_msg_derived<Gst::MessageWarning>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageWarning>(message, false);
}
void MessageWarning::parse(Glib::Error& error, std::string& debug) const
@@ -158,7 +158,7 @@ Glib::RefPtr<Gst::MessageInfo>
{
GstMessage* message = gst_message_new_info(Glib::unwrap(src), error.gobj(),
reinterpret_cast<const gchar*>(debug.c_str()));
- return Gst::wrap_msg_derived<Gst::MessageInfo>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageInfo>(message, false);
}
@@ -206,7 +206,7 @@ Glib::RefPtr<Gst::MessageTag>
{
GstTagList* c_taglist = gst_tag_list_copy(taglist.gobj());
GstMessage* message = gst_message_new_tag(Glib::unwrap(src), c_taglist);
- return Gst::wrap_msg_derived<Gst::MessageTag>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageTag>(message, false);
}
void MessageTag::parse(Gst::TagList& tag_list)
@@ -231,7 +231,7 @@ Glib::RefPtr<Gst::MessageBuffering>
MessageBuffering::create(const Glib::RefPtr<Gst::Object>& src, int percent)
{
GstMessage* message = gst_message_new_buffering(Glib::unwrap(src), percent);
- return Gst::wrap_msg_derived<Gst::MessageBuffering>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageBuffering>(message, false);
}
int MessageBuffering::parse() const
@@ -299,7 +299,7 @@ Glib::RefPtr<Gst::MessageStateChanged>
GstMessage* message = gst_message_new_state_changed(Glib::unwrap(src),
static_cast<GstState>(oldstate), static_cast<GstState>(newstate),
static_cast<GstState>(pending));
- return Gst::wrap_msg_derived<Gst::MessageStateChanged>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageStateChanged>(message, false);
}
void MessageStateChanged::parse(State& oldstate, State& newstate,
@@ -341,7 +341,7 @@ Glib::RefPtr<Gst::MessageStateDirty>
MessageStateDirty::create(const Glib::RefPtr<Gst::Object>& src)
{
GstMessage* message = gst_message_new_state_dirty(Glib::unwrap(src));
- return Gst::wrap_msg_derived<Gst::MessageStateDirty>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageStateDirty>(message, false);
}
Glib::RefPtr<Gst::MessageStepDone>
@@ -352,7 +352,7 @@ Glib::RefPtr<Gst::MessageStepDone>
GstMessage* message = gst_message_new_step_done(Glib::unwrap(src),
static_cast<GstFormat>(format), amount, rate, flush, intermediate,
duration, eos);
- return Gst::wrap_msg_derived<Gst::MessageStepDone>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageStepDone>(message, false);
}
void MessageStepDone::parse(Gst::Format& format, guint64& amount, double& rate,
@@ -433,7 +433,7 @@ Glib::RefPtr<Gst::MessageClockProvide>
{
GstMessage* message = gst_message_new_clock_provide(Glib::unwrap(src),
Glib::unwrap(clock), ready);
- return Gst::wrap_msg_derived<Gst::MessageClockProvide>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageClockProvide>(message, false);
}
void MessageClockProvide::parse(Glib::RefPtr<Gst::Clock>& clock, bool& ready) const
@@ -472,7 +472,7 @@ Glib::RefPtr<Gst::MessageClockLost>
{
GstMessage* message = gst_message_new_clock_lost(Glib::unwrap(src),
Glib::unwrap(clock));
- return Gst::wrap_msg_derived<Gst::MessageClockLost>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageClockLost>(message, false);
}
Glib::RefPtr<Gst::Clock> MessageClockLost::parse()
@@ -493,7 +493,7 @@ Glib::RefPtr<Gst::MessageNewClock>
{
GstMessage* message = gst_message_new_new_clock(Glib::unwrap(src),
Glib::unwrap(clock));
- return Gst::wrap_msg_derived<Gst::MessageNewClock>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageNewClock>(message, false);
}
Glib::RefPtr<Gst::Clock> MessageNewClock::parse()
@@ -515,7 +515,7 @@ Glib::RefPtr<Gst::MessageApplication>
GstStructure* copy_struct = gst_structure_copy(structure.gobj());
GstMessage* message = gst_message_new_application(Glib::unwrap(src),
copy_struct);
- return Gst::wrap_msg_derived<Gst::MessageApplication>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageApplication>(message, false);
}
Glib::RefPtr<Gst::MessageElement>
@@ -525,14 +525,14 @@ Glib::RefPtr<Gst::MessageElement>
GstStructure* copy_struct = gst_structure_copy(structure.gobj());
GstMessage* message = gst_message_new_element(Glib::unwrap(src),
copy_struct);
- return Gst::wrap_msg_derived<Gst::MessageElement>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageElement>(message, false);
}
Glib::RefPtr<Gst::MessageElement>
MessageElement::create(const Glib::RefPtr<Gst::Object>& src)
{
GstMessage* message = gst_message_new_element(Glib::unwrap(src), 0);
- return Gst::wrap_msg_derived<Gst::MessageElement>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageElement>(message, false);
}
Glib::RefPtr<Gst::MessageCustom>
@@ -542,7 +542,7 @@ Glib::RefPtr<Gst::MessageCustom>
GstStructure* copy_struct = gst_structure_copy(structure.gobj());
GstMessage* message = gst_message_new_custom(GstMessageType(type),
Glib::unwrap(src), copy_struct);
- return Gst::wrap_msg_derived<Gst::MessageCustom>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageCustom>(message, false);
}
Glib::RefPtr<Gst::MessageCustom>
@@ -550,7 +550,7 @@ Glib::RefPtr<Gst::MessageCustom>
{
GstMessage* message = gst_message_new_custom(GstMessageType(type),
Glib::unwrap(src), 0);
- return Gst::wrap_msg_derived<Gst::MessageCustom>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageCustom>(message, false);
}
Glib::RefPtr<Gst::MessageSegmentStart>
@@ -559,7 +559,7 @@ Glib::RefPtr<Gst::MessageSegmentStart>
{
GstMessage* message = gst_message_new_segment_start(Glib::unwrap(src),
static_cast<GstFormat>(format), position);
- return Gst::wrap_msg_derived<Gst::MessageSegmentStart>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageSegmentStart>(message, false);
}
void MessageSegmentStart::parse(Format& format, gint64& position) const
@@ -590,7 +590,7 @@ Glib::RefPtr<Gst::MessageSegmentDone>
{
GstMessage* message = gst_message_new_segment_done(Glib::unwrap(src),
static_cast<GstFormat>(format), position);
- return Gst::wrap_msg_derived<Gst::MessageSegmentDone>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageSegmentDone>(message, false);
}
void MessageSegmentDone::parse(Format& format, gint64& position) const
@@ -615,55 +615,39 @@ Format MessageSegmentDone::parse_format() const
return format;
}
-Glib::RefPtr<Gst::MessageDuration>
- MessageDuration::create(const Glib::RefPtr<Gst::Object>& src, Gst::Format,
- gint64 /* duration */)
+Glib::RefPtr<Gst::MessageDurationChanged>
+ MessageDurationChanged::create(const Glib::RefPtr<Gst::Object>& src)
{
- GstMessage* message = gst_message_new_duration(Glib::unwrap(src),
- static_cast<GstFormat>(format), duration);
- return Gst::wrap_msg_derived<Gst::MessageDuration>(message, true);
-}
-
-void MessageDuration::parse(Format& format, gint64& duration) const
-{
- gst_message_parse_duration(const_cast<GstMessage*>(gobj()),
- reinterpret_cast<GstFormat*>(&format), &duration);
-}
-
-gint64 MessageDuration::parse() const
-{
- gint64 duration = 0;
- gst_message_parse_duration(const_cast<GstMessage*>(gobj()), 0, &duration);
- return duration;
-}
-
-Format MessageDuration::parse_format() const
-{
- Format format = Gst::FORMAT_UNDEFINED;
- gst_message_parse_duration(const_cast<GstMessage*>(gobj()),
- reinterpret_cast<GstFormat*>(&format), 0);
- return format;
+ GstMessage* message = gst_message_new_duration_changed(Glib::unwrap(src));
+ return Gst::wrap_msg_derived<Gst::MessageDurationChanged>(message, false);
}
Glib::RefPtr<Gst::MessageLatency>
MessageLatency::create(const Glib::RefPtr<Gst::Object>& src)
{
GstMessage* message = gst_message_new_latency(Glib::unwrap(src));
- return Gst::wrap_msg_derived<Gst::MessageLatency>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageLatency>(message, false);
}
Glib::RefPtr<Gst::MessageAsyncStart>
MessageAsyncStart::create(const Glib::RefPtr<Gst::Object>& src)
{
GstMessage* message = gst_message_new_async_start(Glib::unwrap(src));
- return Gst::wrap_msg_derived<Gst::MessageAsyncStart>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageAsyncStart>(message, false);
}
Glib::RefPtr<Gst::MessageAsyncDone>
MessageAsyncDone::create(const Glib::RefPtr<Gst::Object>& src, ClockTime running_time)
{
GstMessage* message = gst_message_new_async_done(Glib::unwrap(src), running_time);
- return Gst::wrap_msg_derived<Gst::MessageAsyncDone>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageAsyncDone>(message, false);
+}
+
+Gst::ClockTime MessageAsyncDone::parse() const
+{
+ GstClockTime running_time;
+ gst_message_parse_async_done(const_cast<GstMessage*>(gobj()), &running_time);
+ return static_cast<Gst::ClockTime>(running_time);
}
Glib::RefPtr<Gst::MessageStepStart>
@@ -673,7 +657,7 @@ Glib::RefPtr<Gst::MessageStepStart>
{
GstMessage* message = gst_message_new_step_start(Glib::unwrap(src),
active, static_cast<GstFormat>(format), amount, rate, flush, intermediate);
- return Gst::wrap_msg_derived<Gst::MessageStepStart>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageStepStart>(message, false);
}
void MessageStepStart::parse(bool& active, Gst::Format& format,
@@ -747,7 +731,7 @@ Glib::RefPtr<Gst::MessageStructureChange>
{
GstMessage* message = gst_message_new_structure_change(Glib::unwrap(src),
static_cast<GstStructureChangeType>(type), Glib::unwrap(owner), busy);
- return Gst::wrap_msg_derived<Gst::MessageStructureChange>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageStructureChange>(message, false);
}
void MessageStructureChange::parse(Gst::StructureChangeType& type,
@@ -791,7 +775,7 @@ Glib::RefPtr<Gst::MessageRequestState>
{
GstMessage* message = gst_message_new_request_state(Glib::unwrap(src),
static_cast<GstState>(state));
- return Gst::wrap_msg_derived<Gst::MessageRequestState>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageRequestState>(message, false);
}
Gst::State MessageRequestState::parse() const
@@ -808,7 +792,7 @@ Glib::RefPtr<Gst::MessageStreamStatus>
{
GstMessage* message = gst_message_new_stream_status(Glib::unwrap(src),
static_cast<GstStreamStatusType>(type), Glib::unwrap(owner));
- return Gst::wrap_msg_derived<Gst::MessageStreamStatus>(message, true);
+ return Gst::wrap_msg_derived<Gst::MessageStreamStatus>(message, false);
}
void MessageStreamStatus::set_object(const Glib::RefPtr<Gst::Object>& object)
@@ -853,4 +837,151 @@ Glib::RefPtr<Gst::Element> MessageStreamStatus::parse_owner() const
return Glib::wrap(gst_element, true);
}
+Glib::RefPtr<Gst::MessageQos> MessageQos::create(const Glib::RefPtr<Gst::Object>& src,
+ bool live, guint64 running_time, guint64 stream_time, guint64 timestamp, guint64 duration)
+{
+ GstMessage* message = gst_message_new_qos(Glib::unwrap(src), live, running_time,
+ stream_time, timestamp, duration);
+ return Gst::wrap_msg_derived<Gst::MessageQos>(message, false);
+}
+
+void MessageQos::set_values(gint64 jitter, double proportion, gint quality)
+{
+ gst_message_set_qos_values(gobj(), jitter, proportion, quality);
+}
+
+void MessageQos::set_stats(Gst::Format format, guint64 processed, guint64 dropped)
+{
+ gst_message_set_qos_stats(gobj(), static_cast<GstFormat>(format),
+ processed, dropped);
+}
+
+void MessageQos::parse(bool& live, guint64& running_time, guint64& stream_time,
+ guint64& timestamp, guint64& duration) const
+{
+ gboolean tmp_live;
+ gst_message_parse_qos(const_cast<GstMessage*>(gobj()), &tmp_live, &running_time,
+ &stream_time, ×tamp, &duration);
+ live = tmp_live;
+}
+
+void MessageQos::parse_values(gint64& jitter, double& proportion, gint& quality) const
+{
+ gst_message_parse_qos_values(const_cast<GstMessage*>(gobj()), &jitter, &proportion, &quality);
+}
+
+void MessageQos::parse_stats(Gst::Format& format, guint64& processed, guint64& dropped) const
+{
+ gst_message_parse_qos_stats(const_cast<GstMessage*>(gobj()),
+ reinterpret_cast<GstFormat*>(&format), &processed, &dropped);
+}
+
+Glib::RefPtr<Gst::MessageStreamStart>
+ MessageStreamStart::create(const Glib::RefPtr<Gst::Object>& src)
+{
+ GstMessage* message = gst_message_new_stream_start(Glib::unwrap(src));
+ return Gst::wrap_msg_derived<Gst::MessageStreamStart>(message, false);
+}
+
+void MessageStreamStart::set_group_id(guint group_id)
+{
+ gst_message_set_group_id(gobj(), group_id);
+}
+
+bool MessageStreamStart::parse_group_id(guint& group_id) const
+{
+ return gst_message_parse_group_id(const_cast<GstMessage*>(gobj()), &group_id);
+}
+
+
+Glib::RefPtr<Gst::MessageHaveContext> MessageHaveContext::create(
+ const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Context>& context)
+{
+ GstMessage* message = gst_message_new_have_context(Glib::unwrap(src), Glib::unwrap(context));
+ return Gst::wrap_msg_derived<Gst::MessageHaveContext>(message, false);
+}
+
+Glib::RefPtr<Gst::Context> MessageHaveContext::parse() const
+{
+ GstContext* context;
+ gst_message_parse_have_context(const_cast<GstMessage*>(gobj()), &context);
+ return Glib::wrap(context, true);
+}
+
+Glib::RefPtr<Gst::MessageNeedContext> MessageNeedContext::create(
+ const Glib::RefPtr<Gst::Object>& src, const Glib::ustring& context_type)
+{
+ GstMessage* message = gst_message_new_need_context(Glib::unwrap(src),
+ reinterpret_cast<const gchar*>(context_type.c_str()));
+ return Gst::wrap_msg_derived<Gst::MessageNeedContext>(message, false);
+}
+
+bool MessageNeedContext::parse(Glib::ustring& context_type) const
+{
+ gchar* c_context_type = 0;
+ bool ret = gst_message_parse_context_type(const_cast<GstMessage*>(gobj()),
+ const_cast<const gchar**>(&c_context_type));
+ context_type = c_context_type;
+ if(c_context_type)
+ g_free(c_context_type);
+ return ret;
+}
+
+Glib::RefPtr<Gst::MessageResetTime> MessageResetTime::create(
+ const Glib::RefPtr<Gst::Object>& src, Gst::ClockTime running_time)
+{
+ GstMessage* message = gst_message_new_reset_time(Glib::unwrap(src),
+ static_cast<GstClockTime>(running_time));
+ return Gst::wrap_msg_derived<Gst::MessageResetTime>(message, false);
+}
+
+Gst::ClockTime MessageResetTime::parse() const
+{
+ GstClockTime running_time;
+ gst_message_parse_reset_time(const_cast<GstMessage*>(gobj()),
+ &running_time);
+ return static_cast<GstClockTime>(running_time);
+}
+
+Glib::RefPtr<Gst::MessageToc> MessageToc::create(
+ const Glib::RefPtr<Gst::Object>& src,
+ const Glib::RefPtr<Gst::Toc>& toc, bool updated)
+{
+ GstMessage* message = gst_message_new_toc(Glib::unwrap(src),
+ Glib::unwrap(toc), updated);
+ return Gst::wrap_msg_derived<Gst::MessageToc>(message, false);
+}
+
+void MessageToc::parse(Glib::RefPtr<Gst::Toc>& toc, bool& updated) const
+{
+ GstToc* c_toc;
+ gboolean c_updated;
+ gst_message_parse_toc(const_cast<GstMessage*>(gobj()), &c_toc, &c_updated);
+ toc = Glib::wrap(c_toc, true);
+ updated = updated;
+}
+
+Glib::RefPtr<Gst::MessageProgress> MessageProgress::create(
+ const Glib::RefPtr<Gst::Object>& src, Gst::ProgressType type,
+ const Glib::ustring& code, const Glib::ustring& text)
+{
+ GstMessage* message = gst_message_new_progress(Glib::unwrap(src),
+ static_cast<GstProgressType>(type), code.c_str(), text.c_str());
+ return Gst::wrap_msg_derived<Gst::MessageProgress>(message, false);
+}
+
+void MessageProgress::parse(Gst::ProgressType& type, Glib::ustring code, Glib::ustring& text) const
+{
+ GstProgressType c_type;
+ gchar* c_code, * c_text;
+ gst_message_parse_progress(const_cast<GstMessage*>(gobj()), &c_type, &c_code, &c_text);
+ code = c_code;
+ text = c_text;
+ if(c_code)
+ g_free(c_code);
+ if(c_text)
+ g_free(c_text);
+ type = static_cast<Gst::ProgressType>(c_type);
+}
+
} //namespace Gst
diff --git a/gstreamer/src/message.hg b/gstreamer/src/message.hg
index fe5b17c..9baf315 100644
--- a/gstreamer/src/message.hg
+++ b/gstreamer/src/message.hg
@@ -22,6 +22,8 @@
#include <gstreamermm/format.h>
#include <gstreamermm/clock.h>
#include <gstreamermm/query.h>
+#include <gstreamermm/context.h>
+#include <gstreamermm/toc.h>
_DEFS(gstreamermm,gst)
@@ -39,6 +41,7 @@ namespace Gst
}
_WRAP_ENUM(MessageType, GstMessageType)
+_WRAP_ENUM(ProgressType, GstProgressType)
_WRAP_ENUM(StructureChangeType, GstStructureChangeType)
_WRAP_ENUM(StreamStatusType, GstStreamStatusType)
@@ -98,6 +101,7 @@ public:
_WRAP_METHOD(guint32 get_seqnum() const, gst_message_get_seqnum)
_WRAP_METHOD(void set_seqnum(guint32 seqnum), gst_message_set_seqnum)
+ _WRAP_METHOD(Glib::RefPtr<Gst::Message> copy() const, gst_message_copy)
/** Get the GstMessageType of message.
*/
@@ -112,6 +116,8 @@ public:
*/
_MEMBER_GET_GOBJECT(source, src, Gst::Object, GstObject*)
+ _WRAP_METHOD(bool has_name(const Glib::ustring& name) const, gst_message_has_name)
+
protected:
// This method is used in the create() methods to convert a wrapped
// GstMessage to one of the more specific Gst::Message types.
@@ -886,60 +892,23 @@ public:
/** A duration message.
* See create() for more details.
*/
-class MessageDuration : public Message
+class MessageDurationChanged : public Message
{
public:
- /** Create a new duration message. This message is posted by elements that
- * know the duration of a stream in a specific format. This message is
- * received by bins and is used to calculate the total duration of a
+ /** Create a new duration changed message. This message is posted by elements
+ * that know the duration of a stream when the duration changes. This message
+ * is received by bins and is used to calculate the total duration of a
* pipeline. Elements may post a duration message with a duration of
* Gst::CLOCK_TIME_NONE to indicate that the duration has changed and the
* cached duration should be discarded. The new duration can then be
* retrieved via a query.
*
* @param src The object originating the message.
- * @param format The format of the duration.
- * @param duration The new duration.
- * @return The new duration message. MT safe.
- */
- static Glib::RefPtr<Gst::MessageDuration>
- create(const Glib::RefPtr<Gst::Object>& src, Format format,
- gint64 duration);
-
- /** Extracts the duration and format from the duration message. The duration
- * might be Gst::CLOCK_TIME_NONE, which indicates that the duration has
- * changed. Applications should always use a query to retrieve the duration
- * of a pipeline.
- *
- * MT safe.
- *
- * @param format Result location for the format.
- * @param duration Result location for the duration.
- */
- void parse(Format& format, gint64& duration) const;
- _IGNORE(gst_message_parse_duration)
-
- /** Extracts and returns the duration from the duration message. The duration
- * might be Gst::CLOCK_TIME_NONE, which indicates that the duration has
- * changed. Applications should always use a query to retrieve the duration
- * of a pipeline.
- *
- * MT safe.
- *
- * @return The duration.
- */
- gint64 parse() const;
-
- /** Extracts and returns the format from the duration message. Applications
- * should always use a query to retrieve the duration
- * of a pipeline.
- *
- * MT safe.
- *
- * @return The format.
+ * @return The new duration-changed message. MT safe.
*/
- Format parse_format() const;
+ static Glib::RefPtr<Gst::MessageDurationChanged>
+ create(const Glib::RefPtr<Gst::Object>& src);
};
/** A latency message.
@@ -978,8 +947,6 @@ public:
*/
static Glib::RefPtr<Gst::MessageAsyncStart>
create(const Glib::RefPtr<Gst::Object>& src);
-
- _IGNORE(gst_message_parse_async_start)
};
/** An asynchronous done message.
@@ -997,6 +964,15 @@ public:
*/
static Glib::RefPtr<Gst::MessageAsyncDone>
create(const Glib::RefPtr<Gst::Object>& src, ClockTime running_time);
+
+ /** Extract the running_time from the async_done message.
+ *
+ * MT safe.
+ *
+ * @return The running time from the async_done message.
+ */
+ Gst::ClockTime parse() const;
+ _IGNORE(gst_message_parse_async_done)
};
/** A step start message.
@@ -1250,4 +1226,318 @@ public:
Glib::RefPtr<Gst::Element> parse_owner() const;
};
+/** A qos message.
+ * See create() for more details.
+ */
+class MessageQos : public Message
+{
+public:
+ /** A QOS message is posted on the bus whenever an element decides to drop a
+ * buffer because of QoS reasons or whenever it changes its processing strategy
+ * because of QoS reasons (quality adjustments such as processing at lower
+ * accuracy).
+ *
+ * This message can be posted by an element that performs synchronisation against the
+ * clock (live) or it could be dropped by an element that performs QoS because of QOS
+ * events received from a downstream element (!live).
+ *
+ * MT safe.
+ *
+ * @param src The object originating the message.
+ * @param live If the message was generated by a live element
+ * @param running_time The running time of the buffer that generated the message
+ * @param stream_time The stream time of the buffer that generated the message
+ * @param timestamp The timestamps of the buffer that generated the message
+ * @param duration The duration of the buffer that generated the message
+ *
+ * @return The new qos message.
+ */
+ static Glib::RefPtr<Gst::MessageQos>
+ create(const Glib::RefPtr<Gst::Object>& src, bool live, guint64 running_time,
+ guint64 stream_time, guint64 timestamp, guint64 duration);
+
+ /** Set the QoS values that have been calculated/analysed from the QoS data.
+ *
+ * MT safe.
+ *
+ * @param jitter The difference of the running-time against the deadline.
+ * @param proportion Long term prediction of the ideal rate relative to normal rate
+ * to get optimal quality.
+ * @param quality An element dependent integer value that specifies the current
+ * quality level of the element. The default maximum quality is 1000000.
+ */
+ void set_values(gint64 jitter, double proportion, gint quality);
+ _IGNORE(gst_message_set_qos_values)
+
+ /** Set the QoS stats representing the history of the current continuous pipeline
+ * playback period.
+ *
+ * When @format is Gst::FORMAT_UNDEFINED both @dropped and @processed are
+ * invalid. Values of -1 for either @processed or @dropped mean unknown values.
+ *
+ * MT safe.
+ *
+ * @param format Units of the 'processed' and 'dropped' fields. Video sinks and video
+ * filters will use Gst::FORMAT_BUFFERS (frames). Audio sinks and audio filters
+ * will likely use Gst::FORMAT_DEFAULT (samples).
+ * @param processed Total number of units correctly processed since the last state
+ * change to READY or a flushing operation.
+ * @param dropped Total number of units dropped since the last state change to READY
+ * or a flushing operation.
+ */
+ void set_stats(Gst::Format format, guint64 processed, guint64 dropped);
+ _IGNORE(gst_message_set_qos_stats)
+
+ /** Extract the timestamps and live status from the QoS message.
+ *
+ * The returned values give the running_time, stream_time, timestamp and
+ * duration of the dropped buffer. Values of Gst::CLOCK_TIME_NONE mean unknown
+ * values.
+ *
+ * MT safe.
+ *
+ * @param live If the message was generated by a live element.
+ * @param running_time The running time of the buffer that
+ * generated the message.
+ * @param stream_time The stream time of the buffer that
+ * generated the message.
+ * @param timestamp The timestamps of the buffer that
+ * generated the message.
+ * @param duration The duration of the buffer that
+ * generated the message.
+ */
+ void parse(bool& live, guint64& running_time, guint64& stream_time,
+ guint64& timestamp, guint64& duration) const;
+ _IGNORE(gst_message_parse_qos)
+
+ /** Extract the QoS values that have been calculated/analysed from the QoS data.
+ * @param jitter The difference of the running-time against
+ * the deadline.
+ * @param proportion Long term prediction of the ideal rate
+ * relative to normal rate to get optimal quality.
+ * @param An element dependent integer value that
+ * specifies the current quality level of the element. The default
+ * maximum quality is 1000000.
+ *
+ * MT safe.
+ */
+ void parse_values(gint64& jitter, double& proportion, gint& quality) const;
+ _IGNORE(gst_message_parse_qos_values)
+
+ /** Extract the QoS stats representing the history of the current continuous
+ * pipeline playback period.
+ *
+ * @param format Units of the 'processed' and 'dropped' fields.
+ * Video sinks and video filters will use GST_FORMAT_BUFFERS (frames).
+ * Audio sinks and audio filters will likely use GST_FORMAT_DEFAULT
+ * (samples).
+ * @param processed Total number of units correctly processed
+ * since the last state change to READY or a flushing operation.
+ * @param dropped Total number of units dropped since the last
+ * state change to READY or a flushing operation.
+ *
+ * MT_safe.
+ *
+ * When @format is Gst::FORMAT_UNDEFINED both @dropped and @processed are
+ * invalid. Values of -1 for either @processed or @dropped mean unknown values.
+ */
+ void parse_stats(Gst::Format& format, guint64& processed, guint64& dropped) const;
+ _IGNORE(gst_message_parse_qos_stats)
+};
+
+/** A stream-start message.
+ * See create() for more details.
+ */
+class MessageStreamStart : public Message
+{
+public:
+ /** Create a new stream_start message. This message is generated and posted in
+ * the sink elements of a GstBin. The bin will only forward the STREAM_START
+ * message to the application if all sinks have posted an STREAM_START message.
+ *
+ * MT safe.
+ *
+ * @param src The object originating the message.
+ *
+ * @return The new stream_start message.
+ */
+ static Glib::RefPtr<Gst::MessageStreamStart> create(const Glib::RefPtr<Gst::Object>& src);
+
+ /** Sets the group id on the stream-start message.
+ *
+ * All streams that have the same group id are supposed to be played
+ * together, i.e. all streams inside a container file should have the
+ * same group id but different stream ids. The group id should change
+ * each time the stream is started, resulting in different group ids
+ * each time a file is played for example.
+ *
+ * MT safe.
+ *
+ * @param group_id The group id.
+ */
+ void set_group_id(guint group_id);
+ _IGNORE(gst_message_set_group_id)
+
+ /** Extract the group from the STREAM_START message.
+ *
+ * MT safe
+ *
+ * @param group_id Result location for the group id.
+ *
+ * @return true if the message had a group id set, false otherwse.
+ */
+ bool parse_group_id(guint& group_id) const;
+ _IGNORE(gst_message_parse_group_id)
+};
+
+/** A have-context message.
+ * See create() for more details.
+ */
+class MessageHaveContext : public Message
+{
+public:
+ /** This message is posted when an element has a new local Gst::Context.
+ *
+ * MT safe
+ *
+ * @param src The object originating the message.
+ * @param context The context.
+ *
+ * @return The new have-context message.
+ */
+ static Glib::RefPtr<Gst::MessageHaveContext>
+ create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Context>& context);
+
+ /** Extract the context from the HAVE_CONTEXT message.
+ *
+ * MT safe.
+ *
+ * @return context Result location for the context.
+ */
+ Glib::RefPtr<Gst::Context> parse() const;
+ _IGNORE(gst_message_parse_have_context)
+};
+
+/** A need-context message.
+ * See create() for more details.
+ */
+class MessageNeedContext : public Message
+{
+public:
+ /** This message is posted when an element needs a specific Gst::Context.
+ *
+ * MT safe.
+ *
+ * @param src The object originating the message.
+ * @param context_type The context type that is needed.
+ *
+ * @return The new need-context message.
+ */
+ static Glib::RefPtr<Gst::MessageNeedContext>
+ create(const Glib::RefPtr<Gst::Object>& src, const Glib::ustring& context_type);
+
+ /** Parse a context type from an existing Gst::MESSAGE_NEED_CONTEXT message.
+ *
+ * @param context_type The context type.
+ *
+ * @return a bool indicating if the parsing succeeded.
+ */
+ bool parse(Glib::ustring& context_type) const;
+ _IGNORE(gst_message_parse_context_type)
+};
+
+/** A reset-time message.
+ * See create() for more details.
+ */
+class MessageResetTime : public Message
+{
+public:
+ /** This message is posted when the pipeline running-time should be reset to
+ * @running_time, like after a flushing seek.
+ *
+ * MT safe.
+ *
+ * @param src The object originating the message.
+ * @param running_time The requested running-time.
+ *
+ * @return The new reset_time message.
+ */
+ static Glib::RefPtr<Gst::MessageResetTime>
+ create(const Glib::RefPtr<Gst::Object>& src, Gst::ClockTime running_time);
+
+ /** Extract the running-time from the RESET_TIME message.
+ *
+ * MT safe.
+ *
+ * @return Result location for the running_time.
+ */
+ Gst::ClockTime parse() const;
+ _IGNORE(gst_message_parse_reset_time)
+};
+
+/** A toc message.
+ * See create() for more details.
+ */
+class MessageToc : public Message
+{
+public:
+ /** Create a new TOC message. The message is posted by elements
+ * that discovered or updated a TOC.
+ *
+ * MT safe.
+ *
+ * @param src The object originating the message.
+ * @param toc Gst::Toc structure for hte message.
+ * @param updated whether TOC was updated
+ *
+ * @return A new TOC message.
+ */
+ static Glib::RefPtr<Gst::MessageToc>
+ create(const Glib::RefPtr<Gst::Object>& src,
+ const Glib::RefPtr<Gst::Toc>& toc, bool updated);
+
+ /** Extract the TOC from the Gst::Message.
+ *
+ * MT safe.
+ *
+ * @param toc Return location for the TOC.
+ * @param updated Return location for the updated flag.
+ */
+ void parse(Glib::RefPtr<Gst::Toc>& toc, bool& updated) const;
+ _IGNORE(gst_message_parse_toc)
+};
+
+/** A progress message.
+ * See create() for more details.
+ */
+class MessageProgress : public Message
+{
+public:
+ /** Progress messages are posted by elements when they use an asynchronous task
+ * to perform actions triggered by a state change.
+ *
+ * @code contains a well defined string describing the action.
+ * @text should contain a user visible string detailing the current action.
+ *
+ * @param src The object originating the message.
+ * @param type A Gst::ProgressType.
+ * @param code A progress code.
+ * @param text Free, user visible text describing the progress.
+ *
+ * @return The new progress message.
+ */
+ static Glib::RefPtr<Gst::MessageProgress>
+ create(const Glib::RefPtr<Gst::Object>& src,
+ Gst::ProgressType type, const Glib::ustring& code, const Glib::ustring& text);
+
+ /** Parses the progress @type, @code and @text.
+ *
+ * @param type A Gst::ProgressType.
+ * @param code A code.
+ * @param text A text.
+ */
+ void parse(Gst::ProgressType& type, Glib::ustring code, Glib::ustring& text) const;
+ _IGNORE(gst_message_parse_progress)
+};
+
} //namespace Gst
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a3b9813..b1f4c3e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,7 +22,7 @@ LDADD = $(GSTREAMERMM_LIBS) $(local_libgstreamermm) -lgtest -lpthread
check_PROGRAMS = test-caps test-buffer test-bus test-caps test-pad \
test-allocator test-atomicqueue test-bin \
- test-capsfeatures \
+ test-capsfeatures test-message \
test-urihandler test-ghostpad test-init test-miniobject \
test-query test-structure test-taglist test-plugin-appsink \
test-plugin-appsrc test-plugin-register test-plugin-pushsrc \
@@ -45,6 +45,7 @@ test_buffer_SOURCES = test-buffer.cc $(TEST_MAIN_SOURCE)
test_bus_SOURCES = test-bus.cc $(TEST_MAIN_SOURCE)
test_ghostpad_SOURCES = test-ghostpad.cc $(TEST_MAIN_SOURCE)
test_init_SOURCES = test-init.cc $(TEST_MAIN_SOURCE)
+test_message_SOURCES = test-message.cc $(TEST_MAIN_SOURCE)
test_miniobject_SOURCES = test-miniobject.cc $(TEST_MAIN_SOURCE)
test_pad_SOURCES = test-pad.cc $(TEST_MAIN_SOURCE)
test_pipeline_SOURCES = test-pipeline.cc $(TEST_MAIN_SOURCE)
diff --git a/tests/regression/test-regression-seekonstartup.cc
b/tests/regression/test-regression-seekonstartup.cc
index 5e0fb82..c4fce91 100644
--- a/tests/regression/test-regression-seekonstartup.cc
+++ b/tests/regression/test-regression-seekonstartup.cc
@@ -46,7 +46,8 @@ void dec_counter()
if (g_atomic_int_dec_and_test (&counter))
{
prerolled = true;
- bus->post(MessageApplication::create(pipeline, Structure("empty")));
+ Glib::RefPtr<Message> app = MessageApplication::create(pipeline, Structure("empty"));
+ bus->post(app);
}
}
diff --git a/tests/test-bus.cc b/tests/test-bus.cc
index 0ae919e..f40b5ff 100644
--- a/tests/test-bus.cc
+++ b/tests/test-bus.cc
@@ -18,7 +18,8 @@ protected:
void PostMessage()
{
- bool message_posted = bus->post(MessageEos::create(Glib::RefPtr<Object>()));
+ Glib::RefPtr<Message> m = MessageEos::create(Glib::RefPtr<Object>());
+ bool message_posted = bus->post(m);
ASSERT_TRUE(message_posted);
}
diff --git a/tests/test-message.cc b/tests/test-message.cc
new file mode 100644
index 0000000..c0efe40
--- /dev/null
+++ b/tests/test-message.cc
@@ -0,0 +1,16 @@
+/*
+ * test-message.cc
+ *
+ * Created on: Feb 27, 2015
+ * Author: m.kolny
+ */
+#include <gtest/gtest.h>
+#include <gstreamermm.h>
+
+using namespace Gst;
+
+TEST(MessageTest, CheckDerivedMessageRefcount)
+{
+ Glib::RefPtr<MessageStateDirty> msg = MessageStateDirty::create(Glib::RefPtr<Object>());
+ ASSERT_EQ(1, msg->get_refcount());
+}
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index 2eff1b3..181031e 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -39,6 +39,7 @@ _CONV_ENUM(Gst,PadMode)
_CONV_ENUM(Gst,PadPresence)
_CONV_ENUM(Gst,PadProbeType)
_CONV_ENUM(Gst,PluginDependencyFlags)
+_CONV_ENUM(Gst,ProgressType)
_CONV_ENUM(Gst,QOSType)
_CONV_ENUM(Gst,QueryType)
_CONV_ENUM(Gst,QueryTypeFlags)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]