Commit 68cdf347 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

DSO friendliness

parent be9cd599
......@@ -134,7 +134,6 @@ vlc_module_begin();
set_capability( "sout access", 100 );
add_shortcut( "udp" );
add_shortcut( "rtp" ); // Will work only with ts muxer
set_callbacks( Open, Close );
vlc_module_end();
......@@ -203,11 +202,7 @@ typedef struct sout_access_thread_t
struct sout_access_out_sys_t
{
int i_mtu;
vlc_bool_t b_rtpts; // true for RTP/MP2 encapsulation
vlc_bool_t b_mtu_warning;
uint16_t i_sequence_number;
uint32_t i_ssrc;
block_t *p_buffer;
......@@ -257,12 +252,6 @@ static int Open( vlc_object_t *p_this )
}
p_access->p_sys = p_sys;
if( p_access->psz_access != NULL )
{
if (strcmp (p_access->psz_access, "rtp") == 0)
p_sys->b_rtpts = VLC_TRUE;
}
if (var_GetBool (p_access, SOUT_CFG_PREFIX"lite"))
{
protoname = "UDP-Lite";
......@@ -381,13 +370,7 @@ static int Open( vlc_object_t *p_this )
var_GetInteger( p_access, SOUT_CFG_PREFIX "group" );
p_sys->i_mtu = var_CreateGetInteger( p_this, "mtu" );
if( p_sys->b_rtpts && ( p_sys->i_mtu < RTP_HEADER_LENGTH ) )
p_sys->i_mtu = 576 - 20 - 8;
srand( (uint32_t)mdate());
p_sys->p_buffer = NULL;
p_sys->i_sequence_number = rand()&0xffff;
p_sys->i_ssrc = rand()&0xffffffff;
if (i_rtcp_port && OpenRTCP (VLC_OBJECT (p_access), &p_sys->p_thread->rtcp,
i_handle, proto, i_rtcp_port))
......@@ -499,8 +482,6 @@ static int Write( sout_access_out_t *p_access, block_t *p_buffer )
while( p_buffer->i_buffer )
{
int i_payload_size = p_sys->i_mtu;
if( p_sys->b_rtpts )
i_payload_size -= RTP_HEADER_LENGTH;
int i_write = __MIN( p_buffer->i_buffer, i_payload_size );
......@@ -605,22 +586,6 @@ static block_t *NewUDPPacket( sout_access_out_t *p_access, mtime_t i_dts)
p_buffer->i_dts = i_dts;
p_buffer->i_buffer = 0;
if( p_sys->b_rtpts )
{
mtime_t i_timestamp = p_buffer->i_dts * 9 / 100;
/* add rtp/ts header */
p_buffer->p_buffer[0] = 0x80;
p_buffer->p_buffer[1] = 33; // mpeg2-ts
SetWBE( p_buffer->p_buffer + 2, p_sys->i_sequence_number );
p_sys->i_sequence_number++;
SetDWBE( p_buffer->p_buffer + 4, i_timestamp );
SetDWBE( p_buffer->p_buffer + 8, p_sys->i_ssrc );
p_buffer->i_buffer = RTP_HEADER_LENGTH;
}
return p_buffer;
}
......
......@@ -179,7 +179,7 @@ static int Open( vlc_object_t *p_this )
if( psz_url && strrchr( psz_url, '.' ) )
{
/* by extension */
static struct { const char *ext; const char *mux; } exttomux[] =
static struct { const char ext[6]; const char mux[16]; } exttomux[] =
{
{ "avi", "avi" },
{ "ogg", "ogg" },
......@@ -196,15 +196,15 @@ static int Open( vlc_object_t *p_this )
{ "mpeg","ps" },
{ "ps", "ps" },
{ "mpeg1","mpeg1" },
{ "wav","wav" },
{ "wav", "wav" },
{ "flv", "ffmpeg{mux=flv}" },
{ NULL, NULL }
{ "", "" }
};
const char *psz_ext = strrchr( psz_url, '.' ) + 1;
int i;
msg_Dbg( p_this, "extension is %s", psz_ext );
for( i = 0; exttomux[i].ext != NULL; i++ )
for( i = 0; exttomux[i].ext[0]; i++ )
{
if( !strcasecmp( psz_ext, exttomux[i].ext ) )
{
......
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