Skip to content

Commit 7800bb2

Browse files
GeopJrRafostar
andauthored
feat(MediaViewer): optional clapper support (#931)
Co-authored-by: Rafał Dzięgiel <[email protected]>
1 parent 691a7fc commit 7800bb2

File tree

9 files changed

+312
-45
lines changed

9 files changed

+312
-45
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.PHONY: all install uninstall build test potfiles
22
PREFIX ?= /usr
33

4+
clapper ?=
45
# Remove the devel headerbar style:
56
# make release=1
67
release ?=
@@ -9,7 +10,7 @@ all: build
910

1011
build:
1112
meson setup builddir --prefix=$(PREFIX)
12-
meson configure builddir -Ddevel=$(if $(release),false,true)
13+
meson configure builddir -Ddevel=$(if $(release),false,true) -Dclapper=$(if $(clapper),true,false)
1314
meson compile -C builddir
1415

1516
install:

build-aux/clapper/clapper.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "clapper",
3+
"buildsystem": "meson",
4+
"config-opts": [
5+
"-Dclapper=enabled",
6+
"-Dclapper-gtk=enabled",
7+
"-Dclapper-app=disabled",
8+
"-Dintrospection=enabled",
9+
"-Dvapi=enabled"
10+
],
11+
"cleanup": [
12+
"/include",
13+
"/lib/pkgconfig"
14+
],
15+
"sources": [
16+
{
17+
"type": "git",
18+
"url": "https://github.com/Rafostar/clapper.git",
19+
"branch": "master"
20+
}
21+
]
22+
}

build-aux/clapper/gstreamer.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"name": "gstreamer",
3+
"buildsystem": "meson",
4+
"config-opts": [
5+
"--buildtype=release",
6+
"--wrap-mode=nodownload",
7+
8+
"-Dbase=enabled",
9+
"-Dgood=enabled",
10+
"-Dbad=enabled",
11+
"-Dugly=enabled",
12+
"-Dlibav=enabled",
13+
"-Dvaapi=enabled",
14+
"-Dsharp=disabled",
15+
"-Drs=disabled",
16+
"-Dpython=disabled",
17+
"-Ddevtools=disabled",
18+
"-Dges=disabled",
19+
"-Drtsp_server=disabled",
20+
"-Dgst-examples=disabled",
21+
"-Dqt5=disabled",
22+
"-Dtests=disabled",
23+
"-Dexamples=disabled",
24+
"-Dintrospection=enabled",
25+
"-Ddoc=disabled",
26+
"-Dgtk_doc=disabled",
27+
"-Dgpl=enabled",
28+
29+
"-Dgstreamer:benchmarks=disabled",
30+
"-Dgstreamer:gobject-cast-checks=disabled",
31+
"-Dgstreamer:glib-asserts=disabled",
32+
"-Dgstreamer:glib-checks=disabled",
33+
"-Dgstreamer:extra-checks=disabled",
34+
35+
"-Dgst-plugins-base:gobject-cast-checks=disabled",
36+
"-Dgst-plugins-base:glib-asserts=disabled",
37+
"-Dgst-plugins-base:glib-checks=disabled",
38+
"-Dgst-plugins-base:gl_api=opengl,gles2",
39+
"-Dgst-plugins-base:gl_platform=egl,glx",
40+
41+
"-Dgst-plugins-good:gobject-cast-checks=disabled",
42+
"-Dgst-plugins-good:glib-asserts=disabled",
43+
"-Dgst-plugins-good:glib-checks=disabled",
44+
"-Dgst-plugins-good:gtk3=disabled",
45+
46+
"-Dgst-plugins-bad:gobject-cast-checks=disabled",
47+
"-Dgst-plugins-bad:glib-asserts=disabled",
48+
"-Dgst-plugins-bad:glib-checks=disabled",
49+
"-Dgst-plugins-bad:extra-checks=disabled",
50+
"-Dgst-plugins-bad:vulkan=disabled",
51+
"-Dgst-plugins-bad:webrtc=disabled",
52+
"-Dgst-plugins-bad:wasapi=disabled",
53+
"-Dgst-plugins-bad:wasapi2=disabled",
54+
"-Dgst-plugins-bad:winks=disabled",
55+
"-Dgst-plugins-bad:winscreencap=disabled",
56+
"-Dgst-plugins-bad:nvcodec=enabled",
57+
"-Dgst-plugins-bad:v4l2codecs=enabled",
58+
"-Dgst-plugins-bad:va=enabled",
59+
60+
"-Dgst-plugins-ugly:gobject-cast-checks=disabled",
61+
"-Dgst-plugins-ugly:glib-asserts=disabled",
62+
"-Dgst-plugins-ugly:glib-checks=disabled"
63+
],
64+
"sources": [
65+
{
66+
"type": "git",
67+
"url": "https://gitlab.freedesktop.org/gstreamer/gstreamer.git",
68+
"tag": "1.24.3",
69+
"commit": "da69285863780ce0ebb51482edcf1d54c7c29533",
70+
"disable-submodules": true
71+
}
72+
]
73+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"app-id": "dev.geopjr.Tuba",
3+
"runtime": "org.gnome.Platform",
4+
"runtime-version": "46",
5+
"sdk": "org.gnome.Sdk",
6+
"add-extensions": {
7+
"org.freedesktop.Platform.ffmpeg-full": {
8+
"version": "23.08",
9+
"directory": "lib/ffmpeg",
10+
"add-ld-path": ".",
11+
"no-autodownload": false,
12+
"autodelete": false
13+
}
14+
},
15+
"command": "dev.geopjr.Tuba",
16+
"finish-args": [
17+
"--device=dri",
18+
"--share=ipc",
19+
"--share=network",
20+
"--socket=fallback-x11",
21+
"--socket=wayland",
22+
"--socket=pulseaudio",
23+
"--own-name=org.mpris.MediaPlayer2.Tuba",
24+
"--env=GST_PLUGIN_SYSTEM_PATH=/app/lib/gstreamer-1.0"
25+
],
26+
"cleanup": [
27+
"/include",
28+
"/lib/pkgconfig",
29+
"/man",
30+
"/share/doc",
31+
"/share/gtk-doc",
32+
"/share/man",
33+
"/share/pkgconfig",
34+
"/share/vala",
35+
"*.la",
36+
"*.a"
37+
],
38+
"modules": [
39+
"clapper/gstreamer.json",
40+
"clapper/clapper.json",
41+
{
42+
"name" : "libspelling",
43+
"buildsystem" : "meson",
44+
"config-opts" : [
45+
"-Ddocs=false"
46+
],
47+
"sources" : [
48+
{
49+
"type" : "git",
50+
"url" : "https://gitlab.gnome.org/GNOME/libspelling.git",
51+
"branch" : "main"
52+
}
53+
]
54+
},
55+
{
56+
"name": "tuba",
57+
"builddir": true,
58+
"buildsystem": "meson",
59+
"config-opts" : [
60+
"-Ddevel=true",
61+
"-Dclapper=true"
62+
],
63+
"sources": [
64+
{
65+
"type": "dir",
66+
"path": "../"
67+
}
68+
]
69+
}
70+
],
71+
"cleanup-commands": [
72+
"mkdir -p /app/lib/ffmpeg"
73+
]
74+
}

