access: make access_t.p_sys void * (refs #17078)

This commit is contained in:
Rémi Denis-Courmont 2016-07-18 20:29:31 +03:00
parent 4489a0487e
commit 6e1ace8a75
17 changed files with 66 additions and 35 deletions

View File

@ -67,7 +67,7 @@ struct access_t
{
bool b_eof; /* idem */
} info;
access_sys_t *p_sys;
void *p_sys;
/* Weak link to parent input */
input_thread_t *p_input;

View File

@ -303,7 +303,9 @@ void OutCloseAvio(vlc_object_t *object)
static ssize_t Read(access_t *access, void *data, size_t size)
{
int r = avio_read(access->p_sys->context, data, size);
access_sys_t *sys = access->p_sys;
int r = avio_read(sys->context, data, size);
if (r < 0)
r = 0;
return r;

View File

@ -349,6 +349,8 @@ static int Seek( access_t *p_access, uint64_t i_pos )
*****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args )
{
access_sys_t *sys = p_access->p_sys;
switch( i_query )
{
case STREAM_CAN_SEEK:
@ -358,7 +360,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
*va_arg( args, bool* ) = true;
break;
case STREAM_GET_SIZE:
*va_arg( args, uint64_t * ) = p_access->p_sys->size;
*va_arg( args, uint64_t * ) = sys->size;
break;
case STREAM_GET_PTS_DELAY:
*va_arg( args, int64_t * ) =

View File

@ -827,7 +827,7 @@ static void CommonClose( vlc_object_t *p_this, access_sys_t *p_sys )
static void AccessClose( vlc_object_t *p_this )
{
access_t *p_access = (access_t *)p_this;
access_sys_t *p_sys = p_access->p_sys;
access_sys_t *p_sys = (access_sys_t *)p_access->p_sys;
/* Stop capturing stuff */
p_sys->p_control->Stop();
@ -1751,7 +1751,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
*****************************************************************************/
static block_t *ReadCompressed( access_t *p_access, bool *eof )
{
access_sys_t *p_sys = p_access->p_sys;
access_sys_t *p_sys = (access_sys_t *)p_access->p_sys;
/* There must be only 1 elementary stream to produce a valid stream
* of MPEG or DV data */
dshow_stream_t *p_stream = p_sys->pp_streams[0];
@ -1896,6 +1896,7 @@ static int Demux( demux_t *p_demux )
*****************************************************************************/
static int AccessControl( access_t *p_access, int i_query, va_list args )
{
access_sys_t *sys = (access_sys_t *)p_access->p_sys;
bool *pb_bool;
int64_t *pi_64;
@ -1917,7 +1918,7 @@ static int AccessControl( access_t *p_access, int i_query, va_list args )
case STREAM_GET_CONTENT_TYPE:
{
dshow_stream_t *p_stream = p_access->p_sys->pp_streams[0];
dshow_stream_t *p_stream = sys->pp_streams[0];
char **type = va_arg( args, char ** );
/* Check if we need to force demuxers */

View File

@ -475,6 +475,8 @@ static ssize_t Read( access_t *p_access, void *p_buffer, size_t i_len )
*****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args )
{
access_sys_t *sys = p_access->p_sys;
switch( i_query )
{
case STREAM_CAN_SEEK:
@ -489,8 +491,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case STREAM_GET_SIZE:
{
smb_stat st = smb_stat_fd( p_access->p_sys->p_session,
p_access->p_sys->i_fd );
smb_stat st = smb_stat_fd( p_sys->p_session, p_sys->i_fd );
*va_arg( args, uint64_t * ) = smb_stat_get( st, SMB_STAT_SIZE );
break;
}

View File

@ -267,6 +267,8 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args )
{
access_sys_t *sys = p_access->p_sys;
switch( i_query )
{
/* */
@ -287,7 +289,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
/* */
case STREAM_SET_PAUSE_STATE:
AVCPause( p_access, p_access->p_sys->i_node );
AVCPause( p_access, sys->i_node );
break;
default:
@ -315,8 +317,9 @@ static block_t *Block( access_t *p_access, bool *restrict eof )
static void Raw1394EventThreadCleanup( void *obj )
{
event_thread_t *p_ev = (event_thread_t *)obj;
access_sys_t *sys = p_ev->p_access->p_sys;
AVCStop( p_ev->p_access, p_ev->p_access->p_sys->i_node );
AVCStop( p_ev->p_access, sys->i_node );
}
static void* Raw1394EventThread( void *obj )

View File

@ -220,6 +220,7 @@ static int ScanFrontendTuningHandler( scan_t *p_scan, void *p_privdata,
const scan_tuner_config_t *p_cfg )
{
access_t *p_access = (access_t *) p_privdata;
access_sys_t *sys = p_access->p_sys;
VLC_UNUSED(p_scan);
var_SetInteger( p_access, "dvb-frequency", p_cfg->i_frequency );
@ -235,7 +236,7 @@ static int ScanFrontendTuningHandler( scan_t *p_scan, void *p_privdata,
msg_Dbg( p_access, " bandwidth %d", p_cfg->i_bandwidth );
/* Setting frontend parameters for tuning the hardware */
if( FrontendSet( VLC_OBJECT(p_access), &p_access->p_sys->dvb ) < 0 )
if( FrontendSet( VLC_OBJECT(p_access), &sys->dvb ) < 0 )
{
msg_Err( p_access, "Failed to tune the frontend" );
return VLC_EGENERIC;
@ -247,10 +248,11 @@ static int ScanFrontendTuningHandler( scan_t *p_scan, void *p_privdata,
static int ScanStatsCallback( scan_t *p_scan, void *p_privdata, int *pi_snr )
{
access_t *p_access = (access_t *) p_privdata;
access_sys_t *sys = p_access->p_sys;
VLC_UNUSED(p_scan);
frontend_statistic_t stat;
if( !FrontendGetStatistic( &p_access->p_sys->dvb, &stat ) )
if( !FrontendGetStatistic( &sys->dvb, &stat ) )
{
*pi_snr = stat.i_snr;
return VLC_SUCCESS;
@ -381,6 +383,7 @@ static block_t *BlockScan( access_t *p_access, bool *restrict eof )
*****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args )
{
access_sys_t *sys = p_access->p_sys;
bool *pb_bool;
int64_t *pi_64;
double *pf1, *pf2;
@ -410,7 +413,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
pf2 = (double*)va_arg( args, double * );
*pf1 = *pf2 = 0;
if( !FrontendGetStatistic( &p_access->p_sys->dvb, &stat ) )
if( !FrontendGetStatistic( &sys->dvb, &stat ) )
{
*pf1 = (double)stat.i_snr / 65535.0;
*pf2 = (double)stat.i_signal_strenth / 65535.0;

View File

@ -302,7 +302,9 @@ static ssize_t Read (access_t *p_access, void *p_buffer, size_t i_len)
*****************************************************************************/
static int FileSeek (access_t *p_access, uint64_t i_pos)
{
if (lseek (p_access->p_sys->fd, i_pos, SEEK_SET) == (off_t)-1)
access_sys_t *sys = p_access->p_sys;
if (lseek(sys->fd, i_pos, SEEK_SET) == (off_t)-1)
return VLC_EGENERIC;
return VLC_SUCCESS;
}

View File

@ -961,6 +961,7 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
*****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args )
{
access_sys_t *sys = p_access->p_sys;
bool *pb_bool;
int64_t *pi_64;
@ -983,9 +984,9 @@ static int Control( access_t *p_access, int i_query, va_list args )
*pb_bool = true; /* FIXME */
break;
case STREAM_GET_SIZE:
if( p_access->p_sys->size == UINT64_MAX )
if( sys->size == UINT64_MAX )
return VLC_EGENERIC;
*va_arg( args, uint64_t * ) = p_access->p_sys->size;
*va_arg( args, uint64_t * ) = sys->size;
break;
case STREAM_GET_PTS_DELAY:
@ -997,7 +998,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case STREAM_SET_PAUSE_STATE:
pb_bool = (bool*)va_arg( args, bool* );
if ( !pb_bool )
return Seek( p_access, p_access->p_sys->offset );
return Seek( p_access, sys->offset );
break;
default:

View File

@ -208,7 +208,9 @@ static ssize_t Read( access_t *p_access, void *p_buffer, size_t i_len )
*****************************************************************************/
static int Seek( access_t *p_access, uint64_t i_pos )
{
if (lseek( p_access->p_sys->fd, i_pos, SEEK_SET ) == (off_t)-1)
access_sys_t *sys = p_access->p_sys;
if (lseek( sys->fd, i_pos, SEEK_SET ) == (off_t)-1)
return VLC_EGENERIC;
return VLC_SUCCESS;
}

View File

@ -101,20 +101,22 @@ static bool
nfs_check_status(access_t *p_access, int i_status, const char *psz_error,
const char *psz_func)
{
access_sys_t *sys = p_access->p_sys;
if (i_status < 0)
{
if (i_status != -EINTR)
{
msg_Err(p_access, "%s failed: %d, '%s'", psz_func, i_status,
psz_error);
if (!p_access->p_sys->b_error)
if (!sys->b_error)
vlc_dialog_display_error(p_access,
_("NFS operation failed"), "%s",
psz_error);
}
else
msg_Warn(p_access, "%s interrupted", psz_func);
p_access->p_sys->b_error = true;
sys->b_error = true;
return true;
}
else

View File

@ -277,11 +277,11 @@ static block_t *BlockRead( access_t *p_access, bool *restrict eof )
return p_block;
}
i_size = real_get_rdt_chunk_header( p_access->p_sys->p_rtsp, &pheader );
i_size = real_get_rdt_chunk_header( p_sys->p_rtsp, &pheader );
if( i_size <= 0 ) return NULL;
p_block = block_Alloc( i_size );
p_block->i_buffer = real_get_rdt_chunk( p_access->p_sys->p_rtsp, &pheader,
p_block->i_buffer = real_get_rdt_chunk( p_sys->p_rtsp, &pheader,
&p_block->p_buffer );
(void) eof;

View File

@ -400,13 +400,16 @@ static ssize_t Read( access_t *p_access, void *buf, size_t len )
static int Seek( access_t* p_access, uint64_t i_pos )
{
libssh2_sftp_seek( p_access->p_sys->file, i_pos );
access_sys_t *sys = p_access->p_sys;
libssh2_sftp_seek( sys->file, i_pos );
return VLC_SUCCESS;
}
static int Control( access_t* p_access, int i_query, va_list args )
{
access_sys_t *sys = p_access->p_sys;
bool* pb_bool;
int64_t* pi_64;
@ -431,7 +434,7 @@ static int Control( access_t* p_access, int i_query, va_list args )
case STREAM_GET_SIZE:
if( p_access->pf_readdir != NULL )
return VLC_EGENERIC;
*va_arg( args, uint64_t * ) = p_access->p_sys->filesize;
*va_arg( args, uint64_t * ) = sys->filesize;
break;
case STREAM_GET_PTS_DELAY:

View File

@ -420,6 +420,8 @@ static int DirControl( access_t *p_access, int i_query, va_list args )
*****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args )
{
access_sys_t *sys = p_access->p_sys;
switch( i_query )
{
case STREAM_CAN_SEEK:
@ -435,7 +437,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case STREAM_GET_SIZE:
if( p_access->pf_readdir != NULL )
return VLC_EGENERIC;
*va_arg( args, uint64_t * ) = p_access->p_sys->size;
*va_arg( args, uint64_t * ) = sys->size;
break;
case STREAM_GET_PTS_DELAY:

View File

@ -443,8 +443,10 @@ static void FindSeekpoint( access_t *p_access )
*****************************************************************************/
static char *GetFilePath( access_t *p_access, unsigned i_file )
{
access_sys_t *sys = p_access->p_sys;
char *psz_path;
if( asprintf( &psz_path, p_access->p_sys->b_ts_format ?
if( asprintf( &psz_path, sys->b_ts_format ?
"%s" DIR_SEP "%05u.ts" : "%s" DIR_SEP "%03u.vdr",
p_access->psz_filepath, i_file + 1 ) == -1 )
return NULL;
@ -594,11 +596,12 @@ static void UpdateFileSize( access_t *p_access )
*****************************************************************************/
static FILE *OpenRelativeFile( access_t *p_access, const char *psz_file )
{
access_sys_t *sys = p_access->p_sys;
/* build path and add extension */
char *psz_path;
if( asprintf( &psz_path, "%s" DIR_SEP "%s%s",
p_access->psz_filepath, psz_file,
p_access->p_sys->b_ts_format ? "" : ".vdr" ) == -1 )
if( asprintf( &psz_path, "%s" DIR_SEP "%s%s", p_access->psz_filepath,
psz_file, sys->b_ts_format ? "" : ".vdr" ) == -1 )
return NULL;
FILE *file = vlc_fopen( psz_path, "rb" );

View File

@ -186,8 +186,8 @@ exit:
{
if( p_sys->zipFile )
{
unzCloseCurrentFile( p_access->p_sys->zipFile );
unzClose( p_access->p_sys->zipFile );
unzCloseCurrentFile( p_sys->zipFile );
unzClose( p_sys->zipFile );
}
free( p_sys );
}
@ -217,6 +217,7 @@ void AccessClose( vlc_object_t *p_this )
*****************************************************************************/
static int AccessControl( access_t *p_access, int i_query, va_list args )
{
access_sys_t *sys = p_access->p_sys;
bool *pb_bool;
int64_t *pi_64;
@ -238,7 +239,7 @@ static int AccessControl( access_t *p_access, int i_query, va_list args )
{
unz_file_info z_info;
unzGetCurrentFileInfo( p_access->p_sys->zipFile, &z_info,
unzGetCurrentFileInfo( sys->zipFile, &z_info,
NULL, 0, NULL, 0, NULL, 0 );
*va_arg( args, uint64_t * ) = z_info.uncompressed_size;
break;

View File

@ -1045,6 +1045,7 @@ IXML_Document* MediaServer::_browseAction( const char* psz_object_id_,
IXML_Document* p_action = NULL;
IXML_Document* p_response = NULL;
Upnp_i11e_cb *i11eCb = NULL;
access_sys_t *sys = (access_sys_t *)m_access->p_sys;
int i_res;
@ -1113,7 +1114,7 @@ IXML_Document* MediaServer::_browseAction( const char* psz_object_id_,
/* Setup an interruptible callback that will call sendActionCb if not
* interrupted by vlc_interrupt_kill */
i11eCb = new Upnp_i11e_cb( sendActionCb, &p_response );
i_res = UpnpSendActionAsync( m_access->p_sys->p_upnp->handle(),
i_res = UpnpSendActionAsync( sys->p_upnp->handle(),
m_psz_root,
CONTENT_DIRECTORY_SERVICE_TYPE,
NULL, /* ignored in SDK, must be NULL */
@ -1235,8 +1236,10 @@ static int Open( vlc_object_t *p_this )
static void Close( vlc_object_t* p_this )
{
access_t* p_access = (access_t*)p_this;
p_access->p_sys->p_upnp->release( false );
delete p_access->p_sys;
access_sys_t *sys = (access_sys_t *)p_access->p_sys;
sys->p_upnp->release( false );
delete sys;
}
}