[vlc-commits] access: add full URL/MRL in access_t

Rémi Denis-Courmont git at videolan.org
Wed Sep 2 21:54:15 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Sep  2 22:27:15 2015 +0300| [80bc1fe21a6ad6667469d710ba709513f7fe68de] | committer: Rémi Denis-Courmont

access: add full URL/MRL in access_t

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

 include/vlc_access.h |    7 ++++---
 src/input/access.c   |   20 +++++++++++---------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/include/vlc_access.h b/include/vlc_access.h
index 026dadd..964fbfd 100644
--- a/include/vlc_access.h
+++ b/include/vlc_access.h
@@ -78,9 +78,10 @@ struct access_t
     /* Module properties */
     module_t    *p_module;
 
-    /* Access name (empty if non forced) */
-    char        *psz_access;
-    char        *psz_location; /**< Location (URL with the scheme stripped) */
+
+    char        *psz_access; /**< Access name (empty if non forced) */
+    char        *psz_url; /**< Full URL or MRL */
+    const char  *psz_location; /**< Location (URL with the scheme stripped) */
     char        *psz_filepath; /**< Local file path (if applicable) */
 
     /* pf_read/pf_block/pf_readdir is used to read data.
diff --git a/src/input/access.c b/src/input/access.c
index e04e30b..a4f5e14 100644
--- a/src/input/access.c
+++ b/src/input/access.c
@@ -66,11 +66,11 @@ static access_t *access_New(vlc_object_t *parent, input_thread_t *input,
 
     access_t *access = vlc_custom_create(parent, sizeof (*access), "access");
     char *scheme = strndup(mrl, p - mrl);
-    char *location = strdup(p + 3);
+    char *url = strdup(mrl);
 
-    if (unlikely(access == NULL || scheme == NULL || location == NULL))
+    if (unlikely(access == NULL || scheme == NULL || url == NULL))
     {
-        free(location);
+        free(url);
         free(scheme);
         vlc_object_release(access);
         return NULL;
@@ -78,8 +78,9 @@ static access_t *access_New(vlc_object_t *parent, input_thread_t *input,
 
     access->p_input = input;
     access->psz_access = scheme;
-    access->psz_location = location;
-    access->psz_filepath = get_path(location);
+    access->psz_url = url;
+    access->psz_location = url + (p + 3 - mrl);
+    access->psz_filepath = get_path(access->psz_location);
     access->pf_read    = NULL;
     access->pf_block   = NULL;
     access->pf_readdir = NULL;
@@ -89,13 +90,14 @@ static access_t *access_New(vlc_object_t *parent, input_thread_t *input,
     access_InitFields(access);
 
     msg_Dbg(access, "creating access '%s' location='%s', path='%s'", scheme,
-            location, access->psz_filepath ? access->psz_filepath : "(null)");
+            access->psz_location,
+            access->psz_filepath ? access->psz_filepath : "(null)");
 
     access->p_module = module_need(access, "access", scheme, true);
     if (access->p_module == NULL)
     {
         free(access->psz_filepath);
-        free(access->psz_location);
+        free(access->psz_url);
         free(access->psz_access);
         vlc_object_release(access);
         access = NULL;
@@ -113,9 +115,9 @@ void vlc_access_Delete(access_t *access)
 {
     module_unneed(access, access->p_module);
 
-    free(access->psz_access);
-    free(access->psz_location);
     free(access->psz_filepath);
+    free(access->psz_url);
+    free(access->psz_access);
     vlc_object_release(access);
 }
 



More information about the vlc-commits mailing list