3 * RTP decoding routines for Wireshark.
4 * Copied from ui/gtk/rtp_player.c
6 * Copyright 2006, Alejandro Vaquero <alejandrovaquero@yahoo.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1999 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
15 #ifndef __RTP_MEDIA_H__
16 #define __RTP_MEDIA_H__
19 #include <wsutil/wmem/wmem_map.h>
22 * "RTP Player" dialog box common routines.
23 * @ingroup main_ui_group
28 #endif /* __cplusplus */
30 /****************************************************************************/
32 /****************************************************************************/
34 typedef int16_t SAMPLE
;
35 #define SAMPLE_MAX INT16_MAX
36 #define SAMPLE_MIN INT16_MIN
37 #define SAMPLE_NaN SAMPLE_MIN
38 #define SAMPLE_BYTES (sizeof(SAMPLE) / sizeof(char))
40 /* Defines an RTP packet */
41 typedef struct _rtp_packet
{
42 uint32_t frame_num
; /* Qt only */
43 struct _rtp_info
*info
; /* the RTP dissected info */
44 double arrive_offset
; /* arrive offset time since the beginning of the stream as ms in GTK UI and s in Qt UI */
45 uint8_t* payload_data
;
48 /** Create a new hash table.
50 * @return A new hash table suitable for passing to decode_rtp_packet.
52 GHashTable
*rtp_decoder_hash_table_new(void);
54 /** Decode an RTP packet
56 * @param rp Wrapper for per-packet RTP tap data.
57 * @param out_buff Output audio samples.
58 * @param decoders_hash Hash table created with rtp_decoder_hash_table_new.
59 * @param channels_ptr If non-NULL, receives the number of channels in the sample.
60 * @param sample_rate_ptr If non-NULL, receives the sample rate.
61 * @return The number of decoded bytes on success, 0 on failure.
63 size_t decode_rtp_packet(rtp_packet_t
*rp
, SAMPLE
**out_buff
, GHashTable
*decoders_hash
, unsigned *channels_ptr
, unsigned *sample_rate_ptr
);
67 #endif /* __cplusplus */
69 #endif /* __RTP_MEDIA_H__ */