mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
Reorder the message docs and headers for clarity.
Original commit message from CVS: * docs/gst/gstreamer-sections.txt: * gst/gstmessage.c: (gst_message_set_buffering_stats), (gst_message_parse_buffering_stats): * gst/gstmessage.h: * gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency), (gst_query_parse_latency), (gst_query_new_buffering), (gst_query_set_buffering_percent), (gst_query_parse_buffering_percent), (gst_query_set_buffering_stats), (gst_query_parse_buffering_stats), (gst_query_set_buffering_avail), (gst_query_parse_buffering_avail): * gst/gstquery.h: Reorder the message docs and headers for clarity. Add aditional buffering stats API for messages. Add buffering query. Convert some leftover queries to use GstQuark. API: gst_message_set_buffering_stats API: gst_message_parse_buffering_stats API: GST_QUERY_BUFFERING API: GstBufferingMode API: gst_query_new_buffering API: gst_query_set_buffering_percent API: gst_query_parse_buffering_percent API: gst_query_set_buffering_stats API: gst_query_parse_buffering_stats API: gst_query_set_buffering_avail API: gst_query_parse_buffering_avail
This commit is contained in:
parent
6215f509c8
commit
5e14412c47
6 changed files with 450 additions and 61 deletions
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
2008-04-08 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
* docs/gst/gstreamer-sections.txt:
|
||||
* gst/gstmessage.c: (gst_message_set_buffering_stats),
|
||||
(gst_message_parse_buffering_stats):
|
||||
* gst/gstmessage.h:
|
||||
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
|
||||
(gst_query_parse_latency), (gst_query_new_buffering),
|
||||
(gst_query_set_buffering_percent),
|
||||
(gst_query_parse_buffering_percent),
|
||||
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
|
||||
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
|
||||
* gst/gstquery.h:
|
||||
Reorder the message docs and headers for clarity.
|
||||
Add aditional buffering stats API for messages.
|
||||
Add buffering query.
|
||||
Convert some leftover queries to use GstQuark.
|
||||
API: gst_message_set_buffering_stats
|
||||
API: gst_message_parse_buffering_stats
|
||||
API: GST_QUERY_BUFFERING
|
||||
API: GstBufferingMode
|
||||
API: gst_query_new_buffering
|
||||
API: gst_query_set_buffering_percent
|
||||
API: gst_query_parse_buffering_percent
|
||||
API: gst_query_set_buffering_stats
|
||||
API: gst_query_parse_buffering_stats
|
||||
API: gst_query_set_buffering_avail
|
||||
API: gst_query_parse_buffering_avail
|
||||
|
||||
2008-04-08 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
* gst/gstmessage.c: (gst_message_new_error),
|
||||
|
|
|
@ -1014,44 +1014,47 @@ GST_MESSAGE_TYPE_NAME
|
|||
GST_MESSAGE_TRACE_NAME
|
||||
gst_message_type_to_quark
|
||||
gst_message_type_get_name
|
||||
gst_message_ref
|
||||
gst_message_unref
|
||||
gst_message_copy
|
||||
gst_message_get_structure
|
||||
gst_message_make_writable
|
||||
gst_message_new_application
|
||||
gst_message_new_clock_provide
|
||||
gst_message_new_clock_lost
|
||||
gst_message_new_custom
|
||||
gst_message_new_element
|
||||
|
||||
gst_message_new_eos
|
||||
gst_message_new_error
|
||||
gst_message_new_info
|
||||
gst_message_new_new_clock
|
||||
gst_message_new_segment_done
|
||||
gst_message_new_segment_start
|
||||
gst_message_new_state_changed
|
||||
gst_message_new_tag
|
||||
gst_message_new_buffering
|
||||
gst_message_new_warning
|
||||
gst_message_new_duration
|
||||
gst_message_new_state_dirty
|
||||
gst_message_new_async_start
|
||||
gst_message_new_async_done
|
||||
gst_message_new_latency
|
||||
gst_message_parse_clock_lost
|
||||
gst_message_parse_clock_provide
|
||||
gst_message_parse_error
|
||||
gst_message_parse_info
|
||||
gst_message_parse_new_clock
|
||||
gst_message_parse_segment_done
|
||||
gst_message_parse_segment_start
|
||||
gst_message_parse_state_changed
|
||||
gst_message_parse_tag
|
||||
gst_message_parse_buffering
|
||||
gst_message_new_warning
|
||||
gst_message_parse_warning
|
||||
gst_message_new_info
|
||||
gst_message_parse_info
|
||||
gst_message_new_tag
|
||||
gst_message_parse_tag
|
||||
gst_message_new_buffering
|
||||
gst_message_parse_buffering
|
||||
gst_message_set_buffering_stats
|
||||
gst_message_parse_buffering_stats
|
||||
gst_message_new_state_changed
|
||||
gst_message_parse_state_changed
|
||||
gst_message_new_state_dirty
|
||||
gst_message_new_clock_provide
|
||||
gst_message_parse_clock_provide
|
||||
gst_message_new_clock_lost
|
||||
gst_message_parse_clock_lost
|
||||
gst_message_new_new_clock
|
||||
gst_message_parse_new_clock
|
||||
gst_message_new_application
|
||||
gst_message_new_element
|
||||
gst_message_new_custom
|
||||
gst_message_new_segment_start
|
||||
gst_message_parse_segment_start
|
||||
gst_message_new_segment_done
|
||||
gst_message_parse_segment_done
|
||||
gst_message_new_duration
|
||||
gst_message_parse_duration
|
||||
gst_message_new_latency
|
||||
gst_message_new_async_start
|
||||
gst_message_parse_async_start
|
||||
gst_message_ref
|
||||
gst_message_unref
|
||||
gst_message_new_async_done
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GstMessageClass
|
||||
|
@ -1692,6 +1695,15 @@ gst_query_new_segment
|
|||
gst_query_set_segment
|
||||
gst_query_parse_segment
|
||||
|
||||
GstBufferingMode
|
||||
gst_query_new_buffering
|
||||
gst_query_set_buffering_percent
|
||||
gst_query_parse_buffering_percent
|
||||
gst_query_set_buffering_stats
|
||||
gst_query_parse_buffering_stats
|
||||
gst_query_set_buffering_avail
|
||||
gst_query_parse_buffering_avail
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GstQueryClass
|
||||
GST_QUERY
|
||||
|
@ -1702,9 +1714,11 @@ GST_TYPE_QUERY
|
|||
GST_TYPE_QUERY_TYPE
|
||||
GST_QUERY_GET_CLASS
|
||||
GST_QUERY_TYPE
|
||||
GST_TYPE_BUFFERING_MODE
|
||||
<SUBSECTION Private>
|
||||
gst_query_get_type
|
||||
gst_query_type_get_type
|
||||
gst_buffering_mode_get_type
|
||||
</SECTION>
|
||||
|
||||
|
||||
|
|
|
@ -894,6 +894,65 @@ gst_message_parse_buffering (GstMessage * message, gint * percent)
|
|||
GST_QUARK (BUFFER_PERCENT)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_set_buffering_stats:
|
||||
* @message: A valid #GstMessage of type GST_MESSAGE_BUFFERING.
|
||||
* @mode: a buffering mode
|
||||
* @avg_in: the average input rate
|
||||
* @avg_out: the average output rate
|
||||
* @buffering_left: amount of buffering time left in milliseconds
|
||||
*
|
||||
* Configures the buffering stats values in @message.
|
||||
*
|
||||
* Since: 0.10.20
|
||||
*/
|
||||
void
|
||||
gst_message_set_buffering_stats (GstMessage * message, GstBufferingMode mode,
|
||||
gint avg_in, gint avg_out, gint64 buffering_left)
|
||||
{
|
||||
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING);
|
||||
|
||||
gst_structure_id_set (message->structure,
|
||||
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode,
|
||||
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in,
|
||||
GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out,
|
||||
GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_parse_buffering_stats:
|
||||
* @message: A valid #GstMessage of type GST_MESSAGE_BUFFERING.
|
||||
* @mode: a buffering mode
|
||||
* @avg_in: the average input rate
|
||||
* @avg_out: the average output rate
|
||||
* @buffering_left: amount of buffering time left in milliseconds.
|
||||
*
|
||||
* Extracts the buffering stats values from @message.
|
||||
*
|
||||
* Since: 0.10.20
|
||||
*/
|
||||
void
|
||||
gst_message_parse_buffering_stats (GstMessage * message,
|
||||
GstBufferingMode * mode, gint * avg_in, gint * avg_out,
|
||||
gint64 * buffering_left)
|
||||
{
|
||||
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING);
|
||||
|
||||
if (mode)
|
||||
*mode = g_value_get_enum (gst_structure_id_get_value (message->structure,
|
||||
GST_QUARK (BUFFERING_MODE)));
|
||||
if (avg_in)
|
||||
*avg_in = g_value_get_int (gst_structure_id_get_value (message->structure,
|
||||
GST_QUARK (AVG_IN_RATE)));
|
||||
if (avg_out)
|
||||
*avg_out = g_value_get_int (gst_structure_id_get_value (message->structure,
|
||||
GST_QUARK (AVG_OUT_RATE)));
|
||||
if (buffering_left)
|
||||
*buffering_left =
|
||||
g_value_get_int64 (gst_structure_id_get_value (message->structure,
|
||||
GST_QUARK (BUFFERING_LEFT)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_parse_state_changed:
|
||||
* @message: a valid #GstMessage of type GST_MESSAGE_STATE_CHANGED
|
||||
|
|
|
@ -270,45 +270,93 @@ gst_message_ref (GstMessage * msg)
|
|||
*/
|
||||
#define gst_message_make_writable(msg) GST_MESSAGE (gst_mini_object_make_writable (GST_MINI_OBJECT (msg)))
|
||||
|
||||
/* EOS */
|
||||
GstMessage * gst_message_new_eos (GstObject * src);
|
||||
|
||||
/* ERROR */
|
||||
|
||||
GstMessage * gst_message_new_error (GstObject * src, GError * error, gchar * debug);
|
||||
void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug);
|
||||
|
||||
/* WARNING */
|
||||
GstMessage * gst_message_new_warning (GstObject * src, GError * error, gchar * debug);
|
||||
void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug);
|
||||
|
||||
/* INFO */
|
||||
GstMessage * gst_message_new_info (GstObject * src, GError * error, gchar * debug);
|
||||
void gst_message_parse_info (GstMessage *message, GError **gerror, gchar **debug);
|
||||
|
||||
/* TAG */
|
||||
GstMessage * gst_message_new_tag (GstObject * src, GstTagList * tag_list);
|
||||
void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list);
|
||||
|
||||
/* BUFFERING */
|
||||
GstMessage * gst_message_new_buffering (GstObject * src, gint percent);
|
||||
void gst_message_parse_buffering (GstMessage *message, gint *percent);
|
||||
void gst_message_set_buffering_stats (GstMessage *message, GstBufferingMode mode,
|
||||
gint avg_in, gint avg_out,
|
||||
gint64 buffering_left);
|
||||
void gst_message_parse_buffering_stats (GstMessage *message, GstBufferingMode *mode,
|
||||
gint *avg_in, gint *avg_out,
|
||||
gint64 *buffering_left);
|
||||
|
||||
/* STATE_CHANGED */
|
||||
GstMessage * gst_message_new_state_changed (GstObject * src, GstState oldstate,
|
||||
GstState newstate, GstState pending);
|
||||
void gst_message_parse_state_changed (GstMessage *message, GstState *oldstate,
|
||||
GstState *newstate, GstState *pending);
|
||||
|
||||
/* STATE_DIRTY */
|
||||
GstMessage * gst_message_new_state_dirty (GstObject * src);
|
||||
|
||||
/* CLOCK_PROVIDE */
|
||||
GstMessage * gst_message_new_clock_provide (GstObject * src, GstClock *clock, gboolean ready);
|
||||
void gst_message_parse_clock_provide (GstMessage *message, GstClock **clock,
|
||||
gboolean *ready);
|
||||
|
||||
/* CLOCK_LOST */
|
||||
GstMessage * gst_message_new_clock_lost (GstObject * src, GstClock *clock);
|
||||
void gst_message_parse_clock_lost (GstMessage *message, GstClock **clock);
|
||||
|
||||
/* NEW_CLOCK */
|
||||
GstMessage * gst_message_new_new_clock (GstObject * src, GstClock *clock);
|
||||
void gst_message_parse_new_clock (GstMessage *message, GstClock **clock);
|
||||
|
||||
/* APPLICATION */
|
||||
GstMessage * gst_message_new_application (GstObject * src, GstStructure * structure);
|
||||
|
||||
/* ELEMENT */
|
||||
GstMessage * gst_message_new_element (GstObject * src, GstStructure * structure);
|
||||
|
||||
/* SEGMENT_START */
|
||||
GstMessage * gst_message_new_segment_start (GstObject * src, GstFormat format, gint64 position);
|
||||
void gst_message_parse_segment_start (GstMessage *message, GstFormat *format,
|
||||
gint64 *position);
|
||||
|
||||
/* SEGMENT_DONE */
|
||||
GstMessage * gst_message_new_segment_done (GstObject * src, GstFormat format, gint64 position);
|
||||
void gst_message_parse_segment_done (GstMessage *message, GstFormat *format,
|
||||
gint64 *position);
|
||||
|
||||
/* DURATION */
|
||||
GstMessage * gst_message_new_duration (GstObject * src, GstFormat format, gint64 duration);
|
||||
GstMessage * gst_message_new_async_start (GstObject * src, gboolean new_base_time);
|
||||
GstMessage * gst_message_new_async_done (GstObject * src);
|
||||
void gst_message_parse_duration (GstMessage *message, GstFormat *format,
|
||||
gint64 *duration);
|
||||
|
||||
/* LATENCY */
|
||||
GstMessage * gst_message_new_latency (GstObject * src);
|
||||
|
||||
/* ASYNC_START */
|
||||
GstMessage * gst_message_new_async_start (GstObject * src, gboolean new_base_time);
|
||||
void gst_message_parse_async_start (GstMessage *message, gboolean *new_base_time);
|
||||
|
||||
/* ASYNC_DONE */
|
||||
GstMessage * gst_message_new_async_done (GstObject * src);
|
||||
|
||||
/* custom messages */
|
||||
GstMessage * gst_message_new_custom (GstMessageType type,
|
||||
GstObject * src,
|
||||
GstStructure * structure);
|
||||
|
||||
void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug);
|
||||
void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug);
|
||||
void gst_message_parse_info (GstMessage *message, GError **gerror, gchar **debug);
|
||||
void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list);
|
||||
void gst_message_parse_buffering (GstMessage *message, gint *percent);
|
||||
void gst_message_parse_state_changed (GstMessage *message, GstState *oldstate,
|
||||
GstState *newstate, GstState *pending);
|
||||
void gst_message_parse_clock_provide (GstMessage *message, GstClock **clock, gboolean *ready);
|
||||
void gst_message_parse_clock_lost (GstMessage *message, GstClock **clock);
|
||||
void gst_message_parse_new_clock (GstMessage *message, GstClock **clock);
|
||||
void gst_message_parse_segment_start (GstMessage *message, GstFormat *format, gint64 *position);
|
||||
void gst_message_parse_segment_done (GstMessage *message, GstFormat *format, gint64 *position);
|
||||
void gst_message_parse_duration (GstMessage *message, GstFormat *format, gint64 *duration);
|
||||
void gst_message_parse_async_start (GstMessage *message, gboolean *new_base_time);
|
||||
|
||||
const GstStructure * gst_message_get_structure (GstMessage *message);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
227
gst/gstquery.c
227
gst/gstquery.c
|
@ -91,6 +91,7 @@ static GstQueryTypeDefinition standard_definitions[] = {
|
|||
{GST_QUERY_SEGMENT, "segment", "currently configured segment", 0},
|
||||
{GST_QUERY_CONVERT, "convert", "Converting between formats", 0},
|
||||
{GST_QUERY_FORMATS, "formats", "Supported formats for conversion", 0},
|
||||
{GST_QUERY_BUFFERING, "buffering", "Buffering status", 0},
|
||||
{0, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
|
@ -554,10 +555,10 @@ gst_query_new_latency (void)
|
|||
GstStructure *structure;
|
||||
|
||||
structure = gst_structure_empty_new ("GstQueryLatency");
|
||||
gst_structure_set (structure,
|
||||
"live", G_TYPE_BOOLEAN, FALSE,
|
||||
"min-latency", G_TYPE_UINT64, (gint64) 0,
|
||||
"max-latency", G_TYPE_UINT64, (gint64) - 1, NULL);
|
||||
gst_structure_id_set (structure,
|
||||
GST_QUARK (LIVE), G_TYPE_BOOLEAN, FALSE,
|
||||
GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, (gint64) 0,
|
||||
GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, (gint64) - 1, NULL);
|
||||
|
||||
query = gst_query_new (GST_QUERY_LATENCY, structure);
|
||||
|
||||
|
@ -584,10 +585,10 @@ gst_query_set_latency (GstQuery * query, gboolean live,
|
|||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY);
|
||||
|
||||
structure = gst_query_get_structure (query);
|
||||
gst_structure_set (structure,
|
||||
"live", G_TYPE_BOOLEAN, live,
|
||||
"min-latency", G_TYPE_UINT64, min_latency,
|
||||
"max-latency", G_TYPE_UINT64, max_latency, NULL);
|
||||
gst_structure_id_set (structure,
|
||||
GST_QUARK (LIVE), G_TYPE_BOOLEAN, live,
|
||||
GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, min_latency,
|
||||
GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, max_latency, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -611,13 +612,15 @@ gst_query_parse_latency (GstQuery * query, gboolean * live,
|
|||
|
||||
structure = gst_query_get_structure (query);
|
||||
if (live)
|
||||
*live = g_value_get_boolean (gst_structure_get_value (structure, "live"));
|
||||
*live =
|
||||
g_value_get_boolean (gst_structure_id_get_value (structure,
|
||||
GST_QUARK (LIVE)));
|
||||
if (min_latency)
|
||||
*min_latency = g_value_get_uint64 (gst_structure_get_value (structure,
|
||||
"min-latency"));
|
||||
*min_latency = g_value_get_uint64 (gst_structure_id_get_value (structure,
|
||||
GST_QUARK (MIN_LATENCY)));
|
||||
if (max_latency)
|
||||
*max_latency = g_value_get_uint64 (gst_structure_get_value (structure,
|
||||
"max-latency"));
|
||||
*max_latency = g_value_get_uint64 (gst_structure_id_get_value (structure,
|
||||
GST_QUARK (MAX_LATENCY)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1096,3 +1099,201 @@ gst_query_parse_formats_nth (GstQuery * query, guint nth, GstFormat * format)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_new_buffering
|
||||
* @format: the default #GstFormat for the new query
|
||||
*
|
||||
* Constructs a new query object for querying the buffering status of
|
||||
* a stream.
|
||||
*
|
||||
* Returns: A #GstQuery
|
||||
*
|
||||
* Since: 0.10.20
|
||||
*/
|
||||
GstQuery *
|
||||
gst_query_new_buffering (GstFormat format)
|
||||
{
|
||||
GstQuery *query;
|
||||
GstStructure *structure;
|
||||
|
||||
structure = gst_structure_empty_new ("GstQueryBuffering");
|
||||
gst_structure_id_set (structure,
|
||||
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, -1,
|
||||
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM,
|
||||
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, -1,
|
||||
GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, -1,
|
||||
GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, -1,
|
||||
GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, -1,
|
||||
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
||||
GST_QUARK (START_VALUE), G_TYPE_INT64, (gint64) - 1,
|
||||
GST_QUARK (STOP_VALUE), G_TYPE_INT64, (gint64) - 1, NULL);
|
||||
|
||||
query = gst_query_new (GST_QUERY_BUFFERING, structure);
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_set_buffering_percent
|
||||
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
|
||||
* @percent: a buffering percent
|
||||
*
|
||||
* Set the percentage of buffered data. This is a value between 0 and 100.
|
||||
*
|
||||
* Since: 0.10.20
|
||||
*/
|
||||
void
|
||||
gst_query_set_buffering_percent (GstQuery * query, gint percent)
|
||||
{
|
||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
||||
g_return_if_fail (percent >= 0 && percent <= 100);
|
||||
|
||||
gst_structure_id_set (query->structure,
|
||||
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_parse_buffering_percent
|
||||
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
|
||||
* @percent: a buffering percent
|
||||
*
|
||||
* Get the percentage of buffered data. This is a value between 0 and 100.
|
||||
*
|
||||
* Since: 0.10.20
|
||||
*/
|
||||
void
|
||||
gst_query_parse_buffering_percent (GstQuery * query, gint * percent)
|
||||
{
|
||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
||||
|
||||
if (percent)
|
||||
*percent = g_value_get_int (gst_structure_id_get_value (query->structure,
|
||||
GST_QUARK (BUFFER_PERCENT)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_set_buffering_stats:
|
||||
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
|
||||
* @mode: a buffering mode
|
||||
* @avg_in: the average input rate
|
||||
* @avg_out: the average output rate
|
||||
* @buffering_left: amount of buffering time left
|
||||
*
|
||||
* Configures the buffering stats values in @query.
|
||||
*
|
||||
* Since: 0.10.20
|
||||
*/
|
||||
void
|
||||
gst_query_set_buffering_stats (GstQuery * query, GstBufferingMode mode,
|
||||
gint avg_in, gint avg_out, gint64 buffering_left)
|
||||
{
|
||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
||||
|
||||
gst_structure_id_set (query->structure,
|
||||
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode,
|
||||
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in,
|
||||
GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out,
|
||||
GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_parse_buffering_stats:
|
||||
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
|
||||
* @mode: a buffering mode
|
||||
* @avg_in: the average input rate
|
||||
* @avg_out: the average output rate
|
||||
* @buffering_left: amount of buffering time left
|
||||
*
|
||||
* Extracts the buffering stats values from @query.
|
||||
*
|
||||
* Since: 0.10.20
|
||||
*/
|
||||
void
|
||||
gst_query_parse_buffering_stats (GstQuery * query,
|
||||
GstBufferingMode * mode, gint * avg_in, gint * avg_out,
|
||||
gint64 * buffering_left)
|
||||
{
|
||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
||||
|
||||
if (mode)
|
||||
*mode = g_value_get_enum (gst_structure_id_get_value (query->structure,
|
||||
GST_QUARK (BUFFERING_MODE)));
|
||||
if (avg_in)
|
||||
*avg_in = g_value_get_int (gst_structure_id_get_value (query->structure,
|
||||
GST_QUARK (AVG_IN_RATE)));
|
||||
if (avg_out)
|
||||
*avg_out = g_value_get_int (gst_structure_id_get_value (query->structure,
|
||||
GST_QUARK (AVG_OUT_RATE)));
|
||||
if (buffering_left)
|
||||
*buffering_left =
|
||||
g_value_get_int64 (gst_structure_id_get_value (query->structure,
|
||||
GST_QUARK (BUFFERING_LEFT)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gst_query_set_buffering_avail:
|
||||
* @query: a #GstQuery
|
||||
* @format: the format to set for the @start and @stop values
|
||||
* @start: the start to set
|
||||
* @stop: the stop to set
|
||||
* @estimated_total: estimated total amount of download time
|
||||
*
|
||||
* Set the available query result fields in @query.
|
||||
*
|
||||
* Since: 0.10.20
|
||||
*/
|
||||
void
|
||||
gst_query_set_buffering_avail (GstQuery * query, GstFormat format,
|
||||
gint64 start, gint64 stop, gint64 estimated_total)
|
||||
{
|
||||
GstStructure *structure;
|
||||
|
||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
||||
|
||||
structure = gst_query_get_structure (query);
|
||||
gst_structure_id_set (structure,
|
||||
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
||||
GST_QUARK (START_VALUE), G_TYPE_INT64, start,
|
||||
GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop,
|
||||
GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, estimated_total, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_parse_buffering_avail:
|
||||
* @query: a GST_QUERY_SEEKING type query #GstQuery
|
||||
* @format: the format to set for the @segment_start and @segment_end values
|
||||
* @start: the start to set
|
||||
* @stop: the stop to set
|
||||
* @estimated_total: estimated total amount of download time
|
||||
*
|
||||
* Parse an available query, writing the format into @format, and
|
||||
* other results into the passed parameters, if the respective parameters
|
||||
* are non-NULL
|
||||
*
|
||||
* Since: 0.10.20
|
||||
*/
|
||||
void
|
||||
gst_query_parse_buffering_avail (GstQuery * query, GstFormat * format,
|
||||
gint64 * start, gint64 * stop, gint64 * estimated_total)
|
||||
{
|
||||
GstStructure *structure;
|
||||
|
||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
||||
|
||||
structure = gst_query_get_structure (query);
|
||||
if (format)
|
||||
*format = g_value_get_enum (gst_structure_id_get_value (structure,
|
||||
GST_QUARK (FORMAT)));
|
||||
if (start)
|
||||
*start = g_value_get_int64 (gst_structure_id_get_value (structure,
|
||||
GST_QUARK (START_VALUE)));
|
||||
if (stop)
|
||||
*stop = g_value_get_int64 (gst_structure_id_get_value (structure,
|
||||
GST_QUARK (STOP_VALUE)));
|
||||
if (estimated_total)
|
||||
*estimated_total =
|
||||
g_value_get_int64 (gst_structure_id_get_value (structure,
|
||||
GST_QUARK (ESTIMATED_TOTAL)));
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ G_BEGIN_DECLS
|
|||
* @GST_QUERY_SEGMENT: segment start/stop positions
|
||||
* @GST_QUERY_CONVERT: convert values between formats
|
||||
* @GST_QUERY_FORMATS: query supported formats for convert
|
||||
* @GST_QUERY_BUFFERING: query available media for efficient seeking. Since
|
||||
* 0.10.20.
|
||||
*
|
||||
* Standard predefined Query types
|
||||
*/
|
||||
|
@ -61,9 +63,26 @@ typedef enum {
|
|||
GST_QUERY_SEEKING,
|
||||
GST_QUERY_SEGMENT,
|
||||
GST_QUERY_CONVERT,
|
||||
GST_QUERY_FORMATS
|
||||
GST_QUERY_FORMATS,
|
||||
GST_QUERY_BUFFERING
|
||||
} GstQueryType;
|
||||
|
||||
/**
|
||||
* GstBufferingMode:
|
||||
* @GST_BUFFERING_STREAM: a small amount of data is buffered
|
||||
* @GST_BUFFERING_DOWNLOAD: the stream is being downloaded
|
||||
* @GST_BUFFERING_TIMESHIFT: the stream is being downloaded in a ringbuffer
|
||||
* @GST_BUFFERING_LIVE: the stream is a live stream
|
||||
*
|
||||
* The different types of buffering methods.
|
||||
*/
|
||||
typedef enum {
|
||||
GST_BUFFERING_STREAM,
|
||||
GST_BUFFERING_DOWNLOAD,
|
||||
GST_BUFFERING_TIMESHIFT,
|
||||
GST_BUFFERING_LIVE
|
||||
} GstBufferingMode;
|
||||
|
||||
typedef struct _GstQueryTypeDefinition GstQueryTypeDefinition;
|
||||
typedef struct _GstQuery GstQuery;
|
||||
typedef struct _GstQueryClass GstQueryClass;
|
||||
|
@ -245,6 +264,25 @@ void gst_query_set_formatsv (GstQuery *query, gint n_formats
|
|||
void gst_query_parse_formats_length (GstQuery *query, guint *n_formats);
|
||||
void gst_query_parse_formats_nth (GstQuery *query, guint nth, GstFormat *format);
|
||||
|
||||
/* buffering query */
|
||||
GstQuery* gst_query_new_buffering (GstFormat format);
|
||||
void gst_query_set_buffering_percent (GstQuery *query, gint percent);
|
||||
void gst_query_parse_buffering_percent (GstQuery *query, gint *percent);
|
||||
|
||||
void gst_query_set_buffering_stats (GstQuery *query, GstBufferingMode mode,
|
||||
gint avg_in, gint avg_out,
|
||||
gint64 buffering_left);
|
||||
void gst_query_parse_buffering_stats (GstQuery *query, GstBufferingMode *mode,
|
||||
gint *avg_in, gint *avg_out,
|
||||
gint64 *buffering_left);
|
||||
|
||||
void gst_query_set_buffering_avail (GstQuery *query, GstFormat format,
|
||||
gint64 start, gint64 stop,
|
||||
gint64 extimated_total);
|
||||
void gst_query_parse_buffering_avail (GstQuery *query, GstFormat *format,
|
||||
gint64 *start, gint64 *stop,
|
||||
gint64 *estimated_total);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_QUERY_H__ */
|
||||
|
|
Loading…
Reference in a new issue