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

access_output: allow pf_seek to be NULL, simplify

parent a5f8015d
......@@ -55,7 +55,6 @@ vlc_module_end ()
* Exported prototypes
*****************************************************************************/
static ssize_t Write( sout_access_out_t *, block_t * );
static int Seek ( sout_access_out_t *, off_t );
/*****************************************************************************
* Open: open the file
......@@ -66,7 +65,6 @@ static int Open( vlc_object_t *p_this )
p_access->p_sys = NULL;
p_access->pf_write = Write;
p_access->pf_seek = Seek;
msg_Dbg( p_access, "dummy stream output access opened" );
return VLC_SUCCESS;
......@@ -101,14 +99,3 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
(void)p_access;
return i_write;
}
/*****************************************************************************
* Seek: seek to a specific location in a file
*****************************************************************************/
static int Seek( sout_access_out_t *p_access, off_t i_pos )
{
(void)p_access; (void)i_pos;
return 0;
}
......@@ -192,12 +192,6 @@ static int Seek( sout_access_out_t *p_access, off_t i_pos )
return lseek( (intptr_t)p_access->p_sys, i_pos, SEEK_SET );
}
static int NoSeek(sout_access_out_t *access, off_t pos)
{
(void) access; (void) pos;
return -1;
}
static int Control( sout_access_out_t *p_access, int i_query, va_list args )
{
switch( i_query )
......@@ -212,7 +206,7 @@ static int Control( sout_access_out_t *p_access, int i_query, va_list args )
case ACCESS_OUT_CAN_SEEK:
{
bool *pb = va_arg( args, bool * );
*pb = p_access->pf_seek == Seek;
*pb = p_access->pf_seek != NULL;
break;
}
......@@ -348,13 +342,13 @@ static int Open( vlc_object_t *p_this )
else if (S_ISSOCK(st.st_mode))
{
p_access->pf_write = Send;
p_access->pf_seek = NoSeek;
p_access->pf_seek = NULL;
}
#endif
else
{
p_access->pf_write = WritePipe;
p_access->pf_seek = NoSeek;
p_access->pf_seek = NULL;
}
p_access->pf_control = Control;
p_access->p_sys = (void *)(intptr_t)fd;
......
......@@ -90,7 +90,6 @@ static const char *const ppsz_sout_options[] = {
};
static ssize_t Write( sout_access_out_t *, block_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
......@@ -295,7 +294,6 @@ static int Open( vlc_object_t *p_this )
p_sys->b_header_complete = false;
p_access->pf_write = Write;
p_access->pf_seek = Seek;
p_access->pf_control = Control;
return VLC_SUCCESS;
......@@ -462,13 +460,3 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
return( i_err < 0 ? VLC_EGENERIC : i_len );
}
/*****************************************************************************
* Seek: seek to a specific location in a file
*****************************************************************************/
static int Seek( sout_access_out_t *p_access, off_t i_pos )
{
(void)i_pos;
msg_Warn( p_access, "HTTP sout access cannot seek" );
return VLC_EGENERIC;
}
......@@ -160,7 +160,6 @@ static const char *const ppsz_sout_options[] = {
};
static ssize_t Write( sout_access_out_t *, block_t * );
static int Seek ( sout_access_out_t *, off_t );
static int Control( sout_access_out_t *, int, va_list );
typedef struct output_segment
......@@ -303,7 +302,6 @@ static int Open( vlc_object_t *p_this )
p_sys->psz_cursegPath = NULL;
p_access->pf_write = Write;
p_access->pf_seek = Seek;
p_access->pf_control = Control;
return VLC_SUCCESS;
......@@ -1058,13 +1056,3 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
return i_write;
}
/*****************************************************************************
* Seek: seek to a specific location in a file
*****************************************************************************/
static int Seek( sout_access_out_t *p_access, off_t i_pos )
{
(void) i_pos;
msg_Err( p_access, "livehttp sout access cannot seek" );
return -1;
}
......@@ -150,7 +150,6 @@ static const char *const ppsz_sout_options[] = {
* Exported prototypes
*****************************************************************************/
static ssize_t Write( sout_access_out_t *, block_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
......@@ -378,7 +377,6 @@ static int Open( vlc_object_t *p_this )
}
p_access->pf_write = Write;
p_access->pf_seek = Seek;
p_access->pf_control = Control;
msg_Dbg( p_access, "shout access output opened (%s@%s:%i/%s)",
......@@ -482,14 +480,3 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
return i_write;
}
/*****************************************************************************
* Seek: seek to a specific location -- not supported
*****************************************************************************/
static int Seek( sout_access_out_t *p_access, off_t i_pos )
{
VLC_UNUSED(i_pos);
msg_Err( p_access, "cannot seek on shout" );
return VLC_EGENERIC;
}
......@@ -104,7 +104,6 @@ static const char *const ppsz_core_options[] = {
};
static ssize_t Write ( sout_access_out_t *, block_t * );
static int Seek ( sout_access_out_t *, off_t );
static int Control( sout_access_out_t *, int, va_list );
static void* ThreadWrite( void * );
......@@ -226,7 +225,6 @@ static int Open( vlc_object_t *p_this )
}
p_access->pf_write = Write;
p_access->pf_seek = Seek;
p_access->pf_control = Control;
return VLC_SUCCESS;
......@@ -351,16 +349,6 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
return i_len;
}
/*****************************************************************************
* Seek: seek to a specific location in a file
*****************************************************************************/
static int Seek( sout_access_out_t *p_access, off_t i_pos )
{
(void) i_pos;
msg_Err( p_access, "UDP sout access cannot seek" );
return -1;
}
/*****************************************************************************
* NewUDPPacket: allocate a new UDP packet of size p_sys->i_mtu
*****************************************************************************/
......
......@@ -301,6 +301,8 @@ void sout_AccessOutDelete( sout_access_out_t *p_access )
*****************************************************************************/
int sout_AccessOutSeek( sout_access_out_t *p_access, off_t i_pos )
{
if (p_access->pf_seek == NULL)
return VLC_EGENERIC;
return p_access->pf_seek( p_access, i_pos );
}
......
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