X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_stream.h;h=0de036c1088aeaa126e9c4257c30f26ac9911b47;hb=39cc95b62529366b05633376c784ef11f76426b1;hp=565961c6091f6f2ec9db4746a77c533b0e230660;hpb=efc525bf535a76f00793461ffc4f7bb7f8331e72;p=vlc diff --git a/include/vlc_stream.h b/include/vlc_stream.h index 565961c609..0de036c108 100644 --- a/include/vlc_stream.h +++ b/include/vlc_stream.h @@ -1,7 +1,7 @@ /***************************************************************************** * vlc_stream.h ***************************************************************************** - * Copyright (C) 1999-2004 VideoLAN + * Copyright (C) 1999-2004 the VideoLAN team * $Id$ * * Authors: Laurent Aimar @@ -24,6 +24,10 @@ #ifndef _VLC_STREAM_H #define _VLC_STREAM_H 1 +# ifdef __cplusplus +extern "C" { +# endif + /** * \defgroup stream Stream * @@ -50,8 +54,8 @@ enum stream_query_e /* Special for direct access control from demuxer. * XXX: avoid using it by all means */ - STREAM_CONTROL_ACCESS, /* arg1= int i_access_query, args res: can fail - if access unreachable or access control answer */ + STREAM_CONTROL_ACCESS /* arg1= int i_access_query, args res: can fail + if access unreachable or access control answer */ }; /** @@ -65,6 +69,7 @@ struct stream_t int (*pf_read) ( stream_t *, void *p_read, int i_read ); int (*pf_peek) ( stream_t *, uint8_t **pp_peek, int i_peek ); int (*pf_control)( stream_t *, int i_query, va_list ); + void (*pf_destroy)( stream_t *); stream_sys_t *p_sys; }; @@ -104,6 +109,15 @@ static inline int stream_vaControl( stream_t *s, int i_query, va_list args ) { return s->pf_control( s, i_query, args ); } + +/** + * Destroy a stream + */ +static inline void stream_Delete( stream_t *s ) +{ + s->pf_destroy( s ); +} + static inline int stream_Control( stream_t *s, int i_query, ... ) { va_list args; @@ -114,12 +128,20 @@ static inline int stream_Control( stream_t *s, int i_query, ... ) va_end( args ); return i_result; } + +/** + * Get the current position in a stream + */ static inline int64_t stream_Tell( stream_t *s ) { int64_t i_pos; stream_Control( s, STREAM_GET_POSITION, &i_pos ); return i_pos; } + +/** + * Get the size of the stream. + */ static inline int64_t stream_Size( stream_t *s ) { int64_t i_pos; @@ -176,11 +198,19 @@ VLC_EXPORT( char *, stream_ReadLine, ( stream_t * ) ); VLC_EXPORT( stream_t *,__stream_DemuxNew, ( vlc_object_t *p_obj, char *psz_demux, es_out_t *out ) ); VLC_EXPORT( void, stream_DemuxSend, ( stream_t *s, block_t *p_block ) ); VLC_EXPORT( void, stream_DemuxDelete,( stream_t *s ) ); -#define stream_MemoryNew( a, b, c ) __stream_MemoryNew( VLC_OBJECT(a), b, c ) -VLC_EXPORT( stream_t *,__stream_MemoryNew, (vlc_object_t *p_obj, uint8_t *p_buffer, int64_t i_size ) ); -VLC_EXPORT( void, stream_MemoryDelete,( stream_t *s, vlc_bool_t b_free_buffer ) ); + + +#define stream_MemoryNew( a, b, c, d ) __stream_MemoryNew( VLC_OBJECT(a), b, c, d ) +VLC_EXPORT( stream_t *,__stream_MemoryNew, (vlc_object_t *p_obj, uint8_t *p_buffer, int64_t i_size, vlc_bool_t i_preserve_memory ) ); +#define stream_UrlNew( a, b ) __stream_UrlNew( VLC_OBJECT(a), b ) +VLC_EXPORT( stream_t *,__stream_UrlNew, (vlc_object_t *p_this, const char *psz_url ) ); + /** * @} */ +# ifdef __cplusplus +} +# endif + #endif