]> git.sesse.net Git - vlc/blobdiff - modules/access/avio.c
Update LGPL license blurb, choosing v2.1+.
[vlc] / modules / access / avio.c
index ebd9e32e610a4b1f34d4455bf14a21de22b87b1c..639e2c20b74ad9aafd03ebe7c7d05205f5876cb8 100644 (file)
@@ -46,7 +46,7 @@ vlc_module_end()
  * Local prototypes
  *****************************************************************************/
 static ssize_t Read   (access_t *, uint8_t *, size_t);
-static int     Seek   (access_t *, int64_t);
+static int     Seek   (access_t *, uint64_t);
 static int     Control(access_t *, int, va_list);
 
 static int     SetupAvio(access_t *);
@@ -84,8 +84,9 @@ int OpenAvio(vlc_object_t *object)
      */
     char *url;
     if (!strcmp(access->psz_access, "avio"))
-        url = strdup(access->psz_path);
-    else if (asprintf(&url, "%s://%s", access->psz_access, access->psz_path) < 0)
+        url = strdup(access->psz_location);
+    else if (asprintf(&url, "%s://%s", access->psz_access,
+                      access->psz_location) < 0)
         url = NULL;
 
     if (!url)
@@ -101,7 +102,7 @@ int OpenAvio(vlc_object_t *object)
         goto error;
     }
     const int64_t size = url_filesize(sys->context);
-    msg_Dbg(access, "is_streamed=%d size=%lld", sys->context->is_streamed, size);
+    msg_Dbg(access, "is_streamed=%d size=%"PRIi64, sys->context->is_streamed, size);
 
     /* */
     access_InitFields(access);
@@ -120,6 +121,8 @@ error:
     free(sys);
     return VLC_EGENERIC;
 }
+
+
 void CloseAvio(vlc_object_t *object)
 {
     access_t *access = (access_t*)object;
@@ -132,6 +135,7 @@ void CloseAvio(vlc_object_t *object)
     free(sys);
 }
 
+
 static ssize_t Read(access_t *access, uint8_t *data, size_t size)
 {
     /* FIXME I am unsure of the meaning of the return value in case
@@ -144,12 +148,15 @@ static ssize_t Read(access_t *access, uint8_t *data, size_t size)
     access->info.i_pos += r;
     return r;
 }
-static int Seek(access_t *access, int64_t position)
+
+
+static int Seek(access_t *access, uint64_t position)
 {
     access_sys_t *sys = access->p_sys;
 
-    if (url_seek(sys->context, position, SEEK_SET) < 0) {
-        msg_Err(access, "Seek to %lld failed\n", position);
+    if (position > INT64_MAX ||
+        url_seek(sys->context, position, SEEK_SET) < 0) {
+        msg_Err(access, "Seek to %"PRIu64" failed\n", position);
         if (access->info.i_size <= 0 || position != access->info.i_size)
             return VLC_EGENERIC;
     }
@@ -157,6 +164,8 @@ static int Seek(access_t *access, int64_t position)
     access->info.b_eof = false;
     return VLC_SUCCESS;
 }
+
+
 static int Control(access_t *access, int query, va_list args)
 {
     access_sys_t *sys = access->p_sys;
@@ -206,11 +215,14 @@ static int Control(access_t *access, int query, va_list args)
 static vlc_mutex_t avio_lock = VLC_STATIC_MUTEX;
 static access_t *current_access = NULL;
 
+
 static int UrlInterruptCallback(void)
 {
     assert(current_access);
     return !vlc_object_alive(current_access);
 }
+
+
 static int SetupAvio(access_t *access)
 {
     vlc_mutex_lock(&avio_lock);