This repository has been archived by the owner on May 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from dr-Styki/Flatpak
Flatpak support !
- Loading branch information
Showing
14 changed files
with
1,796 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*~ | ||
build/ | ||
.vscode/ | ||
.flatpak-builder/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
app-id: com.github.dr_styki.screenrec | ||
runtime: io.elementary.Platform | ||
runtime-version: '6' | ||
sdk: io.elementary.Sdk | ||
command: com.github.dr_styki.screenrec | ||
finish-args: | ||
- '--share=ipc' | ||
- '--socket=x11' | ||
- '--device=dri' | ||
- '--socket=pulseaudio' | ||
|
||
- '--system-talk-name=org.freedesktop.Accounts' | ||
|
||
- '--filesystem=home' | ||
- '--filesystem=/tmp' | ||
- '--env=GST_PLUGIN_PATH_1_0=/app/lib/gstreamer-1.0' | ||
|
||
modules: | ||
- name: x264 | ||
config-opts: | ||
- --enable-shared | ||
- --system-libx264 | ||
- --enable-pic | ||
sources: | ||
- type: archive | ||
url: https://download.videolan.org/pub/x264/snapshots/x264-snapshot-20191217-2245-stable.tar.bz2 | ||
sha256: b2495c8f2930167d470994b1ce02b0f4bfb24b3317ba36ba7f112e9809264160 | ||
|
||
- name: gstreamer1-plugins-ugly | ||
buildsystem: meson | ||
config-opts: | ||
- -D=x264=enabled | ||
sources: | ||
- type: archive | ||
url: https://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-1.16.3.tar.xz | ||
sha256: 403c21688065f41e53008874402b5c07832567cc1309a60df597eab7ff5843f0 | ||
|
||
- name: ScreenRec | ||
buildsystem: meson | ||
sources: | ||
- type: dir | ||
path: . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
com.github.dr_styki.screenrec (3.0.0) focal; urgency=medium | ||
|
||
* Add Flatpak support ! | ||
|
||
-- dr_Styki <[email protected]> Sat, 30 Oct 2021 16:55:00 +0200 | ||
|
||
com.github.dr_styki.screenrec (2.3.1) bionic; urgency=medium | ||
|
||
* Fix Cancel button color. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
* SPDX-FileCopyrightText: 2018-2021 Ryo Nakano <[email protected]> | ||
* | ||
* Code brought from elementary/switchboard-plug-sound, src/PulseAudioManager.vala, authored by Corentin Noël | ||
*/ | ||
|
||
public class PulseAudioManager : GLib.Object { | ||
public string default_source_name { get; private set; } | ||
public string default_sink_name { get; private set; } | ||
|
||
private PulseAudio.Context context; | ||
private PulseAudio.GLibMainLoop loop; | ||
private bool is_ready = false; | ||
private uint reconnect_timer_id = 0U; | ||
|
||
private static PulseAudioManager pam; | ||
public static unowned PulseAudioManager get_default () { | ||
if (pam == null) { | ||
pam = new PulseAudioManager (); | ||
} | ||
|
||
return pam; | ||
} | ||
|
||
private PulseAudioManager () { | ||
loop = new PulseAudio.GLibMainLoop (); | ||
} | ||
|
||
public void start () { | ||
reconnect_to_pulse.begin (); | ||
} | ||
|
||
private bool reconnect_timeout () { | ||
reconnect_timer_id = 0U; | ||
reconnect_to_pulse.begin (); | ||
return false; | ||
} | ||
|
||
private async void reconnect_to_pulse () { | ||
if (is_ready) { | ||
context.disconnect (); | ||
context = null; | ||
is_ready = false; | ||
} | ||
|
||
var props = new PulseAudio.Proplist (); | ||
props.sets (PulseAudio.Proplist.PROP_APPLICATION_ID, "com.github.ryonakano.reco"); | ||
context = new PulseAudio.Context (loop.get_api (), null, props); | ||
context.set_state_callback (context_state_callback); | ||
|
||
if (context.connect (null, PulseAudio.Context.Flags.NOFAIL, null) < 0) { | ||
warning ("pa_context_connect () failed: %s", PulseAudio.strerror (context.errno ())); | ||
} | ||
} | ||
|
||
private void context_state_callback (PulseAudio.Context c) { | ||
switch (c.get_state ()) { | ||
case PulseAudio.Context.State.READY: | ||
c.set_subscribe_callback (subscribe_callback); | ||
c.subscribe (PulseAudio.Context.SubscriptionMask.SERVER); | ||
context.get_server_info (server_info_callback); | ||
is_ready = true; | ||
break; | ||
case PulseAudio.Context.State.FAILED: | ||
case PulseAudio.Context.State.TERMINATED: | ||
if (reconnect_timer_id == 0U) { | ||
reconnect_timer_id = Timeout.add_seconds (2, reconnect_timeout); | ||
} | ||
|
||
break; | ||
default: | ||
is_ready = false; | ||
break; | ||
} | ||
} | ||
|
||
private void subscribe_callback (PulseAudio.Context c, PulseAudio.Context.SubscriptionEventType t, uint32 index) { | ||
var source_type = t & PulseAudio.Context.SubscriptionEventType.FACILITY_MASK; | ||
if (source_type == PulseAudio.Context.SubscriptionEventType.SERVER) { | ||
context.get_server_info (server_info_callback); | ||
} | ||
} | ||
|
||
private void server_info_callback (PulseAudio.Context context, PulseAudio.ServerInfo? server) { | ||
if (server == null) { | ||
return; | ||
} | ||
|
||
if (default_sink_name == null) { | ||
default_sink_name = server.default_sink_name; | ||
debug ("Detected default sink: %s", default_sink_name); | ||
} | ||
|
||
if (default_sink_name != server.default_sink_name) { | ||
debug ("Detected default sink changed: %s > %s", default_sink_name, server.default_sink_name); | ||
default_sink_name = server.default_sink_name; | ||
} | ||
|
||
if (default_source_name == null) { | ||
default_source_name = server.default_source_name; | ||
debug ("Detected default source: %s", default_source_name); | ||
} | ||
|
||
if (default_source_name != server.default_source_name) { | ||
debug ("Detected default source changed: %s > %s", default_source_name, server.default_source_name); | ||
default_source_name = server.default_source_name; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
libpulse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using GLib; | ||
|
||
namespace PulseAudio { | ||
[Compact] | ||
[CCode (cheader_filename="pulse/glib-mainloop.h", cname="pa_glib_mainloop", cprefix="pa_glib_mainloop_", free_function="pa_glib_mainloop_free")] | ||
public class GLibMainLoop { | ||
|
||
[CCode (cname="pa_glib_mainloop_new")] | ||
public GLibMainLoop(MainContext? c = null); | ||
|
||
public unowned MainLoopApi get_api(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
posix |
Oops, something went wrong.