[vlc-commits] concat: fix handling of unknown sizes

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


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

concat: fix handling of unknown sizes

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

 modules/access/concat.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/modules/access/concat.c b/modules/access/concat.c
index 93c96ed..1bd34c9 100644
--- a/modules/access/concat.c
+++ b/modules/access/concat.c
@@ -23,6 +23,7 @@
 #endif
 
 #include <assert.h>
+#include <stdint.h>
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
@@ -159,7 +160,7 @@ static int Seek(access_t *access, uint64_t position)
         uint64_t size;
 
         if (access_GetSize(a, &size))
-            size = 0;
+            break;
         if (position - access->info.i_pos < size)
         {
             if (vlc_access_Seek(a, position - access->info.i_pos))
@@ -196,6 +197,8 @@ static int Control(access_t *access, int query, va_list args)
             *va_arg(args, bool *) = sys->can_control_pace;
             break;
         case ACCESS_GET_SIZE:
+            if (sys->size == UINT64_MAX)
+                return VLC_EGENERIC;
             *va_arg(args, uint64_t *) = sys->size;
             break;
         case ACCESS_GET_PTS_DELAY:
@@ -282,10 +285,15 @@ static int Open(vlc_object_t *obj)
             access_Control(a, ACCESS_CAN_PAUSE, &sys->can_pause);
         if (sys->can_control_pace)
             access_Control(a, ACCESS_CAN_CONTROL_PACE, &sys->can_control_pace);
+        if (sys->size != UINT64_MAX)
+        {
+            uint64_t size;
 
-        uint64_t size;
-        if (access_GetSize(a, &size) == 0)
-            sys->size += size;
+            if (access_GetSize(a, &size))
+                sys->size = UINT64_MAX;
+            else
+                sys->size += size;
+        }
 
         int64_t caching;
         access_Control(a, ACCESS_GET_PTS_DELAY, &caching);



More information about the vlc-commits mailing list