ROHC compression/decompression library
c_rtp.h
Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 2 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * This program is distributed in the hope that it will be useful,
00008  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  * GNU General Public License for more details.
00011  *
00012  * You should have received a copy of the GNU General Public License
00013  * along with this program; if not, write to the Free Software
00014  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00015  */
00016 
00017 /**
00018  * @file c_rtp.h
00019  * @brief ROHC compression context for the RTP profile.
00020  * @author David Moreau from TAS
00021  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
00022  */
00023 
00024 #ifndef C_RTP_H
00025 #define C_RTP_H
00026 
00027 #include "c_generic.h"
00028 #include "ts_sc_comp.h"
00029 #include "protocols/udp.h"
00030 #include "protocols/rtp.h"
00031 
00032 
00033 /**
00034  * @brief Define the RTP and UDP specific temporary variables in the profile
00035  *        compression context.
00036  *
00037  * This object must be used by the RTP-specific decompression context
00038  * sc_rtp_context.
00039  *
00040  * @see sc_rtp_context
00041  */
00042 struct rtp_tmp_vars
00043 {
00044         /// The number of UDP/RTP fields that changed in the UDP/RTP headers
00045         int send_rtp_dynamic;
00046 
00047         /// The number of bits needed to encode ts_send
00048         size_t nr_ts_bits;
00049 
00050         /// The number of bits of TS to place in the extension 3 header
00051         size_t nr_ts_bits_ext3;
00052 
00053         /// The real timestamp of the last RTP message
00054         uint32_t timestamp;
00055 
00056         /// The TS field to send (ts_scaled or ts)
00057         uint32_t ts_send;
00058 
00059         /// Whether the Marker (M) bit is set in the RTP header or not
00060         bool is_marker_bit_set;
00061 
00062         /** Whether the Padding (P) bit changed or not */
00063         bool padding_bit_changed;
00064 
00065         /// Whether the eXtension (X) bit changed or not
00066         bool extension_bit_changed;
00067 
00068         /// Whether the Payload Type (PT) field changed or not
00069         int rtp_pt_changed;
00070 };
00071 
00072 
00073 /**
00074  * @brief Define the RTP part of the profile decompression context.
00075  *
00076  * This object must be used with the generic part of the decompression
00077  * context c_generic_context.
00078  *
00079  * @warning The 2 first fields MUST stay at the beginning of the structure
00080  *          to be compatible with \ref sc_udp_context
00081  *
00082  * @see c_generic_context
00083  */
00084 struct sc_rtp_context
00085 {
00086         /// @brief The number of times the UDP checksum field was added to the
00087         ///        compressed header
00088         int udp_checksum_change_count;
00089 
00090         /// The previous UDP header
00091         struct udphdr old_udp;
00092 
00093         /// @brief The number of times the RTP Payload Type (PT) field was added to
00094         ///        the compressed header
00095         int rtp_pt_change_count;
00096 
00097         /// @brief The number of times the RTP Padding (P) bit was added to
00098         ///        the compressed header
00099         size_t rtp_padding_change_count;
00100 
00101         /// @brief The number of times the RTP eXtension (X) bit was added to
00102         ///        the compressed header
00103         size_t rtp_extension_change_count;
00104 
00105         /// The previous RTP header
00106         struct rtphdr old_rtp;
00107 
00108         /// @brief RTP-specific temporary variables that are used during one single
00109         ///        compression of packet
00110         struct rtp_tmp_vars tmp;
00111 
00112         /// Scaled RTP Time Stamp
00113         int tss;
00114 
00115         /// Whether the Time Stride field is present or not
00116         int tis;
00117 
00118         /// Structure to encode the TS field
00119         struct ts_sc_comp ts_sc;
00120 };
00121 
00122 
00123 /*
00124  * Function prototypes.
00125  */
00126 
00127 /* no public function */
00128 
00129 #endif
00130