# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <assert.h>
vlc_module_begin();
set_shortname( "FTP" );
- set_description( _("FTP input") );
- set_capability( "access2", 0 );
+ set_description( N_("FTP input") );
+ set_capability( "access", 0 );
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_ACCESS );
add_integer( "ftp-caching", 2 * DEFAULT_PTS_DELAY / 1000, NULL,
add_submodule();
set_shortname( "FTP" );
- set_description( _("FTP upload output") );
+ set_description( N_("FTP upload output") );
set_capability( "sout access", 0 );
set_category( CAT_SOUT );
set_subcategory( SUBCAT_SOUT_ACO );
int fd_data;
char sz_epsv_ip[NI_MAXNUMERICHOST];
+ bool out;
};
#define GET_OUT_SYS( p_this ) \
((access_sys_t *)(((sout_access_out_t *)(p_this))->p_sys))
/* Init p_access */
STANDARD_READ_ACCESS_INIT
p_sys->fd_data = -1;
+ p_sys->out = false;
if( parseURL( &p_sys->url, p_access->psz_path ) )
goto exit_error;
}
p_access->info.i_size = atoll( &psz_arg[4] );
free( psz_arg );
- msg_Dbg( p_access, "file size: "I64Fd, p_access->info.i_size );
+ msg_Dbg( p_access, "file size: %"PRId64, p_access->info.i_size );
/* Start the 'stream' */
if( ftp_StartStream( p_this, p_sys, 0 ) < 0 )
/* Init p_access */
p_sys->fd_data = -1;
+ p_sys->out = true;
if( parseURL( &p_sys->url, p_access->psz_path ) )
goto exit_error;
if( i_pos < 0 )
return VLC_EGENERIC;
- msg_Dbg( p_access, "seeking to "I64Fd, i_pos );
+ msg_Dbg( p_access, "seeking to %"PRId64, i_pos );
ftp_StopStream( (vlc_object_t *)p_access, p_sys );
if( ftp_StartStream( (vlc_object_t *)p_access, p_sys, i_pos ) < 0 )
int i_read;
assert( p_sys->fd_data != -1 );
- assert( p_access->i_object_type == VLC_OBJECT_ACCESS );
+ assert( !p_sys->out );
if( p_access->info.b_eof )
return 0;
case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * );
var_Get( p_access, "ftp-caching", &val );
- *pi_64 = (int64_t)var_GetInteger( p_access, "ftp-caching" ) * I64C(1000);
+ *pi_64 = (int64_t)var_GetInteger( p_access, "ftp-caching" ) * INT64_C(1000);
break;
/* */
if( i_start > 0 )
{
- if( ftp_SendCommand( p_access, p_sys, "REST "I64Fu, i_start ) < 0 ||
+ if( ftp_SendCommand( p_access, p_sys, "REST %"PRIu64, i_start ) < 0 ||
ftp_ReadCommand( p_access, p_sys, &i_answer, NULL ) > 3 )
{
msg_Err( p_access, "cannot set restart offset" );
/* "1xx" message */
if( ftp_SendCommand( p_access, p_sys, "%s %s",
- (p_access->i_object_type == VLC_OBJECT_ACCESS)
- ? "RETR" : "STOR",
+ p_sys->out ? "STOR" : "RETR",
p_sys->url.psz_path ) < 0 ||
ftp_ReadCommand( p_access, p_sys, &i_answer, NULL ) > 2 )
{
return VLC_EGENERIC;
}
- shutdown( p_sys->fd_data,
- ( p_access->i_object_type == VLC_OBJECT_ACCESS ) );
+ shutdown( p_sys->fd_data, p_sys->out ? SHUT_RD : SHUT_WR );
return VLC_SUCCESS;
}