From f6f2a2f4e4f438048e2852ded41b9f3fd075f684 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Thu, 3 Sep 2020 11:33:42 +0200 Subject: [PATCH] Add some easy way to install I know that this should be done using some sort of build system (like meson), but the player is still far from finished and a basic install script should be sufficient for the time being, if anyone wishes to test it. --- README.md | 24 +++++++++++++++++++++--- bin/clapper | 12 ++++++++++++ gjs-1.0/clapper.js | 11 +++++++++++ install.sh | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 3 deletions(-) create mode 100755 bin/clapper create mode 100644 gjs-1.0/clapper.js create mode 100755 install.sh diff --git a/README.md b/README.md index 6d9ff8e5..efeae9cf 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,35 @@ # Clapper -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 ## Requirements -Clapper uses these `GStreamer` elements: +Clapper uses `GStreamer` bindings from `GI` repository, so if your repo ships them as separate package, they must be installed first. +Additionally Clapper requires these `GStreamer` elements: * [gtkglsink](https://gstreamer.freedesktop.org/documentation/gtk/gtkglsink.html) * [glsinkbin](https://gstreamer.freedesktop.org/documentation/opengl/glsinkbin.html) Other required plugins (codecs) depend on video format. -To use `VAAPI` make sure you have `gstreamer1-vaapi` installed. Verify with: +## Installation +Run in terminal: +```sh +sudo ./install.sh +``` +I know that this should be done using some sort of build system (like `meson`), but the player is still far from finished and a basic install script should be sufficient for the time being, if anyone wishes to test it. + +## Hardware acceleration +Using hardware acceleration is highly recommended. As stated in `GStreamer` wiki: +``` +In the case of OpenGL based elements, the buffers have the GstVideoGLTextureUploadMeta meta, which +efficiently copies the content of the VA-API surface into a GL texture. +``` +Clapper uses `OpenGL` based sinks, so when `VA-API` is available, both CPU and RAM usage is much lower. + +To use `VA-API` make sure you have `gstreamer1-vaapi` installed. Verify with: ```shell gst-inspect-1.0 vaapi ``` On some older GPUs you might need to export `GST_VAAPI_ALL_DRIVERS=1` environment variable. + +Other acceleration methods (supported by `GStreamer`) should also work, but I have not tested them due to lack of hardware. diff --git a/bin/clapper b/bin/clapper new file mode 100755 index 00000000..7238d51c --- /dev/null +++ b/bin/clapper @@ -0,0 +1,12 @@ +#!/usr/bin/gjs + +const Package = imports.package; + +Package.init({ + name: "clapper", + version: "0.0.0", + prefix: "/usr/local", + libdir: "/usr/local/lib", + datadir: "/usr/local/share", +}); +Package.run(imports.main); diff --git a/gjs-1.0/clapper.js b/gjs-1.0/clapper.js new file mode 100644 index 00000000..3e756ef7 --- /dev/null +++ b/gjs-1.0/clapper.js @@ -0,0 +1,11 @@ +imports.gi.versions.Gdk = '3.0'; +imports.gi.versions.Gtk = '3.0'; +imports.searchPath.unshift('/usr/local/share/clapper'); + +const ClapperSrc = imports.clapper_src; + +var { App } = ClapperSrc.app; +var { Interface } = ClapperSrc.interface; +var { Player } = ClapperSrc.player; + +imports.searchPath.shift(); diff --git a/install.sh b/install.sh new file mode 100755 index 00000000..678cae46 --- /dev/null +++ b/install.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +LICENSES_DIR="/usr/local/share/licenses/clapper" +DOC_DIR="/usr/local/share/doc/clapper" +MAIN_DIR="/usr/local/share/clapper" +BIN_DIR="/usr/local/bin" +GJS_DIR="/usr/local/share/gjs-1.0" + +SCRIPT_ERR="Error: this script must be" + +if [ ! -d "./clapper_src" ]; then + echo "$SCRIPT_ERR run from clapper directory!" 1>&2 + exit 1 +elif [ "$EUID" -ne 0 ]; then + echo "$SCRIPT_ERR run as root!" 1>&2 + exit 1 +fi + +echo "Creating directories..." +mkdir -p "$LICENSES_DIR" +mkdir -p "$DOC_DIR" +mkdir -p "$MAIN_DIR" +mkdir -p "$GJS_DIR" +mkdir -p "$BIN_DIR" + +echo "Copying files..." +cp -f "./COPYING" "$LICENSES_DIR/" +cp -f "./README.md" "$DOC_DIR/" +cp -rf "./clapper_src" "$MAIN_DIR/" +cp -f "./main.js" "$MAIN_DIR/" +cp -f "./gjs-1.0/clapper.js" "$GJS_DIR/" +cp -f "./bin/clapper" "$BIN_DIR/" + +echo "Creating executables..." +chmod +x "$BIN_DIR/clapper" + +echo "Install finished"