*****************************************************************************/
#include <vlc/vlc.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <assert.h>
#include <vlc_access.h>
set_capability( "sout access", 0 );
set_category( CAT_SOUT );
set_subcategory( SUBCAT_SOUT_ACO );
- add_shortcut( "ftp" );
set_callbacks( OutOpen, OutClose );
vlc_module_end();
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int Read( access_t *, uint8_t *, int );
-static int Write( sout_access_out_t *, block_t * );
+static ssize_t Read( access_t *, uint8_t *, size_t );
+static ssize_t Write( sout_access_out_t *, block_t * );
static int Seek( access_t *, int64_t );
static int OutSeek( sout_access_out_t *, int64_t );
static int Control( access_t *, int, va_list );
if( fd == -1 )
{
msg_Err( p_access, "connection failed" );
- intf_UserFatal( p_access, VLC_FALSE, _("Network interaction failed"),
+ intf_UserFatal( p_access, VLC_FALSE, _("Network interaction failed"),
_("VLC could not connect with the given server.") );
return -1;
}
if( i_answer / 100 != 2 )
{
msg_Err( p_access, "connection rejected" );
- intf_UserFatal( p_access, VLC_FALSE, _("Network interaction failed"),
+ intf_UserFatal( p_access, VLC_FALSE, _("Network interaction failed"),
_("VLC's connection to the given server was rejected.") );
return -1;
}
if( i_answer / 100 != 2 )
{
msg_Err( p_access, "account rejected" );
- intf_UserFatal( p_access, VLC_FALSE,
- _("Network interaction failed"),
+ intf_UserFatal( p_access, VLC_FALSE,
+ _("Network interaction failed"),
_("Your account was rejected.") );
return -1;
}
default:
msg_Err( p_access, "password rejected" );
- intf_UserFatal( p_access, VLC_FALSE,
- _("Network interaction failed"),
+ intf_UserFatal( p_access, VLC_FALSE,
+ _("Network interaction failed"),
_("Your password was rejected.") );
return -1;
}
break;
default:
msg_Err( p_access, "user rejected" );
- intf_UserFatal( p_access, VLC_FALSE,
- _("Network interaction failed"),
- _("Your connection attemp to the server was rejected.") );
+ intf_UserFatal( p_access, VLC_FALSE,
+ _("Network interaction failed"),
+ _("Your connection attempt to the server was rejected.") );
return -1;
}
/*****************************************************************************
* Read:
*****************************************************************************/
-static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
+static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
access_sys_t *p_sys = p_access->p_sys;
int i_read;
/*****************************************************************************
* Write:
*****************************************************************************/
-static int Write( sout_access_out_t *p_access, block_t *p_buffer )
+static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
{
access_sys_t *p_sys = GET_OUT_SYS(p_access);
size_t i_write = 0;
/* */
case ACCESS_SET_PAUSE_STATE:
- /* Nothing to do */
+ pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
+ if ( !pb_bool )
+ return Seek( p_access, p_access->info.i_pos );
break;
case ACCESS_GET_TITLE_INFO:
case ACCESS_SET_TITLE:
case ACCESS_SET_SEEKPOINT:
case ACCESS_SET_PRIVATE_ID_STATE:
+ case ACCESS_GET_CONTENT_TYPE:
+ case ACCESS_GET_META:
return VLC_EGENERIC;
default:
- msg_Warn( p_access, "unimplemented query in control" );
+ msg_Warn( p_access, "unimplemented query in control: %d", i_query);
return VLC_EGENERIC;
}
p_sys->url.psz_path ) < 0 ||
ftp_ReadCommand( p_access, p_sys, &i_answer, NULL ) > 2 )
{
- msg_Err( p_access, "cannot retreive file" );
+ msg_Err( p_access, "cannot retrieve file" );
return VLC_EGENERIC;
}
- if( p_access->i_object_type == VLC_OBJECT_ACCESS )
- net_StopSend( p_sys->fd_data );
- else
- net_StopRecv( p_sys->fd_data );
+ shutdown( p_sys->fd_data,
+ ( p_access->i_object_type == VLC_OBJECT_ACCESS ) );
return VLC_SUCCESS;
}
if( p_sys->fd_data != -1 )
{
+ int i_answer;
+ ftp_ReadCommand( p_access, p_sys, &i_answer, NULL );
+ if ( i_answer != 227 )
+ /* If answer is from the previous command,
+ * rathen that succesful ABOR - read next command */
+ ftp_ReadCommand( p_access, p_sys, NULL, NULL );
+
net_Close( p_sys->fd_data );
p_sys->fd_data = -1;
- ftp_ReadCommand( p_access, p_sys, NULL, NULL );
}
- ftp_ReadCommand( p_access, p_sys, NULL, NULL );
return VLC_SUCCESS;
}