diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2005-10-19 15:58:01 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2005-10-19 15:58:01 +0000 |
commit | f7d63a74e07e66b6871a6ae09b6de58ff625dbc6 (patch) | |
tree | 5c3875f1f5ff6a369707d94cecf025b1a5c3e188 /gst/speed | |
parent | 8d8b51648af85d0633cf76cc16c36f9682fcf99f (diff) | |
download | gst-plugins-bad-f7d63a74e07e66b6871a6ae09b6de58ff625dbc6.tar.gz gst-plugins-bad-f7d63a74e07e66b6871a6ae09b6de58ff625dbc6.tar.bz2 gst-plugins-bad-f7d63a74e07e66b6871a6ae09b6de58ff625dbc6.zip |
gst/: API change fix.
Original commit message from CVS:
* gst/qtdemux/qtdemux.c: (gst_qtdemux_get_src_query_types),
(gst_qtdemux_handle_src_query):
* gst/speed/gstspeed.c: (speed_get_query_types), (speed_src_query):
* gst/tta/gstttaparse.c: (gst_tta_parse_src_event),
(gst_tta_parse_get_query_types), (gst_tta_parse_query):
API change fix.
Diffstat (limited to 'gst/speed')
-rw-r--r-- | gst/speed/gstspeed.c | 71 |
1 files changed, 54 insertions, 17 deletions
diff --git a/gst/speed/gstspeed.c b/gst/speed/gstspeed.c index 9e69180a..850ebc81 100644 --- a/gst/speed/gstspeed.c +++ b/gst/speed/gstspeed.c @@ -182,6 +182,7 @@ speed_get_query_types (GstPad * pad) { static const GstQueryType src_query_types[] = { GST_QUERY_POSITION, + GST_QUERY_DURATION, 0 }; @@ -334,64 +335,100 @@ speed_src_query (GstPad * pad, GstQuery * query) { GstFormat format; GstFormat rformat = GST_FORMAT_TIME; - gint64 cur, end; + gint64 cur; GstPad *peer; GstFormat conv_format = GST_FORMAT_TIME; /* save requested format */ - gst_query_parse_position (query, &format, NULL, NULL); - - /* query peer for total length in bytes */ - gst_query_set_position (query, GST_FORMAT_TIME, -1, -1); + gst_query_parse_position (query, &format, NULL); + /* query peer for current position in time */ + gst_query_set_position (query, GST_FORMAT_TIME, -1); if ((peer = gst_pad_get_peer (filter->sinkpad)) == NULL) goto error; - if (!gst_pad_query_position (peer, &rformat, &cur, &end)) { + if (!gst_pad_query_position (peer, &rformat, &cur)) { GST_LOG_OBJECT (filter, "query on peer pad failed"); gst_object_unref (peer); goto error; } gst_object_unref (peer); - if (rformat == GST_FORMAT_BYTES) - GST_LOG_OBJECT (filter, "peer pad returned total=%lld bytes", end); + GST_LOG_OBJECT (filter, "peer pad returned current=%lld bytes", cur); else if (rformat == GST_FORMAT_TIME) - GST_LOG_OBJECT (filter, "peer pad returned time=%lld", end); + GST_LOG_OBJECT (filter, "peer pad returned time=%lld", cur); /* convert to time format */ if (!gst_speed_convert (pad, rformat, cur, &conv_format, &cur)) { ret = FALSE; break; } + + /* adjust for speed factor */ + cur /= filter->speed; + /* convert to time format */ - if (!gst_speed_convert (pad, rformat, end, &conv_format, &end)) { + if (!gst_speed_convert (pad, conv_format, cur, &format, &cur)) { ret = FALSE; break; } + gst_query_set_position (query, format, cur); - /* adjust for speed factor */ - cur /= filter->speed; - end /= filter->speed; + GST_LOG_OBJECT (filter, + "position query: we return %llu (format %u)", cur, format); + + break; + } + case GST_QUERY_DURATION: + { + GstFormat format; + GstFormat rformat = GST_FORMAT_TIME; + gint64 end; + GstPad *peer; + GstFormat conv_format = GST_FORMAT_TIME; + + /* save requested format */ + gst_query_parse_duration (query, &format, NULL); + + /* query peer for total length in time */ + gst_query_set_duration (query, GST_FORMAT_TIME, -1); + + if ((peer = gst_pad_get_peer (filter->sinkpad)) == NULL) + goto error; + + if (!gst_pad_query_duration (peer, &rformat, &end)) { + GST_LOG_OBJECT (filter, "query on peer pad failed"); + gst_object_unref (peer); + goto error; + } + gst_object_unref (peer); + + if (rformat == GST_FORMAT_BYTES) + GST_LOG_OBJECT (filter, "peer pad returned total=%lld bytes", end); + else if (rformat == GST_FORMAT_TIME) + GST_LOG_OBJECT (filter, "peer pad returned time=%lld", end); /* convert to time format */ - if (!gst_speed_convert (pad, conv_format, cur, &format, &cur)) { + if (!gst_speed_convert (pad, rformat, end, &conv_format, &end)) { ret = FALSE; break; } + + /* adjust for speed factor */ + end /= filter->speed; + /* convert to time format */ if (!gst_speed_convert (pad, conv_format, end, &format, &end)) { ret = FALSE; break; } - gst_query_set_position (query, format, cur, end); + gst_query_set_duration (query, format, end); GST_LOG_OBJECT (filter, - "position query: peer returned total: %llu - we return %llu (format %u)", - end, cur, format); + "duration query: we return %llu (format %u)", end, format); break; } |