commit 4f8a95b7c0211798dd8a3e08063070f8c23de581
parent abeaae1be53be7264f5f7bed0331b5aa009bf793
Author: Jacki <jacki@thejackimonster.de>
Date: Wed, 15 May 2024 17:09:04 +0200
Fix dependencies and progress bar of audio playback
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat:
4 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
@@ -21,7 +21,7 @@ jobs:
- name: Install dependencies (framework)
run: |
sudo apt-get -qq update
- sudo apt-get -qq install libgcrypt20-dev recutils libjansson-dev libsodium-dev libcurl4-gnutls-dev libidn2-dev libunistring-dev libsqlite3-dev libmicrohttpd-dev
+ sudo apt-get -qq install libgcrypt20-dev recutils libjansson-dev libsodium-dev libcurl4-gnutls-dev libidn2-dev libunistring-dev libsqlite3-dev libmicrohttpd-dev libltdl-dev
- name: Build framework
run: |
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
@@ -68,6 +68,7 @@ parts:
- libunistring-dev
- libsqlite3-dev
- libmicrohttpd-dev
+ - libltdl-dev
stage-packages:
- libgcrypt20
- recutils
@@ -80,6 +81,7 @@ parts:
- libmicrohttpd12
- libgnutls-dane0
- libunbound8
+ - libltdl7
source: http://ftpmirror.gnu.org/gnunet/gnunet-0.21.1.tar.gz
plugin: autotools
autotools-configure-parameters:
@@ -116,7 +118,6 @@ parts:
- libpipewire-0.3-0t64
- libportal1
- libportal-gtk3-1
- - libltdl7
source: http://ftpmirror.gnu.org/gnunet/messenger-gtk-0.9.0.tar.gz
plugin: meson
meson-parameters:
diff --git a/src/ui/chat.c b/src/ui/chat.c
@@ -999,14 +999,23 @@ _play_timer_func(gpointer user_data)
g_assert(user_data);
UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data;
+ gint64 pos, len;
- const gdouble played_seconds = 0.010 * handle->play_time + 0.005;
- const gdouble listen_seconds = MAX(handle->record_time - 0.010, 0.0);
+ handle->play_timer = 0;
- if (played_seconds < listen_seconds)
+ if (!(handle->play_pipeline))
+ return FALSE;
+
+ if (!gst_element_query_position(handle->play_pipeline, GST_FORMAT_TIME, &pos))
+ return FALSE;
+
+ if (!gst_element_query_duration(handle->play_pipeline, GST_FORMAT_TIME, &len))
+ return FALSE;
+
+ if (pos < len)
gtk_progress_bar_set_fraction(
handle->recording_progress_bar,
- played_seconds / listen_seconds
+ 1.0 * pos / len
);
else
gtk_progress_bar_set_fraction(
@@ -1015,16 +1024,11 @@ _play_timer_func(gpointer user_data)
);
if (handle->playing)
- {
- handle->play_time++;
handle->play_timer = util_timeout_add(
10,
_play_timer_func,
handle
);
- }
- else
- handle->play_timer = 0;
return FALSE;
}
@@ -1066,14 +1070,20 @@ handle_play_bus_watch(UNUSED GstBus *bus,
switch (type)
{
- case GST_MESSAGE_STREAM_START:
- handle->play_time = 0;
- handle->play_timer = util_idle_add(
- _play_timer_func,
- handle
- );
-
+ case GST_MESSAGE_STATE_CHANGED:
+ {
+ GstState old_state, new_state, pending_state;
+ gst_message_parse_state_changed(msg, &old_state, &new_state, &pending_state);
+
+ if (GST_STATE_PLAYING == new_state)
+ handle->play_timer = util_idle_add(
+ _play_timer_func,
+ handle
+ );
+ else if (GST_STATE_PLAYING == old_state)
+ _stop_playing_recording(handle, FALSE);
break;
+ }
case GST_MESSAGE_EOS:
if (handle->playing)
_stop_playing_recording(handle, FALSE);
diff --git a/src/ui/chat.h b/src/ui/chat.h
@@ -53,7 +53,6 @@ typedef struct UI_CHAT_Handle
guint record_time;
guint play_timer;
- guint play_time;
GstElement *record_pipeline;
GstElement *record_sink;