[vlc-commits] stream: add stream_GetSize() helper

Rémi Denis-Courmont git at videolan.org
Mon Aug 31 18:32:06 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 31 18:57:17 2015 +0300| [db7e4c7780b65d10801a27bfe46f5babb4becdec] | committer: Rémi Denis-Courmont

stream: add stream_GetSize() helper

Unlike stream_Size(), this helper distinguishes between unknown and
zero sizes.

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

 include/vlc_stream.h |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index 648a777..289f311 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -133,12 +133,17 @@ static inline int64_t stream_Tell( stream_t *s )
 /**
  * Get the size of the stream.
  */
+VLC_USED static inline int stream_GetSize( stream_t *s, uint64_t *size )
+{
+    return stream_Control( s, STREAM_GET_SIZE, size );
+}
+
 static inline int64_t stream_Size( stream_t *s )
 {
     uint64_t i_pos;
 
-    if( stream_Control( s, STREAM_GET_SIZE, &i_pos ) )
-        i_pos = 0;
+    if( stream_GetSize( s, &i_pos ) )
+        return 0;
     if( i_pos >> 62 )
         return (int64_t)1 << 62;
     return i_pos;



More information about the vlc-commits mailing list