@stremio/stremio-video 0.0.80 → 0.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stremio/stremio-video",
3
- "version": "0.0.80",
3
+ "version": "0.0.82",
4
4
  "description": "Abstraction layer on top of different media players",
5
5
  "author": "Smart Code OOD",
6
6
  "main": "src/index.js",
@@ -4,6 +4,7 @@ var deepFreeze = require('deep-freeze');
4
4
  var ERROR = require('../error');
5
5
 
6
6
  var SUBS_SCALE_FACTOR = 0.0066;
7
+ var EOF_END_TOLERANCE = 60000;
7
8
 
8
9
  var stremioToMPVProps = {
9
10
  'loaded': 'loaded',
@@ -259,7 +260,9 @@ function ShellVideo(options) {
259
260
  ipc.on('mpv-event-ended', function(args) {
260
261
  // older shells report 'other' for every non-error reason, including eof
261
262
  if (args.error) onError(args.error);
262
- else if (!args.reason || args.reason === 'eof' || args.reason === 'other') onEnded();
263
+ else if (!args.reason || args.reason === 'eof' || args.reason === 'other') {
264
+ if (!isKnownEarlyEof()) onEnded();
265
+ }
263
266
  });
264
267
 
265
268
  function getProp(propName) {
@@ -279,6 +282,15 @@ function ShellVideo(options) {
279
282
  function onEnded() {
280
283
  events.emit('ended');
281
284
  }
285
+ function isKnownEarlyEof() {
286
+ var time = props['time-pos'];
287
+ var duration = props.duration;
288
+ return typeof time === 'number' &&
289
+ isFinite(time) &&
290
+ typeof duration === 'number' &&
291
+ isFinite(duration) &&
292
+ time + EOF_END_TOLERANCE < duration;
293
+ }
282
294
  function onPropChanged(propName) {
283
295
  if (observedProps[propName]) {
284
296
  events.emit('propChanged', propName, getProp(propName));
@@ -410,10 +422,18 @@ function ShellVideo(options) {
410
422
  var subAssOverride = commandArgs.assSubtitlesStyling ? 'strip' : 'no';
411
423
  ipc.send('mpv-set-prop', ['sub-ass-override', subAssOverride]);
412
424
 
425
+ var gpuProcessing = !!commandArgs.gpuVideoProcessing &&
426
+ !!commandArgs.hardwareDecoding;
427
+
413
428
  // Hardware decoding
414
- var hwdecValue = commandArgs.hardwareDecoding ? 'auto-copy' : 'no';
429
+ var hwdecValue = commandArgs.hardwareDecoding ? (gpuProcessing ? 'd3d11va' : 'auto-copy') : 'no';
415
430
  ipc.send('mpv-set-prop', ['hwdec', hwdecValue]);
416
431
 
432
+ // GPU video processing
433
+ if (typeof commandArgs.gpuVideoProcessing === 'boolean') {
434
+ ipc.send('mpv-set-gpu-video-processing', gpuProcessing);
435
+ }
436
+
417
437
  // Video output
418
438
  var videoOutput = commandArgs.platform === 'windows' ? (commandArgs.videoMode === null ? 'gpu-next' : 'gpu') : 'libmpv';
419
439
  ipc.send('mpv-set-prop', ['vo', videoOutput]);