API: add some new utility functions:

Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstutils.c: (gst_pad_query_peer_position),
(gst_pad_query_peer_duration), (gst_pad_query_peer_convert):
* gst/gstutils.h:
API: add some new utility functions:
- gst_pad_query_peer_position
- gst_pad_query_peer_duration
- gst_pad_query_peer_convert
This commit is contained in:
Tim-Philipp Müller 2006-03-23 18:45:02 +00:00
parent ac8e65f3eb
commit 18132911b4
4 changed files with 121 additions and 0 deletions

View file

@ -1,3 +1,14 @@
2006-03-23 Tim-Philipp Müller <tim at centricular dot net>
* docs/gst/gstreamer-sections.txt:
* gst/gstutils.c: (gst_pad_query_peer_position),
(gst_pad_query_peer_duration), (gst_pad_query_peer_convert):
* gst/gstutils.h:
API: add some new utility functions:
- gst_pad_query_peer_position
- gst_pad_query_peer_duration
- gst_pad_query_peer_convert
2006-03-23 Wim Taymans <wim@fluendo.com>
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),

View file

@ -1224,6 +1224,9 @@ gst_pad_query_default
gst_pad_query_position
gst_pad_query_duration
gst_pad_query_convert
gst_pad_query_peer_position
gst_pad_query_peer_duration
gst_pad_query_peer_convert
gst_pad_set_query_function
GstPadQueryFunction
gst_pad_set_query_type_function

View file

@ -2531,6 +2531,37 @@ gst_pad_query_position (GstPad * pad, GstFormat * format, gint64 * cur)
return ret;
}
/**
* gst_pad_query_peer_position:
* @pad: a #GstPad on whose peer to invoke the position query on.
* Must be a sink pad.
* @format: a pointer to the #GstFormat asked for.
* On return contains the #GstFormat used.
* @cur: A location in which to store the current position, or NULL.
*
* Queries the peer of a given sink pad for the stream position.
*
* Returns: TRUE if the query could be performed.
*/
gboolean
gst_pad_query_peer_position (GstPad * pad, GstFormat * format, gint64 * cur)
{
gboolean ret = FALSE;
GstPad *peer;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (GST_PAD_IS_SINK (pad), FALSE);
g_return_val_if_fail (format != NULL, FALSE);
peer = gst_pad_get_peer (pad);
if (peer) {
ret = gst_pad_query_position (peer, format, cur);
gst_object_unref (peer);
}
return ret;
}
/**
* gst_pad_query_duration:
* @pad: a #GstPad to invoke the duration query on.
@ -2562,6 +2593,38 @@ gst_pad_query_duration (GstPad * pad, GstFormat * format, gint64 * duration)
return ret;
}
/**
* gst_pad_query_peer_duration:
* @pad: a #GstPad on whose peer pad to invoke the duration query on.
* Must be a sink pad.
* @format: a pointer to the #GstFormat asked for.
* On return contains the #GstFormat used.
* @duration: A location in which to store the total duration, or NULL.
*
* Queries the peer pad of a given sink pad for the total stream duration.
*
* Returns: TRUE if the query could be performed.
*/
gboolean
gst_pad_query_peer_duration (GstPad * pad, GstFormat * format,
gint64 * duration)
{
gboolean ret = FALSE;
GstPad *peer;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (GST_PAD_IS_SINK (pad), FALSE);
g_return_val_if_fail (format != NULL, FALSE);
peer = gst_pad_get_peer (pad);
if (peer) {
ret = gst_pad_query_duration (peer, format, duration);
gst_object_unref (peer);
}
return ret;
}
/**
* gst_pad_query_convert:
* @pad: a #GstPad to invoke the convert query on.
@ -2602,6 +2665,43 @@ gst_pad_query_convert (GstPad * pad, GstFormat src_format, gint64 src_val,
return ret;
}
/**
* gst_pad_query_peer_convert:
* @pad: a #GstPad, on whose peer pad to invoke the convert query on.
* Must be a sink pad.
* @src_format: a #GstFormat to convert from.
* @src_val: a value to convert.
* @dest_format: a pointer to the #GstFormat to convert to.
* @dest_val: a pointer to the result.
*
* Queries the peer pad of a given sink pad to convert @src_val in @src_format
* to @dest_format.
*
* Returns: TRUE if the query could be performed.
*/
gboolean
gst_pad_query_peer_convert (GstPad * pad, GstFormat src_format, gint64 src_val,
GstFormat * dest_format, gint64 * dest_val)
{
gboolean ret = FALSE;
GstPad *peer;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (GST_PAD_IS_SINK (pad), FALSE);
g_return_val_if_fail (src_val >= 0, FALSE);
g_return_val_if_fail (dest_format != NULL, FALSE);
g_return_val_if_fail (dest_val != NULL, FALSE);
peer = gst_pad_get_peer (pad);
if (peer) {
ret = gst_pad_query_convert (peer, src_format, src_val, dest_format,
dest_val);
gst_object_unref (peer);
}
return ret;
}
/**
* gst_atomic_int_set:
* @atomic_int: pointer to an atomic integer

View file

@ -567,6 +567,13 @@ gboolean gst_pad_query_duration (GstPad *pad, GstFormat
gboolean gst_pad_query_convert (GstPad *pad, GstFormat src_format, gint64 src_val,
GstFormat *dest_format, gint64 *dest_val);
gboolean gst_pad_query_peer_position (GstPad *pad, GstFormat *format,
gint64 *cur);
gboolean gst_pad_query_peer_duration (GstPad *pad, GstFormat *format,
gint64 *duration);
gboolean gst_pad_query_peer_convert (GstPad *pad, GstFormat src_format, gint64 src_val,
GstFormat *dest_format, gint64 *dest_val);
/* bin functions */
void gst_bin_add_many (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;
void gst_bin_remove_many (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;