mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Support loading files using full or relative paths
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
A GNOME media player built using [GJS](https://gitlab.gnome.org/GNOME/gjs) and powered by [GStreamer](https://gstreamer.freedesktop.org) with [OpenGL](https://www.opengl.org) rendering. Can also be used as a pre-made widget for [GTK](https://www.gtk.org) apps.
|
A GNOME media player built using [GJS](https://gitlab.gnome.org/GNOME/gjs) and powered by [GStreamer](https://gstreamer.freedesktop.org) with [OpenGL](https://www.opengl.org) rendering. Can also be used as a pre-made widget for [GTK](https://www.gtk.org) apps.
|
||||||
|
|
||||||
### WORK IN PROGRESS
|
### WORK IN PROGRESS
|
||||||
This is still early WIP. Many features are not implemented yet and quite a few are still unstable. Right now Clapper can only play single file from URI. So if you want to test it, start it from terminal like this:
|
This is still early WIP. Many features are not implemented yet and quite a few are still unstable. Right now Clapper can only play single file. So if you want to test it, start it from terminal like this:
|
||||||
```shell
|
```shell
|
||||||
clapper file:///path/to/video.mkv
|
clapper video.mp4
|
||||||
```
|
```
|
||||||
## Requirements
|
## Requirements
|
||||||
Clapper uses `GStreamer` bindings from `GI` repository, so if your repo ships them as separate package, they must be installed first.
|
Clapper uses `GStreamer` bindings from `GI` repository, so if your repo ships them as separate package, they must be installed first.
|
||||||
@@ -38,7 +38,7 @@ On some older GPUs you might need to export `GST_VAAPI_ALL_DRIVERS=1` environmen
|
|||||||
Other acceleration methods (supported by `GStreamer`) should also work, but I have not tested them due to lack of hardware.
|
Other acceleration methods (supported by `GStreamer`) should also work, but I have not tested them due to lack of hardware.
|
||||||
|
|
||||||
## Performace Comparison
|
## Performace Comparison
|
||||||
Here is the average **CPU** and **RAM** usage (lower is better) when playing the same H.264 1080p video in Clapper and [Totem](https://wiki.gnome.org/Apps/Videos) (GNOME Videos) with **VA-API enabled** on an old AMD APU:
|
Here is the average **CPU** and **RAM** usage (lower is better) when playing the same H.264 1080p video in Clapper and [Totem](https://wiki.gnome.org/Apps/Videos) (GNOME Videos) with **VA-API available** on an old AMD APU:
|
||||||
|
|
||||||
| Player | CPU | RAM |
|
| Player | CPU | RAM |
|
||||||
| ------- | --- | ----- |
|
| ------- | --- | ----- |
|
||||||
|
@@ -249,7 +249,7 @@ var App = GObject.registerClass({
|
|||||||
if(!this.playlist.length)
|
if(!this.playlist.length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.player.set_uri(this.playlist[0]);
|
this.player.set_media(this.playlist[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onPlayerStateChanged(self, state)
|
_onPlayerStateChanged(self, state)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
const { GLib, GObject, Gst, GstPlayer } = imports.gi;
|
const { Gio, GLib, GObject, Gst, GstPlayer } = imports.gi;
|
||||||
const Debug = imports.clapper_src.debug;
|
const Debug = imports.clapper_src.debug;
|
||||||
|
|
||||||
const GSTPLAYER_DEFAULTS = {
|
const GSTPLAYER_DEFAULTS = {
|
||||||
@@ -62,6 +62,27 @@ class ClapperPlayer extends GstPlayer.Player
|
|||||||
this.widget.connect('destroy', this._onWidgetDestroy.bind(this));
|
this.widget.connect('destroy', this._onWidgetDestroy.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_media(source)
|
||||||
|
{
|
||||||
|
if(Gst.uri_is_valid(source)) {
|
||||||
|
debug(`setting source URI: ${source}`);
|
||||||
|
return this.set_uri(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
debug(`parsing source: ${source}`);
|
||||||
|
let uri = Gst.filename_to_uri(source);
|
||||||
|
|
||||||
|
if(!uri)
|
||||||
|
return debug('parsing to URI failed');
|
||||||
|
|
||||||
|
debug(`parsed source to URI: ${uri}`);
|
||||||
|
|
||||||
|
if(!Gio.file_new_for_uri(uri).query_exists(null))
|
||||||
|
return debug(`file does not exist: ${source}`, 'LEVEL_WARNING');
|
||||||
|
|
||||||
|
this.set_uri(uri);
|
||||||
|
}
|
||||||
|
|
||||||
seek_seconds(position)
|
seek_seconds(position)
|
||||||
{
|
{
|
||||||
this.seek(position * 1000000000);
|
this.seek(position * 1000000000);
|
||||||
|
Reference in New Issue
Block a user