flacparse: tell baseparse the duration in samples for better accuracy

Tell GstBaseParse the duration in samples instead of time, so that
a duration query in DEFAULT format will return the correct number
of samples without rounding errors. Baseparse will convert this
into time itself when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=650785
This commit is contained in:
Tim-Philipp Müller 2011-05-23 13:50:46 +01:00
parent 900b2fb63d
commit a53540346a

View file

@ -798,10 +798,10 @@ gst_flac_parse_handle_streaminfo (GstFlacParse * flacparse, GstBuffer * buffer)
if (!gst_bit_reader_get_bits_uint64 (&reader, &flacparse->total_samples, 36))
goto error;
if (flacparse->total_samples)
gst_base_parse_set_duration (GST_BASE_PARSE (flacparse), GST_FORMAT_TIME,
GST_FRAMES_TO_CLOCK_TIME (flacparse->total_samples,
flacparse->samplerate), 0);
if (flacparse->total_samples) {
gst_base_parse_set_duration (GST_BASE_PARSE (flacparse),
GST_FORMAT_DEFAULT, flacparse->total_samples, 0);
}
GST_DEBUG_OBJECT (flacparse, "STREAMINFO:\n"
"\tmin/max blocksize: %u/%u,\n"