diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2006-06-11 18:20:39 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2006-06-11 18:20:39 +0000 |
commit | 1a79337544f22d66a4de436ffd17a767cd45b73b (patch) | |
tree | 4bea1dd57f1441593acc087ac439846f5c49accb /gst/id3demux/gstid3demux.c | |
parent | 5a027ffd66994bc4f7c9b5103af3ed0c60f7503b (diff) |
gst/: Use gst_pad_query_peer_duration() utility function here.
Original commit message from CVS:
* gst/apetag/gsttagdemux.c: (gst_tag_demux_get_upstream_size):
* gst/id3demux/gstid3demux.c: (id3demux_get_upstream_size):
Use gst_pad_query_peer_duration() utility function here.
Diffstat (limited to 'gst/id3demux/gstid3demux.c')
-rw-r--r-- | gst/id3demux/gstid3demux.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/gst/id3demux/gstid3demux.c b/gst/id3demux/gstid3demux.c index 40fdf657..e03a1939 100644 --- a/gst/id3demux/gstid3demux.c +++ b/gst/id3demux/gstid3demux.c @@ -600,37 +600,21 @@ gst_id3demux_get_property (GObject * object, guint prop_id, static gboolean id3demux_get_upstream_size (GstID3Demux * id3demux) { - GstQuery *query; - GstPad *peer = NULL; GstFormat format; gint64 result; - gboolean res = FALSE; /* Short-cut if we already queried upstream */ if (id3demux->upstream_size > 0) return TRUE; - if ((peer = gst_pad_get_peer (id3demux->sinkpad)) == NULL) + format = GST_FORMAT_BYTES; + if (!gst_pad_query_peer_duration (id3demux->sinkpad, &format, &result) || + result < 0) { return FALSE; - - query = gst_query_new_duration (GST_FORMAT_BYTES); - gst_query_set_duration (query, GST_FORMAT_BYTES, -1); - - if (!gst_pad_query (peer, query)) - goto out; - - gst_query_parse_duration (query, &format, &result); - gst_query_unref (query); - - if (format != GST_FORMAT_BYTES || result == -1) - goto out; + } id3demux->upstream_size = result; - res = TRUE; - -out: - gst_object_unref (peer); - return res; + return TRUE; } static gboolean |