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