mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
Do not do fast seeks when seeking to chapter
Fast seeks are always a little off from requested time. When seeking to chapter position, do it by using a normal seek and restore user selected fast seeks afterwards.
This commit is contained in:
12
clapper_src/controls.js
vendored
12
clapper_src/controls.js
vendored
@@ -585,14 +585,22 @@ class ClapperControls extends Gtk.Box
|
||||
if((this.isPositionDragging = isPositionDragging))
|
||||
return;
|
||||
|
||||
const isChapterSeek = this.chapterPopover.visible;
|
||||
|
||||
if(!isPositionDragging)
|
||||
this._setChapterVisible(false);
|
||||
|
||||
const clapperWidget = this.get_ancestor(Gtk.Grid);
|
||||
if(!clapperWidget) return;
|
||||
|
||||
const positionSeconds = Math.round(scale.get_value());
|
||||
clapperWidget.player.seek_seconds(positionSeconds);
|
||||
const scaleValue = scale.get_value();
|
||||
|
||||
if(!isChapterSeek) {
|
||||
const positionSeconds = Math.round(scaleValue);
|
||||
clapperWidget.player.seek_seconds(positionSeconds);
|
||||
}
|
||||
else
|
||||
clapperWidget.player.seek_chapter(scaleValue);
|
||||
}
|
||||
|
||||
/* Only happens when navigating through controls panel */
|
||||
|
@@ -20,6 +20,7 @@ class ClapperPlayer extends PlayerBase
|
||||
this.dragAllowed = false;
|
||||
this.isWidgetDragging = false;
|
||||
this.doneStartup = false;
|
||||
this.needsFastSeekRestore = false;
|
||||
|
||||
this.playOnFullscreen = false;
|
||||
this.quitOnStop = false;
|
||||
@@ -209,9 +210,26 @@ class ClapperPlayer extends PlayerBase
|
||||
super.seek(position);
|
||||
}
|
||||
|
||||
seek_seconds(position)
|
||||
seek_seconds(seconds)
|
||||
{
|
||||
this.seek(position * 1000000000);
|
||||
this.seek(seconds * 1000000000);
|
||||
}
|
||||
|
||||
seek_chapter(seconds)
|
||||
{
|
||||
if(this.seekingMode !== 'fast') {
|
||||
this.seek_seconds(seconds);
|
||||
return;
|
||||
}
|
||||
|
||||
/* FIXME: Remove this check when GstPlay(er) have set_seek_mode function */
|
||||
if(this.set_seek_mode) {
|
||||
this.set_seek_mode(GstPlayer.PlayerSeekMode.DEFAULT);
|
||||
this.seekingMode = 'normal';
|
||||
this.needsFastSeekRestore = true;
|
||||
}
|
||||
|
||||
this.seek_seconds(seconds);
|
||||
}
|
||||
|
||||
set_volume(volume)
|
||||
@@ -399,6 +417,13 @@ class ClapperPlayer extends PlayerBase
|
||||
|
||||
if(!this.seek_done && state !== GstPlayer.PlayerState.BUFFERING) {
|
||||
clapperWidget.updateTime();
|
||||
|
||||
if(this.needsFastSeekRestore) {
|
||||
this.set_seek_mode(GstPlayer.PlayerSeekMode.FAST);
|
||||
this.seekingMode = 'fast';
|
||||
this.needsFastSeekRestore = false;
|
||||
}
|
||||
|
||||
this.seek_done = true;
|
||||
debug('seeking finished');
|
||||
}
|
||||
|
@@ -388,12 +388,12 @@ class ClapperWidget extends Gtk.Grid
|
||||
return;
|
||||
}
|
||||
|
||||
/* FIXME: Use higher precision for position scale */
|
||||
const pos = Math.floor(start / 1000000) / 1000;
|
||||
const tags = subentry.get_tags();
|
||||
|
||||
this.controls.positionScale.add_mark(pos, Gtk.PositionType.TOP, null);
|
||||
this.controls.positionScale.add_mark(pos, Gtk.PositionType.BOTTOM, null);
|
||||
|
||||
const tags = subentry.get_tags();
|
||||
if(!tags) {
|
||||
debug('could not obtain toc subentry tags');
|
||||
return;
|
||||
|
Reference in New Issue
Block a user