X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Fmms%2Fmmsh.c;h=c2a2c24342711b950384b0778757a015fa226841;hb=ce3c305fdb10d98292218bf08951087e3e4f94fc;hp=4798e043fb55e105349b96b4c797117eb0193a69;hpb=54b9a46e561362cd0c7527e78a142b2ed4585db3;p=vlc diff --git a/modules/access/mms/mmsh.c b/modules/access/mms/mmsh.c index 4798e043fb..c2a2c24342 100644 --- a/modules/access/mms/mmsh.c +++ b/modules/access/mms/mmsh.c @@ -25,6 +25,10 @@ * Preamble *****************************************************************************/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include "vlc_playlist.h" @@ -48,8 +52,8 @@ int E_(MMSHOpen) ( access_t * ); void E_(MMSHClose) ( access_t * ); -static int Read( access_t *, uint8_t *, int ); -static int ReadRedirect( access_t *, uint8_t *, int ); +static ssize_t Read( access_t *, uint8_t *, size_t ); +static ssize_t ReadRedirect( access_t *, uint8_t *, size_t ); static int Seek( access_t *, int64_t ); static int Control( access_t *, int, va_list ); @@ -317,6 +321,7 @@ static int Seek( access_t *p_access, int64_t i_pos ) while( !p_access->b_die ) { + msg_Warn( p_access, "GetPacket 1" ); if( GetPacket( p_access, &ck ) ) break; @@ -337,22 +342,22 @@ static int Seek( access_t *p_access, int64_t i_pos ) /***************************************************************************** * Read: *****************************************************************************/ -static int ReadRedirect( access_t *p_access, uint8_t *p, int i_len ) +static ssize_t ReadRedirect( access_t *p_access, uint8_t *p, size_t i_len ) { - return VLC_SUCCESS; + return 0; } /***************************************************************************** * 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; size_t i_copy; size_t i_data = 0; if( p_access->info.b_eof ) - return VLC_SUCCESS; + return 0; while( i_data < (size_t) i_len ) { @@ -392,6 +397,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len ) else { chunk_t ck; + msg_Warn( p_access, "GetPacket 2" ); if( GetPacket( p_access, &ck ) ) { int i_ret = -1; @@ -437,13 +443,13 @@ static int Restart( access_t *p_access ) if( Describe( p_access, &psz_location ) ) { msg_Err( p_access, "describe failed" ); - return VLC_ENGENERIC; + return VLC_EGENERIC; } /* */ if( Start( p_access, 0 ) ) { msg_Err( p_access, "Start failed" ); - return VLC_ENGENERIC; + return VLC_EGENERIC; } return VLC_SUCCESS; } @@ -465,7 +471,7 @@ static int Reset( access_t *p_access ) /* Get the next header FIXME memory loss ? */ GetHeader( p_access ); if( p_sys->i_header <= 0 ) - return VLC_ENGENERIC; + return VLC_EGENERIC; E_( asf_HeaderParse )( &p_sys->asfh, p_sys->p_header, p_sys->i_header ); @@ -749,8 +755,8 @@ static void GetHeader( access_t *p_access ) /***************************************************************************** * Start stream - *****************************************************************************/ -static int Start( access_t *p_access, off_t i_pos ) + ****************************************************************************/ +static int Start( access_t *p_access, int64_t i_pos ) { access_sys_t *p_sys = p_access->p_sys; int i_streams = 0; @@ -828,7 +834,7 @@ static int Start( access_t *p_access, off_t i_pos ) psz = net_Gets( VLC_OBJECT(p_access), p_sys->fd, NULL ); if( psz == NULL ) { - msg_Err( p_access, "cannot read data" ); + msg_Err( p_access, "cannot read data 0" ); return VLC_EGENERIC; } @@ -847,7 +853,7 @@ static int Start( access_t *p_access, off_t i_pos ) char *psz = net_Gets( p_access, p_sys->fd, NULL ); if( psz == NULL ) { - msg_Err( p_access, "cannot read data" ); + msg_Err( p_access, "cannot read data 1" ); return VLC_EGENERIC; } if( *psz == '\0' ) @@ -898,7 +904,10 @@ static int GetPacket( access_t * p_access, chunk_t *p_ck ) * entire header. */ if( net_Read( p_access, p_sys->fd, NULL, p_sys->buffer, 4, VLC_TRUE ) < 4 ) + { + msg_Err( p_access, "cannot read data 2" ); return VLC_EGENERIC; + } p_ck->i_type = GetWLE( p_sys->buffer); p_ck->i_size = GetWLE( p_sys->buffer + 2); @@ -909,7 +918,7 @@ static int GetPacket( access_t * p_access, chunk_t *p_ck ) if( net_Read( p_access, p_sys->fd, NULL, p_sys->buffer + 4, restsize, VLC_TRUE ) < restsize ) { - msg_Err( p_access, "cannot read data" ); + msg_Err( p_access, "cannot read data 3" ); return VLC_EGENERIC; } p_ck->i_sequence = GetDWLE( p_sys->buffer + 4); @@ -956,7 +965,7 @@ static int GetPacket( access_t * p_access, chunk_t *p_ck ) (net_Read( p_access, p_sys->fd, NULL, &p_sys->buffer[12], p_ck->i_data, VLC_TRUE ) < p_ck->i_data) ) { - msg_Err( p_access, "cannot read data" ); + msg_Err( p_access, "cannot read data 4" ); return VLC_EGENERIC; }