mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 16:31:58 +02:00
Add progressive video download option
Buffer download whole network video during playback to allow fast seeking for online media. Can be disabled in prefs (enabled by default).
This commit is contained in:
@@ -196,6 +196,10 @@ class ClapperPrefsDialog extends Gtk.Dialog
|
||||
{
|
||||
title: 'Subtitles',
|
||||
widget: Prefs.SubtitlesPage,
|
||||
},
|
||||
{
|
||||
title: 'Network',
|
||||
widget: Prefs.NetworkPage,
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -88,6 +88,7 @@ class ClapperPlayerBase extends GstPlayer.Player
|
||||
'seeking-mode',
|
||||
'audio-offset',
|
||||
'subtitle-offset',
|
||||
'play-flags',
|
||||
];
|
||||
|
||||
for(let key of settingsToSet)
|
||||
@@ -256,6 +257,16 @@ class ClapperPlayerBase extends GstPlayer.Player
|
||||
root[action + '_css_class'](brightClass);
|
||||
debug(`${action} brighter sliders`);
|
||||
break;
|
||||
case 'play-flags':
|
||||
const initialFlags = this.pipeline.flags;
|
||||
const settingsFlags = settings.get_int(key);
|
||||
|
||||
if(initialFlags === settingsFlags)
|
||||
break;
|
||||
|
||||
this.pipeline.flags = settingsFlags;
|
||||
debug(`changed play flags: ${initialFlags} -> ${settingsFlags}`);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
const { GObject, Gtk, Pango } = imports.gi;
|
||||
const { GObject, Gst, Gtk, Pango } = imports.gi;
|
||||
const Misc = imports.clapper_src.misc;
|
||||
const PrefsBase = imports.clapper_src.prefsBase;
|
||||
|
||||
@@ -85,6 +85,18 @@ class ClapperSubtitlesPage extends PrefsBase.Grid
|
||||
}
|
||||
});
|
||||
|
||||
var NetworkPage = GObject.registerClass(
|
||||
class ClapperNetworkPage extends PrefsBase.Grid
|
||||
{
|
||||
_init()
|
||||
{
|
||||
super._init();
|
||||
|
||||
this.addTitle('Client');
|
||||
this.addPlayFlagCheckButton('Progressive download buffering', Gst.PlayFlags.DOWNLOAD);
|
||||
}
|
||||
});
|
||||
|
||||
var GStreamerPage = GObject.registerClass(
|
||||
class ClapperGStreamerPage extends PrefsBase.Grid
|
||||
{
|
||||
|
@@ -127,6 +127,17 @@ class ClapperPrefsGrid extends Gtk.Grid
|
||||
return this.addToGrid(widget);
|
||||
}
|
||||
|
||||
addPlayFlagCheckButton(text, flag)
|
||||
{
|
||||
let checkButton = this.addCheckButton(text);
|
||||
let playFlags = settings.get_int('play-flags');
|
||||
|
||||
checkButton.active = ((playFlags & flag) === flag);
|
||||
checkButton.connect('toggled', this._onPlayFlagToggled.bind(this, flag));
|
||||
|
||||
return checkButton;
|
||||
}
|
||||
|
||||
addFontButton(text, setting)
|
||||
{
|
||||
let label = this.getLabel(text + ':');
|
||||
@@ -188,7 +199,9 @@ class ClapperPrefsGrid extends Gtk.Grid
|
||||
let checkButton = new Gtk.CheckButton({
|
||||
label: text || null,
|
||||
});
|
||||
settings.bind(setting, checkButton, 'active', this.flag);
|
||||
|
||||
if(setting)
|
||||
settings.bind(setting, checkButton, 'active', this.flag);
|
||||
|
||||
return checkButton;
|
||||
}
|
||||
@@ -204,6 +217,18 @@ class ClapperPrefsGrid extends Gtk.Grid
|
||||
return fontButton;
|
||||
}
|
||||
|
||||
_onPlayFlagToggled(flag, button)
|
||||
{
|
||||
let playFlags = settings.get_int('play-flags');
|
||||
|
||||
if(button.active)
|
||||
playFlags |= flag;
|
||||
else
|
||||
playFlags &= ~flag;
|
||||
|
||||
settings.set_int('play-flags', playFlags);
|
||||
}
|
||||
|
||||
_onClose(name)
|
||||
{
|
||||
if(name)
|
||||
|
Reference in New Issue
Block a user