Commit 42051dfb authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Implement ACCESS_OUT_CONTROLS_PACE as needed

parent 9b792408
...@@ -89,6 +89,7 @@ static const char *const ppsz_sout_options[] = { ...@@ -89,6 +89,7 @@ static const char *const ppsz_sout_options[] = {
static ssize_t Write( sout_access_out_t *, block_t * ); static ssize_t Write( sout_access_out_t *, block_t * );
static int Seek ( sout_access_out_t *, off_t ); static int Seek ( sout_access_out_t *, off_t );
static ssize_t Read ( sout_access_out_t *, block_t * ); static ssize_t Read ( sout_access_out_t *, block_t * );
static int Control( sout_access_out_t *, int, va_list );
struct sout_access_out_sys_t struct sout_access_out_sys_t
{ {
...@@ -140,16 +141,13 @@ static int Open( vlc_object_t *p_this ) ...@@ -140,16 +141,13 @@ static int Open( vlc_object_t *p_this )
p_access->pf_write = Write; p_access->pf_write = Write;
p_access->pf_read = Read; p_access->pf_read = Read;
p_access->pf_seek = Seek; p_access->pf_seek = Seek;
p_access->pf_control = Control;
p_access->p_sys = (void *)(intptr_t)fd; p_access->p_sys = (void *)(intptr_t)fd;
msg_Dbg( p_access, "file access output opened (%s)", p_access->psz_path ); msg_Dbg( p_access, "file access output opened (%s)", p_access->psz_path );
if (append) if (append)
lseek (fd, 0, SEEK_END); lseek (fd, 0, SEEK_END);
/* Update pace control flag */
if( p_access->psz_access && !strcmp( p_access->psz_access, "stream" ) )
p_access->p_sout->i_out_pace_nocontrol++;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -162,13 +160,26 @@ static void Close( vlc_object_t * p_this ) ...@@ -162,13 +160,26 @@ static void Close( vlc_object_t * p_this )
close( (intptr_t)p_access->p_sys ); close( (intptr_t)p_access->p_sys );
/* Update pace control flag */
if( p_access->psz_access && !strcmp( p_access->psz_access, "stream" ) )
p_access->p_sout->i_out_pace_nocontrol--;
msg_Dbg( p_access, "file access output closed" ); msg_Dbg( p_access, "file access output closed" );
} }
static int Control( sout_access_out_t *p_access, int i_query, va_list args )
{
switch( i_query )
{
case ACCESS_OUT_CONTROLS_PACE:
{
bool *pb = va_arg( args, bool * );
*pb = strcmp( p_access->psz_access, "stream" );
break;
}
default:
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
/***************************************************************************** /*****************************************************************************
* Read: standard read on a file descriptor. * Read: standard read on a file descriptor.
*****************************************************************************/ *****************************************************************************/
......
...@@ -129,6 +129,7 @@ static const char *const ppsz_sout_options[] = { ...@@ -129,6 +129,7 @@ static const char *const ppsz_sout_options[] = {
static ssize_t Write( sout_access_out_t *, block_t * ); static ssize_t Write( sout_access_out_t *, block_t * );
static int Seek ( sout_access_out_t *, off_t ); static int Seek ( sout_access_out_t *, off_t );
static int Control( sout_access_out_t *, int, va_list );
struct sout_access_out_sys_t struct sout_access_out_sys_t
{ {
...@@ -343,10 +344,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -343,10 +344,7 @@ static int Open( vlc_object_t *p_this )
p_access->pf_write = Write; p_access->pf_write = Write;
p_access->pf_seek = Seek; p_access->pf_seek = Seek;
p_access->pf_control = Control;
/* update p_sout->i_out_pace_nocontrol */
p_access->p_sout->i_out_pace_nocontrol++;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -364,9 +362,6 @@ static void Close( vlc_object_t * p_this ) ...@@ -364,9 +362,6 @@ static void Close( vlc_object_t * p_this )
bonjour_stop_service( p_sys->p_bonjour ); bonjour_stop_service( p_sys->p_bonjour );
#endif #endif
/* update p_sout->i_out_pace_nocontrol */
p_access->p_sout->i_out_pace_nocontrol--;
httpd_StreamDelete( p_sys->p_httpd_stream ); httpd_StreamDelete( p_sys->p_httpd_stream );
httpd_HostDelete( p_sys->p_httpd_host ); httpd_HostDelete( p_sys->p_httpd_host );
...@@ -377,6 +372,22 @@ static void Close( vlc_object_t * p_this ) ...@@ -377,6 +372,22 @@ static void Close( vlc_object_t * p_this )
free( p_sys ); free( p_sys );
} }
static int Control( sout_access_out_t *p_access, int i_query, va_list args )
{
(void)p_access;
switch( i_query )
{
case ACCESS_OUT_CONTROLS_PACE:
*va_arg( args, bool * ) = false;
break;
default:
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
/***************************************************************************** /*****************************************************************************
* Write: * Write:
*****************************************************************************/ *****************************************************************************/
......
...@@ -151,6 +151,7 @@ static const char *const ppsz_sout_options[] = { ...@@ -151,6 +151,7 @@ static const char *const ppsz_sout_options[] = {
*****************************************************************************/ *****************************************************************************/
static ssize_t Write( sout_access_out_t *, block_t * ); static ssize_t Write( sout_access_out_t *, block_t * );
static int Seek ( sout_access_out_t *, off_t ); static int Seek ( sout_access_out_t *, off_t );
static int Control( sout_access_out_t *, int, va_list );
struct sout_access_out_sys_t struct sout_access_out_sys_t
{ {
...@@ -459,6 +460,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -459,6 +460,7 @@ static int Open( vlc_object_t *p_this )
p_access->pf_write = Write; p_access->pf_write = Write;
p_access->pf_seek = Seek; p_access->pf_seek = Seek;
p_access->pf_control = Control;
msg_Dbg( p_access, "shout access output opened (%s@%s:%i/%s)", msg_Dbg( p_access, "shout access output opened (%s@%s:%i/%s)",
psz_user, psz_host, i_port, psz_mount ); psz_user, psz_host, i_port, psz_mount );
...@@ -497,6 +499,23 @@ static void Close( vlc_object_t * p_this ) ...@@ -497,6 +499,23 @@ static void Close( vlc_object_t * p_this )
msg_Dbg( p_access, "shout access output closed" ); msg_Dbg( p_access, "shout access output closed" );
} }
static int Control( sout_access_out_t *p_access, int i_query, va_list args )
{
switch( i_query )
{
case ACCESS_OUT_CONTROLS_PACE:
{
bool *pb = va_arg( args, bool * );
*pb = strcmp( p_access->psz_access, "stream" );
break;
}
default:
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
/***************************************************************************** /*****************************************************************************
* Write: standard write * Write: standard write
*****************************************************************************/ *****************************************************************************/
......
...@@ -113,6 +113,7 @@ static const char *const ppsz_core_options[] = { ...@@ -113,6 +113,7 @@ static const char *const ppsz_core_options[] = {
static ssize_t Write ( sout_access_out_t *, block_t * ); static ssize_t Write ( sout_access_out_t *, block_t * );
static int Seek ( sout_access_out_t *, off_t ); static int Seek ( sout_access_out_t *, off_t );
static int Control( sout_access_out_t *, int, va_list );
static void* ThreadWrite( vlc_object_t * ); static void* ThreadWrite( vlc_object_t * );
static block_t *NewUDPPacket( sout_access_out_t *, mtime_t ); static block_t *NewUDPPacket( sout_access_out_t *, mtime_t );
...@@ -260,9 +261,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -260,9 +261,7 @@ static int Open( vlc_object_t *p_this )
p_access->pf_write = Write; p_access->pf_write = Write;
p_access->pf_seek = Seek; p_access->pf_seek = Seek;
p_access->pf_control = Control;
/* update p_sout->i_out_pace_nocontrol */
p_access->p_sout->i_out_pace_nocontrol++;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -298,13 +297,27 @@ static void Close( vlc_object_t * p_this ) ...@@ -298,13 +297,27 @@ static void Close( vlc_object_t * p_this )
vlc_object_detach( p_sys->p_thread ); vlc_object_detach( p_sys->p_thread );
vlc_object_release( p_sys->p_thread ); vlc_object_release( p_sys->p_thread );
/* update p_sout->i_out_pace_nocontrol */
p_access->p_sout->i_out_pace_nocontrol--;
msg_Dbg( p_access, "UDP access output closed" ); msg_Dbg( p_access, "UDP access output closed" );
free( p_sys ); free( p_sys );
} }
static int Control( sout_access_out_t *p_access, int i_query, va_list args )
{
(void)p_access;
switch( i_query )
{
case ACCESS_OUT_CONTROLS_PACE:
*va_arg( args, bool * ) = false;
break;
default:
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
/***************************************************************************** /*****************************************************************************
* Write: standard write on a file descriptor. * Write: standard write on a file descriptor.
*****************************************************************************/ *****************************************************************************/
......
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