diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-02-22 06:06:06 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-02-22 06:06:06 +0000 |
commit | e5333665217d1e5e4675945f1d383ce1e8ae0785 (patch) | |
tree | 2aa9a60a6d6641420fb9ca7cd7375f673fdc8863 /ext/wavpack/gstwavpackparse.c | |
parent | 73a4369e0e3cf05a2ac57726bdd946fb271ded0d (diff) |
ext/wavpack/gstwavpackparse.*: Always report the duration if we know it in push mode and don't return 0 just to make ...
Original commit message from CVS:
* ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_src_query),
(gst_wavpack_parse_create_src_pad):
* ext/wavpack/gstwavpackparse.h:
Always report the duration if we know it in push mode and don't
return 0 just to make totem believe we can't seek in push mode.
Newer totem version use the SEEKING query which properly reports
if we can seek or not.
Diffstat (limited to 'ext/wavpack/gstwavpackparse.c')
-rw-r--r-- | ext/wavpack/gstwavpackparse.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/ext/wavpack/gstwavpackparse.c b/ext/wavpack/gstwavpackparse.c index 0c34401e..2cdf0071 100644 --- a/ext/wavpack/gstwavpackparse.c +++ b/ext/wavpack/gstwavpackparse.c @@ -275,16 +275,15 @@ gst_wavpack_parse_src_query (GstPad * pad, GstQuery * query) switch (GST_QUERY_TYPE (query)) { case GST_QUERY_POSITION:{ - gint64 cur, len; + gint64 cur; guint rate; GST_OBJECT_LOCK (parse); cur = parse->segment.last_stop; - len = parse->total_samples; rate = parse->samplerate; GST_OBJECT_UNLOCK (parse); - if (len < 0 || rate == 0) { + if (rate == 0) { GST_DEBUG_OBJECT (parse, "haven't read header yet"); break; } @@ -315,12 +314,10 @@ gst_wavpack_parse_src_query (GstPad * pad, GstQuery * query) GST_OBJECT_LOCK (parse); rate = parse->samplerate; - /* FIXME: return 0 if we work in push based mode to let totem - * recognize that we can't seek */ - len = (parse->adapter) ? 0 : parse->total_samples; + len = parse->total_samples; GST_OBJECT_UNLOCK (parse); - if (len < 0 || rate == 0) { + if (rate == 0) { GST_DEBUG_OBJECT (parse, "haven't read header yet"); break; } @@ -329,7 +326,8 @@ gst_wavpack_parse_src_query (GstPad * pad, GstQuery * query) switch (format) { case GST_FORMAT_TIME: - len = gst_util_uint64_scale_int (len, GST_SECOND, rate); + if (len != -1) + len = gst_util_uint64_scale_int (len, GST_SECOND, rate); gst_query_set_duration (query, GST_FORMAT_TIME, len); ret = TRUE; break; @@ -827,9 +825,8 @@ gst_wavpack_parse_create_src_pad (GstWavpackParse * wvparse, GstBuffer * buf, wvparse->samplerate = WavpackGetSampleRate (wpc); wvparse->channels = WavpackGetNumChannels (wpc); - wvparse->total_samples = header->total_samples; - if (wvparse->total_samples == (int32_t) - 1) - wvparse->total_samples = 0; + wvparse->total_samples = (header->total_samples == (int32_t) - 1) ? + -1 : header->total_samples; caps = gst_caps_new_simple ("audio/x-wavpack", "width", G_TYPE_INT, WavpackGetBitsPerSample (wpc), |