GstMessage: Add STREAM_STATUS message methods

Add methods to handle the stream_status message types.
This commit is contained in:
Wim Taymans 2009-04-21 13:42:01 +02:00 committed by Wim Taymans
parent 81c0840ab0
commit e72efeccd1
4 changed files with 159 additions and 1 deletions

View file

@ -1043,7 +1043,6 @@ gst_iterator_result_get_type
<TITLE>GstMessage</TITLE> <TITLE>GstMessage</TITLE>
GstMessage GstMessage
GstMessageType GstMessageType
GstStructureChangeType
GST_MESSAGE_SRC GST_MESSAGE_SRC
GST_MESSAGE_TIMESTAMP GST_MESSAGE_TIMESTAMP
GST_MESSAGE_TYPE GST_MESSAGE_TYPE
@ -1094,10 +1093,19 @@ gst_message_new_latency
gst_message_new_async_start gst_message_new_async_start
gst_message_parse_async_start gst_message_parse_async_start
gst_message_new_async_done gst_message_new_async_done
GstStructureChangeType
gst_message_new_structure_change gst_message_new_structure_change
gst_message_parse_structure_change gst_message_parse_structure_change
gst_message_new_request_state gst_message_new_request_state
gst_message_parse_request_state gst_message_parse_request_state
GstStreamStatusType
gst_message_new_stream_status
gst_message_parse_stream_status
gst_message_set_stream_status_object
gst_message_get_stream_status_object
<SUBSECTION Standard> <SUBSECTION Standard>
GstMessageClass GstMessageClass
GST_MESSAGE GST_MESSAGE
@ -1109,10 +1117,12 @@ GST_IS_MESSAGE_CLASS
GST_MESSAGE_GET_CLASS GST_MESSAGE_GET_CLASS
GST_TYPE_MESSAGE_TYPE GST_TYPE_MESSAGE_TYPE
GST_TYPE_STRUCTURE_CHANGE_TYPE GST_TYPE_STRUCTURE_CHANGE_TYPE
GST_TYPE_STREAM_STATUS_TYPE
<SUBSECTION Private> <SUBSECTION Private>
gst_message_get_type gst_message_get_type
gst_message_type_get_type gst_message_type_get_type
gst_structure_change_type_get_type gst_structure_change_type_get_type
gst_stream_status_type_get_type
GST_MESSAGE_COND GST_MESSAGE_COND
GST_MESSAGE_GET_LOCK GST_MESSAGE_GET_LOCK
GST_MESSAGE_LOCK GST_MESSAGE_LOCK

View file

@ -1458,3 +1458,112 @@ gst_message_parse_request_state (GstMessage * message, GstState * state)
*state = g_value_get_enum (gst_structure_id_get_value (message->structure, *state = g_value_get_enum (gst_structure_id_get_value (message->structure,
GST_QUARK (NEW_STATE))); GST_QUARK (NEW_STATE)));
} }
/**
* gst_message_new_stream_status:
* @src: The object originating the message.
* @type: The stream status type.
* @owner: The owner element of @src.
*
* Create a new stream status message. This message is posted when a streaming
* thread is created/destroyed or when the state changed.
*
* Returns: The new stream status message.
*
* MT safe.
*
* Since: 0.10.24.
*/
GstMessage *
gst_message_new_stream_status (GstObject * src, GstStreamStatusType type,
GstElement * owner)
{
GstMessage *message;
GstStructure *structure;
structure = gst_structure_empty_new ("GstMessageStreamStatus");
gst_structure_id_set (structure,
GST_QUARK (TYPE), GST_TYPE_STREAM_STATUS_TYPE, (gint) type,
GST_QUARK (OWNER), GST_TYPE_ELEMENT, owner, NULL);
message = gst_message_new_custom (GST_MESSAGE_STREAM_STATUS, src, structure);
return message;
}
/**
* gst_message_parse_stream_status:
* @message: A valid #GstMessage of type GST_MESSAGE_STREAM_STATUS.
* @type: A pointer to hold the status type
* @owner: The owner element of the message source
*
* Extracts the stream status type and owner the GstMessage.
*
* Since: 0.10.24.
*
* MT safe.
*/
void
gst_message_parse_stream_status (GstMessage * message,
GstStreamStatusType * type, GstElement ** owner)
{
const GValue *owner_gvalue;
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS);
owner_gvalue =
gst_structure_id_get_value (message->structure, GST_QUARK (OWNER));
g_return_if_fail (owner_gvalue != NULL);
if (type)
*type = g_value_get_enum (gst_structure_id_get_value (message->structure,
GST_QUARK (TYPE)));
if (owner)
*owner = (GstElement *) g_value_get_object (owner_gvalue);
}
/**
* gst_message_set_stream_status_object:
* @message: A valid #GstMessage of type GST_MESSAGE_STREAM_STATUS.
* @object: the object controlling the streaming
*
* Configures the object handling the streaming thread. This is usually a
* GstTask object but other objects might be added in the future.
*
* Since: 0.10.24
*/
void
gst_message_set_stream_status_object (GstMessage * message,
const GValue * object)
{
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS);
gst_structure_id_set_value (message->structure, GST_QUARK (OBJECT), object);
}
/**
* gst_message_get_stream_status_object:
* @message: A valid #GstMessage of type GST_MESSAGE_STREAM_STATUS.
*
* Extracts the object managing the streaming thread from @message.
*
* Returns: a GValue containing the object that manages the streaming thread.
* This object is usually of type GstTask but other types can be added in the
* future. The object remains valid as long as @message is valid.
*
* Since: 0.10.24
*/
const GValue *
gst_message_get_stream_status_object (GstMessage * message)
{
const GValue *result;
g_return_val_if_fail (GST_IS_MESSAGE (message), NULL);
g_return_val_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS,
NULL);
result = gst_structure_id_get_value (message->structure, GST_QUARK (OBJECT));
return result;
}

