Commit 6daa02af authored by Sébastien Escudier's avatar Sébastien Escudier

Add Vorbis and VP8 codecs to live555.

Chained vorbis stream is not supported.
parent 41a7f1cb
......@@ -61,6 +61,7 @@
#include <GroupsockHelper.hh>
#include <liveMedia.hh>
#include <liveMedia_version.hh>
#include <Base64.hh>
extern "C" {
#include "../access/mms/asf.h" /* Who said ugly ? */
......@@ -268,6 +269,8 @@ static void* TimeoutPrevention( void * );
static unsigned char* parseH264ConfigStr( char const* configStr,
unsigned int& configSize );
static unsigned char* parseVorbisConfigStr( char const* configStr,
unsigned int& configSize );
/*****************************************************************************
* DemuxOpen:
......@@ -959,6 +962,20 @@ static int SessionsSetup( demux_t *p_demux )
tk->fmt.audio.i_rate = 8000;
}
}
else if( !strcmp( sub->codecName(), "VORBIS" ) )
{
tk->fmt.i_codec = VLC_CODEC_VORBIS;
unsigned int i_extra;
unsigned char *p_extra;
if( ( p_extra=parseVorbisConfigStr( sub->fmtp_config(),
i_extra ) ) )
{
tk->fmt.i_extra = i_extra;
tk->fmt.p_extra = p_extra;
}
else
msg_Warn( p_demux,"Missing or unsupported vorbis header." );
}
}
else if( !strcmp( sub->mediumName(), "video" ) )
{
......@@ -1050,6 +1067,10 @@ static int SessionsSetup( demux_t *p_demux )
tk->p_out_muxed = stream_DemuxNew( p_demux, "rawdv",
p_demux->out );
}
else if( !strcmp( sub->codecName(), "VP8" ) )
{
tk->fmt.i_codec = VLC_CODEC_VP8;
}
}
else if( !strcmp( sub->mediumName(), "text" ) )
{
......@@ -2123,3 +2144,24 @@ static unsigned char* parseH264ConfigStr( char const* configStr,
free( dup );
return cfg;
}
static uint8_t *parseVorbisConfigStr( char const* configStr,
unsigned int& configSize )
{
configSize = 0;
if( configStr == NULL || *configStr == '\0' )
return NULL;
unsigned char *p_cfg = base64Decode( configStr, configSize );
uint8_t *p_extra = NULL;
/* skip header count, ident number and length (cf. RFC 5215) */
const unsigned int headerSkip = 9;
if( configSize > headerSkip && ((uint8_t*)p_cfg)[3] == 1 )
{
configSize -= headerSkip;
p_extra = (uint8_t*)xmalloc( configSize );
memcpy( p_extra, p_cfg+headerSkip, configSize );
}
delete[] p_cfg;
return p_extra;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment