From 2397f01e979a4dd8cafe51dcfa4c4f7d99b97a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 31 Jan 2007 08:32:59 +0000 Subject: ext/wavpack/gstwavpackparse.c: Fix a off by one that leads to the duration reported as one sample less than it is Original commit message from CVS: * ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_src_query), (gst_wavpack_parse_handle_seek_event), (gst_wavpack_parse_create_src_pad): Fix a off by one that leads to the duration reported as one sample less than it is --- ChangeLog | 8 ++++++++ ext/wavpack/gstwavpackparse.c | 10 ++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf97694a..8365d9e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-01-31 Sebastian Dröge + + * ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_src_query), + (gst_wavpack_parse_handle_seek_event), + (gst_wavpack_parse_create_src_pad): + Fix a off by one that leads to the duration reported as one + sample less than it is + 2007-01-31 Stefan Kost * ext/alsaspdif/alsaspdifsink.c: diff --git a/ext/wavpack/gstwavpackparse.c b/ext/wavpack/gstwavpackparse.c index ed1de714..6f8ce0e5 100644 --- a/ext/wavpack/gstwavpackparse.c +++ b/ext/wavpack/gstwavpackparse.c @@ -276,7 +276,7 @@ gst_wavpack_parse_src_query (GstPad * pad, GstQuery * query) rate = parse->samplerate; GST_OBJECT_UNLOCK (parse); - if (len <= 0 || rate == 0) { + if (len < 0 || rate == 0) { GST_DEBUG_OBJECT (parse, "haven't read header yet"); break; } @@ -534,9 +534,7 @@ gst_wavpack_parse_handle_seek_event (GstWavpackParse * wvparse, /* if seek is to something after the end of the stream seek only * to the end. this can be caused by rounding errors */ if (start >= wvparse->total_samples) - start = wvparse->total_samples; - - flush = ((seek_flags & GST_SEEK_FLAG_FLUSH) != 0); + start = wvparse->total_samples - 1; if (start < 0) { GST_OBJECT_UNLOCK (wvparse); @@ -544,6 +542,8 @@ gst_wavpack_parse_handle_seek_event (GstWavpackParse * wvparse, return FALSE; } + flush = ((seek_flags & GST_SEEK_FLAG_FLUSH) != 0); + /* operate on segment copy until we know the seek worked */ segment = wvparse->segment; @@ -795,8 +795,6 @@ gst_wavpack_parse_create_src_pad (GstWavpackParse * wvparse, GstBuffer * buf, wvparse->total_samples = header->total_samples; if (wvparse->total_samples == (int32_t) - 1) wvparse->total_samples = 0; - else - wvparse->total_samples--; caps = gst_caps_new_simple ("audio/x-wavpack", "width", G_TYPE_INT, WavpackGetBitsPerSample (wpc), -- cgit v1.2.1