View file

@ -197,6 +197,32 @@ typedef enum {
GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK = 1 GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK = 1
} GstStructureChangeType; } GstStructureChangeType;
/**
* GstStreamStatusType:
* @GST_STREAM_STATUS_TYPE_CREATE: A new thread need to be created.
* @GST_STREAM_STATUS_TYPE_ENTER: a thread entered its loop function
* @GST_STREAM_STATUS_TYPE_LEAVE: a thread left its loop function
* @GST_STREAM_STATUS_TYPE_DESTROY: a thread is destroyed
* @GST_STREAM_STATUS_TYPE_START: a thread is started
* @GST_STREAM_STATUS_TYPE_PAUSE: a thread is paused
* @GST_STREAM_STATUS_TYPE_STOP: a thread is stopped
*
* The type of a #GstMessageStreamStatus. The stream status messages inform the
* application of new streaming threads and their status.
*
* Since: 0.10.24
*/
typedef enum {
GST_STREAM_STATUS_TYPE_CREATE = 0,
GST_STREAM_STATUS_TYPE_ENTER = 1,
GST_STREAM_STATUS_TYPE_LEAVE = 2,
GST_STREAM_STATUS_TYPE_DESTROY = 3,
GST_STREAM_STATUS_TYPE_START = 8,
GST_STREAM_STATUS_TYPE_PAUSE = 9,
GST_STREAM_STATUS_TYPE_STOP = 10
} GstStreamStatusType;
/** /**
* GstMessage: * GstMessage:
* @mini_object: the parent structure * @mini_object: the parent structure
@ -405,6 +431,14 @@ GstMessage * gst_message_new_structure_change (GstObject * src, GstStructureCh
void gst_message_parse_structure_change (GstMessage *message, GstStructureChangeType *type, void gst_message_parse_structure_change (GstMessage *message, GstStructureChangeType *type,
GstElement **owner, gboolean *busy); GstElement **owner, gboolean *busy);
/* STREAM STATUS */
GstMessage * gst_message_new_stream_status (GstObject * src, GstStreamStatusType type,
GstElement *owner);
void gst_message_parse_stream_status (GstMessage *message, GstStreamStatusType *type,
GstElement **owner);
void gst_message_set_stream_status_object (GstMessage *message, const GValue *object);
const GValue * gst_message_get_stream_status_object (GstMessage *message);
/* REQUEST_STATE */ /* REQUEST_STATE */
GstMessage * gst_message_new_request_state (GstObject * src, GstState state); GstMessage * gst_message_new_request_state (GstObject * src, GstState state);
void gst_message_parse_request_state (GstMessage * message, GstState *state); void gst_message_parse_request_state (GstMessage * message, GstState *state);

View file

@ -446,6 +446,7 @@ EXPORTS
gst_marshal_VOID__POINTER_OBJECT gst_marshal_VOID__POINTER_OBJECT
gst_marshal_VOID__UINT_BOXED gst_marshal_VOID__UINT_BOXED
gst_message_get_seqnum gst_message_get_seqnum
gst_message_get_stream_status_object
gst_message_get_structure gst_message_get_structure
gst_message_get_type gst_message_get_type
gst_message_new_application gst_message_new_application
@ -467,6 +468,7 @@ EXPORTS
gst_message_new_segment_start gst_message_new_segment_start
gst_message_new_state_changed gst_message_new_state_changed
gst_message_new_state_dirty gst_message_new_state_dirty
gst_message_new_stream_status
gst_message_new_structure_change gst_message_new_structure_change
gst_message_new_tag gst_message_new_tag
gst_message_new_warning gst_message_new_warning
@ -483,11 +485,13 @@ EXPORTS
gst_message_parse_segment_done gst_message_parse_segment_done
gst_message_parse_segment_start gst_message_parse_segment_start
gst_message_parse_state_changed gst_message_parse_state_changed
gst_message_parse_stream_status
gst_message_parse_structure_change gst_message_parse_structure_change
gst_message_parse_tag gst_message_parse_tag
gst_message_parse_warning gst_message_parse_warning
gst_message_set_buffering_stats gst_message_set_buffering_stats
gst_message_set_seqnum gst_message_set_seqnum
gst_message_set_stream_status_object
gst_message_type_get_name gst_message_type_get_name
gst_message_type_get_type gst_message_type_get_type
gst_message_type_to_quark gst_message_type_to_quark
@ -815,6 +819,7 @@ EXPORTS
gst_static_pad_template_get_type gst_static_pad_template_get_type
gst_stream_error_get_type gst_stream_error_get_type
gst_stream_error_quark gst_stream_error_quark
gst_stream_status_type_get_type
gst_structure_change_type_get_type gst_structure_change_type_get_type
gst_structure_copy gst_structure_copy
gst_structure_empty_new gst_structure_empty_new