mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
baseparse: make seeking in DEFAULT format work if the subclass can convert for us
We only deal in TIME format ourselves, but if the subclass can handle converting other formats into TIME format, we can support that too. Fixes seeking in DEFAULT (sample) format with flacparse, and the flacdec unit test.
This commit is contained in:
parent
fc0d6ce23a
commit
b94e46b8b4
1 changed files with 22 additions and 3 deletions
|
@ -3762,9 +3762,21 @@ gst_base_parse_handle_seek (GstBaseParse * parse, GstEvent * event)
|
|||
GST_TIME_FORMAT, gst_format_get_name (format), rate,
|
||||
start_type, GST_TIME_ARGS (start), stop_type, GST_TIME_ARGS (stop));
|
||||
|
||||
/* we can only handle TIME */
|
||||
if (format != GST_FORMAT_TIME)
|
||||
goto done;
|
||||
/* we can only handle TIME, so check if subclass can convert
|
||||
* to TIME format if it's some other format (such as DEFAULT) */
|
||||
if (format != GST_FORMAT_TIME) {
|
||||
if (!gst_base_parse_convert (parse, format, start, GST_FORMAT_TIME, &start)
|
||||
|| !gst_base_parse_convert (parse, format, stop, GST_FORMAT_TIME,
|
||||
&stop))
|
||||
goto no_convert_to_time;
|
||||
|
||||
GST_INFO_OBJECT (parse, "converted %s format to start time "
|
||||
"%" GST_TIME_FORMAT " and stop time %" GST_TIME_FORMAT,
|
||||
gst_format_get_name (format), GST_TIME_ARGS (start),
|
||||
GST_TIME_ARGS (stop));
|
||||
|
||||
format = GST_FORMAT_TIME;
|
||||
}
|
||||
|
||||
/* no negative rates in push mode (unless upstream takes care of that, but
|
||||
* we've already tried upstream and it didn't handle the seek request) */
|
||||
|
@ -3985,6 +3997,13 @@ wrong_type:
|
|||
res = FALSE;
|
||||
goto done;
|
||||
}
|
||||
no_convert_to_time:
|
||||
{
|
||||
GST_DEBUG_OBJECT (parse, "seek in %s format was requested, but subclass "
|
||||
"couldn't convert that into TIME format", gst_format_get_name (format));
|
||||
res = FALSE;
|
||||
goto done;
|
||||
}
|
||||
convert_failed:
|
||||
{
|
||||
GST_DEBUG_OBJECT (parse, "conversion TIME to BYTES failed.");
|
||||
|
|
Loading…
Reference in a new issue