build-aux/dev.geopjr.Tuba.Devel.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@
5454
]
5555
}
5656
]
57-
}
57+
}

meson.build

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ endif
1818

1919
devel = get_option('devel')
2020
distro = get_option('distro')
21+
clapper_support = get_option('clapper')
2122

2223
# Setup configuration file
2324
config = configuration_data()
@@ -82,6 +83,8 @@ libadwaita_dep = dependency('libadwaita-1', version: '>=1.5', required: true)
8283
gtksourceview_dep = dependency('gtksourceview-5', required: true, version: '>=5.6.0')
8384
libwebp_dep = dependency('libwebp', required: false)
8485
libspelling = dependency('libspelling-1', required: false)
86+
clapper_dep = dependency('clapper-0.0', required: false)
87+
clapper_gtk_dep = dependency('clapper-gtk-0.0', required: false)
8588

8689
if not libwebp_dep.found ()
8790
warning('WebP support might be missing, please install webp-pixbuf-loader.')
@@ -99,6 +102,13 @@ if gtksourceview_dep.version().version_compare('>=5.7.1')
99102
add_project_arguments(['--define=GTKSOURCEVIEW_5_7_1'], language: 'vala')
100103
endif
101104

105+
if clapper_support and clapper_dep.found () and clapper_dep.version().version_compare('>=0.6.0') and clapper_gtk_dep.found ()
106+
add_project_arguments(['--define=CLAPPER'], language: 'vala')
107+
if (clapper_dep.get_variable('features').split().contains('mpris'))
108+
add_project_arguments(['--define=CLAPPER_MPRIS'], language: 'vala')
109+
endif
110+
endif
111+
102112
if gtk_dep.version().version_compare('>=4.14')
103113
add_project_arguments(['--define=GTK_4_14'], language: 'vala')
104114
endif
@@ -118,7 +128,9 @@ final_deps = [
118128
gtksourceview_dep,
119129
gtk_dep,
120130
libadwaita_dep,
121-
meson.get_compiler('c').find_library('m', required: false)
131+
meson.get_compiler('c').find_library('m', required: false),
132+
clapper_dep,
133+
clapper_gtk_dep
122134
]
123135

124136
executable(

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
option('devel', type: 'boolean', value: false)
22
option('distro', type: 'boolean', value: false)
3+
option('clapper', type: 'boolean', value: false)

src/Application.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ namespace Tuba {
169169
warning (e.message);
170170
}
171171

172+
#if CLAPPER
173+
Clapper.init (ref args);
174+
GLib.Environment.set_variable ("CLAPPER_USE_PLAYBIN3", "1", false);
175+
#endif
172176
cache_path = GLib.Path.build_path (GLib.Path.DIR_SEPARATOR_S, GLib.Environment.get_user_cache_dir (), Build.NAME.down ());
173177

174178
try {

0 commit comments

Comments
 (0)