[vlc-commits] stream_extractor: archive: add archive_skip_decompressed

Filip Roséen git at videolan.org
Tue Jul 24 15:41:05 CEST 2018


vlc | branch: master | Filip Roséen <filip at atch.se> | Tue Jul 24 14:28:56 2018 +0200| [732058913798092a5c23811d0c03af5dc33fe56b] | committer: Jean-Baptiste Kempf

stream_extractor: archive: add archive_skip_decompressed

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/stream_extractor/archive.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/modules/stream_extractor/archive.c b/modules/stream_extractor/archive.c
index ad0a38ca62..43b4056360 100644
--- a/modules/stream_extractor/archive.c
+++ b/modules/stream_extractor/archive.c
@@ -577,6 +577,21 @@ static ssize_t Read( stream_extractor_t *p_extractor, void* p_data, size_t i_siz
     return i_ret;
 }
 
+static int archive_skip_decompressed( stream_extractor_t* p_extractor, uint64_t i_skip )
+{
+    while( i_skip )
+    {
+        ssize_t i_read = Read( p_extractor, NULL, i_skip );
+
+        if( i_read < 1 )
+            return VLC_EGENERIC;
+
+        i_skip -= i_read;
+    }
+
+    return VLC_SUCCESS;
+}
+
 static int Seek( stream_extractor_t* p_extractor, uint64_t i_req )
 {
     private_sys_t* p_sys = p_extractor->p_sys;
@@ -618,18 +633,8 @@ static int Seek( stream_extractor_t* p_extractor, uint64_t i_req )
             i_offset = 0;
         }
 
-        /* SKIP _DECOMPRESSED_ DATA */
-
-        while( i_skip )
-        {
-            ssize_t i_read = Read( p_extractor, NULL, i_skip );
-
-            if( i_read < 1 )
-                return VLC_EGENERIC;
-
-            i_offset += i_read;
-            i_skip   -= i_read;
-        }
+        if( archive_skip_decompressed( p_extractor, i_skip ) )
+            return VLC_EGENERIC;
     }
 
     p_sys->i_offset = i_req;



More information about the vlc-commits mailing list