/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdlib.h>
+#include <vlc/vlc.h>
+
#include <assert.h>
-#include <vlc/vlc.h>
-#include <vlc/input.h>
-#include <vlc_interaction.h>
+#include <vlc_access.h>
+#include <vlc_interface.h>
-#include "network.h"
+#include <vlc_network.h>
#include "vlc_url.h"
-#include "stream_output.h"
+#include <vlc_sout.h>
#ifndef IPPORT_FTP
# define IPPORT_FTP 21u
set_capability( "sout access", 0 );
set_category( CAT_SOUT );
set_subcategory( SUBCAT_SOUT_ACO );
- add_shortcut( "ftp" );
set_callbacks( OutOpen, OutClose );
vlc_module_end();
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;
}
/* Init p_access */
p_sys->fd_data = -1;
- if( parseURL( &p_sys->url, p_access->psz_name ) )
+ if( parseURL( &p_sys->url, p_access->psz_path ) )
goto exit_error;
if( Connect( p_this, p_sys ) )
p_access->pf_seek = OutSeek;
p_access->pf_write = Write;
+ p_access->p_sys = (void *)p_sys;
return VLC_SUCCESS;
case ACCESS_SET_TITLE:
case ACCESS_SET_SEEKPOINT:
case ACCESS_SET_PRIVATE_ID_STATE:
+ case ACCESS_GET_CONTENT_TYPE:
return VLC_EGENERIC;
default:
int i_answer;
psz_line = net_Gets( p_access, p_sys->fd_cmd, NULL );
- msg_Dbg( p_access, "answer=%s", psz_line );
if( psz_line == NULL || strlen( psz_line ) < 3 )
{
msg_Err( p_access, "cannot get answer" );
if( ppsz_answer ) *ppsz_answer = NULL;
return -1;
}
+ msg_Dbg( p_access, "answer=%s", psz_line );
if( psz_line[3] == '-' ) /* Multiple response */
{
return VLC_EGENERIC;
}
- if( psz_ip != NULL )
+ if( *psz_ip )
{
char psz_fmt[7] = "(|||%u";
psz_fmt[1] = psz_fmt[2] = psz_fmt[3] = psz_parser[1];
}
else
{
- unsigned a1, a2, a3, a4, p1, p2;
+ unsigned a1, a2, a3, a4, p1, p2;
if( ( sscanf( psz_parser, "(%u,%u,%u,%u,%u,%u", &a1, &a2, &a3, &a4,
&p1, &p2 ) < 6 ) || ( a1 > 255 ) || ( a2 > 255 )
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;
}
+
+ shutdown( p_sys->fd_data,
+ ( p_access->i_object_type == VLC_OBJECT_ACCESS ) );
+
return VLC_SUCCESS;
}