aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/utils
diff options
context:
space:
mode:
authorJirka Novak <j.novak@netsystem.cz>2021-04-14 15:47:07 +0200
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-04-15 21:19:51 +0000
commitc8479e41aef12427be96b7db7f4c6a9bf87d2216 (patch)
tree951ea3f46762d46aac3c4025d7e00422dcc9fe7b /ui/qt/utils
parent212ff30603e343929c4c22173c38b7149bc4998c (diff)
VoIP dialogs: Improvements and new functions
Changes: - RTP Player added to Telephony/RTP menu. - When openning RTP Analysis or RTP Player from RTP menu, just selected stream is added. When Ctrl is hold during opening, reverse stream is searched and added too. - RTP Player: Added tool to select/deselect all inaudible streams - RTP Player: Added Prepare Filter button - RTP Player: Added Analyze button - RTP Analysis: Added Prepare Filter button - documentation updated Code changes: - RTP Player::rescanPacket() is not fired multiple times during rate change and during dialog creation - Error shown in RTP player is cleared after every new decode of streams - RTP Player handles case when Qt do not emit stop stream event - "Select" menu code unified between dialogs> - RTP Player: Audio routing menu unified - buttons are connected to actions by signals() - Analyze dialog is called by list of rtpstream_id, not rtpstream_info
Diffstat (limited to 'ui/qt/utils')
-rw-r--r--ui/qt/utils/qt_ui_utils.cpp34
-rw-r--r--ui/qt/utils/qt_ui_utils.h18
2 files changed, 52 insertions, 0 deletions
diff --git a/ui/qt/utils/qt_ui_utils.cpp b/ui/qt/utils/qt_ui_utils.cpp
index 0535cd0b3b..016c455452 100644
--- a/ui/qt/utils/qt_ui_utils.cpp
+++ b/ui/qt/utils/qt_ui_utils.cpp
@@ -256,3 +256,37 @@ void set_action_shortcuts_visible_in_context_menu(QList<QAction *> actions)
Q_UNUSED(actions)
#endif
}
+
+QString make_filter_based_on_rtpstream_id(QVector<rtpstream_id_t *> ids)
+{
+ QStringList stream_filters;
+ QString filter;
+
+ foreach(rtpstream_id_t *id, ids) {
+ QString ip_proto = id->src_addr.type == AT_IPv6 ? "ipv6" : "ip";
+ stream_filters << QString("(%1.src==%2 && udp.srcport==%3 && %1.dst==%4 && udp.dstport==%5 && rtp.ssrc==0x%6)")
+ .arg(ip_proto) // %1
+ .arg(address_to_qstring(&id->src_addr)) // %2
+ .arg(id->src_port) // %3
+ .arg(address_to_qstring(&id->dst_addr)) // %4
+ .arg(id->dst_port) // %5
+ .arg(id->ssrc, 0, 16);
+ }
+ if (stream_filters.length() > 0) {
+ filter = stream_filters.join(" || ");
+ }
+
+ return filter;
+}
+
+QString make_filter_based_on_rtpstream_info(QVector<rtpstream_info_t *> streams)
+{
+ QVector<rtpstream_id_t *> ids;
+
+ foreach(rtpstream_info_t *stream_info, streams) {
+ ids << &stream_info->id;
+ }
+
+ return make_filter_based_on_rtpstream_id(ids);
+}
+
diff --git a/ui/qt/utils/qt_ui_utils.h b/ui/qt/utils/qt_ui_utils.h
index 9d8a56dca9..f8414b8a8a 100644
--- a/ui/qt/utils/qt_ui_utils.h
+++ b/ui/qt/utils/qt_ui_utils.h
@@ -21,6 +21,8 @@
#include <glib.h>
+#include "ui/rtp_stream.h"
+
#include <QString>
class QAction;
@@ -231,6 +233,22 @@ bool rect_on_screen(const QRect &rect);
*/
void set_action_shortcuts_visible_in_context_menu(QList<QAction *> actions);
+/**
+ * Make display filter from list of rtpstream_id
+ *
+ * @param List of ids
+ * @return Filter or empty string
+ */
+QString make_filter_based_on_rtpstream_id(QVector<rtpstream_id_t *> ids);
+
+/**
+ * Make display filter from list of rtpstream_infos
+ *
+ * @param List of streams
+ * @return Filter or empty string
+ */
+QString make_filter_based_on_rtpstream_info(QVector<rtpstream_info_t *> streams);
+
#endif /* __QT_UI_UTILS__H__ */
// XXX Add a routine to fetch the HWND corresponding to a widget using QPlatformIntegration