Add fast seeking support as a patch

This commit is contained in:
Rafostar
2020-11-05 16:13:57 +01:00
parent 81bdcf6244
commit da21c2fafc
4 changed files with 170 additions and 10 deletions

View File

@@ -175,15 +175,7 @@ class ClapperPlayer extends PlayerBase
debug(`${this.seekingMode} seeking to position: ${position}`);
if(this.seekingMode !== 'fast')
return super.seek(position);
let pipeline = this.get_pipeline();
let flags = Gst.SeekFlags.FLUSH
| Gst.SeekFlags.KEY_UNIT
| Gst.SeekFlags.SNAP_AFTER;
pipeline.seek_simple(Gst.Format.TIME, flags, position);
super.seek(position);
}
seek_seconds(position)

View File

@@ -106,7 +106,10 @@ class ClapperPlayerBase extends GstPlayer.Player
let config = this.get_config();
setOption(config, value);
this.set_config(config);
let success = this.set_config(config);
if(!success)
debug(`could not change option: ${option}`);
}
/* FIXME: add in prefs and move to bind_settings() */
@@ -160,10 +163,15 @@ class ClapperPlayerBase extends GstPlayer.Player
case 'seeking-mode':
this.seekingMode = settings.get_string('seeking-mode');
switch(this.seekingMode) {
case 'fast':
this.set_config_option('seek_fast', true);
break;
case 'accurate':
this.set_config_option('seek_fast', false);
this.set_config_option('seek_accurate', true);
break;
default:
this.set_config_option('seek_fast', false);
this.set_config_option('seek_accurate', false);
break;
}