mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 08:21:59 +02:00
Use Gst.(M)SECOND constants instead of numbers
It makes code easier to read
This commit is contained in:
@@ -183,7 +183,7 @@ class ClapperPlayer extends PlayerBase
|
|||||||
|
|
||||||
seek_seconds(seconds)
|
seek_seconds(seconds)
|
||||||
{
|
{
|
||||||
this.seek(seconds * 1000000000);
|
this.seek(seconds * Gst.SECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
seek_chapter(seconds)
|
seek_chapter(seconds)
|
||||||
@@ -324,8 +324,8 @@ class ClapperPlayer extends PlayerBase
|
|||||||
|
|
||||||
let resumeInfo = {};
|
let resumeInfo = {};
|
||||||
if(playlistItem.isLocalFile && settings.get_boolean('resume-enabled')) {
|
if(playlistItem.isLocalFile && settings.get_boolean('resume-enabled')) {
|
||||||
const resumeTime = Math.floor(this.position / 1000000000);
|
const resumeTime = Math.floor(this.position / Gst.SECOND);
|
||||||
const resumeDuration = this.duration / 1000000000;
|
const resumeDuration = this.duration / Gst.SECOND;
|
||||||
|
|
||||||
/* Do not save resume info when video is very short,
|
/* Do not save resume info when video is very short,
|
||||||
* just started or almost finished */
|
* just started or almost finished */
|
||||||
|
@@ -164,12 +164,12 @@ class ClapperPlayerBase extends GstClapper.Clapper
|
|||||||
root[action + '_css_class'](gpuClass);
|
root[action + '_css_class'](gpuClass);
|
||||||
break;
|
break;
|
||||||
case 'audio-offset':
|
case 'audio-offset':
|
||||||
value = Math.round(settings.get_double(key) * -1000000);
|
value = Math.round(settings.get_double(key) * -Gst.MSECOND);
|
||||||
this.set_audio_video_offset(value);
|
this.set_audio_video_offset(value);
|
||||||
debug(`set audio-video offset: ${value}`);
|
debug(`set audio-video offset: ${value}`);
|
||||||
break;
|
break;
|
||||||
case 'subtitle-offset':
|
case 'subtitle-offset':
|
||||||
value = Math.round(settings.get_double(key) * -1000000);
|
value = Math.round(settings.get_double(key) * -Gst.MSECOND);
|
||||||
this.set_subtitle_video_offset(value);
|
this.set_subtitle_video_offset(value);
|
||||||
debug(`set subtitle-video offset: ${value}`);
|
debug(`set subtitle-video offset: ${value}`);
|
||||||
break;
|
break;
|
||||||
|
@@ -371,7 +371,7 @@ class ClapperWidget extends Gtk.Grid
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pos = Math.floor(start / 1000000) / 1000;
|
const pos = Math.floor(start / Gst.MSECOND) / 1000;
|
||||||
const tags = subentry.get_tags();
|
const tags = subentry.get_tags();
|
||||||
|
|
||||||
this.controls.positionScale.add_mark(pos, Gtk.PositionType.TOP, null);
|
this.controls.positionScale.add_mark(pos, Gtk.PositionType.TOP, null);
|
||||||
@@ -467,7 +467,7 @@ class ClapperWidget extends Gtk.Grid
|
|||||||
|
|
||||||
_onPlayerDurationChanged(player, duration)
|
_onPlayerDurationChanged(player, duration)
|
||||||
{
|
{
|
||||||
const durationSeconds = duration / 1000000000;
|
const durationSeconds = duration / Gst.SECOND;
|
||||||
const durationFloor = Math.floor(durationSeconds);
|
const durationFloor = Math.floor(durationSeconds);
|
||||||
|
|
||||||
/* Sometimes GstPlayer might re-emit
|
/* Sometimes GstPlayer might re-emit
|
||||||
@@ -515,7 +515,7 @@ class ClapperWidget extends Gtk.Grid
|
|||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const positionSeconds = Math.round(position / 1000000000);
|
const positionSeconds = Math.round(position / Gst.SECOND);
|
||||||
if(positionSeconds === this.controls.currentPosition)
|
if(positionSeconds === this.controls.currentPosition)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user