*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2.0
+ * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
+ * You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
****************************************************************************/
#include <vlc_plugin.h>
#include <vlc_codecs.h>
+#include "../../demux/xiph.h"
#include "rtp.h"
-#include <srtp.h>
/* PT=dynamic
* vorbis: Xiph Vorbis audio (draft-ietf-avt-rtp-vorbis-09, RFC FIXME)
setuplen = len - (idlen + cmtlen);
/* Create the VLC extra format header */
- uint8_t *extra = malloc ((size_t)6 + idlen + cmtlen + setuplen);
- if (extra == NULL)
- return -1;
- uint8_t *ptr = *pextra = extra;
- /* Identification header */
- *ptr++ = idlen >> 8;
- *ptr++ = idlen & 0xff;
- memcpy (ptr, buf, idlen);
- buf += idlen;
- ptr += idlen;
- /* Comments header */
- *ptr++ = cmtlen >> 8;
- *ptr++ = cmtlen & 0xff;
- memcpy (ptr, buf, cmtlen);
- buf += cmtlen;
- ptr += cmtlen;
- /* Setup header */
- *ptr++ = setuplen >> 8;
- *ptr++ = setuplen & 0xff;
- memcpy (ptr, buf, setuplen);
- ptr += setuplen;
- return ptr - extra;
+ unsigned sizes[3] = {
+ idlen, cmtlen, setuplen
+ };
+ void *payloads[3] = {
+ buf + 0,
+ buf + idlen,
+ buf + cmtlen
+ };
+ void *extra;
+ int extra_size;
+ if (xiph_PackHeaders (&extra_size, &extra, sizes, payloads, 3))
+ return -1;;
+ *pextra = extra;
+ return extra_size;
}