Commit 312d1984 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

stream: stream_ -> vlc_stream_

parent 9e8c9e95
......@@ -369,14 +369,15 @@ static inline void demux_UpdateTitleFromStream( demux_t *demux )
stream_t *s = demux->s;
unsigned title, seekpoint;
if( stream_Control( s, STREAM_GET_TITLE, &title ) == VLC_SUCCESS
if( vlc_stream_Control( s, STREAM_GET_TITLE, &title ) == VLC_SUCCESS
&& title != (unsigned)demux->info.i_title )
{
demux->info.i_title = title;
demux->info.i_update |= INPUT_UPDATE_TITLE;
}
if( stream_Control( s, STREAM_GET_SEEKPOINT, &seekpoint ) == VLC_SUCCESS
if( vlc_stream_Control( s, STREAM_GET_SEEKPOINT,
&seekpoint ) == VLC_SUCCESS
&& seekpoint != (unsigned)demux->info.i_seekpoint )
{
demux->info.i_seekpoint = seekpoint;
......
......@@ -128,7 +128,7 @@ struct stream_t
};
/**
* Possible commands to send to stream_Control() and stream_vaControl()
* Possible commands to send to vlc_stream_Control() and vlc_stream_vaControl()
*/
enum stream_query_e
{
......@@ -154,7 +154,7 @@ enum stream_query_e
STREAM_SET_TITLE, /**< arg1= int res=can fail */
STREAM_SET_SEEKPOINT, /**< arg1= int res=can fail */
/* XXX only data read through stream_Read/Block will be recorded */
/* XXX only data read through vlc_stream_Read/Block will be recorded */
STREAM_SET_RECORD_STATE, /**< arg1=bool, arg2=const char *psz_ext (if arg1 is true) res=can fail */
STREAM_SET_PRIVATE_ID_STATE = 0x1000, /* arg1= int i_private_data, bool b_selected res=can fail */
......@@ -175,14 +175,14 @@ enum stream_query_e
* \param len number of bytes to read
* \return the number of bytes read or a negative value on error.
*/
VLC_API ssize_t stream_Read(stream_t *, void *, size_t) VLC_USED;
VLC_API ssize_t vlc_stream_Read(stream_t *, void *buf, size_t len) VLC_USED;
/**
* Peeks at data from a byte stream.
*
* This function buffers for the requested number of bytes, waiting if
* necessary. Then it stores a pointer to the buffer. Unlike stream_Read()
* or stream_Block(), this function does not modify the stream read offset.
* necessary. Then it stores a pointer to the buffer. Unlike vlc_stream_Read()
* or vlc_stream_Block(), this function does not modify the stream read offset.
*
* \note
* The buffer remains valid until the next read/peek or seek operation on the
......@@ -193,7 +193,7 @@ VLC_API ssize_t stream_Read(stream_t *, void *, size_t) VLC_USED;
* \return the number of bytes actually available (shorter than requested if
* the end-of-stream is reached), or a negative value on error.
*/
VLC_API ssize_t stream_Peek(stream_t *, const uint8_t **, size_t) VLC_USED;
VLC_API ssize_t vlc_stream_Peek(stream_t *, const uint8_t **, size_t) VLC_USED;
/**
* Reads a data block from a byte stream.
......@@ -206,26 +206,26 @@ VLC_API ssize_t stream_Peek(stream_t *, const uint8_t **, size_t) VLC_USED;
* imply that the stream is ended nor that it has encountered a nonrecoverable
* error.
*
* This function should be used instead of stream_Read() or stream_Peek() when
* the caller can handle reads of any size.
* This function should be used instead of vlc_stream_Read() or
* vlc_stream_Peek() when the caller can handle reads of any size.
*
* \return either a data block or NULL
*/
VLC_API block_t *stream_ReadBlock(stream_t *) VLC_USED;
VLC_API block_t *vlc_stream_ReadBlock(stream_t *) VLC_USED;
/**
* Tells the current stream position.
*
* @return the byte offset from the beginning of the stream (cannot fail)
*/
VLC_API uint64_t stream_Tell(const stream_t *) VLC_USED;
VLC_API uint64_t vlc_stream_Tell(const stream_t *) VLC_USED;
/**
* Checks for end of stream.
*
* Checks if the last attempt to reads data from the stream encountered the
* end of stream before the attempt could be fully satisfied.
* The value is initially false, and is reset to false by stream_Seek().
* The value is initially false, and is reset to false by vlc_stream_Seek().
*
* \note The function can return false even though the current stream position
* is equal to the stream size. It will return true after the following attempt
......@@ -240,7 +240,7 @@ VLC_API uint64_t stream_Tell(const stream_t *) VLC_USED;
* the end-of-stream is reached. But that rule is not enforced; it is entirely
* dependent on the underlying implementation of the stream.
*/
VLC_API bool stream_Eof(const stream_t *) VLC_USED;
VLC_API bool vlc_stream_Eof(const stream_t *) VLC_USED;
/**
* Sets the current stream position.
......@@ -248,30 +248,46 @@ VLC_API bool stream_Eof(const stream_t *) VLC_USED;
* @param offset byte offset from the beginning of the stream
* @return zero on success, a negative value on error
*/
VLC_API int stream_Seek(stream_t *, uint64_t offset) VLC_USED;
VLC_API int vlc_stream_Seek(stream_t *, uint64_t offset) VLC_USED;
VLC_API int stream_vaControl( stream_t *s, int i_query, va_list args );
VLC_API void stream_Delete( stream_t *s );
VLC_API int stream_Control( stream_t *s, int i_query, ... );
VLC_API block_t * stream_Block( stream_t *s, size_t );
VLC_API char * stream_ReadLine( stream_t * );
VLC_API int stream_ReadDir( stream_t *, input_item_node_t * );
VLC_API int vlc_stream_vaControl(stream_t *s, int query, va_list args);
VLC_API stream_t *stream_CommonNew(vlc_object_t *, void (*)(stream_t *));
static inline int vlc_stream_Control(stream_t *s, int query, ...)
{
va_list ap;
int ret;
va_start(ap, query);
ret = vlc_stream_vaControl(s, query, ap);
va_end(ap);
return ret;
}
VLC_API block_t *vlc_stream_Block(stream_t *s, size_t);
VLC_API char *vlc_stream_ReadLine(stream_t *);
VLC_API int vlc_stream_ReadDir(stream_t *, input_item_node_t *);
/**
* Closes a byte stream.
* \param s byte stream to close
*/
VLC_API void vlc_stream_Delete(stream_t *s);
VLC_API stream_t *vlc_stream_CommonNew(vlc_object_t *, void (*)(stream_t *));
/**
* Get the size of the stream.
*/
VLC_USED static inline int stream_GetSize( stream_t *s, uint64_t *size )
VLC_USED static inline int vlc_stream_GetSize( stream_t *s, uint64_t *size )
{
return stream_Control( s, STREAM_GET_SIZE, size );
return vlc_stream_Control( s, STREAM_GET_SIZE, size );
}
static inline int64_t stream_Size( stream_t *s )
{
uint64_t i_pos;
if( stream_GetSize( s, &i_pos ) )
if( vlc_stream_GetSize( s, &i_pos ) )
return 0;
if( i_pos >> 62 )
return (int64_t)1 << 62;
......@@ -285,7 +301,7 @@ static inline int64_t stream_Size( stream_t *s )
static inline char *stream_ContentType( stream_t *s )
{
char *res;
if( stream_Control( s, STREAM_GET_CONTENT_TYPE, &res ) )
if( vlc_stream_Control( s, STREAM_GET_CONTENT_TYPE, &res ) )
return NULL;
return res;
}
......@@ -299,17 +315,18 @@ static inline char *stream_ContentType( stream_t *s )
* \param preserve if false, free(base) will be called when the stream is
* destroyed; if true, the memory buffer is preserved
*/
VLC_API stream_t *stream_MemoryNew(vlc_object_t *obj, uint8_t *base,
size_t size, bool preserve) VLC_USED;
#define stream_MemoryNew(a, b, c, d) \
stream_MemoryNew(VLC_OBJECT(a), b, c, d)
VLC_API stream_t *vlc_stream_MemoryNew(vlc_object_t *obj, uint8_t *base,
size_t size, bool preserve) VLC_USED;
#define vlc_stream_MemoryNew(a, b, c, d) \
vlc_stream_MemoryNew(VLC_OBJECT(a), b, c, d)
/**
* Create a stream_t reading from a URL.
* You must delete it using stream_Delete.
* You must delete it using vlc_stream_Delete.
*/
VLC_API stream_t * stream_UrlNew(vlc_object_t *p_this, const char *psz_url );
#define stream_UrlNew( a, b ) stream_UrlNew( VLC_OBJECT(a), b )
VLC_API stream_t * vlc_stream_NewMRL(vlc_object_t *obj, const char *url)
VLC_USED;
#define vlc_stream_NewMRL(a, b) vlc_stream_NewMRL(VLC_OBJECT(a), b)
/**
* \defgroup stream_fifo FIFO stream
......@@ -325,10 +342,10 @@ VLC_API stream_t * stream_UrlNew(vlc_object_t *p_this, const char *psz_url );
* anonymous pipe/FIFO.
*
* On the reader side, the normal stream functions are used,
* e.g. stream_Read() and stream_Delete().
* e.g. vlc_stream_Read() and vlc_stream_Delete().
*
* The created stream object is automatically destroyed when both the reader
* and the writer sides have been closed, with stream_Delete() and
* and the writer sides have been closed, with vlc_stream_Delete() and
* vlc_stream_fifo_Close() respectively.
*
* \param parent parent VLC object for the stream
......@@ -377,19 +394,23 @@ VLC_API void vlc_stream_fifo_Close(stream_t *s);
* Try to add a stream filter to an open stream.
* @return New stream to use, or NULL if the filter could not be added.
**/
VLC_API stream_t* stream_FilterNew( stream_t *p_source, const char *psz_stream_filter );
VLC_API stream_t* vlc_stream_FilterNew( stream_t *p_source, const char *psz_stream_filter );
/**
* Default ReadDir implementation for stream Filter. This implementation just
* forward the pf_readdir call to the p_source stream.
*/
VLC_API int stream_FilterDefaultReadDir( stream_t *s, input_item_node_t *p_node );
VLC_API int vlc_stream_FilterDefaultReadDir(stream_t *s,
input_item_node_t *p_node);
/**
* Sets stream_FilterDefaultReadDir as the pf_readdir callback for this stream filter
* Sets vlc_stream_FilterDefaultReadDir as the pf_readdir callback for this
* stream filter.
*/
#define stream_FilterSetDefaultReadDir(p_stream) \
p_stream->pf_readdir = stream_FilterDefaultReadDir;
#define stream_FilterSetDefaultReadDir(stream) \
do { \
(stream)->pf_readdir = vlc_stream_FilterDefaultReadDir; \
} while (0)
/**
* @}
......
......@@ -117,13 +117,13 @@ static int FindVolumes(access_t *p_access, struct archive *p_archive, const char
/* Probe URI */
int i_savedflags = p_access->obj.flags;
p_access->obj.flags |= OBJECT_FLAGS_NOINTERACT;
stream_t *p_stream = stream_UrlNew(p_access, psz_newuri);
stream_t *p_stream = vlc_stream_NewMRL(p_access, psz_newuri);
p_access->obj.flags = i_savedflags;
if (p_stream)
{
ppsz_files[*pi_files] = psz_newuri;
(*pi_files)++;
stream_Delete(p_stream);
vlc_stream_Delete(p_stream);
}
else
{
......@@ -150,7 +150,7 @@ static ssize_t ReadCallback(struct archive *p_archive, void *p_object, const voi
access_sys_t *p_sys = p_data->p_access->p_sys;
*pp_buffer = &p_sys->buffer;
return stream_Read(p_sys->p_stream, &p_sys->buffer, ARCHIVE_READ_SIZE);
return vlc_stream_Read(p_sys->p_stream, &p_sys->buffer, ARCHIVE_READ_SIZE);
}
static ssize_t SkipCallback(struct archive *p_archive, void *p_object, ssize_t i_request)
......@@ -163,15 +163,15 @@ static ssize_t SkipCallback(struct archive *p_archive, void *p_object, ssize_t i
/* be smart as small seeks converts to reads */
if (p_sys->b_source_canseek)
{
int64_t i_pos = stream_Tell(p_sys->p_stream);
int64_t i_pos = vlc_stream_Tell(p_sys->p_stream);
if (i_pos >=0)
stream_Seek(p_sys->p_stream, i_pos + i_request);
i_skipped = stream_Tell(p_sys->p_stream) - i_pos;
vlc_stream_Seek(p_sys->p_stream, i_pos + i_request);
i_skipped = vlc_stream_Tell(p_sys->p_stream) - i_pos;
}
else while(i_request)
{
int i_skip = __MIN(INT32_MAX, i_request);
int i_read = stream_Read(p_sys->p_stream, NULL, i_skip);
int i_read = vlc_stream_Read(p_sys->p_stream, NULL, i_skip);
if (i_read > 0)
i_skipped += i_read;
else
......@@ -193,7 +193,7 @@ static ssize_t SeekCallback(struct archive *p_archive, void *p_object, ssize_t i
switch(i_whence)
{
case SEEK_CUR:
i_pos = stream_Tell(p_sys->p_stream);
i_pos = vlc_stream_Tell(p_sys->p_stream);
break;
case SEEK_SET:
i_pos = 0;
......@@ -208,8 +208,8 @@ static ssize_t SeekCallback(struct archive *p_archive, void *p_object, ssize_t i
if (i_pos < 0)
return -1;
stream_Seek(p_sys->p_stream, i_pos + i_offset); /* We don't care about return val */
return stream_Tell(p_sys->p_stream);
vlc_stream_Seek(p_sys->p_stream, i_pos + i_offset); /* We don't care about return val */
return vlc_stream_Tell(p_sys->p_stream);
}
static int SwitchCallback(struct archive *p_archive, void *p_object, void *p_object2)
......@@ -220,8 +220,8 @@ static int SwitchCallback(struct archive *p_archive, void *p_object, void *p_obj
access_sys_t *p_sys = p_data->p_access->p_sys;
msg_Dbg(p_data->p_access, "opening next volume %s", p_nextdata->psz_uri);
stream_Delete(p_sys->p_stream);
p_sys->p_stream = stream_UrlNew(p_nextdata->p_access, p_nextdata->psz_uri);
vlc_stream_Delete(p_sys->p_stream);
p_sys->p_stream = vlc_stream_NewMRL(p_nextdata->p_access, p_nextdata->psz_uri);
return p_sys->p_stream ? ARCHIVE_OK : ARCHIVE_FATAL;
}
......@@ -231,12 +231,13 @@ static int OpenCallback(struct archive *p_archive, void *p_object)
callback_data_t *p_data = (callback_data_t *) p_object;
access_sys_t *p_sys = p_data->p_access->p_sys;
p_sys->p_stream = stream_UrlNew( p_data->p_access, p_data->psz_uri );
p_sys->p_stream = vlc_stream_NewMRL( p_data->p_access, p_data->psz_uri );
if(!p_sys->p_stream)
return ARCHIVE_FATAL;
/* Seek callback must only be set if calls are guaranteed to succeed */
stream_Control(p_sys->p_stream, STREAM_CAN_SEEK, &p_sys->b_source_canseek);
vlc_stream_Control(p_sys->p_stream, STREAM_CAN_SEEK,
&p_sys->b_source_canseek);
if(p_sys->b_source_canseek)
archive_read_set_seek_callback(p_sys->p_archive, SeekCallback);
......@@ -251,7 +252,7 @@ static int CloseCallback(struct archive *p_archive, void *p_object)
if (p_sys->p_stream)
{
stream_Delete(p_sys->p_stream);
vlc_stream_Delete(p_sys->p_stream);
p_sys->p_stream = NULL;
}
......@@ -276,7 +277,7 @@ static int Control(access_t *p_access, int i_query, va_list args)
break;
}
else
return stream_vaControl( p_sys->p_stream, i_query, args );
return vlc_stream_vaControl( p_sys->p_stream, i_query, args );
case STREAM_SET_PAUSE_STATE:
break;
......
......@@ -65,7 +65,7 @@ bool ProbeArchiveFormat(stream_t *p_stream)
};
const uint8_t *p_peek;
int i_peek = stream_Peek(p_stream, &p_peek, magicbytes[0].i_offset + magicbytes[0].i_length);
int i_peek = vlc_stream_Peek(p_stream, &p_peek, magicbytes[0].i_offset + magicbytes[0].i_length);
for(int i=0; i<9;i++)
{
......
......@@ -56,7 +56,7 @@ static int Control(stream_t *p_stream, int i_query, va_list args)
return VLC_EGENERIC;
default:
return stream_vaControl( p_stream->p_source, i_query, args );
return vlc_stream_vaControl( p_stream->p_source, i_query, args );
}
return VLC_SUCCESS;
......@@ -69,7 +69,7 @@ static ssize_t ReadCallback(struct archive *p_archive, void *p_object, const voi
stream_sys_t *sys = p_stream->p_sys;
*pp_buffer = &sys->buffer;
return stream_Read(p_stream->p_source, &sys->buffer, ARCHIVE_READ_SIZE);
return vlc_stream_Read(p_stream->p_source, &sys->buffer, ARCHIVE_READ_SIZE);
}
static ssize_t SkipCallback(struct archive *p_archive, void *p_object, ssize_t i_request)
......@@ -82,15 +82,15 @@ static ssize_t SkipCallback(struct archive *p_archive, void *p_object, ssize_t i
/* be smart as small seeks converts to reads */
if (sys->b_source_canseek)
{
int64_t i_pos = stream_Tell(p_stream->p_source);
int64_t i_pos = vlc_stream_Tell(p_stream->p_source);
if (i_pos >=0)
stream_Seek(p_stream->p_source, i_pos + i_request);
i_skipped = stream_Tell(p_stream->p_source) - i_pos;
vlc_stream_Seek(p_stream->p_source, i_pos + i_request);
i_skipped = vlc_stream_Tell(p_stream->p_source) - i_pos;
}
else while(i_request)
{
int i_skip = __MIN(INT32_MAX, i_request);
int i_read = stream_Read(p_stream->p_source, NULL, i_skip);
int i_read = vlc_stream_Read(p_stream->p_source, NULL, i_skip);
if (i_read > 0)
i_skipped += i_read;
else
......@@ -110,7 +110,7 @@ static ssize_t SeekCallback(struct archive *p_archive, void *p_object, ssize_t i
switch(i_whence)
{
case SEEK_CUR:
i_pos = stream_Tell(p_stream->p_source);
i_pos = vlc_stream_Tell(p_stream->p_source);
break;
case SEEK_SET:
i_pos = 0;
......@@ -125,8 +125,8 @@ static ssize_t SeekCallback(struct archive *p_archive, void *p_object, ssize_t i
if (i_pos < 0)
return -1;
stream_Seek(p_stream->p_source, i_pos + i_offset); /* We don't care about return val */
return stream_Tell(p_stream->p_source);
vlc_stream_Seek(p_stream->p_source, i_pos + i_offset); /* We don't care about return val */
return vlc_stream_Tell(p_stream->p_source);
}
static int Browse(stream_t *p_stream, input_item_node_t *p_node)
......@@ -190,7 +190,8 @@ int StreamOpen(vlc_object_t *p_object)
EnableArchiveFormats(p_sys->p_archive);
/* Seek callback must only be set if calls are guaranteed to succeed */
stream_Control(p_stream->p_source, STREAM_CAN_SEEK, &p_sys->b_source_canseek);
vlc_stream_Control(p_stream->p_source, STREAM_CAN_SEEK,
&p_sys->b_source_canseek);
if(p_sys->b_source_canseek)
archive_read_set_seek_callback(p_sys->p_archive, SeekCallback);
......
......@@ -375,9 +375,9 @@ static int Demux( demux_t *p_demux )
/* */
if( p_sys->i_packet == p_sys->i_packet_start )
{
stream_Seek( p_sys->p_m2ts, 0 );
vlc_stream_Seek( p_sys->p_m2ts, 0 );
block_t *p_block = stream_Block( p_sys->p_m2ts,
block_t *p_block = vlc_stream_Block( p_sys->p_m2ts,
p_sys->i_packet_headers * (int64_t)BD_TS_PACKET_SIZE + BD_TS_PACKET_HEADER );
if( p_block )
{
......@@ -386,7 +386,7 @@ static int Demux( demux_t *p_demux )
vlc_demux_chained_Send( p_sys->p_parser, p_block );
}
stream_Seek( p_sys->p_m2ts, p_sys->i_packet_start * (int64_t)BD_TS_PACKET_SIZE );
vlc_stream_Seek( p_sys->p_m2ts, p_sys->i_packet_start * (int64_t)BD_TS_PACKET_SIZE );
}
/* */
......@@ -416,7 +416,7 @@ static int Demux( demux_t *p_demux )
if( !p_block )
return -1;
const int i_read = stream_Read( p_sys->p_m2ts, p_block->p_buffer, p_block->i_buffer - BD_TS_PACKET_HEADER );
const int i_read = vlc_stream_Read( p_sys->p_m2ts, p_block->p_buffer, p_block->i_buffer - BD_TS_PACKET_HEADER );
if( i_read <= 0 )
{
msg_Err( p_demux, "Error reading current title" );
......@@ -624,7 +624,7 @@ static int SetPlayItem( demux_t *p_demux, int i_mpls, int i_play_item )
p_sys->psz_base, p_mpls_clpi->i_id, p_sys->b_shortname ? "MTS" : "m2ts" ) < 0 )
return VLC_EGENERIC;
p_m2ts = stream_UrlNew( p_demux, psz_m2ts );
p_m2ts = vlc_stream_NewMRL( p_demux, psz_m2ts );
if( !p_m2ts )
{
msg_Err( p_demux, "Failed to open %s", psz_m2ts );
......@@ -644,7 +644,7 @@ static int SetPlayItem( demux_t *p_demux, int i_mpls, int i_play_item )
{
msg_Err( p_demux, "Failed to create TS demuxer" );
if( p_m2ts )
stream_Delete( p_m2ts );
vlc_stream_Delete( p_m2ts );
return VLC_EGENERIC;
}
......@@ -700,7 +700,7 @@ static void ClosePlayItem( demux_t *p_demux )
demux_sys_t *p_sys = p_demux->p_sys;
if( p_sys->p_m2ts )
stream_Delete( p_sys->p_m2ts );
vlc_stream_Delete( p_sys->p_m2ts );
if( p_sys->p_parser )
vlc_demux_chained_Delete( p_sys->p_parser );
......@@ -1010,7 +1010,7 @@ error:
/* */
static block_t *LoadBlock( demux_t *p_demux, const char *psz_name )
{
stream_t *s = stream_UrlNew( p_demux, psz_name );
stream_t *s = vlc_stream_NewMRL( p_demux, psz_name );
if( !s )
return NULL;
......@@ -1018,9 +1018,9 @@ static block_t *LoadBlock( demux_t *p_demux, const char *psz_name )
block_t *p_block = NULL;
if( i_size > 0 && i_size < INT_MAX )
p_block = stream_Block( s, i_size );
p_block = vlc_stream_Block( s, i_size );
stream_Delete( s );
vlc_stream_Delete( s );
return p_block;
}
......
......@@ -489,7 +489,7 @@ static int probeStream(demux_t *p_demux)
{
/* input must be seekable */
bool b_canseek = false;
stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_canseek );
vlc_stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_canseek );
if (!b_canseek) {
return VLC_EGENERIC;
}
......@@ -497,7 +497,7 @@ static int probeStream(demux_t *p_demux)
/* first sector(s) should be filled with zeros */
size_t i_peek;
const uint8_t *p_peek;
i_peek = stream_Peek( p_demux->s, &p_peek, 2048 );
i_peek = vlc_stream_Peek( p_demux->s, &p_peek, 2048 );
if( i_peek != 2048 ) {
return VLC_EGENERIC;
}
......@@ -521,11 +521,11 @@ static int blurayReadBlock(void *object, void *buf, int lba, int num_blocks)
vlc_mutex_lock(&p_sys->read_block_lock);
if (stream_Seek( p_demux->s, lba * INT64_C(2048) ) == VLC_SUCCESS) {
if (vlc_stream_Seek( p_demux->s, lba * INT64_C(2048) ) == VLC_SUCCESS) {
size_t req = (size_t)2048 * num_blocks;
ssize_t got;
got = stream_Read( p_demux->s, buf, req);
got = vlc_stream_Read( p_demux->s, buf, req);
if (got < 0) {
msg_Err(p_demux, "read from lba %d failed", lba);
} else {
......@@ -675,7 +675,7 @@ static int blurayOpen(vlc_object_t *object)
/* Open BluRay */
#ifdef BLURAY_DEMUX
if (p_demux->s) {
i_init_pos = stream_Tell(p_demux->s);
i_init_pos = vlc_stream_Tell(p_demux->s);
p_sys->bluray = bd_init();
if (!bd_open_stream(p_sys->bluray, p_demux, blurayReadBlock)) {
......@@ -847,7 +847,7 @@ error:
if (p_demux->s != NULL) {
/* restore stream position */
if (stream_Seek(p_demux->s, i_init_pos) != VLC_SUCCESS) {
if (vlc_stream_Seek(p_demux->s, i_init_pos) != VLC_SUCCESS) {
msg_Err(p_demux, "Failed to seek back to stream start");
return VLC_ETIMEOUT;
}
......
......@@ -724,7 +724,7 @@ int XmlFile::OpenXml()
char *psz_uri;
psz_uri = vlc_path2uri( this->s_path.c_str(), "file" );
this->p_stream = stream_UrlNew(this->p_demux, psz_uri );
this->p_stream = vlc_stream_NewMRL(this->p_demux, psz_uri );
free(psz_uri);
if( ! this->p_stream ) {
return -1;
......@@ -732,7 +732,7 @@ int XmlFile::OpenXml()
this->p_xmlReader = xml_ReaderCreate( this->p_demux, this->p_stream);
if( ! this->p_xmlReader ) {
stream_Delete( this->p_stream );
vlc_stream_Delete( this->p_stream );
return -1;
}
return 0;
......@@ -819,7 +819,7 @@ int XmlFile::isCPL()
void XmlFile::CloseXml() {
if( this->p_stream )
stream_Delete( this->p_stream );
vlc_stream_Delete( this->p_stream );
if( this->p_xmlReader )
xml_ReaderDelete( this->p_xmlReader );
}
......
......@@ -406,7 +406,7 @@ static int StreamProbeDVD( stream_t *s )
/* first sector should be filled with zeros */
ssize_t i_peek;
const uint8_t *p_peek;
i_peek = stream_Peek( s, &p_peek, 2048 );
i_peek = vlc_stream_Peek( s, &p_peek, 2048 );
if( i_peek < 512 ) {
return VLC_EGENERIC;
}
......@@ -418,16 +418,16 @@ static int StreamProbeDVD( stream_t *s )
/* ISO 9660 volume descriptor */
char iso_dsc[6];
if( stream_Seek( s, 0x8000 + 1 ) != VLC_SUCCESS
|| stream_Read( s, iso_dsc, sizeof (iso_dsc) ) < (int)sizeof (iso_dsc)
if( vlc_stream_Seek( s, 0x8000 + 1 ) != VLC_SUCCESS
|| vlc_stream_Read( s, iso_dsc, sizeof (iso_dsc) ) < (int)sizeof (iso_dsc)
|| memcmp( iso_dsc, "CD001\x01", 6 ) )
return VLC_EGENERIC;
/* Try to find the anchor (2 bytes at LBA 256) */
uint16_t anchor;
if( stream_Seek( s, 256 * DVD_VIDEO_LB_LEN ) == VLC_SUCCESS
&& stream_Read( s, &anchor, 2 ) == 2
if( vlc_stream_Seek( s, 256 * DVD_VIDEO_LB_LEN ) == VLC_SUCCESS
&& vlc_stream_Read( s, &anchor, 2 ) == 2
&& GetWLE( &anchor ) == 2 )
return VLC_SUCCESS;
else
......@@ -439,12 +439,12 @@ static int StreamProbeDVD( stream_t *s )
*****************************************************************************/
static int stream_cb_seek( void *s, uint64_t pos )
{
return stream_Seek( (stream_t *)s, pos );
return vlc_stream_Seek( (stream_t *)s, pos );
}
static int stream_cb_read( void *s, void* buffer, int size )
{
return stream_Read( (stream_t *)s, buffer, size );
return vlc_stream_Read( (stream_t *)s, buffer, size );
}
/*****************************************************************************
......@@ -464,12 +464,12 @@ static int DemuxOpen ( vlc_object_t *p_this )
/* StreamProbeDVD need FASTSEEK, but if dvd is forced, we don't probe thus
* don't need fastseek */
stream_Control( p_demux->s, forced ? STREAM_CAN_SEEK : STREAM_CAN_FASTSEEK,
vlc_stream_Control( p_demux->s, forced ? STREAM_CAN_SEEK : STREAM_CAN_FASTSEEK,
&b_seekable );
if( !b_seekable )
return VLC_EGENERIC;
i_init_pos = stream_Tell( p_demux->s );
i_init_pos = vlc_stream_Tell( p_demux->s );
/* Try some simple probing to avoid going through dvdnav_open too often */
if( !forced && StreamProbeDVD( p_demux->s ) != VLC_SUCCESS )
......@@ -496,7 +496,7 @@ static int DemuxOpen ( vlc_object_t *p_this )
bailout:
if( i_ret != VLC_SUCCESS )
stream_Seek( p_demux->s, i_init_pos );
vlc_stream_Seek( p_demux->s, i_init_pos );
return i_ret;
}
#endif
......
......@@ -341,7 +341,7 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/
static int DemuxDemux( demux_t *p_demux )
{
block_t *p_block = stream_Block( p_demux->s, DEMUX_BUFFER_SIZE );
block_t *p_block = vlc_stream_Block( p_demux->s, DEMUX_BUFFER_SIZE );
int i_ret;
if ( p_block == NULL )
......
......@@ -288,7 +288,7 @@ static int Open ( vlc_object_t *p_this )
/* See if it looks like a SDP
v, o, s fields are mandatory and in this order */
const uint8_t *p_peek;
if( stream_Peek( p_demux->s, &p_peek, 7 ) < 7 ) return VLC_EGENERIC;
if( vlc_stream_Peek( p_demux->s, &p_peek, 7 ) < 7 ) return VLC_EGENERIC;
if( memcmp( p_peek, "v=0\r\n", 5 ) &&
memcmp( p_peek, "v=0\n", 4 ) &&
......@@ -352,7 +352,7 @@ static int Open ( vlc_object_t *p_this )
for( ;; )
{
int i_read = stream_Read( p_demux->s, &p_sdp[i_sdp],
int i_read = vlc_stream_Read( p_demux->s, &p_sdp[i_sdp],
i_sdp_max - i_sdp - 1 );
if( i_read < 0 )
{
......
......@@ -65,10 +65,10 @@ static int Seek(access_t *access, uint64_t position)
if (strcmp(old_chunk->mrl, sys->chunk->mrl)) {
if (sys->s)
stream_Delete(sys->s);
sys->s = stream_UrlNew(access, sys->chunk->mrl);
vlc_stream_Delete(sys->s);
sys->s = vlc_stream_NewMRL(access, sys->chunk->mrl);
}
return sys->s ? stream_Seek(sys->s, offset) : VLC_EGENERIC;
return sys->s ? vlc_stream_Seek(sys->s, offset) : VLC_EGENERIC;
}
static ssize_t Read(access_t *access, void *data, size_t size)
......@@ -82,7 +82,7 @@ static ssize_t Read(access_t *access, void *data, size_t size)
if (max <= 0)