X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Ftcp.c;h=1e6f3d1118613ea9cddd5e90eef3539bbebfc724;hb=7179862ee5ec72a7d85a9ceb8ef818f609108704;hp=576a77af6073a89bb519e5bba65d711daca710c0;hpb=d30ae7ec6aaf4b71ab60d596561757b669bf72ca;p=vlc diff --git a/modules/access/tcp.c b/modules/access/tcp.c index 576a77af60..1e6f3d1118 100644 --- a/modules/access/tcp.c +++ b/modules/access/tcp.c @@ -18,26 +18,29 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ -#include + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include -#include +#include -#include "network.h" +#include /***************************************************************************** * Module descriptor *****************************************************************************/ #define CACHING_TEXT N_("Caching value in ms") #define CACHING_LONGTEXT N_( \ - "Allows you to modify the default caching value for TCP streams. This " \ - "value should be set in millisecond units." ) + "Caching value for TCP streams. This " \ + "value should be set in milliseconds." ) static int Open ( vlc_object_t * ); static void Close( vlc_object_t * ); @@ -65,7 +68,7 @@ struct access_sys_t }; -static int Read( access_t *, uint8_t *, int ); +static ssize_t Read( access_t *, uint8_t *, size_t ); static int Control( access_t *, int, va_list ); /***************************************************************************** @@ -98,19 +101,12 @@ static int Open( vlc_object_t *p_this ) *psz_parser++ = '\0'; /* Init p_access */ - p_access->pf_read = Read; - p_access->pf_block = NULL; - p_access->pf_control = Control; - p_access->pf_seek = NULL; - p_access->info.i_update = 0; - p_access->info.i_size = 0; - p_access->info.i_pos = 0; - p_access->info.b_eof = VLC_FALSE; - p_access->info.i_title = 0; - p_access->info.i_seekpoint = 0; - p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) ); - - p_sys->fd = net_OpenTCP( p_access, psz_dup, atoi( psz_parser ) ); + access_InitFields( p_access ); \ + ACCESS_SET_CALLBACKS( Read, NULL, Control, NULL ); \ + MALLOC_ERR( p_access->p_sys, access_sys_t ); \ + p_sys = p_access->p_sys; memset( p_sys, 0, sizeof( access_sys_t ) ); + + p_sys->fd = net_ConnectTCP( p_access, psz_dup, atoi( psz_parser ) ); free( psz_dup ); if( p_sys->fd < 0 ) @@ -140,7 +136,7 @@ static void Close( vlc_object_t *p_this ) /***************************************************************************** * Read: read on a file descriptor, checking b_die periodically *****************************************************************************/ -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; @@ -204,6 +200,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) case ACCESS_SET_TITLE: case ACCESS_SET_SEEKPOINT: case ACCESS_SET_PRIVATE_ID_STATE: + case ACCESS_GET_CONTENT_TYPE: return VLC_EGENERIC; default: