From e6938c29653743974eb4f03d2a988cef50d0adbc Mon Sep 17 00:00:00 2001 From: hrxi Date: Tue, 20 Jun 2023 19:46:41 +0200 Subject: meson: Add rtp plugin --- plugins/rtp/meson.build | 41 +++++++++++++++++++++++++++ plugins/rtp/vapi/webrtc-audio-processing.vapi | 0 2 files changed, 41 insertions(+) create mode 100644 plugins/rtp/meson.build create mode 100644 plugins/rtp/vapi/webrtc-audio-processing.vapi (limited to 'plugins/rtp') diff --git a/plugins/rtp/meson.build b/plugins/rtp/meson.build new file mode 100644 index 00000000..d4d37e36 --- /dev/null +++ b/plugins/rtp/meson.build @@ -0,0 +1,41 @@ +dependencies = [ + dep_gee, + dep_glib, + dep_gmodule, + dep_gnutls, + dep_gtk4, + dep_gstreamer, + dep_gstreamer_app, + dep_gstreamer_audio, + dep_gstreamer_rtp, + dep_gstreamer_video, + dep_crypto_vala, + dep_dino, + dep_qlite, + dep_webrtc_audio_processing, + dep_xmpp_vala, +] +sources = files( + 'src/codec_util.vala', + 'src/device.vala', + 'src/gst_fixes.c', + 'src/module.vala', + 'src/plugin.vala', + 'src/register_plugin.vala', + 'src/stream.vala', + 'src/video_widget.vala', + 'src/voice_processor.vala', + 'src/voice_processor_native.cpp', +) +c_args = [ + '-DGST_1_16', + '-DGST_1_18', + '-DGST_1_20', + '-DWITH_VOICE_PROCESSOR', + '-DG_LOG_DOMAIN="rtp"', +] +vala_args = [ + '--vapidir', meson.current_source_dir() / 'vapi', +] +lib_rtp = shared_library('rtp', sources, name_prefix: '', c_args: c_args, vala_args: vala_args, include_directories: include_directories('src'), dependencies: dependencies, install: true, install_dir: get_option('libdir') / 'dino/plugins') +dep_rtp = declare_dependency(link_with: lib_rtp, include_directories: include_directories('.')) diff --git a/plugins/rtp/vapi/webrtc-audio-processing.vapi b/plugins/rtp/vapi/webrtc-audio-processing.vapi new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3-70-g09d2 From a55a10e88f88a4650aa6a83927ea38960aa26935 Mon Sep 17 00:00:00 2001 From: hrxi Date: Sat, 30 Sep 2023 03:05:11 +0200 Subject: meson: Add RTP options that are also present in the CMakeLists.txt --- meson.build | 2 +- meson_options.txt | 6 ++++++ plugins/rtp/meson.build | 31 ++++++++++++++++++++++++------- 3 files changed, 31 insertions(+), 8 deletions(-) (limited to 'plugins/rtp') diff --git a/meson.build b/meson.build index 3276158f..4ad18477 100644 --- a/meson.build +++ b/meson.build @@ -52,7 +52,7 @@ dep_libsoup = dependency('libsoup-3.0', disabler: true, required: get_option('pl dep_nice = dependency('nice', version: '>=0.1.15', disabler: true, required: get_option('plugin-ice')) dep_m = meson.get_compiler('c').find_library('m', required: false) dep_sqlite3 = dependency('sqlite3', version: '>=3.24') -dep_webrtc_audio_processing = dependency('webrtc-audio-processing', version: ['>=0.2', '<0.4'], disabler: true, required: get_option('plugin-rtp')) +dep_webrtc_audio_processing = dependency('webrtc-audio-processing', version: ['>=0.2', '<0.4'], required: get_option('plugin-rtp-webrtc-audio-processing')) prog_git = find_program('git', required: false) prog_python = python.find_installation() diff --git a/meson_options.txt b/meson_options.txt index ee0ac3c0..caee3093 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,3 +6,9 @@ option('plugin-notification-sound', type: 'feature', description: 'Sound for cha option('plugin-omemo', type: 'feature', description: 'End-to-end encryption') option('plugin-openpgp', type: 'feature', description: 'End-to-end encryption using PGP') option('plugin-rtp', type: 'feature', description: 'Voice/video calls') + +option('plugin-rtp-h264', type: 'feature', value: 'disabled', description: 'H264 codec') +option('plugin-rtp-msdk', type: 'feature', value: 'disabled', description: 'Intel MediaSDK') +option('plugin-rtp-vaapi', type: 'feature', value: 'disabled', description: 'Video Acceleration API') +option('plugin-rtp-vp9', type: 'feature', value: 'disabled', description: 'VP9 codec') +option('plugin-rtp-webrtc-audio-processing', type: 'feature', description: 'Voice preprocessing') diff --git a/plugins/rtp/meson.build b/plugins/rtp/meson.build index d4d37e36..8a72dc41 100644 --- a/plugins/rtp/meson.build +++ b/plugins/rtp/meson.build @@ -1,18 +1,18 @@ dependencies = [ + dep_crypto_vala, + dep_dino, dep_gee, dep_glib, dep_gmodule, dep_gnutls, - dep_gtk4, dep_gstreamer, dep_gstreamer_app, dep_gstreamer_audio, dep_gstreamer_rtp, dep_gstreamer_video, - dep_crypto_vala, - dep_dino, + dep_gtk4, + dep_m, dep_qlite, - dep_webrtc_audio_processing, dep_xmpp_vala, ] sources = files( @@ -24,18 +24,35 @@ sources = files( 'src/register_plugin.vala', 'src/stream.vala', 'src/video_widget.vala', - 'src/voice_processor.vala', - 'src/voice_processor_native.cpp', ) c_args = [ '-DGST_1_16', '-DGST_1_18', '-DGST_1_20', - '-DWITH_VOICE_PROCESSOR', '-DG_LOG_DOMAIN="rtp"', ] vala_args = [ '--vapidir', meson.current_source_dir() / 'vapi', ] +if dep_webrtc_audio_processing.found() + dependencies += [dep_webrtc_audio_processing] + sources += files( + 'src/voice_processor.vala', + 'src/voice_processor_native.cpp', + ) + vala_args += ['-D', 'WITH_VOICE_PROCESSOR'] +endif +if get_option('plugin-rtp-h264').allowed() + vala_args += ['-D', 'ENABLE_H264'] +endif +if get_option('plugin-rtp-msdk').allowed() + vala_args += ['-D', 'ENABLE_MSDK'] +endif +if get_option('plugin-rtp-vaapi').allowed() + vala_args += ['-D', 'ENABLE_VAAPI'] +endif +if get_option('plugin-rtp-vp9').allowed() + vala_args += ['-D', 'ENABLE_VP9'] +endif lib_rtp = shared_library('rtp', sources, name_prefix: '', c_args: c_args, vala_args: vala_args, include_directories: include_directories('src'), dependencies: dependencies, install: true, install_dir: get_option('libdir') / 'dino/plugins') dep_rtp = declare_dependency(link_with: lib_rtp, include_directories: include_directories('.')) -- cgit v1.2.3-70-g09d2 From c312fb282f3312d02779262da9bf969ddfa1e5ac Mon Sep 17 00:00:00 2001 From: hrxi Date: Sat, 30 Sep 2023 03:05:20 +0200 Subject: meson: Add version detection for some dependencies --- main/meson.build | 9 +++++++++ plugins/rtp/meson.build | 12 +++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'plugins/rtp') diff --git a/main/meson.build b/main/meson.build index f6d212f8..ccebf67d 100644 --- a/main/meson.build +++ b/main/meson.build @@ -106,6 +106,15 @@ c_args = [ vala_args = [ '--vapidir', meson.current_source_dir() / 'vapi', ] +if dep_libadwaita.version() == 'unknown' or dep_libadwaita.version().version_compare('>=1.2') + vala_args += ['-D', 'Adw_1_2'] +endif +if dep_gtk4.version() == 'unknown' or dep_gtk4.version().version_compare('>=4.6') + vala_args += ['-D', 'GTK_4_6'] +endif +if dep_gtk4.version() == 'unknown' or dep_gtk4.version().version_compare('>=4.8') + vala_args += ['-D', 'GTK_4_8'] +endif exe_dino = executable('dino', sources, c_args: c_args, vala_args: vala_args, dependencies: dependencies, install: true) install_data('data/icons/scalable/apps/im.dino.Dino-symbolic.svg', install_dir: get_option('datadir') / 'hicolor/symbolic/apps') diff --git a/plugins/rtp/meson.build b/plugins/rtp/meson.build index 8a72dc41..06821c91 100644 --- a/plugins/rtp/meson.build +++ b/plugins/rtp/meson.build @@ -26,9 +26,6 @@ sources = files( 'src/video_widget.vala', ) c_args = [ - '-DGST_1_16', - '-DGST_1_18', - '-DGST_1_20', '-DG_LOG_DOMAIN="rtp"', ] vala_args = [ @@ -42,6 +39,15 @@ if dep_webrtc_audio_processing.found() ) vala_args += ['-D', 'WITH_VOICE_PROCESSOR'] endif +if dep_gstreamer_rtp.version() == 'unknown' or dep_gstreamer_rtp.version().version_compare('>=1.16') + vala_args += ['-D', 'GST_1_16'] +endif +if dep_gstreamer_rtp.version() == 'unknown' or dep_gstreamer_rtp.version().version_compare('>=1.18') + vala_args += ['-D', 'GST_1_18'] +endif +if dep_gstreamer_rtp.version() == 'unknown' or dep_gstreamer_rtp.version().version_compare('>=1.20') + vala_args += ['-D', 'GST_1_20'] +endif if get_option('plugin-rtp-h264').allowed() vala_args += ['-D', 'ENABLE_H264'] endif -- cgit v1.2.3-70-g09d2 From 1e167eeea67f18f3d5788dc34d97d94e6f401499 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 7 Oct 2023 14:29:26 +0200 Subject: Fix some compiler warnings --- libdino/src/service/avatar_manager.vala | 6 +++--- libdino/src/service/history_sync.vala | 3 --- libdino/src/service/message_processor.vala | 1 - main/src/ui/call_window/call_window.vala | 3 ++- .../ui/conversation_content_view/conversation_view.vala | 2 +- .../ui/conversation_content_view/file_image_widget.vala | 1 - main/src/ui/conversation_details.vala | 9 ++++++--- .../ui/conversation_selector/conversation_selector.vala | 1 - main/src/ui/notifier_gnotifications.vala | 2 ++ main/src/ui/occupant_menu/list.vala | 1 - main/src/ui/util/data_forms.vala | 1 - main/src/ui/util/label_hybrid.vala | 4 ---- plugins/rtp/src/video_widget.vala | 2 +- xmpp-vala/src/core/xmpp_stream.vala | 4 ++-- xmpp-vala/src/module/xep/0082_date_time_profiles.vala | 16 ++-------------- 15 files changed, 19 insertions(+), 37 deletions(-) (limited to 'plugins/rtp') diff --git a/libdino/src/service/avatar_manager.vala b/libdino/src/service/avatar_manager.vala index 1296856b..3bd38e72 100644 --- a/libdino/src/service/avatar_manager.vala +++ b/libdino/src/service/avatar_manager.vala @@ -52,7 +52,7 @@ public class AvatarManager : StreamInteractionModule, Object { if (hash == null) return null; File file = File.new_for_path(Path.build_filename(folder, hash)); if (!file.query_exists()) { - fetch_and_store_for_jid(account, jid_); + fetch_and_store_for_jid.begin(account, jid_); return null; } else { return file; @@ -169,7 +169,7 @@ public class AvatarManager : StreamInteractionModule, Object { ); foreach (var entry in get_avatar_hashes(account, Source.USER_AVATARS).entries) { - on_user_avatar_received(account, entry.key, entry.value); + on_user_avatar_received.begin(account, entry.key, entry.value); } foreach (var entry in get_avatar_hashes(account, Source.VCARD).entries) { @@ -179,7 +179,7 @@ public class AvatarManager : StreamInteractionModule, Object { continue; } - on_vcard_avatar_received(account, entry.key, entry.value); + on_vcard_avatar_received.begin(account, entry.key, entry.value); } } diff --git a/libdino/src/service/history_sync.vala b/libdino/src/service/history_sync.vala index 0c0571bb..8ab6d7bb 100644 --- a/libdino/src/service/history_sync.vala +++ b/libdino/src/service/history_sync.vala @@ -388,9 +388,6 @@ public class Dino.HistorySync { page_result = PageResult.NoMoreMessages; } - string selection = null; - string[] selection_args = {}; - string query_id = query_params.query_id; string? after_id = query_params.start_id; diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala index 01687083..baab37ce 100644 --- a/libdino/src/service/message_processor.vala +++ b/libdino/src/service/message_processor.vala @@ -167,7 +167,6 @@ public class MessageProcessor : StreamInteractionModule, Object { new_message.counterpart = counterpart_override ?? (new_message.direction == Entities.Message.DIRECTION_SENT ? message.to : message.from); new_message.ourpart = new_message.direction == Entities.Message.DIRECTION_SENT ? message.from : message.to; - XmppStream? stream = stream_interactor.get_stream(account); Xmpp.MessageArchiveManagement.MessageFlag? mam_message_flag = Xmpp.MessageArchiveManagement.MessageFlag.get_flag(message); EntityInfo entity_info = stream_interactor.get_module(EntityInfo.IDENTITY); if (mam_message_flag != null && mam_message_flag.mam_id != null) { diff --git a/main/src/ui/call_window/call_window.vala b/main/src/ui/call_window/call_window.vala index 14b67449..08ea4b21 100644 --- a/main/src/ui/call_window/call_window.vala +++ b/main/src/ui/call_window/call_window.vala @@ -253,11 +253,12 @@ namespace Dino.Ui { } private bool on_get_child_position(Widget widget, out Gdk.Rectangle allocation) { + allocation = Gdk.Rectangle(); + if (widget == own_video_box) { int width = get_size(Orientation.HORIZONTAL); int height = get_size(Orientation.VERTICAL); - allocation = Gdk.Rectangle(); allocation.width = own_video_width; allocation.height = own_video_height; allocation.x = width - own_video_width - 20; diff --git a/main/src/ui/conversation_content_view/conversation_view.vala b/main/src/ui/conversation_content_view/conversation_view.vala index 4006a02f..33cb3b22 100644 --- a/main/src/ui/conversation_content_view/conversation_view.vala +++ b/main/src/ui/conversation_content_view/conversation_view.vala @@ -329,7 +329,7 @@ public class ConversationView : Widget, Plugins.ConversationItemCollection, Plug do_insert_item(item); } ContentMetaItem meta_item = content_populator.get_content_meta_item(content_item); - Widget w = insert_new(meta_item); + insert_new(meta_item); content_items.add(meta_item); meta_items.add(meta_item); diff --git a/main/src/ui/conversation_content_view/file_image_widget.vala b/main/src/ui/conversation_content_view/file_image_widget.vala index 43c3b74d..a3579185 100644 --- a/main/src/ui/conversation_content_view/file_image_widget.vala +++ b/main/src/ui/conversation_content_view/file_image_widget.vala @@ -45,7 +45,6 @@ public class FileImageWidget : Box { image.add_controller(gesture_click_controller); FileInfo file_info = file.query_info("*", FileQueryInfoFlags.NONE); - string? mime_type = file_info.get_content_type(); MenuButton button = new MenuButton(); button.icon_name = "view-more"; diff --git a/main/src/ui/conversation_details.vala b/main/src/ui/conversation_details.vala index 70c8ce6d..82d6ae54 100644 --- a/main/src/ui/conversation_details.vala +++ b/main/src/ui/conversation_details.vala @@ -26,15 +26,18 @@ namespace Dino.Ui.ConversationDetails { model.display_name.bind_property("display-name", view_model, "name", BindingFlags.SYNC_CREATE); model.conversation.bind_property("notify-setting", view_model, "notification", BindingFlags.SYNC_CREATE, (_, from, ref to) => { switch (model.conversation.get_notification_setting(stream_interactor)) { - case Conversation.NotifySetting.ON: + case ON: to = ViewModel.ConversationDetails.NotificationSetting.ON; break; - case Conversation.NotifySetting.OFF: + case OFF: to = ViewModel.ConversationDetails.NotificationSetting.OFF; break; - case Conversation.NotifySetting.HIGHLIGHT: + case HIGHLIGHT: to = ViewModel.ConversationDetails.NotificationSetting.HIGHLIGHT; break; + case DEFAULT: + // A "default" setting should have been resolved to the actual default value + assert_not_reached(); } return true; }); diff --git a/main/src/ui/conversation_selector/conversation_selector.vala b/main/src/ui/conversation_selector/conversation_selector.vala index 535a61b0..d16ef3ee 100644 --- a/main/src/ui/conversation_selector/conversation_selector.vala +++ b/main/src/ui/conversation_selector/conversation_selector.vala @@ -14,7 +14,6 @@ public class ConversationSelector : Widget { ListBox list_box = new ListBox() { hexpand=true }; private StreamInteractor stream_interactor; - private uint? drag_timeout; private HashMap rows = new HashMap(Conversation.hash_func, Conversation.equals_func); public ConversationSelector init(StreamInteractor stream_interactor) { diff --git a/main/src/ui/notifier_gnotifications.vala b/main/src/ui/notifier_gnotifications.vala index 90c8ca8c..4d36620d 100644 --- a/main/src/ui/notifier_gnotifications.vala +++ b/main/src/ui/notifier_gnotifications.vala @@ -109,6 +109,8 @@ namespace Dino.Ui { case ConnectionManager.ConnectionError.Source.TLS: notification.set_body("Invalid TLS certificate"); break; + default: + break; } GLib.Application.get_default().send_notification(account.id.to_string() + "-connection-error", notification); } diff --git a/main/src/ui/occupant_menu/list.vala b/main/src/ui/occupant_menu/list.vala index b9a4a74f..ce5a1981 100644 --- a/main/src/ui/occupant_menu/list.vala +++ b/main/src/ui/occupant_menu/list.vala @@ -153,7 +153,6 @@ public class List : Box { if (affiliation1 < affiliation2) return -1; else if (affiliation1 > affiliation2) return 1; else return row_wrapper1.name_label.label.collate(row_wrapper2.name_label.label); - return 0; } private int get_affiliation_ranking(Xmpp.Xep.Muc.Affiliation affiliation) { diff --git a/main/src/ui/util/data_forms.vala b/main/src/ui/util/data_forms.vala index d10196ab..39dce3ee 100644 --- a/main/src/ui/util/data_forms.vala +++ b/main/src/ui/util/data_forms.vala @@ -75,7 +75,6 @@ public static ViewModel.PreferencesRow.Any? get_data_form_field_view_model(DataF if (option.value == list_single_field.value) combobox_model.active_item = i; } combobox_model.bind_property("active-item", list_single_field, "value", BindingFlags.DEFAULT, (binding, from, ref to) => { - var src_field = (DataForms.DataForm.ListSingleField) binding.dup_target(); var active_item = (int) from; to = list_single_field.options[active_item].value; return true; diff --git a/main/src/ui/util/label_hybrid.vala b/main/src/ui/util/label_hybrid.vala index f426de7e..0059d2ae 100644 --- a/main/src/ui/util/label_hybrid.vala +++ b/main/src/ui/util/label_hybrid.vala @@ -97,10 +97,6 @@ public class EntryLabelHybrid : LabelHybrid { } } - private void on_focus_leave() { - show_label(); - } - private void update_label() { if (visibility) { label.label = entry.text; diff --git a/plugins/rtp/src/video_widget.vala b/plugins/rtp/src/video_widget.vala index f69a2ba7..05cc5a6c 100644 --- a/plugins/rtp/src/video_widget.vala +++ b/plugins/rtp/src/video_widget.vala @@ -16,7 +16,7 @@ public class Dino.Plugins.Rtp.Paintable : Gdk.Paintable, Object { public override Gdk.Paintable get_current_image() { if (image != null) return image; - return Gdk.Paintable.new_empty(0, 0); + return Gdk.Paintable.empty(0, 0); } public override int get_intrinsic_width() { diff --git a/xmpp-vala/src/core/xmpp_stream.vala b/xmpp-vala/src/core/xmpp_stream.vala index 42e90bf9..54433b67 100644 --- a/xmpp-vala/src/core/xmpp_stream.vala +++ b/xmpp-vala/src/core/xmpp_stream.vala @@ -30,9 +30,9 @@ public abstract class Xmpp.XmppStream : Object { this.remote_name = remote_name; } - public abstract async void connect() throws IOError; + public abstract new async void connect() throws IOError; - public abstract async void disconnect() throws IOError; + public abstract new async void disconnect() throws IOError; public abstract async StanzaNode read() throws IOError; diff --git a/xmpp-vala/src/module/xep/0082_date_time_profiles.vala b/xmpp-vala/src/module/xep/0082_date_time_profiles.vala index 32d4d3ac..8b40d3ac 100644 --- a/xmpp-vala/src/module/xep/0082_date_time_profiles.vala +++ b/xmpp-vala/src/module/xep/0082_date_time_profiles.vala @@ -1,23 +1,11 @@ namespace Xmpp.Xep.DateTimeProfiles { public DateTime? parse_string(string time_string) { - // TODO with glib >= 2.56 - // return new DateTime.from_iso8601(time_string, null); - - TimeVal time_val = TimeVal(); - if (time_val.from_iso8601(time_string)) { - return new DateTime.from_unix_utc(time_val.tv_sec); - } - return null; - + return new DateTime.from_iso8601(time_string, null); } - public string to_datetime(DateTime time) { - // TODO with glib >= 2.62 - // return time.to_utc().format_iso8601().to_string(); - - return time.to_utc().format("%Y-%m-%dT%H:%M:%SZ"); + return time.to_utc().format_iso8601().to_string(); } } -- cgit v1.2.3-70-g09d2