gst-libs: update for query API changes

This commit is contained in:
Tim-Philipp Müller 2011-07-27 01:16:08 +01:00
parent d013481d8e
commit 3d25fe33ea
3 changed files with 15 additions and 21 deletions

View file

@ -1080,22 +1080,20 @@ static void
gst_cdda_base_src_update_duration (GstCddaBaseSrc * src)
{
GstBaseSrc *basesrc;
GstFormat format;
gint64 duration;
gint64 dur;
basesrc = GST_BASE_SRC (src);
format = GST_FORMAT_TIME;
if (!gst_pad_query_duration (GST_BASE_SRC_PAD (src), &format, &duration)) {
duration = GST_CLOCK_TIME_NONE;
if (!gst_pad_query_duration (GST_BASE_SRC_PAD (src), GST_FORMAT_TIME, &dur)) {
dur = GST_CLOCK_TIME_NONE;
}
basesrc->segment.duration = duration;
basesrc->segment.duration = dur;
gst_element_post_message (GST_ELEMENT (src),
gst_message_new_duration (GST_OBJECT (src), GST_FORMAT_TIME, -1));
GST_LOG_OBJECT (src, "duration updated to %" GST_TIME_FORMAT,
GST_TIME_ARGS (duration));
GST_TIME_ARGS (dur));
}
#define CD_MSF_OFFSET 150
@ -1557,7 +1555,6 @@ gst_cdda_base_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer)
GstCddaBaseSrcClass *klass = GST_CDDA_BASE_SRC_GET_CLASS (pushsrc);
GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (pushsrc);
GstBuffer *buf;
GstFormat format;
gboolean eos;
GstClockTime position = GST_CLOCK_TIME_NONE;
@ -1611,14 +1608,15 @@ gst_cdda_base_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer)
return GST_FLOW_ERROR;
}
format = GST_FORMAT_TIME;
if (gst_pad_query_position (GST_BASE_SRC_PAD (src), &format, &qry_position)) {
if (gst_pad_query_position (GST_BASE_SRC_PAD (src), GST_FORMAT_TIME,
&qry_position)) {
gint64 next_ts = 0;
position = (GstClockTime) qry_position;
++src->cur_sector;
if (gst_pad_query_position (GST_BASE_SRC_PAD (src), &format, &next_ts)) {
if (gst_pad_query_position (GST_BASE_SRC_PAD (src), GST_FORMAT_TIME,
&next_ts)) {
duration = (GstClockTime) (next_ts - qry_position);
}
--src->cur_sector;

View file

@ -937,20 +937,18 @@ discoverer_collect (GstDiscoverer * dc)
/* FIXME : Make this querying optional */
if (TRUE) {
GstElement *pipeline = (GstElement *) dc->priv->pipeline;
GstFormat format = GST_FORMAT_TIME;
gint64 dur;
GST_DEBUG ("Attempting to query duration");
if (gst_element_query_duration (pipeline, &format, &dur)) {
if (format == GST_FORMAT_TIME) {
GST_DEBUG ("Got duration %" GST_TIME_FORMAT, GST_TIME_ARGS (dur));
dc->priv->current_info->duration = (guint64) dur;
}
if (gst_element_query_duration (pipeline, GST_FORMAT_TIME, &dur)) {
GST_DEBUG ("Got duration %" GST_TIME_FORMAT, GST_TIME_ARGS (dur));
dc->priv->current_info->duration = (guint64) dur;
}
if (dc->priv->seeking_query) {
if (gst_element_query (pipeline, dc->priv->seeking_query)) {
GstFormat format;
gboolean seekable;
gst_query_parse_seeking (dc->priv->seeking_query, &format,

View file

@ -769,16 +769,14 @@ gst_tag_demux_sink_event (GstPad * pad, GstEvent * event)
static gboolean
gst_tag_demux_get_upstream_size (GstTagDemux * tagdemux)
{
GstFormat format;
gint64 len;
/* Short-cut if we already queried upstream */
if (tagdemux->priv->upstream_size > 0)
return TRUE;
format = GST_FORMAT_BYTES;
if (!gst_pad_query_peer_duration (tagdemux->priv->sinkpad, &format, &len) ||
len <= 0) {
if (!gst_pad_query_peer_duration (tagdemux->priv->sinkpad, GST_FORMAT_BYTES,
&len) || len <= 0) {
return FALSE;
}