diff options
author | Jaap Keuter <jaap.keuter@xs4all.nl> | 2019-09-07 11:49:29 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-09-08 06:13:46 +0000 |
commit | bc1c3dc9a0d27722bab62a1f1f96c764764524ae (patch) | |
tree | 9c9632e7b634d62bc7c92364343392ae4db5a6fc | |
parent | a585a65a608c47be836b3c29208e97c1ee057040 (diff) |
Qt UI: Warn about not saving non-PCM encoded audio
When saving audio data from RTP stream(s) in Sun AU format we (still) do
not harness the build-in codec framework. This results in empty Audio
files for all but PCM encoded RTP streams. At least warn the user about
the codec not being supported for saving in Audio file.
Change-Id: Ia76caf71d0d5319a66dbf1cee517c0922bf7a561
Reviewed-on: https://code.wireshark.org/review/34466
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | ui/qt/rtp_analysis_dialog.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp index 935e50fb43..4213750c69 100644 --- a/ui/qt/rtp_analysis_dialog.cpp +++ b/ui/qt/rtp_analysis_dialog.cpp @@ -21,6 +21,7 @@ #include "epan/dissectors/packet-rtp.h" #include "ui/help_url.h" +#include "ui/simple_dialog.h" #include <wsutil/utf8_entities.h> #include <wsutil/g711.h> @@ -1108,6 +1109,7 @@ gboolean RtpAnalysisDialog::saveAudioAUUnidir(tap_rtp_stat_t &statinfo, QTempora if (*stop_flag) { return FALSE; } + ui->progressFrame->setValue(int(tempfile->pos() * 100 / tempfile->size())); sample_count=convert_payload_to_samples(save_data.payload_type, tempfile ,pd_out, save_data.payload_len); @@ -1414,10 +1416,18 @@ void RtpAnalysisDialog::saveAudio(RtpAnalysisDialog::StreamDirection direction, ((rev_statinfo_.rtp_stats.clock_rate != 0) && (rev_statinfo_.rtp_stats.clock_rate != 8000)) ) { QMessageBox::warning(this, tr("Warning"), tr("Can save audio with 8000 Hz clock rate only")); - } else { - if (! saveAudioAU(direction, &save_file, &stop_flag, sync)) { + goto copy_file_err; + } + + if (((fwd_statinfo_.first_payload_type != PT_PCMU) && (fwd_statinfo_.first_payload_type != PT_PCMA)) || + ((rev_statinfo_.rtp_stats.clock_rate != 0) && + ((rev_statinfo_.first_payload_type != PT_PCMU) && (rev_statinfo_.first_payload_type != PT_PCMA)))) { + QMessageBox::warning(this, tr("Warning"), tr("Can save audio with PCM u-law or A-law encoding only")); + goto copy_file_err; + } + + if (! saveAudioAU(direction, &save_file, &stop_flag, sync)) { goto copy_file_err; - } } } else if (save_format == save_audio_raw_) { /* raw format */ if (! saveAudioRAW(direction, &save_file, &stop_flag)) { |