static void StreamClose( void * );
static void TaskInterrupt( void * );
+#if LIVEMEDIA_LIBRARY_VERSION_INT >= 1117756800
+static unsigned char* parseH264ConfigStr( char const* configStr,
+ unsigned int& configSize );
+#endif
+
/*****************************************************************************
* DemuxOpen:
*****************************************************************************/
v, o, s fields are mandatory and in this order */
if( stream_Peek( p_demux->s, &p_peek, 7 ) < 7 ) return VLC_EGENERIC;
- if( strncmp( (char*)p_peek, "v=0\r\n", 5 ) &&
- strncmp( (char*)p_peek, "v=0\n", 4 ) &&
+ if( memcmp( (char*)p_peek, "v=0\r\n", 5 ) &&
+ memcmp( (char*)p_peek, "v=0\n", 4 ) &&
( p_peek[0] < 'a' || p_peek[0] > 'z' || p_peek[1] != '=' ) )
{
return VLC_EGENERIC;
goto error;
}
- if( strcasecmp( p_demux->psz_access, "sdp" ) &&
- vlc_UrlIsNotEncoded( p_sys->psz_path ) )
+ if( strcasecmp( p_demux->psz_access, "sdp" ) )
{
- p_sys->psz_path = vlc_UrlEncode( p_sys->psz_path );
- if( p_sys->psz_path == NULL )
- goto error;
+ char *p = p_sys->psz_path;
+ while( (p = strchr( p, ' ' )) != NULL )
+ *p = '+';
}
if( p_demux->s == NULL && !strcasecmp( p_demux->psz_access, "rtsp" ) )
/* malloc-ated copy */
p_sys->p_sdp = strdup( (char*)p_sdp );
delete[] p_sdp;
- fprintf( stderr, "sdp=%s\n", p_sys->p_sdp );
+ msg_Dbg( p_demux, "sdp=%s\n", p_sys->p_sdp );
}
else if( p_demux->s == NULL && !strcasecmp( p_demux->psz_access, "sdp" ) )
{
{
es_format_Init( &tk->fmt, AUDIO_ES, VLC_FOURCC('u','n','d','f') );
tk->fmt.audio.i_channels = sub->numChannels();
- tk->fmt.audio.i_rate = sub->rtpSource()->timestampFrequency();
+ tk->fmt.audio.i_rate = sub->rtpTimestampFrequency();
if( !strcmp( sub->codecName(), "MPA" ) ||
!strcmp( sub->codecName(), "MPA-ROBUST" ) ||
{
tk->fmt.i_codec = VLC_FOURCC( 'a', 'l', 'a', 'w' );
}
+ else if( !strcmp( sub->codecName(), "AMR" ) )
+ {
+ tk->fmt.i_codec = VLC_FOURCC( 's', 'a', 'm', 'r' );
+ }
+ else if( !strcmp( sub->codecName(), "AMR-WB" ) )
+ {
+ tk->fmt.i_codec = VLC_FOURCC( 's', 'a', 'w', 'b' );
+ }
else if( !strcmp( sub->codecName(), "MP4A-LATM" ) )
{
unsigned int i_extra;
{
tk->fmt.i_codec = VLC_FOURCC( 'H', '2', '6', '1' );
}
+ else if( !strcmp( sub->codecName(), "H264" ) )
+ {
+#if LIVEMEDIA_LIBRARY_VERSION_INT >= 1117756800
+ unsigned int i_extra = 0;
+ uint8_t *p_extra = NULL;
+#endif
+ tk->fmt.i_codec = VLC_FOURCC( 'H', '2', '6', '4' );
+ tk->fmt.b_packetized = VLC_FALSE;
+
+ /* XXX not the right minimal version I fear */
+#if LIVEMEDIA_LIBRARY_VERSION_INT >= 1117756800
+ if((p_extra=parseH264ConfigStr( sub->fmtp_spropparametersets(),
+ i_extra ) ) )
+ {
+ tk->fmt.i_extra = i_extra;
+ tk->fmt.p_extra = malloc( i_extra );
+ memcpy( tk->fmt.p_extra, p_extra, i_extra );
+
+ delete[] p_extra;
+ }
+#endif
+ }
else if( !strcmp( sub->codecName(), "JPEG" ) )
{
tk->fmt.i_codec = VLC_FOURCC( 'M', 'J', 'P', 'G' );
live_track_t *tk = p_sys->track[i];
if( !tk->b_muxed && !tk->b_rtcp_sync &&
- tk->rtpSource->hasBeenSynchronizedUsingRTCP() )
+ tk->rtpSource && tk->rtpSource->hasBeenSynchronizedUsingRTCP() )
{
msg_Dbg( p_demux, "tk->rtpSource->hasBeenSynchronizedUsingRTCP()" );
msg_Warn( p_demux, "buffer overflow" );
}
/* FIXME could i_size be > buffer size ? */
- if( tk->fmt.i_codec == VLC_FOURCC('h','2','6','1') )
+ if( tk->fmt.i_codec == VLC_FOURCC('H','2','6','1') )
{
#if LIVEMEDIA_LIBRARY_VERSION_INT >= 1081468800
H261VideoRTPSource *h261Source = (H261VideoRTPSource*)tk->rtpSource;
p_block = block_New( p_demux, i_size + 4 );
memcpy( p_block->p_buffer, &header, 4 );
memcpy( p_block->p_buffer + 4, tk->p_buffer, i_size );
+
+ if( tk->rtpSource->curPacketMarkerBit() )
+ p_block->i_flags |= BLOCK_FLAG_END_OF_FRAME;
+ }
+ else if( tk->fmt.i_codec == VLC_FOURCC('H','2','6','4') )
+ {
+ if( (tk->p_buffer[0] & 0x1f) >= 24 )
+ msg_Warn( p_demux, "unsupported NAL type for H264" );
+
+ /* Normal NAL type */
+ p_block = block_New( p_demux, i_size + 4 );
+ p_block->p_buffer[0] = 0x00;
+ p_block->p_buffer[1] = 0x00;
+ p_block->p_buffer[2] = 0x00;
+ p_block->p_buffer[3] = 0x01;
+ memcpy( &p_block->p_buffer[4], tk->p_buffer, i_size );
}
else if( tk->b_asf )
{
p_block = block_New( p_demux, i_size );
memcpy( p_block->p_buffer, tk->p_buffer, i_size );
}
- if( tk->fmt.i_codec == VLC_FOURCC('h','2','6','1') &&
- tk->rtpSource->curPacketMarkerBit() )
- {
- p_block->i_flags |= BLOCK_FLAG_END_OF_FRAME;
- }
+
//p_block->i_rate = p_input->stream.control.i_rate;
if( i_pts != tk->i_pts && !tk->b_muxed )
{
demux_t *p_demux = (demux_t*)p_private;
- fprintf( stderr, "TaskInterrupt\n" );
-
p_demux->p_sys->i_no_data_ti++;
/* Avoid lock */
free( psz_asf );
return VLC_SUCCESS;
}
+
+#if LIVEMEDIA_LIBRARY_VERSION_INT >= 1117756800
+static unsigned char* parseH264ConfigStr( char const* configStr,
+ unsigned int& configSize )
+{
+ char *dup, *psz;
+
+ if( configSize )
+ configSize = 0;
+
+ if( configStr == NULL || *configStr == '\0' )
+ return NULL;
+
+ psz = dup = strdup( configStr );
+
+ unsigned char *cfg = new unsigned char[5 * strlen(psz)];
+ for( ;; )
+ {
+ char *p = strchr( psz, ',' );
+ if( p )
+ *p++ = '\0';
+
+ cfg[configSize++] = 0x00;
+ cfg[configSize++] = 0x00;
+ cfg[configSize++] = 0x00;
+ cfg[configSize++] = 0x01;
+ configSize += b64_decode( (char*)&cfg[configSize], psz );
+
+ if( p == NULL )
+ break;
+ psz = p;
+ }
+
+ if( dup ) free( dup );
+ return cfg;
+}
+#endif
+
/*char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";*/
static int b64_decode( char *dest, char *src )
{