]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
create typedef for payload type\iana code
authorMichael Jerris <mike@jerris.com>
Tue, 18 Apr 2006 16:50:34 +0000 (16:50 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 18 Apr 2006 16:50:34 +0000 (16:50 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1188 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_frame.h
src/include/switch_module_interfaces.h
src/include/switch_rtp.h
src/include/switch_types.h
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/switch_rtp.c

index 2d70bbfc0273ff3b6d38ea5dcc8a7291977e9735..a0b5b6e433d947fac94a63bf25007d3e7360ebe6 100644 (file)
@@ -63,7 +63,7 @@ struct switch_frame {
        /*! the rate of the frame */
        uint32_t rate;
        /*! the payload of the frame */
-       uint32_t payload;
+       switch_payload_t payload;
        /*! the timestamp of the frame */
        uint32_t timestamp;
        /*! frame flags */
index 664a1c9b4d484d16737978909b739f9fa30e6998..f9b8e34a3a1c597e0d7c2f6c995ff5406ab6440d 100644 (file)
@@ -477,7 +477,7 @@ struct switch_codec_interface {
        /*! enumeration defining the type of the codec */
        const switch_codec_type codec_type;
        /*! the IANA code number */
-       uint8_t ianacode;
+       switch_payload_t ianacode;
        /*! the IANA code name */
        char *iananame;
        /*! a list of codec implementations related to the codec */
index 129b59670c505b1b18eb9cca38ed793cfaba7e37..4d4d89c32cb723f27956df928e462cb2ed0240b8 100644 (file)
@@ -82,7 +82,7 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_request_port(void);
   \return the new RTP session or NULL on failure
 */
 SWITCH_DECLARE(switch_status)switch_rtp_create(switch_rtp **new_rtp_session,
-                                                                                          uint8_t payload,
+                                                                                          switch_payload_t payload,
                                                                                           uint32_t packet_size,
                                                                                           uint32_t ms_per_packet,
                                                                                           switch_rtp_flag_t flags,
@@ -110,7 +110,7 @@ SWITCH_DECLARE(switch_rtp *)switch_rtp_new(char *rx_host,
                                                                                   switch_port_t rx_port,
                                                                                   char *tx_host,
                                                                                   switch_port_t tx_port,
-                                                                                  uint8_t payload,
+                                                                                  switch_payload_t payload,
                                                                                   uint32_t packet_size,
                                                                                   uint32_t ms_per_packet,
                                                                                   switch_rtp_flag_t flags,
@@ -204,7 +204,7 @@ SWITCH_DECLARE(uint32_t) switch_rtp_get_default_packet_size(switch_rtp *rtp_sess
   \param rtp_session the RTP session to set the payload number on
   \param payload the new default payload number 
 */
-SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp *rtp_session, uint8_t payload);
+SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp *rtp_session, switch_payload_t payload);
 
 /*! 
   \brief Get the default payload number for a given RTP session
@@ -231,7 +231,7 @@ SWITCH_DECLARE(void) switch_rtp_set_invald_handler(switch_rtp *rtp_session, swit
   \param flags flags
   \return the number of bytes read
 */
-SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp *rtp_session, void *data, uint32_t *datalen, int *payload_type, switch_frame_flag *flags);
+SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp *rtp_session, void *data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags);
 
 /*! 
   \brief Read data from a given RTP session without copying
@@ -242,7 +242,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp *rtp_session, void *dat
   \param flags flags
   \return the number of bytes read
 */
-SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **data, uint32_t *datalen, int *payload_type, switch_frame_flag *flags);
+SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags);
 
 /*! 
   \brief Read data from a given RTP session without copying
@@ -283,7 +283,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp *rtp_session, switch_frame
   \param flags frame flags
   \return the number of bytes written
 */
-SWITCH_DECLARE(int) switch_rtp_write_payload(switch_rtp *rtp_session, void *data, uint16_t datalen, uint8_t payload, uint32_t ts, uint16_t mseq, switch_frame_flag *flags);
+SWITCH_DECLARE(int) switch_rtp_write_payload(switch_rtp *rtp_session, void *data, uint16_t datalen, switch_payload_t payload, uint32_t ts, uint16_t mseq, switch_frame_flag *flags);
 
 /*! 
   \brief Retrieve the SSRC from a given RTP session
index 752d2b1974f43f140eb11f96a2965ec8a18c1c6c..7f5fc1263d3d781515ebfee150a154b34c31c641 100644 (file)
@@ -506,6 +506,7 @@ typedef enum {
        SWITCH_EVENT_ALL
 } switch_event_t;
 
+typedef uint8_t switch_payload_t;
 typedef struct switch_rtp switch_rtp;
 typedef struct switch_core_session_message switch_core_session_message;
 typedef struct switch_audio_resampler switch_audio_resampler;
index 5ac52f79b6d4a92990463c23c28a9dbdecf82267..e6d58b734cc285499c70bdf9be9a4564c3d9178c 100644 (file)
@@ -124,7 +124,7 @@ struct private_object {
        int32_t timestamp_dtmf;
        uint32_t last_read;
        char *codec_name;
-       uint8_t codec_num;
+       switch_payload_t codec_num;
        switch_time_t next_desc;
        switch_time_t next_cand;
        char *stun_ip;
@@ -666,7 +666,7 @@ static switch_status channel_read_frame(switch_core_session *session, switch_fra
        uint32_t bytes = 0;
        switch_size_t samples = 0, frames = 0, ms = 0;
        switch_channel *channel = NULL;
-       int payload = 0;
+       switch_payload_t payload = 0;
        switch_status status;
 
        channel = switch_core_session_get_channel(session);
@@ -690,7 +690,6 @@ static switch_status channel_read_frame(switch_core_session *session, switch_fra
 
        
        while (!switch_test_flag(tech_pvt, TFLAG_BYE) && switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
-               payload = -1;
                tech_pvt->read_frame.flags = 0;
                status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame);
 
index cf9208844f8f87a6bbf785d6e4b6fba28a86e116..29cb86cd53f4af635649143fffc3528b62bf1a3a 100644 (file)
@@ -69,7 +69,7 @@ struct switch_rtp {
        srtp_ctx_t *recv_ctx;
        
        uint16_t seq;
-       uint8_t payload;
+       switch_payload_t payload;
        
        switch_rtp_invalid_handler invalid_handler;
        void *private_data;
@@ -247,7 +247,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_set_remote_address(switch_rtp *rtp_sess
 }
 
 SWITCH_DECLARE(switch_status) switch_rtp_create(switch_rtp **new_rtp_session,
-                                                                                               uint8_t payload,
+                                                                                               switch_payload_t payload,
                                                                                                uint32_t packet_size,
                                                                                                uint32_t ms_per_packet,
                                                                                                switch_rtp_flag_t flags, 
@@ -324,7 +324,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_create(switch_rtp **new_rtp_session,
        rtp_session->send_msg.header.ts      = 0;
        rtp_session->send_msg.header.seq     = (uint16_t) rand();
        rtp_session->send_msg.header.m       = 0;
-       rtp_session->send_msg.header.pt      = (uint8_t)htonl(payload);
+       rtp_session->send_msg.header.pt      = (switch_payload_t)htonl(payload);
        rtp_session->send_msg.header.version = 2;
        rtp_session->send_msg.header.p       = 0;
        rtp_session->send_msg.header.x       = 0;
@@ -334,7 +334,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_create(switch_rtp **new_rtp_session,
        rtp_session->recv_msg.header.ts      = 0;
        rtp_session->recv_msg.header.seq     = 0;
        rtp_session->recv_msg.header.m       = 0;
-       rtp_session->recv_msg.header.pt      = (uint8_t)htonl(payload);
+       rtp_session->recv_msg.header.pt      = (switch_payload_t)htonl(payload);
        rtp_session->recv_msg.header.version = 2;
        rtp_session->recv_msg.header.p       = 0;
        rtp_session->recv_msg.header.x       = 0;
@@ -370,7 +370,7 @@ SWITCH_DECLARE(switch_rtp *)switch_rtp_new(char *rx_host,
                                                                                   switch_port_t rx_port,
                                                                                   char *tx_host,
                                                                                   switch_port_t tx_port,
-                                                                                  uint8_t payload,
+                                                                                  switch_payload_t payload,
                                                                                   uint32_t packet_size,
                                                                                   uint32_t ms_per_packet,
                                                                                   switch_rtp_flag_t flags,
@@ -451,7 +451,7 @@ SWITCH_DECLARE(uint32_t) switch_rtp_get_default_packet_size(switch_rtp *rtp_sess
        return rtp_session->packet_size;
 }
 
-SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp *rtp_session, uint8_t payload)
+SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp *rtp_session, switch_payload_t payload)
 {
        rtp_session->payload = payload;
 }
@@ -487,7 +487,7 @@ SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp *rtp_session, switch_rtp_f
 
 }
 
-static int rtp_common_read(switch_rtp *rtp_session, int *payload_type, switch_frame_flag *flags)
+static int rtp_common_read(switch_rtp *rtp_session, switch_payload_t *payload_type, switch_frame_flag *flags)
 {
        switch_size_t bytes;
        switch_status status;
@@ -572,7 +572,7 @@ static int rtp_common_read(switch_rtp *rtp_session, int *payload_type, switch_fr
        return (int) bytes;
 }
 
-SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp *rtp_session, void *data, uint32_t *datalen, int *payload_type, switch_frame_flag *flags)
+SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp *rtp_session, void *data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags)
 {
 
        int bytes = rtp_common_read(rtp_session, payload_type, flags);
@@ -616,7 +616,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read_frame(switch_rtp *rtp_ses
 }
 
 
-SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **data, uint32_t *datalen, int *payload_type, switch_frame_flag *flags)
+SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags)
 {
 
        int bytes = rtp_common_read(rtp_session, payload_type, flags);
@@ -633,7 +633,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session,
        return SWITCH_STATUS_SUCCESS;
 }
 
-static int rtp_common_write(switch_rtp *rtp_session, void *data, uint32_t datalen, uint8_t payload, switch_frame_flag *flags)
+static int rtp_common_write(switch_rtp *rtp_session, void *data, uint32_t datalen, switch_payload_t payload, switch_frame_flag *flags)
 {
        switch_size_t bytes;
        uint8_t packetize = (rtp_session->packet_size > datalen && (payload == rtp_session->payload)) ? 1 : 0;