aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/main_window.cpp38
-rw-r--r--ui/qt/main_window.h8
-rw-r--r--ui/qt/main_window_slots.cpp78
-rw-r--r--ui/qt/rtp_analysis_dialog.cpp24
-rw-r--r--ui/qt/rtp_analysis_dialog.h8
-rw-r--r--ui/qt/rtp_audio_stream.cpp73
-rw-r--r--ui/qt/rtp_audio_stream.h11
-rw-r--r--ui/qt/rtp_player_dialog.cpp234
-rw-r--r--ui/qt/rtp_player_dialog.h17
-rw-r--r--ui/qt/rtp_player_dialog.ui8
-rw-r--r--ui/qt/rtp_stream_dialog.cpp24
-rw-r--r--ui/qt/rtp_stream_dialog.h8
-rw-r--r--ui/qt/sequence_dialog.cpp14
-rw-r--r--ui/qt/sequence_dialog.h8
-rw-r--r--ui/qt/utils/qt_ui_utils.cpp16
-rw-r--r--ui/qt/utils/qt_ui_utils.h16
-rw-r--r--ui/qt/voip_calls_dialog.cpp26
-rw-r--r--ui/qt/voip_calls_dialog.h8
18 files changed, 335 insertions, 284 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 3fc49c5be1..506926c404 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -3020,21 +3020,21 @@ frame_data * MainWindow::frameDataForRow(int row) const
return Q_NULLPTR;
}
-// Finds rtp information for selected stream and adds it to stream_infos
+// Finds rtp id for selected stream and adds it to stream_ids
// If reverse is set, tries to find reverse stream too
// Return error string if error happens
//
// Note: Caller must free each returned rtpstream_info_t
-QString MainWindow::findRtpStreams(QVector<rtpstream_info_t *> *stream_infos, bool reverse)
+QString MainWindow::findRtpStreams(QVector<rtpstream_id_t *> *stream_ids, bool reverse)
{
rtpstream_tapinfo_t tapinfo;
- rtpstream_info_t *fwd_info, *rev_info;
+ rtpstream_id_t *fwd_id, *rev_id;
const gchar filter_text[] = "rtp && rtp.version == 2 && rtp.ssrc && (ip || ipv6)";
dfilter_t *sfcode;
gchar *err_msg;
- fwd_info = rtpstream_info_malloc_and_init();
- rev_info = rtpstream_info_malloc_and_init();
+ fwd_id = g_new0(rtpstream_id_t, 1);
+ rev_id = g_new0(rtpstream_id_t, 1);
/* Try to get the hfid for "rtp.ssrc". */
int hfid_rtp_ssrc = proto_registrar_get_id_byname("rtp.ssrc");
@@ -3080,10 +3080,10 @@ QString MainWindow::findRtpStreams(QVector<rtpstream_info_t *> *stream_infos, bo
dfilter_free(sfcode);
/* OK, it is an RTP frame. Let's get the IP and port values */
- rtpstream_id_copy_pinfo(&(edt.pi), &(fwd_info->id), false);
+ rtpstream_id_copy_pinfo(&(edt.pi), fwd_id, false);
/* assume the inverse ip/port combination for the reverse direction */
- rtpstream_id_copy_pinfo(&(edt.pi), &(rev_info->id), true);
+ rtpstream_id_copy_pinfo(&(edt.pi), rev_id, true);
/* now we need the SSRC value of the current frame */
GPtrArray *gp = proto_get_finfo_ptr_array(edt.tree, hfid_rtp_ssrc);
@@ -3092,7 +3092,7 @@ QString MainWindow::findRtpStreams(QVector<rtpstream_info_t *> *stream_infos, bo
epan_dissect_cleanup(&edt);
return tr("SSRC value not found.");
}
- fwd_info->id.ssrc = fvalue_get_uinteger(&((field_info *)gp->pdata[0])->value);
+ fwd_id->ssrc = fvalue_get_uinteger(&((field_info *)gp->pdata[0])->value);
epan_dissect_cleanup(&edt);
@@ -3106,28 +3106,18 @@ QString MainWindow::findRtpStreams(QVector<rtpstream_info_t *> *stream_infos, bo
for (GList *strinfo_list = g_list_first(tapinfo.strinfo_list); strinfo_list; strinfo_list = gxx_list_next(strinfo_list)) {
rtpstream_info_t * strinfo = gxx_list_data(rtpstream_info_t*, strinfo_list);
- if (rtpstream_id_equal(&(strinfo->id), &(fwd_info->id),RTPSTREAM_ID_EQUAL_NONE))
+ if (rtpstream_id_equal(&(strinfo->id), fwd_id,RTPSTREAM_ID_EQUAL_NONE))
{
- fwd_info->packet_count = strinfo->packet_count;
- fwd_info->setup_frame_number = strinfo->setup_frame_number;
- nstime_copy(&fwd_info->start_rel_time, &strinfo->start_rel_time);
- nstime_copy(&fwd_info->stop_rel_time, &strinfo->stop_rel_time);
- nstime_copy(&fwd_info->start_abs_time, &strinfo->start_abs_time);
- *stream_infos << fwd_info;
+ *stream_ids << fwd_id;
}
- if (rtpstream_id_equal(&(strinfo->id), &(rev_info->id),RTPSTREAM_ID_EQUAL_NONE))
+ if (rtpstream_id_equal(&(strinfo->id), rev_id,RTPSTREAM_ID_EQUAL_NONE))
{
- rev_info->packet_count = strinfo->packet_count;
- rev_info->setup_frame_number = strinfo->setup_frame_number;
- nstime_copy(&rev_info->start_rel_time, &strinfo->start_rel_time);
- nstime_copy(&rev_info->stop_rel_time, &strinfo->stop_rel_time);
- nstime_copy(&rev_info->start_abs_time, &strinfo->start_abs_time);
- if (rev_info->id.ssrc == 0) {
- rev_info->id.ssrc = strinfo->id.ssrc;
+ if (rev_id->ssrc == 0) {
+ rev_id->ssrc = strinfo->id.ssrc;
}
if (reverse) {
- *stream_infos << rev_info;
+ *stream_ids << rev_id;
}
}
}
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index 145f9c9871..2f1421fe5a 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -363,9 +363,9 @@ public slots:
void on_actionViewFullScreen_triggered(bool checked);
- void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *> stream_infos);
+ void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids);
void rtpAnalysisDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
void rtpAnalysisDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids);
void rtpAnalysisDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids);
@@ -725,7 +725,7 @@ private slots:
void extcap_options_finished(int result);
void showExtcapOptionsDialog(QString & device_name);
- QString findRtpStreams(QVector<rtpstream_info_t *> *stream_infos, bool reverse);
+ QString findRtpStreams(QVector<rtpstream_id_t *> *stream_ids, bool reverse);
friend WiresharkApplication;
};
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 0f1172724c..7f2a7ceba0 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -3311,7 +3311,7 @@ static QMutex telephony_dialog_mutex;
void MainWindow::openTelephonyRtpPlayerDialog()
{
if (!rtp_player_dialog_) {
- rtp_player_dialog_ = new RtpPlayerDialog(*this, capture_file_);
+ rtp_player_dialog_ = new RtpPlayerDialog(*this, capture_file_, captureSession()->state != CAPTURE_STOPPED);
connect(rtp_player_dialog_, SIGNAL(goToPacket(int)),
packet_list_, SLOT(goToPacket(int)));
@@ -3353,12 +3353,12 @@ void MainWindow::openTelephonyVoipCallsDialog(bool all_flows)
this, SLOT(filterPackets(QString, bool)));
connect(this, SIGNAL(displayFilterSuccess(bool)),
dlg, SLOT(displayFilterSuccess(bool)));
- connect(dlg, SIGNAL(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *>)),
- this, SLOT(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *>)));
- connect(dlg, SIGNAL(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *>)),
- this, SLOT(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *>)));
- connect(dlg, SIGNAL(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *>)),
- this, SLOT(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *>)));
+ connect(dlg, SIGNAL(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *>)),
+ this, SLOT(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *>)));
+ connect(dlg, SIGNAL(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *>)),
+ this, SLOT(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *>)));
+ connect(dlg, SIGNAL(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *>)),
+ this, SLOT(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *>)));
}
dlg->show();
}
@@ -3372,12 +3372,12 @@ void MainWindow::openTelephonyRtpAnalysisDialog()
packet_list_, SLOT(goToPacket(int)));
connect(rtp_analysis_dialog_, SIGNAL(updateFilter(QString, bool)),
this, SLOT(filterPackets(QString, bool)));
- connect(rtp_analysis_dialog_, SIGNAL(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *>)),
- this, SLOT(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *>)));
- connect(rtp_analysis_dialog_, SIGNAL(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *>)),
- this, SLOT(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *>)));
- connect(rtp_analysis_dialog_, SIGNAL(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *>)),
- this, SLOT(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *>)));
+ connect(rtp_analysis_dialog_, SIGNAL(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *>)),
+ this, SLOT(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *>)));
+ connect(rtp_analysis_dialog_, SIGNAL(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *>)),
+ this, SLOT(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *>)));
+ connect(rtp_analysis_dialog_, SIGNAL(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *>)),
+ this, SLOT(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *>)));
}
rtp_analysis_dialog_->show();
}
@@ -3483,12 +3483,12 @@ void MainWindow::openTelephonyRtpStreamsDialog()
this, SLOT(filterPackets(QString, bool)));
connect(this, SIGNAL(displayFilterSuccess(bool)),
rtp_stream_dialog_, SLOT(displayFilterSuccess(bool)));
- connect(rtp_stream_dialog_, SIGNAL(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *>)),
- this, SLOT(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *>)));
- connect(rtp_stream_dialog_, SIGNAL(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *>)),
- this, SLOT(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *>)));
- connect(rtp_stream_dialog_, SIGNAL(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *>)),
- this, SLOT(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *>)));
+ connect(rtp_stream_dialog_, SIGNAL(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *>)),
+ this, SLOT(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *>)));
+ connect(rtp_stream_dialog_, SIGNAL(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *>)),
+ this, SLOT(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *>)));
+ connect(rtp_stream_dialog_, SIGNAL(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *>)),
+ this, SLOT(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *>)));
connect(rtp_stream_dialog_, SIGNAL(rtpAnalysisDialogReplaceRtpStreams(QVector<rtpstream_id_t *>)),
this, SLOT(rtpAnalysisDialogReplaceRtpStreams(QVector<rtpstream_id_t *>)));
connect(rtp_stream_dialog_, SIGNAL(rtpAnalysisDialogAddRtpStreams(QVector<rtpstream_id_t *>)),
@@ -3508,54 +3508,50 @@ void MainWindow::on_actionTelephonyRtpStreams_triggered()
void MainWindow::on_actionTelephonyRtpStreamAnalysis_triggered()
{
- QVector<rtpstream_info_t *> stream_infos;
+ QVector<rtpstream_id_t *> stream_ids;
QString err;
telephony_dialog_mutex.lock();
openTelephonyRtpAnalysisDialog();
if (QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) {
- err = findRtpStreams(&stream_infos, true);
+ err = findRtpStreams(&stream_ids, true);
} else {
- err = findRtpStreams(&stream_infos, false);
+ err = findRtpStreams(&stream_ids, false);
}
if (err != NULL) {
QMessageBox::warning(this, tr("RTP packet search failed"),
err,
QMessageBox::Ok);
} else {
- QVector<rtpstream_id_t *> ids;
- foreach(rtpstream_info_t *stream, stream_infos) {
- ids << &stream->id;
- }
- rtp_analysis_dialog_->addRtpStreams(ids);
+ rtp_analysis_dialog_->addRtpStreams(stream_ids);
}
- foreach(rtpstream_info_t *rtpstream, stream_infos) {
- rtpstream_info_free_data(rtpstream);
+ foreach(rtpstream_id_t *id, stream_ids) {
+ rtpstream_id_free(id);
}
telephony_dialog_mutex.unlock();
}
void MainWindow::on_actionTelephonyRtpPlayer_triggered()
{
- QVector<rtpstream_info_t *> stream_infos;
+ QVector<rtpstream_id_t *> stream_ids;
QString err;
telephony_dialog_mutex.lock();
openTelephonyRtpPlayerDialog();
if (QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) {
- err = findRtpStreams(&stream_infos, true);
+ err = findRtpStreams(&stream_ids, true);
} else {
- err = findRtpStreams(&stream_infos, false);
+ err = findRtpStreams(&stream_ids, false);
}
if (err != NULL) {
QMessageBox::warning(this, tr("RTP packet search failed"),
err,
QMessageBox::Ok);
} else {
- rtp_player_dialog_->addRtpStreams(stream_infos);
+ rtp_player_dialog_->addRtpStreams(stream_ids);
}
- foreach(rtpstream_info_t *rtpstream, stream_infos) {
- rtpstream_info_free_data(rtpstream);
+ foreach(rtpstream_id_t *id, stream_ids) {
+ rtpstream_id_free(id);
}
telephony_dialog_mutex.unlock();
}
@@ -4133,27 +4129,27 @@ void MainWindow::activatePluginIFToolbar(bool)
}
}
-void MainWindow::rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *> stream_infos)
+void MainWindow::rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids)
{
telephony_dialog_mutex.lock();
openTelephonyRtpPlayerDialog();
- rtp_player_dialog_->replaceRtpStreams(stream_infos);
+ rtp_player_dialog_->replaceRtpStreams(stream_ids);
telephony_dialog_mutex.unlock();
}
-void MainWindow::rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *> stream_infos)
+void MainWindow::rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids)
{
telephony_dialog_mutex.lock();
openTelephonyRtpPlayerDialog();
- rtp_player_dialog_->addRtpStreams(stream_infos);
+ rtp_player_dialog_->addRtpStreams(stream_ids);
telephony_dialog_mutex.unlock();
}
-void MainWindow::rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *> stream_infos)
+void MainWindow::rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids)
{
telephony_dialog_mutex.lock();
openTelephonyRtpPlayerDialog();
- rtp_player_dialog_->removeRtpStreams(stream_infos);
+ rtp_player_dialog_->removeRtpStreams(stream_ids);
telephony_dialog_mutex.unlock();
}
diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp
index 9ad1c9d69b..34e01db77d 100644
--- a/ui/qt/rtp_analysis_dialog.cpp
+++ b/ui/qt/rtp_analysis_dialog.cpp
@@ -785,35 +785,35 @@ void RtpAnalysisDialog::updateGraph()
ui->streamGraph->replot();
}
-QVector<rtpstream_info_t *>RtpAnalysisDialog::getSelectedRtpStreams()
+QVector<rtpstream_id_t *>RtpAnalysisDialog::getSelectedRtpIds()
{
- QVector<rtpstream_info_t *> stream_infos;
+ QVector<rtpstream_id_t *> stream_ids;
for(int i=0; i < tabs_.count(); i++) {
- stream_infos << &tabs_[i]->stream;
+ stream_ids << &(tabs_[i]->stream.id);
}
- return stream_infos;
+ return stream_ids;
}
void RtpAnalysisDialog::rtpPlayerReplace()
{
if (tabs_.count() < 1) return;
- emit rtpPlayerDialogReplaceRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogReplaceRtpStreams(getSelectedRtpIds());
}
void RtpAnalysisDialog::rtpPlayerAdd()
{
if (tabs_.count() < 1) return;
- emit rtpPlayerDialogAddRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogAddRtpStreams(getSelectedRtpIds());
}
void RtpAnalysisDialog::rtpPlayerRemove()
{
if (tabs_.count() < 1) return;
- emit rtpPlayerDialogRemoveRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogRemoveRtpStreams(getSelectedRtpIds());
}
void RtpAnalysisDialog::saveCsvData(QFile *save_file, QTreeWidget *tree)
@@ -1086,9 +1086,9 @@ QPushButton *RtpAnalysisDialog::addAnalyzeButton(QDialogButtonBox *button_box, Q
void RtpAnalysisDialog::on_actionPrepareFilterOne_triggered()
{
if ((ui->tabWidget->currentIndex() < (ui->tabWidget->count()-1))) {
- QVector<rtpstream_info_t *> streams;
- streams << &tabs_[ui->tabWidget->currentIndex()]->stream;
- QString filter = make_filter_based_on_rtpstream_info(streams);
+ QVector<rtpstream_id_t *> ids;
+ ids << &(tabs_[ui->tabWidget->currentIndex()]->stream.id);
+ QString filter = make_filter_based_on_rtpstream_id(ids);
if (filter.length() > 0) {
emit updateFilter(filter);
}
@@ -1097,8 +1097,8 @@ void RtpAnalysisDialog::on_actionPrepareFilterOne_triggered()
void RtpAnalysisDialog::on_actionPrepareFilterAll_triggered()
{
- QVector<rtpstream_info_t *>streams = getSelectedRtpStreams();
- QString filter = make_filter_based_on_rtpstream_info(streams);
+ QVector<rtpstream_id_t *>ids = getSelectedRtpIds();
+ QString filter = make_filter_based_on_rtpstream_id(ids);
if (filter.length() > 0) {
emit updateFilter(filter);
}
diff --git a/ui/qt/rtp_analysis_dialog.h b/ui/qt/rtp_analysis_dialog.h
index 92545e843f..76ac38250f 100644
--- a/ui/qt/rtp_analysis_dialog.h
+++ b/ui/qt/rtp_analysis_dialog.h
@@ -81,9 +81,9 @@ public:
signals:
void goToPacket(int packet_num);
- void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *> stream_infos);
+ void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids);
void updateFilter(QString filter, bool force = false);
public slots:
@@ -142,7 +142,7 @@ private:
bool eventFilter(QObject*, QEvent* event);
- QVector<rtpstream_info_t *>getSelectedRtpStreams();
+ QVector<rtpstream_id_t *>getSelectedRtpIds();
int addTabUI(tab_info_t *new_tab);
tab_info_t *getTabInfoForCurrentTab();
void deleteTabInfo(tab_info_t *tab_info);
diff --git a/ui/qt/rtp_audio_stream.cpp b/ui/qt/rtp_audio_stream.cpp
index 4ec2a14146..3c2ac0d3d3 100644
--- a/ui/qt/rtp_audio_stream.cpp
+++ b/ui/qt/rtp_audio_stream.cpp
@@ -24,6 +24,7 @@
#include <ui/rtp_media.h>
#include <ui/rtp_stream.h>
+#include <ui/tap-rtp-common.h>
#include <wsutil/nstime.h>
@@ -43,29 +44,32 @@
static const spx_int16_t visual_sample_rate_ = 1000;
-RtpAudioStream::RtpAudioStream(QObject *parent, rtpstream_info_t *rtpstream, bool stereo_required) :
- QObject(parent),
- sample_file_(NULL),
- sample_file_frame_(NULL),
- decoders_hash_(rtp_decoder_hash_table_new()),
- global_start_rel_time_(0.0),
- start_abs_offset_(0.0),
- start_rel_time_(0.0),
- stop_rel_time_(0.0),
- stereo_required_(stereo_required),
- first_sample_rate_(0),
- audio_out_rate_(0),
- audio_requested_out_rate_(0),
- audio_resampler_(0),
- audio_output_(NULL),
- max_sample_val_(1),
- max_sample_val_used_(1),
- color_(0),
- jitter_buffer_size_(50),
- timing_mode_(RtpAudioStream::JitterBuffer),
- start_play_time_(0)
-{
- rtpstream_id_copy(&rtpstream->id, &id_);
+RtpAudioStream::RtpAudioStream(QObject *parent, rtpstream_id_t *id, bool stereo_required) :
+ QObject(parent)
+ , first_packet_(true)
+ , sample_file_(NULL)
+ , sample_file_frame_(NULL)
+ , decoders_hash_(rtp_decoder_hash_table_new())
+ , global_start_rel_time_(0.0)
+ , start_abs_offset_(0.0)
+ , start_rel_time_(0.0)
+ , stop_rel_time_(0.0)
+ , stereo_required_(stereo_required)
+ , first_sample_rate_(0)
+ , audio_out_rate_(0)
+ , audio_requested_out_rate_(0)
+ , audio_resampler_(0)
+ , audio_output_(NULL)
+ , max_sample_val_(1)
+ , max_sample_val_used_(1)
+ , color_(0)
+ , jitter_buffer_size_(50)
+ , timing_mode_(RtpAudioStream::JitterBuffer)
+ , start_play_time_(0)
+{
+ rtpstream_id_copy(id, &id_);
+ memset(&rtpstream_, 0, sizeof(rtpstream_));
+ rtpstream_id_copy(&id_, &rtpstream_.id);
// Rates will be set later, we just init visual resampler
visual_resampler_ = speex_resampler_init(1, visual_sample_rate_,
@@ -77,6 +81,7 @@ RtpAudioStream::RtpAudioStream(QObject *parent, rtpstream_info_t *rtpstream, boo
// We are out of file resources
delete sample_file_;
speex_resampler_destroy(visual_resampler_);
+ rtpstream_info_free_data(&rtpstream_);
rtpstream_id_free(&id_);
qWarning() << "Can't create temp file in " << tempname;
throw -1;
@@ -87,6 +92,7 @@ RtpAudioStream::RtpAudioStream(QObject *parent, rtpstream_info_t *rtpstream, boo
delete sample_file_;
delete sample_file_frame_;
speex_resampler_destroy(visual_resampler_);
+ rtpstream_info_free_data(&rtpstream_);
rtpstream_id_free(&id_);
qWarning() << "Can't create temp file in " << tempname;
throw -1;
@@ -106,6 +112,7 @@ RtpAudioStream::~RtpAudioStream()
g_hash_table_destroy(decoders_hash_);
if (audio_resampler_) speex_resampler_destroy(audio_resampler_);
speex_resampler_destroy(visual_resampler_);
+ rtpstream_info_free_data(&rtpstream_);
rtpstream_id_free(&id_);
if (sample_file_) delete sample_file_;
if (sample_file_frame_) delete sample_file_frame_;
@@ -113,10 +120,10 @@ RtpAudioStream::~RtpAudioStream()
if (audio_output_) delete audio_output_;
}
-bool RtpAudioStream::isMatch(const rtpstream_info_t *rtpstream) const
+bool RtpAudioStream::isMatch(const rtpstream_id_t *id) const
{
- if (rtpstream
- && rtpstream_id_equal(&id_, &(rtpstream->id), RTPSTREAM_ID_EQUAL_SSRC))
+ if (id
+ && rtpstream_id_equal(&id_, id, RTPSTREAM_ID_EQUAL_SSRC))
return true;
return false;
}
@@ -133,6 +140,12 @@ void RtpAudioStream::addRtpPacket(const struct _packet_info *pinfo, const struct
{
if (!rtp_info) return;
+ if (first_packet_) {
+ rtpstream_info_analyse_init(&rtpstream_, pinfo, rtp_info);
+ first_packet_ = false;
+ }
+ rtpstream_info_analyse_process(&rtpstream_, pinfo, rtp_info);
+
rtp_packet_t *rtp_packet = g_new0(rtp_packet_t, 1);
rtp_packet->info = (struct _rtp_info *) g_memdup2(rtp_info, sizeof(struct _rtp_info));
if (rtp_info->info_all_data_present && (rtp_info->info_payload_len != 0)) {
@@ -159,6 +172,10 @@ void RtpAudioStream::clearPackets()
g_free(rtp_packet);
}
rtp_packets_.clear();
+ rtpstream_info_free_data(&rtpstream_);
+ memset(&rtpstream_, 0, sizeof(rtpstream_));
+ rtpstream_id_copy(&id_, &rtpstream_.id);
+ first_packet_ = true;
}
void RtpAudioStream::reset(double global_start_time)
@@ -685,8 +702,8 @@ const QString RtpAudioStream::formatDescription(const QAudioFormat &format)
QString RtpAudioStream::getIDAsQString()
{
- gchar *src_addr_str = address_to_display(NULL, &(id_.src_addr));
- gchar *dst_addr_str = address_to_display(NULL, &(id_.dst_addr));
+ gchar *src_addr_str = address_to_display(NULL, &id_.src_addr);
+ gchar *dst_addr_str = address_to_display(NULL, &id_.dst_addr);
QString str = QString("%1:%2 - %3:%4 %5")
.arg(src_addr_str)
.arg(id_.src_port)
diff --git a/ui/qt/rtp_audio_stream.h b/ui/qt/rtp_audio_stream.h
index 2f062eb0d9..44449c19f4 100644
--- a/ui/qt/rtp_audio_stream.h
+++ b/ui/qt/rtp_audio_stream.h
@@ -49,9 +49,9 @@ class RtpAudioStream : public QObject
public:
enum TimingMode { JitterBuffer, RtpTimestamp, Uninterrupted };
- explicit RtpAudioStream(QObject *parent, rtpstream_info_t *rtpstream, bool stereo_required);
+ explicit RtpAudioStream(QObject *parent, rtpstream_id_t *id, bool stereo_required);
~RtpAudioStream();
- bool isMatch(const rtpstream_info_t *rtpstream) const;
+ bool isMatch(const rtpstream_id_t *id) const;
bool isMatch(const struct _packet_info *pinfo, const struct _rtp_info *rtp_info) const;
void addRtpPacket(const struct _packet_info *pinfo, const struct _rtp_info *rtp_info);
void clearPackets();
@@ -154,9 +154,10 @@ public:
qint64 getLeadSilenceSamples() { return prepend_samples_; }
qint64 getTotalSamples() { return (sample_file_->size()/(qint64)sizeof(SAMPLE)); }
bool savePayload(QIODevice *file);
- guint getHash() { return rtpstream_id_to_hash(&id_); }
- rtpstream_id_t *getID() { return &id_; }
+ guint getHash() { return rtpstream_id_to_hash(&(id_)); }
+ rtpstream_id_t *getID() { return &(id_); }
QString getIDAsQString();
+ rtpstream_info_t *getStreamInfo() { return &rtpstream_; }
signals:
void processedSecs(double secs);
@@ -167,6 +168,8 @@ private:
// Used to identify unique streams.
// The GTK+ UI also uses the call number + current channel.
rtpstream_id_t id_;
+ rtpstream_info_t rtpstream_;
+ bool first_packet_;
QVector<struct _rtp_packet *>rtp_packets_;
QIODevice *sample_file_; // Stores waveform samples
diff --git a/ui/qt/rtp_player_dialog.cpp b/ui/qt/rtp_player_dialog.cpp
index 5cb6c6be7b..f174434e9c 100644
--- a/ui/qt/rtp_player_dialog.cpp
+++ b/ui/qt/rtp_player_dialog.cpp
@@ -130,7 +130,7 @@ public:
}
};
-RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf) :
+RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf, bool capture_running) :
WiresharkDialog(parent, cf)
#ifdef QT_MULTIMEDIA_LIB
, ui(new Ui::RtpPlayerDialog)
@@ -149,6 +149,7 @@ RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf) :
, listener_removed_(true)
, block_redraw_(false)
, lock_ui_(0)
+ , read_capture_enabled_(capture_running)
{
ui->setupUi(this);
loadGeometry(parent.width(), parent.height());
@@ -216,6 +217,11 @@ RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf) :
ui->stopButton->setIcon(StockIcon("media-playback-stop"));
ui->stopButton->setEnabled(false);
+ read_btn_ = ui->buttonBox->addButton(ui->actionReadCapture->text(), QDialogButtonBox::ActionRole);
+ read_btn_->setToolTip(ui->actionReadCapture->toolTip());
+ read_btn_->setEnabled(false);
+ connect(read_btn_, SIGNAL(pressed()), this, SLOT(on_actionReadCapture_triggered()));
+
inaudible_btn_ = ui->buttonBox->addButton(ui->actionInaudibleButton->text(), QDialogButtonBox::ActionRole);
inaudible_btn_->setToolTip(ui->actionInaudibleButton->toolTip());
inaudible_btn_->setEnabled(false);
@@ -281,6 +287,9 @@ RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf) :
graph_ctx_menu_->addAction(ui->actionRemoveStream);
list_ctx_menu_->addAction(ui->actionGoToSetupPacketTree);
set_action_shortcuts_visible_in_context_menu(list_ctx_menu_->actions());
+
+ connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent)),
+ this, SLOT(captureEvent(CaptureEvent)));
#endif // QT_MULTIMEDIA_LIB
}
@@ -391,6 +400,7 @@ void RtpPlayerDialog::retapPackets()
remove_tap_listener(this);
listener_removed_ = true;
}
+ fillTappedColumns();
rescanPackets(true);
}
unlockUI();
@@ -585,40 +595,20 @@ void RtpPlayerDialog::createPlot(bool rescale_axes)
if (rescale_axes) resetXAxis();
}
-void RtpPlayerDialog::addSingleRtpStream(rtpstream_info_t *rtpstream)
+void RtpPlayerDialog::fillTappedColumns()
{
- bool found = false;
+ // true just for first stream
+ bool is_first = true;
- AudioRouting audio_routing = AudioRouting(AUDIO_UNMUTED, channel_mono);
-
- if (!rtpstream) return;
+ // Get all rows, immutable list. Later changes in rows migth reorder them
+ QList<QTreeWidgetItem *> items = ui->streamTreeWidget->findItems(
+ QString("*"), Qt::MatchWrap | Qt::MatchWildcard | Qt::MatchRecursive);
- // Find the RTP streams associated with this conversation.
- // gtk/rtp_player.c:mark_rtp_stream_to_play does this differently.
-
- QList<RtpAudioStream *> streams = stream_hash_.values(rtpstream_to_hash(rtpstream));
- for (int i = 0; i < streams.size(); i++) {
- RtpAudioStream *row_stream = streams.at(i);
- if (row_stream->isMatch(rtpstream)) {
- found = true;
- break;
- }
- }
-
- int tli_count = ui->streamTreeWidget->topLevelItemCount();
-
- if (!found) {
- try {
- RtpAudioStream *audio_stream = new RtpAudioStream(this, rtpstream, stereo_available_);
- audio_stream->setColor(ColorUtils::graphColor(tli_count));
-
- QTreeWidgetItem *ti = new RtpPlayerTreeWidgetItem(ui->streamTreeWidget);
- stream_hash_.insert(rtpstream_to_hash(rtpstream), audio_stream);
- ti->setText(src_addr_col_, address_to_qstring(&rtpstream->id.src_addr));
- ti->setText(src_port_col_, QString::number(rtpstream->id.src_port));
- ti->setText(dst_addr_col_, address_to_qstring(&rtpstream->id.dst_addr));
- ti->setText(dst_port_col_, QString::number(rtpstream->id.dst_port));
- ti->setText(ssrc_col_, int_to_qstring(rtpstream->id.ssrc, 8, 16));
+ // Update rows by calculated values, it might reorder them in view...
+ foreach(QTreeWidgetItem *ti, items) {
+ RtpAudioStream *audio_stream = ti->data(stream_data_col_, Qt::UserRole).value<RtpAudioStream*>();
+ if (audio_stream) {
+ rtpstream_info_t *rtpstream = audio_stream->getStreamInfo();
// 0xFFFFFFFF mean no setup frame
// first_packet_num == setup_frame_number happens, when
@@ -635,43 +625,82 @@ void RtpPlayerDialog::addSingleRtpStream(rtpstream_info_t *rtpstream)
ti->setData(first_pkt_col_, Qt::UserRole, QVariant(packet));
}
ti->setText(num_pkts_col_, QString::number(rtpstream->packet_count));
+ updateStartStopTime(rtpstream, is_first);
+ is_first = false;
+ }
+ }
+ setMarkers();
+}
- ti->setData(stream_data_col_, Qt::UserRole, QVariant::fromValue(audio_stream));
- if (stereo_available_) {
- if (tli_count%2) {
- audio_routing.setChannel(channel_stereo_right);
- } else {
- audio_routing.setChannel(channel_stereo_left);
- }
- } else {
- audio_routing.setChannel(channel_mono);
- }
- ti->setToolTip(channel_col_, QString(tr("Double click on cell to change audio routing")));
- formatAudioRouting(ti, audio_routing);
- audio_stream->setAudioRouting(audio_routing);
-
- for (int col = 0; col < ui->streamTreeWidget->columnCount(); col++) {
- QBrush fgBrush = ti->foreground(col);
- fgBrush.setColor(audio_stream->color());
- ti->setForeground(col, fgBrush);
- }
+void RtpPlayerDialog::addSingleRtpStream(rtpstream_id_t *id)
+{
+ bool found = false;
- connect(audio_stream, SIGNAL(finishedPlaying(RtpAudioStream *, QAudio::Error)), this, SLOT(playFinished(RtpAudioStream *, QAudio::Error)));
- connect(audio_stream, SIGNAL(playbackError(QString)), this, SLOT(setPlaybackError(QString)));
- } catch (...) {
- qWarning() << "Stream ignored, try to add fewer streams to playlist";
+ AudioRouting audio_routing = AudioRouting(AUDIO_UNMUTED, channel_mono);
+
+ if (!id) return;
+
+ // Find the RTP streams associated with this conversation.
+ // gtk/rtp_player.c:mark_rtp_stream_to_play does this differently.
+
+ QList<RtpAudioStream *> streams = stream_hash_.values(rtpstream_id_to_hash(id));
+ for (int i = 0; i < streams.size(); i++) {
+ RtpAudioStream *row_stream = streams.at(i);
+ if (row_stream->isMatch(id)) {
+ found = true;
+ break;
}
}
- // Update start/stop time nevertheless stream is new or already seen
- // because voip_calls_dialog.cpp splits same stream to multiple pieces
- updateStartStopTime(rtpstream, tli_count);
- RTP_STREAM_DEBUG("adding stream %d to layout, %u packets, start %u",
- ui->streamTreeWidget->topLevelItemCount(),
- rtpstream->packet_count,
- rtpstream->start_fd ? rtpstream->start_fd->num : 0);
+ if (found) {
+ return;
+ }
+
+ try {
+ int tli_count = ui->streamTreeWidget->topLevelItemCount();
+
+ RtpAudioStream *audio_stream = new RtpAudioStream(this, id, stereo_available_);
+ audio_stream->setColor(ColorUtils::graphColor(tli_count));
+
+ QTreeWidgetItem *ti = new RtpPlayerTreeWidgetItem(ui->streamTreeWidget);
+ stream_hash_.insert(rtpstream_id_to_hash(id), audio_stream);
+ ti->setText(src_addr_col_, address_to_qstring(&(id->src_addr)));
+ ti->setText(src_port_col_, QString::number(id->src_port));
+ ti->setText(dst_addr_col_, address_to_qstring(&(id->dst_addr)));
+ ti->setText(dst_port_col_, QString::number(id->dst_port));
+ ti->setText(ssrc_col_, int_to_qstring(id->ssrc, 8, 16));
+
+ // Calculated items are updated after every retapPackets()
+
+ ti->setData(stream_data_col_, Qt::UserRole, QVariant::fromValue(audio_stream));
+ if (stereo_available_) {
+ if (tli_count%2) {
+ audio_routing.setChannel(channel_stereo_right);
+ } else {
+ audio_routing.setChannel(channel_stereo_left);
+ }
+ } else {
+ audio_routing.setChannel(channel_mono);
+ }
+ ti->setToolTip(channel_col_, QString(tr("Double click on cell to change audio routing")));
+ formatAudioRouting(ti, audio_routing);
+ audio_stream->setAudioRouting(audio_routing);
+
+ for (int col = 0; col < ui->streamTreeWidget->columnCount(); col++) {
+ QBrush fgBrush = ti->foreground(col);
+ fgBrush.setColor(audio_stream->color());
+ ti->setForeground(col, fgBrush);
+ }
+ connect(audio_stream, SIGNAL(finishedPlaying(RtpAudioStream *, QAudio::Error)), this, SLOT(playFinished(RtpAudioStream *, QAudio::Error)));
+ connect(audio_stream, SIGNAL(playbackError(QString)), this, SLOT(setPlaybackError(QString)));
+ } catch (...) {
+ qWarning() << "Stream ignored, try to add fewer streams to playlist";
+ }
+
+ RTP_STREAM_DEBUG("adding stream %d to layout",
+ ui->streamTreeWidget->topLevelItemCount());
}
void RtpPlayerDialog::lockUI()
@@ -691,7 +720,7 @@ void RtpPlayerDialog::unlockUI()
}
}
-void RtpPlayerDialog::replaceRtpStreams(QVector<rtpstream_info_t *> stream_infos)
+void RtpPlayerDialog::replaceRtpStreams(QVector<rtpstream_id_t *> stream_ids)
{
lockUI();
@@ -707,8 +736,8 @@ void RtpPlayerDialog::replaceRtpStreams(QVector<rtpstream_info_t *> stream_infos
}
// Add all new streams
- for (int i=0; i < stream_infos.size(); i++) {
- addSingleRtpStream(stream_infos[i]);
+ for (int i=0; i < stream_ids.size(); i++) {
+ addSingleRtpStream(stream_ids[i]);
}
setMarkers();
@@ -718,15 +747,15 @@ void RtpPlayerDialog::replaceRtpStreams(QVector<rtpstream_info_t *> stream_infos
#endif
}
-void RtpPlayerDialog::addRtpStreams(QVector<rtpstream_info_t *> stream_infos)
+void RtpPlayerDialog::addRtpStreams(QVector<rtpstream_id_t *> stream_ids)
{
lockUI();
int tli_count = ui->streamTreeWidget->topLevelItemCount();
// Add new streams
- for (int i=0; i < stream_infos.size(); i++) {
- addSingleRtpStream(stream_infos[i]);
+ for (int i=0; i < stream_ids.size(); i++) {
+ addSingleRtpStream(stream_ids[i]);
}
if (tli_count == 0) {
@@ -739,21 +768,16 @@ void RtpPlayerDialog::addRtpStreams(QVector<rtpstream_info_t *> stream_infos)
#endif
}
-void RtpPlayerDialog::removeRtpStreams(QVector<rtpstream_info_t *> stream_infos)
+void RtpPlayerDialog::removeRtpStreams(QVector<rtpstream_id_t *> stream_ids)
{
lockUI();
int tli_count = ui->streamTreeWidget->topLevelItemCount();
- if (last_ti_) {
- highlightItem(last_ti_, false);
- last_ti_ = NULL;
- }
-
- for (int i=0; i < stream_infos.size(); i++) {
+ for (int i=0; i < stream_ids.size(); i++) {
for (int row = 0; row < tli_count; row++) {
QTreeWidgetItem *ti = ui->streamTreeWidget->topLevelItem(row);
RtpAudioStream *row_stream = ti->data(stream_data_col_, Qt::UserRole).value<RtpAudioStream*>();
- if (row_stream->isMatch(stream_infos[i])) {
+ if (row_stream->isMatch(stream_ids[i])) {
removeRow(ti);
tli_count--;
break;
@@ -953,6 +977,7 @@ void RtpPlayerDialog::updateWidgets()
ui->timingComboBox->setEnabled(enable_timing);
ui->todCheckBox->setEnabled(enable_timing);
+ read_btn_->setEnabled(read_capture_enabled_);
inaudible_btn_->setEnabled(count > 0);
analyze_btn_->setEnabled(selected > 0);
prepare_btn_->setEnabled(selected > 0);
@@ -1064,7 +1089,7 @@ QTreeWidgetItem *RtpPlayerDialog::findItem(QCPAbstractPlottable *plottable)
for (int row = 0; row < ui->streamTreeWidget->topLevelItemCount(); row++) {
QTreeWidgetItem *ti = ui->streamTreeWidget->topLevelItem(row);
RtpAudioGraph *audio_graph = ti->data(graph_audio_data_col_, Qt::UserRole).value<RtpAudioGraph*>();
- if (audio_graph->isMyPlottable(plottable)) {
+ if (audio_graph && audio_graph->isMyPlottable(plottable)) {
return ti;
}
}
@@ -1488,6 +1513,10 @@ void RtpPlayerDialog::on_streamTreeWidget_itemDoubleClicked(QTreeWidgetItem *ite
void RtpPlayerDialog::removeRow(QTreeWidgetItem *ti)
{
+ if (last_ti_ && (last_ti_ == ti)) {
+ highlightItem(last_ti_, false);
+ last_ti_ = NULL;
+ }
RtpAudioStream *audio_stream = ti->data(stream_data_col_, Qt::UserRole).value<RtpAudioStream*>();
if (audio_stream) {
stream_hash_.remove(audio_stream->getHash(), audio_stream);
@@ -1535,11 +1564,6 @@ void RtpPlayerDialog::on_actionRemoveStream_triggered()
QList<QTreeWidgetItem *> items = ui->streamTreeWidget->selectedItems();
block_redraw_ = true;
- if (last_ti_) {
- highlightItem(last_ti_, false);
- last_ti_ = NULL;
- }
- //for(int i = 0; i<items.count(); i++ ) {
for(int i = items.count() - 1; i>=0; i-- ) {
removeRow(items[i]);
}
@@ -1847,14 +1871,14 @@ void RtpPlayerDialog::setStartPlayMarker(double new_time)
}
}
-void RtpPlayerDialog::updateStartStopTime(rtpstream_info_t *rtpstream, int tli_count)
+void RtpPlayerDialog::updateStartStopTime(rtpstream_info_t *rtpstream, bool is_first)
{
- // Calculate start time of first stream and end time of last stream
+ // Calculate start time of first last packet of last stream
double stream_rel_start_time = nstime_to_sec(&rtpstream->start_rel_time);
double stream_abs_start_time = nstime_to_sec(&rtpstream->start_abs_time);
double stream_rel_stop_time = nstime_to_sec(&rtpstream->stop_rel_time);
- if (tli_count == 0) {
+ if (is_first) {
// Take start/stop time for first stream
first_stream_rel_start_time_ = stream_rel_start_time;
first_stream_abs_start_time_ = stream_abs_start_time;
@@ -2409,5 +2433,45 @@ void RtpPlayerDialog::rtpAnalysisRemove()
emit rtpAnalysisDialogRemoveRtpStreams(getSelectedRtpStreamIDs());
}
+void RtpPlayerDialog::on_actionReadCapture_triggered()
+{
+#ifdef QT_MULTIMEDIA_LIB
+ QTimer::singleShot(0, this, SLOT(retapPackets()));
+#endif
+}
+
+// _U_ is used for case w have no LIBPCAP
+void RtpPlayerDialog::captureEvent(CaptureEvent e _U_)
+{
+#ifdef HAVE_LIBPCAP
+ bool new_read_capture_enabled = false;
+ bool found = false;
+
+ if ((e.captureContext() & CaptureEvent::Capture) &&
+ (e.eventType() == CaptureEvent::Prepared)
+ ) {
+ new_read_capture_enabled = true;
+ found = true;
+ } else if ((e.captureContext() & CaptureEvent::Capture) &&
+ (e.eventType() == CaptureEvent::Finished)
+ ) {
+ new_read_capture_enabled = false;
+ found = true;
+ }
+
+ if (found) {
+ bool retap = false;
+ if (read_capture_enabled_ && !new_read_capture_enabled) {
+ // Capturing ended, automatically refresh data
+ retap = true;
+ }
+ read_capture_enabled_ = new_read_capture_enabled;
+ updateWidgets();
+ if (retap) {
+ QTimer::singleShot(0, this, SLOT(retapPackets()));
+ }
+ }
+#endif
+}
#endif // QT_MULTIMEDIA_LIB
diff --git a/ui/qt/rtp_player_dialog.h b/ui/qt/rtp_player_dialog.h
index ce7a15ec45..505265ff8f 100644
--- a/ui/qt/rtp_player_dialog.h
+++ b/ui/qt/rtp_player_dialog.h
@@ -56,7 +56,7 @@ class RtpPlayerDialog : public WiresharkDialog
#endif
public:
- explicit RtpPlayerDialog(QWidget &parent, CaptureFile &cf);
+ explicit RtpPlayerDialog(QWidget &parent, CaptureFile &cf, bool capture_running);
/**
* @brief Common routine to add a "Play call" button to a QDialogButtonBox.
@@ -80,9 +80,9 @@ public:
*
* @param stream_infos struct with rtpstream info
*/
- void replaceRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void addRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void removeRtpStreams(QVector<rtpstream_info_t *> stream_infos);
+ void replaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void addRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void removeRtpStreams(QVector<rtpstream_id_t *> stream_ids);
signals:
// Tells the packet list to redraw. An alternative might be to add a
@@ -110,6 +110,7 @@ private slots:
* streams added using ::addRtpStream.
*/
void retapPackets();
+ void captureEvent(CaptureEvent e);
/** Clear, decode, and redraw each stream.
*/
void rescanPackets(bool rescale_axes = false);
@@ -171,6 +172,7 @@ private slots:
void on_actionSelectInaudible_triggered();
void on_actionDeselectInaudible_triggered();
void on_actionPrepareFilter_triggered();
+ void on_actionReadCapture_triggered();
private:
Ui::RtpPlayerDialog *ui;
@@ -193,6 +195,7 @@ private:
quint32 marker_stream_requested_out_rate_;
QTreeWidgetItem *last_ti_;
bool listener_removed_;
+ QPushButton *read_btn_;
QPushButton *inaudible_btn_;
QPushButton *analyze_btn_;
QPushButton *prepare_btn_;
@@ -200,6 +203,7 @@ private:
QMultiHash<guint, RtpAudioStream *> stream_hash_;
bool block_redraw_;
int lock_ui_;
+ bool read_capture_enabled_;
// const QString streamKey(const rtpstream_info_t *rtpstream);
// const QString streamKey(const packet_info *pinfo, const struct _rtp_info *rtpinfo);
@@ -219,7 +223,7 @@ private:
double getStartPlayMarker();
void drawStartPlayMarker();
void setStartPlayMarker(double new_time);
- void updateStartStopTime(rtpstream_info_t *rtpstream, int tli_count);
+ void updateStartStopTime(rtpstream_info_t *rtpstream, bool is_first);
void formatAudioRouting(QTreeWidgetItem *ti, AudioRouting audio_routing);
bool isStereoAvailable();
QAudioOutput *getSilenceAudioOutput();
@@ -230,7 +234,7 @@ private:
void highlightItem(QTreeWidgetItem *ti, bool highlight);
void invertSelection();
void handleGoToSetupPacket(QTreeWidgetItem *ti);
- void addSingleRtpStream(rtpstream_info_t *rtpstream);
+ void addSingleRtpStream(rtpstream_id_t *id);
void removeRow(QTreeWidgetItem *ti);
void fillAudioRateMenu();
void cleanupMarkerStream();
@@ -247,6 +251,7 @@ private:
void unlockUI();
void selectInaudible(bool select);
QVector<rtpstream_id_t *>getSelectedRtpStreamIDs();
+ void fillTappedColumns();
#else // QT_MULTIMEDIA_LIB
private:
diff --git a/ui/qt/rtp_player_dialog.ui b/ui/qt/rtp_player_dialog.ui
index 6d13973395..9833a1c07b 100644
--- a/ui/qt/rtp_player_dialog.ui
+++ b/ui/qt/rtp_player_dialog.ui
@@ -687,6 +687,14 @@
<string>Prepare a filter matching the selected stream(s).</string>
</property>
</action>
+ <action name="actionReadCapture">
+ <property name="text">
+ <string>R&amp;efresh streams</string>
+ </property>
+ <property name="toolTip">
+ <string>Read captured packets from capture in progress to player</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
diff --git a/ui/qt/rtp_stream_dialog.cpp b/ui/qt/rtp_stream_dialog.cpp
index a2a11735fe..0dc15de580 100644
--- a/ui/qt/rtp_stream_dialog.cpp
+++ b/ui/qt/rtp_stream_dialog.cpp
@@ -815,8 +815,8 @@ void RtpStreamDialog::on_actionMarkPackets_triggered()
void RtpStreamDialog::on_actionPrepareFilter_triggered()
{
- QVector<rtpstream_info_t *> streams = getSelectedRtpStreams();
- QString filter = make_filter_based_on_rtpstream_info(streams);
+ QVector<rtpstream_id_t *> ids = getSelectedRtpIds();
+ QString filter = make_filter_based_on_rtpstream_id(ids);
if (filter.length() > 0) {
remove_tap_listener_rtpstream(&tapinfo_);
emit updateFilter(filter);
@@ -871,61 +871,61 @@ void RtpStreamDialog::on_actionSelectNone_triggered()
ui->streamTreeWidget->clearSelection();
}
-QVector<rtpstream_info_t *>RtpStreamDialog::getSelectedRtpStreams()
+QVector<rtpstream_id_t *>RtpStreamDialog::getSelectedRtpIds()
{
// Gather up our selected streams...
- QVector<rtpstream_info_t *> stream_infos;
+ QVector<rtpstream_id_t *> stream_ids;
foreach(QTreeWidgetItem *ti, ui->streamTreeWidget->selectedItems()) {
RtpStreamTreeWidgetItem *rsti = static_cast<RtpStreamTreeWidgetItem*>(ti);
rtpstream_info_t *selected_stream = rsti->streamInfo();
if (selected_stream) {
- stream_infos << selected_stream;
+ stream_ids << &(selected_stream->id);
}
}
- return stream_infos;
+ return stream_ids;
}
void RtpStreamDialog::rtpPlayerReplace()
{
if (ui->streamTreeWidget->selectedItems().count() < 1) return;
- emit rtpPlayerDialogReplaceRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogReplaceRtpStreams(getSelectedRtpIds());
}
void RtpStreamDialog::rtpPlayerAdd()
{
if (ui->streamTreeWidget->selectedItems().count() < 1) return;
- emit rtpPlayerDialogAddRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogAddRtpStreams(getSelectedRtpIds());
}
void RtpStreamDialog::rtpPlayerRemove()
{
if (ui->streamTreeWidget->selectedItems().count() < 1) return;
- emit rtpPlayerDialogRemoveRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogRemoveRtpStreams(getSelectedRtpIds());
}
void RtpStreamDialog::rtpAnalysisReplace()
{
if (ui->streamTreeWidget->selectedItems().count() < 1) return;
- emit rtpAnalysisDialogReplaceRtpStreams(make_rtpstream_ids_from_rtpstream_infos(getSelectedRtpStreams()));
+ emit rtpAnalysisDialogReplaceRtpStreams(getSelectedRtpIds());
}
void RtpStreamDialog::rtpAnalysisAdd()
{
if (ui->streamTreeWidget->selectedItems().count() < 1) return;
- emit rtpAnalysisDialogAddRtpStreams(make_rtpstream_ids_from_rtpstream_infos(getSelectedRtpStreams()));
+ emit rtpAnalysisDialogAddRtpStreams(getSelectedRtpIds());
}
void RtpStreamDialog::rtpAnalysisRemove()
{
if (ui->streamTreeWidget->selectedItems().count() < 1) return;
- emit rtpAnalysisDialogRemoveRtpStreams(make_rtpstream_ids_from_rtpstream_infos(getSelectedRtpStreams()));
+ emit rtpAnalysisDialogRemoveRtpStreams(getSelectedRtpIds());
}
void RtpStreamDialog::displayFilterSuccess(bool success)
diff --git a/ui/qt/rtp_stream_dialog.h b/ui/qt/rtp_stream_dialog.h
index a5fb008f1c..2ffa18e700 100644
--- a/ui/qt/rtp_stream_dialog.h
+++ b/ui/qt/rtp_stream_dialog.h
@@ -41,9 +41,9 @@ signals:
void packetsMarked();
void updateFilter(QString filter, bool force = false);
void goToPacket(int packet_num);
- void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *> stream_infos);
+ void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids);
void rtpAnalysisDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_infos);
void rtpAnalysisDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_infos);
void rtpAnalysisDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_infos);
@@ -88,7 +88,7 @@ private:
QList<QVariant> streamRowData(int row) const;
void freeLastSelected();
void invertSelection();
- QVector<rtpstream_info_t *>getSelectedRtpStreams();
+ QVector<rtpstream_id_t *>getSelectedRtpIds();
private slots:
void showStreamMenu(QPoint pos);
diff --git a/ui/qt/sequence_dialog.cpp b/ui/qt/sequence_dialog.cpp
index a4cc90bc5f..e533bc68a7 100644
--- a/ui/qt/sequence_dialog.cpp
+++ b/ui/qt/sequence_dialog.cpp
@@ -810,30 +810,30 @@ gboolean SequenceDialog::addFlowSequenceItem(const void* key, void *value, void
return FALSE;
}
-QVector<rtpstream_info_t *>SequenceDialog::getSelectedRtpStreams()
+QVector<rtpstream_id_t *>SequenceDialog::getSelectedRtpIds()
{
- QVector<rtpstream_info_t *> stream_infos;
+ QVector<rtpstream_id_t *> stream_ids;
if (current_rtp_sai_ && GA_INFO_TYPE_RTP == current_rtp_sai_->info_type) {
- stream_infos << (rtpstream_info_t *)current_rtp_sai_->info_ptr;
+ stream_ids << &((rtpstream_info_t *)current_rtp_sai_->info_ptr)->id;
}
- return stream_infos;
+ return stream_ids;
}
void SequenceDialog::rtpPlayerReplace()
{
- emit rtpPlayerDialogReplaceRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogReplaceRtpStreams(getSelectedRtpIds());
}
void SequenceDialog::rtpPlayerAdd()
{
- emit rtpPlayerDialogAddRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogAddRtpStreams(getSelectedRtpIds());
}
void SequenceDialog::rtpPlayerRemove()
{
- emit rtpPlayerDialogRemoveRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogRemoveRtpStreams(getSelectedRtpIds());
}
void SequenceDialog::on_buttonBox_helpRequested()
diff --git a/ui/qt/sequence_dialog.h b/ui/qt/sequence_dialog.h
index 894c6f66be..e5185b1d28 100644
--- a/ui/qt/sequence_dialog.h
+++ b/ui/qt/sequence_dialog.h
@@ -61,9 +61,9 @@ protected:
signals:
void rtpStreamsDialogSelectRtpStreams(QVector<rtpstream_id_t *> stream_infos);
void rtpStreamsDialogDeselectRtpStreams(QVector<rtpstream_id_t *> stream_infos);
- void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *> stream_infos);
+ void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids);
private slots:
void updateWidgets();
@@ -129,7 +129,7 @@ private:
static gboolean addFlowSequenceItem(const void *key, void *value, void *userdata);
- QVector<rtpstream_info_t *>getSelectedRtpStreams();
+ QVector<rtpstream_id_t *>getSelectedRtpIds();
};
#endif // SEQUENCE_DIALOG_H
diff --git a/ui/qt/utils/qt_ui_utils.cpp b/ui/qt/utils/qt_ui_utils.cpp
index 65d824b115..1321ee0e8f 100644
--- a/ui/qt/utils/qt_ui_utils.cpp
+++ b/ui/qt/utils/qt_ui_utils.cpp
@@ -257,17 +257,6 @@ void set_action_shortcuts_visible_in_context_menu(QList<QAction *> actions)
#endif
}
-QVector<rtpstream_id_t *>make_rtpstream_ids_from_rtpstream_infos(QVector<rtpstream_info_t *> stream_infos)
-{
- QVector<rtpstream_id_t *>stream_ids;
-
- foreach(rtpstream_info_t *stream, stream_infos) {
- stream_ids << &stream->id;
- }
-
- return stream_ids;
-}
-
QVector<rtpstream_id_t *>qvector_rtpstream_ids_copy(QVector<rtpstream_id_t *> stream_ids)
{
QVector<rtpstream_id_t *>new_ids;
@@ -310,8 +299,3 @@ QString make_filter_based_on_rtpstream_id(QVector<rtpstream_id_t *> stream_ids)
return filter;
}
-QString make_filter_based_on_rtpstream_info(QVector<rtpstream_info_t *> stream_infos)
-{
- return make_filter_based_on_rtpstream_id(make_rtpstream_ids_from_rtpstream_infos(stream_infos));
-}
-
diff --git a/ui/qt/utils/qt_ui_utils.h b/ui/qt/utils/qt_ui_utils.h
index 2a32ce25ee..fbc1e29ec6 100644
--- a/ui/qt/utils/qt_ui_utils.h
+++ b/ui/qt/utils/qt_ui_utils.h
@@ -234,14 +234,6 @@ bool rect_on_screen(const QRect &rect);
void set_action_shortcuts_visible_in_context_menu(QList<QAction *> actions);
/**
- * Extract rtpstream ids from rtpstream infos
- *
- * @param rtpstream_infos List of infos
- * @return Vector of rtpstream_ids
- */
-QVector<rtpstream_id_t *>make_rtpstream_ids_from_rtpstream_infos(QVector<rtpstream_info_t *> stream_infos);
-
-/**
* Create copy of all rtpstream_ids to new QVector
* => caller must release it with qvector_rtpstream_ids_free()
*
@@ -265,14 +257,6 @@ void qvector_rtpstream_ids_free(QVector<rtpstream_id_t *> stream_ids);
*/
QString make_filter_based_on_rtpstream_id(QVector<rtpstream_id_t *> stream_ids);
-/**
- * Make display filter from list of rtpstream_infos
- *
- * @param stream_infos List of stream infos
- * @return Filter or empty string
- */
-QString make_filter_based_on_rtpstream_info(QVector<rtpstream_info_t *> stream_infos);
-
#endif /* __QT_UI_UTILS__H__ */
// XXX Add a routine to fetch the HWND corresponding to a widget using QPlatformIntegration
diff --git a/ui/qt/voip_calls_dialog.cpp b/ui/qt/voip_calls_dialog.cpp
index 09c2531649..3f78b9fd05 100644
--- a/ui/qt/voip_calls_dialog.cpp
+++ b/ui/qt/voip_calls_dialog.cpp
@@ -548,18 +548,18 @@ void VoipCallsDialog::showSequence()
// Bypass this dialog and forward signals to parent
connect(sequence_dialog, SIGNAL(rtpStreamsDialogSelectRtpStreams(QVector<rtpstream_id_t *>)), &parent_, SLOT(rtpStreamsDialogSelectRtpStreams(QVector<rtpstream_id_t *>)));
connect(sequence_dialog, SIGNAL(rtpStreamsDialogDeselectRtpStreams(QVector<rtpstream_id_t *>)), &parent_, SLOT(rtpStreamsDialogDeselectRtpStreams(QVector<rtpstream_id_t *>)));
- connect(sequence_dialog, SIGNAL(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *>)), &parent_, SLOT(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *>)));
- connect(sequence_dialog, SIGNAL(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *>)), &parent_, SLOT(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *>)));
- connect(sequence_dialog, SIGNAL(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *>)), &parent_, SLOT(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *>)));
+ connect(sequence_dialog, SIGNAL(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *>)), &parent_, SLOT(rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *>)));
+ connect(sequence_dialog, SIGNAL(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *>)), &parent_, SLOT(rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *>)));
+ connect(sequence_dialog, SIGNAL(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *>)), &parent_, SLOT(rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *>)));
sequence_dialog->setAttribute(Qt::WA_DeleteOnClose);
sequence_dialog->enableVoIPFeatures();
sequence_dialog->show();
}
-QVector<rtpstream_info_t *>VoipCallsDialog::getSelectedRtpStreams()
+QVector<rtpstream_id_t *>VoipCallsDialog::getSelectedRtpIds()
{
- QVector<rtpstream_info_t *> stream_infos;
+ QVector<rtpstream_id_t *> stream_ids;
foreach (QModelIndex index, ui->callTreeView->selectionModel()->selectedIndexes()) {
voip_calls_info_t *vci = VoipCallsInfoModel::indexToCallInfo(index);
if (!vci) continue;
@@ -573,36 +573,36 @@ QVector<rtpstream_info_t *>VoipCallsDialog::getSelectedRtpStreams()
// rsi->call_num, rsi->start_fd->num, rsi->setup_frame_number);
if (vci->call_num == static_cast<guint>(rsi->call_num)) {
//VOIP_CALLS_DEBUG("adding call number %u", vci->call_num);
- if (-1 == stream_infos.indexOf(rsi)) {
+ if (-1 == stream_ids.indexOf(&(rsi->id))) {
// Add only new stream
- stream_infos << rsi;
+ stream_ids << &(rsi->id);
}
}
}
}
- return stream_infos;
+ return stream_ids;
}
void VoipCallsDialog::rtpPlayerReplace()
{
if (ui->callTreeView->selectionModel()->selectedIndexes().count() < 1) return;
- emit rtpPlayerDialogReplaceRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogReplaceRtpStreams(getSelectedRtpIds());
}
void VoipCallsDialog::rtpPlayerAdd()
{
if (ui->callTreeView->selectionModel()->selectedIndexes().count() < 1) return;
- emit rtpPlayerDialogAddRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogAddRtpStreams(getSelectedRtpIds());
}
void VoipCallsDialog::rtpPlayerRemove()
{
if (ui->callTreeView->selectionModel()->selectedIndexes().count() < 1) return;
- emit rtpPlayerDialogRemoveRtpStreams(getSelectedRtpStreams());
+ emit rtpPlayerDialogRemoveRtpStreams(getSelectedRtpIds());
}
QList<QVariant> VoipCallsDialog::streamRowData(int row) const
@@ -763,7 +763,7 @@ void VoipCallsDialog::on_actionSelectNone_triggered()
void VoipCallsDialog::on_actionSelectRtpStreams_triggered()
{
- QVector<rtpstream_id_t *>stream_ids = qvector_rtpstream_ids_copy(make_rtpstream_ids_from_rtpstream_infos(getSelectedRtpStreams()));
+ QVector<rtpstream_id_t *>stream_ids = qvector_rtpstream_ids_copy(getSelectedRtpIds());
emit rtpStreamsDialogSelectRtpStreams(stream_ids);
@@ -773,7 +773,7 @@ void VoipCallsDialog::on_actionSelectRtpStreams_triggered()
void VoipCallsDialog::on_actionDeselectRtpStreams_triggered()
{
- QVector<rtpstream_id_t *>stream_ids = qvector_rtpstream_ids_copy(make_rtpstream_ids_from_rtpstream_infos(getSelectedRtpStreams()));
+ QVector<rtpstream_id_t *>stream_ids = qvector_rtpstream_ids_copy(getSelectedRtpIds());
emit rtpStreamsDialogDeselectRtpStreams(stream_ids);
diff --git a/ui/qt/voip_calls_dialog.h b/ui/qt/voip_calls_dialog.h
index 96c8b6266d..40381a3f70 100644
--- a/ui/qt/voip_calls_dialog.h
+++ b/ui/qt/voip_calls_dialog.h
@@ -47,9 +47,9 @@ signals:
void updateFilter(QString filter, bool force = false);
void captureFileChanged(capture_file *cf);
void goToPacket(int packet_num);
- void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_info_t *> stream_infos);
- void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_info_t *> stream_infos);
+ void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids);
+ void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids);
void rtpStreamsDialogSelectRtpStreams(QVector<rtpstream_id_t *> stream_ids);
void rtpStreamsDialogDeselectRtpStreams(QVector<rtpstream_id_t *> stream_ids);
@@ -99,7 +99,7 @@ private:
void invertSelection();
QList<QVariant> streamRowData(int row) const;
- QVector<rtpstream_info_t *>getSelectedRtpStreams();
+ QVector<rtpstream_id_t *>getSelectedRtpIds();
private slots:
void selectAll();