00001 /* * 00002 * This file is part of libnemesi 00003 * 00004 * Copyright (C) 2007 by LScube team <team@streaming.polito.it> 00005 * See AUTHORS for more details 00006 * 00007 * libnemesi 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 * libnemesi 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 libnemesi; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 * 00021 * */ 00022 00023 #include "rtpparser.h" 00024 #include "rtp_utils.h" 00025 #include <math.h> 00026 00032 static const rtpparser_info speex_served = { 00033 -1, 00034 {"speex", NULL} 00035 }; 00036 00037 static int speex_parse(rtp_ssrc * ssrc, rtp_frame * fr, rtp_buff * config) 00038 { 00039 rtp_pkt *pkt; 00040 uint8_t *buf; 00041 size_t len; 00042 void *priv = ssrc->privs[fr->pt]; 00043 int err = RTP_FILL_OK; 00044 00045 if (!(pkt = rtp_get_pkt(ssrc, &len))) 00046 return RTP_BUFF_EMPTY; 00047 00048 buf = RTP_PKT_DATA(pkt); 00049 len = RTP_PAYLOAD_SIZE(pkt, len); 00050 00051 /* Check for PADDING BIT in RTP header and remove it. 00052 * The last octet of the padding is a count of how many padding octets 00053 * should be ignored, including itself (it will be a multiple of 00054 * four) 00055 */ 00056 priv = fr->data = realloc(priv, len); 00057 memcpy(fr->data, buf, len); 00058 fr->len = len; 00059 00060 rtp_rm_pkt(ssrc); 00061 00062 memset(config, 0, sizeof(rtp_buff)); 00063 00064 return err; 00065 } 00066 00067 RTP_PARSER(speex);
1.5.4