summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-07-13 11:56:20 -0700
committerGerald Combs <gerald@wireshark.org>2015-07-13 20:12:33 +0000
commitef3cc4a2c15cc351a38193e44adf938624634666 (patch)
treedc1bab362deb15ad35a1cecf2a8007286b8dc60a /ui
parentbed31637255464d890cb74d4c7edc57c20c9a2f4 (diff)
downloadwireshark-ef3cc4a2c15cc351a38193e44adf938624634666.tar.gz
RTP updates.
Merge rtp_sample_header_t into rtp_sample_t. That's the only place it was used. Note that rtp_sample_t is used for writing rtpdump files. Move the rtp_sample_t definition to tap-rtp-common.c. Rename it to rtpdump_info_t. Make rtp_write_sample static. Change-Id: I04e7428f634efa87a98e5d6c82a354f94ab1765d Reviewed-on: https://code.wireshark.org/review/9629 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/rtp_player.c2
-rw-r--r--ui/rtp_stream.h17
-rw-r--r--ui/tap-rtp-common.c28
-rw-r--r--ui/tap-rtp-common.h1
4 files changed, 19 insertions, 29 deletions
diff --git a/ui/gtk/rtp_player.c b/ui/gtk/rtp_player.c
index 1894bd7556..9dc9767846 100644
--- a/ui/gtk/rtp_player.c
+++ b/ui/gtk/rtp_player.c
@@ -159,7 +159,7 @@ static PaStream *pa_stream;
typedef struct _rtp_channel_info {
nstime_t start_time_abs;
nstime_t stop_time_abs;
- GArray *samples; /* the array with decoded audio */
+ GArray *samples; /* Array of sample_t (decoded audio) */
guint16 call_num;
gboolean selected;
unsigned long frame_index;
diff --git a/ui/rtp_stream.h b/ui/rtp_stream.h
index d7cef57158..f6097561ff 100644
--- a/ui/rtp_stream.h
+++ b/ui/rtp_stream.h
@@ -44,23 +44,6 @@ extern "C" {
#include <epan/address.h>
#include <epan/tap.h>
-
-/****************************************************************************/
-/* type for storing rtp frame information */
-typedef struct st_rtp_sample_header {
- double rec_time; /**< milliseconds since start of recording */
- guint16 frame_length; /**< number of bytes in *frame */
-} rtp_sample_header_t;
-
-/** type for storing rtp frame information */
-typedef struct st_rtp_sample {
- rtp_sample_header_t header; /**< date and size */
- const guint8 *frame; /**< data bytes */
-} rtp_sample_t;
-
-typedef rtp_sample_t* rtp_sample_p;
-
-
/** Defines an rtp stream */
typedef struct _rtp_stream_info {
address src_addr;
diff --git a/ui/tap-rtp-common.c b/ui/tap-rtp-common.c
index 60f6fa90d7..d260a0f1a4 100644
--- a/ui/tap-rtp-common.c
+++ b/ui/tap-rtp-common.c
@@ -45,6 +45,14 @@
*/
/****************************************************************************/
+/* Type for storing and writing rtpdump information */
+typedef struct st_rtpdump_info {
+ double rec_time; /**< milliseconds since start of recording */
+ guint16 num_samples; /**< number of bytes in *frame */
+ const guint8 *samples; /**< data bytes */
+} rtpdump_info_t;
+
+/****************************************************************************/
/* GCompareFunc style comparison function for _rtp_stream_info */
static gint rtp_stream_info_cmp(gconstpointer aa, gconstpointer bb)
{
@@ -158,16 +166,16 @@ void rtp_write_header(rtp_stream_info_t *strinfo, FILE *file)
}
/* utility function for writing a sample to file in rtpdump -F dump format (.rtp)*/
-void rtp_write_sample(rtp_sample_t* sample, FILE* file)
+static void rtp_write_sample(rtpdump_info_t* rtpdump_info, FILE* file)
{
guint16 length; /* length of packet, including this header (may
be smaller than plen if not whole packet recorded) */
guint16 plen; /* actual header+payload length for RTP, 0 for RTCP */
guint32 offset; /* milliseconds since the start of recording */
- length = g_htons(sample->header.frame_length + 8);
- plen = g_htons(sample->header.frame_length);
- offset = g_htonl(sample->header.rec_time);
+ length = g_htons(rtpdump_info->num_samples + 8);
+ plen = g_htons(rtpdump_info->num_samples);
+ offset = g_htonl(rtpdump_info->rec_time);
if (fwrite(&length, 2, 1, file) == 0)
return;
@@ -175,7 +183,7 @@ void rtp_write_sample(rtp_sample_t* sample, FILE* file)
return;
if (fwrite(&offset, 4, 1, file) == 0)
return;
- if (fwrite(sample->frame, sample->header.frame_length, 1, file) == 0)
+ if (fwrite(rtpdump_info->samples, rtpdump_info->num_samples, 1, file) == 0)
return;
}
@@ -189,7 +197,7 @@ int rtpstream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, con
rtp_stream_info_t new_stream_info;
rtp_stream_info_t *stream_info = NULL;
GList* list;
- rtp_sample_t sample;
+ rtpdump_info_t rtpdump_info;
struct _rtp_conversation_info *p_conv_data = NULL;
@@ -257,11 +265,11 @@ int rtpstream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, con
if (rtp_stream_info_cmp(&new_stream_info, tapinfo->filter_stream_fwd)==0) {
/* XXX - what if rtpinfo->info_all_data_present is
FALSE, so that we don't *have* all the data? */
- sample.header.rec_time = nstime_to_msec(&pinfo->fd->abs_ts) -
+ rtpdump_info.rec_time = nstime_to_msec(&pinfo->fd->abs_ts) -
nstime_to_msec(&tapinfo->filter_stream_fwd->start_fd->abs_ts);
- sample.header.frame_length = rtpinfo->info_data_len;
- sample.frame = rtpinfo->info_data;
- rtp_write_sample(&sample, tapinfo->save_file);
+ rtpdump_info.num_samples = rtpinfo->info_data_len;
+ rtpdump_info.samples = rtpinfo->info_data;
+ rtp_write_sample(&rtpdump_info, tapinfo->save_file);
}
}
else if (tapinfo->mode == TAP_MARK && tapinfo->tap_mark_packet) {
diff --git a/ui/tap-rtp-common.h b/ui/tap-rtp-common.h
index 7fb27c7ed8..a4242c794e 100644
--- a/ui/tap-rtp-common.h
+++ b/ui/tap-rtp-common.h
@@ -32,7 +32,6 @@
void rtpstream_reset_cb(void*);
void rtp_write_header(rtp_stream_info_t*, FILE*);
-void rtp_write_sample(rtp_sample_t*, FILE*);
int rtpstream_packet(void*, packet_info*, epan_dissect_t *, const void *);
#endif /*TAP_RTP_COMMON_H_INCLUDED*/