Commit bb651921 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

ext,gst: update for query API changes

parent 3d25fe33
......@@ -2935,7 +2935,6 @@ gst_ogg_demux_find_chains (GstOggDemux * ogg)
{
ogg_page og;
GstPad *peer;
GstFormat format;
gboolean res;
gulong serialno;
GstOggChain *chain;
......@@ -2946,8 +2945,7 @@ gst_ogg_demux_find_chains (GstOggDemux * ogg)
goto no_peer;
/* find length to read last page, we store this for later use. */
format = GST_FORMAT_BYTES;
res = gst_pad_query_duration (peer, &format, &ogg->length);
res = gst_pad_query_duration (peer, GST_FORMAT_BYTES, &ogg->length);
gst_object_unref (peer);
if (!res || ogg->length <= 0)
goto no_length;
......
......@@ -304,7 +304,7 @@ gst_vorbis_enc_sink_setcaps (GstVorbisEnc * vorbisenc, GstCaps * caps)
static gboolean
gst_vorbis_enc_convert_src (GstPad * pad, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
gint64 src_value, GstFormat dest_format, gint64 * dest_value)
{
gboolean res = TRUE;
GstVorbisEnc *vorbisenc;
......@@ -322,7 +322,7 @@ gst_vorbis_enc_convert_src (GstPad * pad, GstFormat src_format,
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
switch (dest_format) {
case GST_FORMAT_TIME:
*dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND, avg);
break;
......@@ -331,7 +331,7 @@ gst_vorbis_enc_convert_src (GstPad * pad, GstFormat src_format,
}
break;
case GST_FORMAT_TIME:
switch (*dest_format) {
switch (dest_format) {
case GST_FORMAT_BYTES:
*dest_value = gst_util_uint64_scale_int (src_value, avg, GST_SECOND);
break;
......@@ -448,45 +448,47 @@ gst_vorbis_enc_src_query (GstPad * pad, GstQuery * query)
GstPad *peerpad;
vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
peerpad = gst_pad_get_peer (GST_PAD (vorbisenc->sinkpad));
peerpad = gst_pad_get_peer (vorbisenc->sinkpad);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
{
GstFormat fmt, req_fmt;
GstFormat req_fmt;
gint64 pos, val;
gst_query_parse_position (query, &req_fmt, NULL);
if ((res = gst_pad_query_position (peerpad, &req_fmt, &val))) {
if ((res = gst_pad_query_position (peerpad, req_fmt, &val))) {
gst_query_set_position (query, req_fmt, val);
break;
}
fmt = GST_FORMAT_TIME;
if (!(res = gst_pad_query_position (peerpad, &fmt, &pos)))
if (!(res = gst_pad_query_position (peerpad, GST_FORMAT_TIME, &pos)))
break;
if ((res = gst_pad_query_convert (peerpad, fmt, pos, &req_fmt, &val))) {
if ((res =
gst_pad_query_convert (peerpad, GST_FORMAT_TIME, pos, req_fmt,
&val))) {
gst_query_set_position (query, req_fmt, val);
}
break;
}
case GST_QUERY_DURATION:
{
GstFormat fmt, req_fmt;
GstFormat req_fmt;
gint64 dur, val;
gst_query_parse_duration (query, &req_fmt, NULL);
if ((res = gst_pad_query_duration (peerpad, &req_fmt, &val))) {
if ((res = gst_pad_query_duration (peerpad, req_fmt, &val))) {
gst_query_set_duration (query, req_fmt, val);
break;
}
fmt = GST_FORMAT_TIME;
if (!(res = gst_pad_query_duration (peerpad, &fmt, &dur)))
if (!(res = gst_pad_query_duration (peerpad, GST_FORMAT_TIME, &dur)))
break;
if ((res = gst_pad_query_convert (peerpad, fmt, dur, &req_fmt, &val))) {
if ((res =
gst_pad_query_convert (peerpad, GST_FORMAT_TIME, dur, req_fmt,
&val))) {
gst_query_set_duration (query, req_fmt, val);
}
break;
......@@ -498,7 +500,7 @@ gst_vorbis_enc_src_query (GstPad * pad, GstQuery * query)
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
if (!(res =
gst_vorbis_enc_convert_src (pad, src_fmt, src_val, &dest_fmt,
gst_vorbis_enc_convert_src (pad, src_fmt, src_val, dest_fmt,
&dest_val)))
goto error;
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
......
......@@ -406,7 +406,7 @@ gst_adder_query_duration (GstAdder * adder, GstQuery * query)
gint64 duration;
/* ask sink peer for duration */
res &= gst_pad_query_peer_duration (pad, &format, &duration);
res &= gst_pad_query_peer_duration (pad, format, &duration);
/* take max from all valid return values */
if (res) {
/* valid unknown length, stop searching */
......
......@@ -2032,10 +2032,8 @@ check_upstream_seekable (GstDecodeBin * dbin, GstPad * pad)
/* try harder to query upstream size if we didn't get it the first time */
if (dbin->upstream_seekable && stop == -1) {
GstFormat fmt = GST_FORMAT_BYTES;
GST_DEBUG_OBJECT (dbin, "doing duration query to fix up unset stop");
gst_pad_query_peer_duration (pad, &fmt, &stop);
gst_pad_query_peer_duration (pad, GST_FORMAT_BYTES, &stop);
}
/* if upstream doesn't know the size, it's likely that it's not seekable in
......
......@@ -1740,11 +1740,11 @@ type_found (GstElement * typefind, guint probability,
decoder->is_download = IS_DOWNLOAD_MEDIA (media_type) && decoder->download;
/* only enable download buffering if the upstream duration is known */
if (decoder->is_download) {
GstFormat fmt = GST_FORMAT_BYTES;
gint64 dur;
decoder->is_download = (gst_element_query_duration (typefind, &fmt, &dur)
&& fmt == GST_FORMAT_BYTES && dur != -1);
decoder->is_download =
(gst_element_query_duration (typefind, GST_FORMAT_BYTES, &dur)
&& dur != -1);
}
dec_elem = make_decoder (decoder);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment