ROHC compression/decompression library
|
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 ts_sc_decomp.h 00019 * @brief Scaled RTP Timestamp decoding 00020 * @author David Moreau from TAS 00021 * @author Didier Barvaux <didier@barvaux.org> 00022 */ 00023 00024 #ifndef TS_SC_DECOMP_H 00025 #define TS_SC_DECOMP_H 00026 00027 #include "lsb.h" 00028 00029 #include <stdint.h> 00030 00031 00032 /** 00033 * @brief Scaled RTP Timestamp decoding object 00034 * 00035 * See section 4.5.3 of RFC 3095 for details about Scaled RTP Timestamp 00036 * decoding. 00037 */ 00038 struct ts_sc_decomp 00039 { 00040 /// The last computed or received TS_STRIDE value (validated by CRC) 00041 uint32_t ts_stride; 00042 00043 /// The last computed or received TS_SCALED value (validated by CRC) 00044 uint32_t ts_scaled; 00045 /// The LSB-encoded TS_SCALED value 00046 struct d_lsb_decode lsb_ts_scaled; 00047 00048 /// The last computed or received TS_OFFSET value (validated by CRC) 00049 uint32_t ts_offset; 00050 00051 /// The timestamp (TS) value 00052 uint32_t ts; 00053 /// The previous timestamp value 00054 uint32_t old_ts; 00055 00056 /// The sequence number (SN) 00057 uint16_t sn; 00058 /// The previous sequence number 00059 uint16_t old_sn; 00060 00061 00062 /* the attributes below are new TS_* values computed by not yet validated 00063 by CRC check */ 00064 00065 /// The last computed or received TS_STRIDE value (not validated by CRC) 00066 uint32_t new_ts_stride; 00067 /// The last computed or received TS_SCALED value (not validated by CRC) 00068 uint32_t new_ts_scaled; 00069 /// The last computed or received TS_OFFSET value (not validated by CRC) 00070 uint32_t new_ts_offset; 00071 00072 }; 00073 00074 00075 00076 /* 00077 * Function prototypes 00078 */ 00079 00080 void d_create_sc(struct ts_sc_decomp *const ts_sc); 00081 00082 void ts_update_context(struct ts_sc_decomp *const ts_sc, 00083 const uint32_t ts, 00084 const uint16_t sn); 00085 00086 void d_record_ts_stride(struct ts_sc_decomp *const ts_sc, 00087 const uint32_t ts_stride); 00088 00089 int ts_decode_scaled(struct ts_sc_decomp *const ts_sc, 00090 const uint32_t ts_scaled, 00091 const size_t bits_nr, 00092 uint32_t *const decoded_ts); 00093 00094 uint32_t ts_decode_unscaled(struct ts_sc_decomp *const ts_sc, 00095 const uint32_t ts_bits); 00096 00097 uint32_t ts_deduce_from_sn(struct ts_sc_decomp *const ts_sc, 00098 const uint16_t sn); 00099 00100 #endif 00101