[vlc-commits] stream: fix stream_MemoryNew() prototype

Rémi Denis-Courmont git at videolan.org
Wed Jul 20 23:06:54 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jul 20 23:57:43 2016 +0300| [8d599e76b75393c9e630ab5fc3ea34e4000383a7] | committer: Rémi Denis-Courmont

stream: fix stream_MemoryNew() prototype

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8d599e76b75393c9e630ab5fc3ea34e4000383a7
---

 include/vlc_stream.h      |   15 +++++++++++----
 src/input/stream_memory.c |   14 ++------------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index 25a478a..c304bf4 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -196,11 +196,18 @@ static inline char *stream_ContentType( stream_t *s )
 }
 
 /**
- * Create a stream_t reading from memory.
- * You must delete it using stream_Delete.
+ * Create a stream from a memory buffer.
+ *
+ * \param obj parent VLC object
+ * \param base start address of the memory buffer to read from
+ * \param size size in bytes of the memory buffer
+ * \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 *p_obj, uint8_t *p_buffer, uint64_t i_size, bool b_preserve_memory );
-#define stream_MemoryNew( a, b, c, d ) stream_MemoryNew( VLC_OBJECT(a), b, c, d )
+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)
 
 /**
  * Create a stream_t reading from a URL.
diff --git a/src/input/stream_memory.c b/src/input/stream_memory.c
index 28ed9c0..fd53ab4 100644
--- a/src/input/stream_memory.c
+++ b/src/input/stream_memory.c
@@ -41,18 +41,8 @@ static int Seek( stream_t *, uint64_t );
 static int  Control( stream_t *, int i_query, va_list );
 static void Delete ( stream_t * );
 
-#undef stream_MemoryNew
-/**
- * Create a stream from a memory buffer
- *
- * \param p_this the calling vlc_object
- * \param p_buffer the memory buffer for the stream
- * \param i_buffer the size of the buffer
- * \param i_preserve_memory if this is set to false the memory buffer
- *        pointed to by p_buffer is freed on stream_Destroy
- */
-stream_t *stream_MemoryNew( vlc_object_t *p_this, uint8_t *p_buffer,
-                            uint64_t i_size, bool i_preserve_memory )
+stream_t *(stream_MemoryNew)(vlc_object_t *p_this, uint8_t *p_buffer,
+                             size_t i_size, bool i_preserve_memory)
 {
     stream_t *s = stream_CommonNew( p_this, Delete );
     stream_sys_t *p_sys;



More information about the vlc-commits mailing list