<div dir="ltr">Here is an update that includes some fixes after trying to test out the code. Major changes are fixed naive attempts to do memory management and using "|" instead of "#" due to other code in vlc striping them out. Sadly, even after those fixes, it still doesn't seem to be playing yet.<br><br>Index: modules/access/file.c<br>IDEA additional info:<br>Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP<br><+>UTF-8<br>===================================================================<br>--- modules/access/file.c    (date 1449063148000)<br>+++ modules/access/file.c    (revision )<br>@@ -3,7 +3,7 @@<br>  *****************************************************************************<br>  * Copyright (C) 2001-2006 VLC authors and VideoLAN<br>  * Copyright © 2006-2007 Rémi Denis-Courmont<br>- * $Id$<br>+ * $Id: 48482790da310350a109e62f0f2b64f90b09dc43 $<br>  *<br>  * Authors: Christophe Massiot <<a href="mailto:massiot@via.ecp.fr">massiot@via.ecp.fr</a>><br>  *          Rémi Denis-Courmont <rem # videolan # org><br>@@ -69,6 +69,10 @@<br> {<br>     int fd;<br> <br>+    long fd_offset;<br>+<br>+    long fd_size;<br>+<br>     bool b_pace_control;<br> };<br> <br>@@ -143,10 +147,67 @@<br>     /* Open file */<br>     int fd = -1;<br> <br>-    if (!strcasecmp (p_access->psz_access, "fd"))<br>-    {<br>+    /* Part of file to use */<br>+    long fd_offset = -1;<br>+    long fd_size = -1;<br>+<br>+    if (!strcasecmp (p_access->psz_access, "fd")) {<br>         char *end;<br>-        int oldfd = strtol (p_access->psz_location, &end, 10);<br>+        int oldfd;<br>+        /* Check if location data has bars that represent partial file access<br>+         * ex. fd://20|65477|4456677|<br>+         */<br>+        if (strstr(p_access->psz_location, "|") != NULL)<br>+        {<br>+            char *location, *working_split, *saveptr;<br>+            location = malloc(strlen(p_access->psz_location));<br>+            strcpy(location, p_access->psz_location);<br>+            working_split = strtok_r(location, "|", &saveptr);<br>+            if (working_split != NULL)<br>+            {<br>+                oldfd = strtol(working_split, &end, 10);<br>+                working_split = strtok_r(NULL,"|",&saveptr);<br>+                if (working_split != NULL) {<br>+                    fd_offset = strtol(working_split, &end, 10);<br>+                    working_split = strtok_r(NULL,"|", &saveptr);<br>+                    if (working_split != NULL)<br>+                    {<br>+                        fd_size = strtol(working_split, &end, 10);<br>+                    }<br>+                    else<br>+                    {<br>+                        msg_Err (p_access, "cannot open file %s (%s). Invalid.",<br>+                                 p_access->psz_filepath ? p_access->psz_filepath<br>+                                                        : p_access->psz_location,<br>+                                 vlc_strerror_c(errno));<br>+                        dialog_Fatal (p_access, _("File reading failed"),<br>+                                      _("VLC could not open the file \"%s\" (%s). Invalid."),<br>+                                      p_access->psz_filepath ? p_access->psz_filepath<br>+                                                             : p_access->psz_location,<br>+                                      vlc_strerror(errno));<br>+                        return VLC_EGENERIC;<br>+                    }<br>+                }<br>+                else<br>+                {<br>+                    msg_Err (p_access, "cannot open file %s (%s). Invalid.",<br>+                             p_access->psz_filepath ? p_access->psz_filepath<br>+                                                    : p_access->psz_location,<br>+                             vlc_strerror_c(errno));<br>+                    dialog_Fatal (p_access, _("File reading failed"),<br>+                                  _("VLC could not open the file \"%s\" (%s). Invalid."),<br>+                                  p_access->psz_filepath ? p_access->psz_filepath<br>+                                                         : p_access->psz_location,<br>+                                  vlc_strerror(errno));<br>+                    return VLC_EGENERIC;<br>+                }<br>+            }<br>+            free(location);<br>+        }<br>+        else<br>+        {<br>+            oldfd = strtol(p_access->psz_location, &end, 10);<br>+        }<br> <br>         if (*end == '\0')<br>             fd = vlc_dup (oldfd);<br>@@ -278,6 +339,11 @@<br>     access_sys_t *p_sys = p_access->p_sys;<br>     int fd = p_sys->fd;<br> <br>+    /* If this is the first read of a file with an offset, seek to that offset. */<br>+    if (p_sys->fd_offset != -1 && lseek(fd, 0, SEEK_CUR) == (off_t)0) {<br>+        lseek(fd, p_sys->fd_offset, SEEK_SET);<br>+    }<br>+<br>     ssize_t val = vlc_read_i11e (fd, p_buffer, i_len);<br>     if (val < 0)<br>     {<br>@@ -306,6 +372,12 @@<br> {<br>     p_access->info.b_eof = false;<br> <br>+    /* If this file has an offset, add offset to any seek position given. */<br>+    if (p_access->p_sys->fd_offset != -1)<br>+    {<br>+        i_pos = i_pos + p_access->p_sys->fd_offset;<br>+    }<br>+<br>     if (lseek (p_access->p_sys->fd, i_pos, SEEK_SET) == (off_t)-1)<br>         return VLC_EGENERIC;<br>     return VLC_SUCCESS;<br>@@ -347,7 +419,14 @@<br> <br>             if (fstat (p_sys->fd, &st) || !S_ISREG(st.st_mode))<br>                 return VLC_EGENERIC;<br>+            if (p_sys->fd_offset != -1)<br>+            {<br>+                *va_arg( args, uint64_t * ) = (off_t)p_sys->fd_size;<br>+            }<br>+            else<br>+            {<br>-            *va_arg( args, uint64_t * ) = st.st_size;<br>+                *va_arg( args, uint64_t * ) = st.st_size;<br>+            }<br>             break;<br>         }<br> <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 4, 2016 at 9:34 AM, Kevin Whitaker <span dir="ltr"><<a href="mailto:kevin@lisnr.com" target="_blank">kevin@lisnr.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Just noticed the attachment doesn't show up right in my last email. Pasting into body.<br><br>Index: modules/access/file.c<br>IDEA additional info:<br>Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP<br><+>UTF-8<br>===================================================================<br>--- modules/access/file.c    (date 1449063148000)<br>+++ modules/access/file.c    (revision )<br>@@ -3,7 +3,7 @@<br>  *****************************************************************************<br>  * Copyright (C) 2001-2006 VLC authors and VideoLAN<br>  * Copyright © 2006-2007 Rémi Denis-Courmont<br>- * $Id$<br>+ * $Id: 48482790da310350a109e62f0f2b64f90b09dc43 $<br>  *<br>  * Authors: Christophe Massiot <<a href="mailto:massiot@via.ecp.fr" target="_blank">massiot@via.ecp.fr</a>><br>  *          Rémi Denis-Courmont <rem # videolan # org><br>@@ -69,6 +69,10 @@<br> {<br>     int fd;<br> <br>+    long fd_offset;<br>+<br>+    long fd_size;<br>+<br>     bool b_pace_control;<br> };<br> <br>@@ -143,10 +147,68 @@<br>     /* Open file */<br>     int fd = -1;<br> <br>-    if (!strcasecmp (p_access->psz_access, "fd"))<br>-    {<br>+    /* Part of file to use */<br>+    long fd_offset = -1;<br>+    long fd_size = -1;<br>+<br>+    if (!strcasecmp (p_access->psz_access, "fd")) {<br>         char *end;<br>-        int oldfd = strtol (p_access->psz_location, &end, 10);<br>+        int oldfd;<br>+        /* Check if location data has hashes that represent partial file access<br>+         * ex. fd://20#65477#4456677#<br>+         */<br>+        if (strstr(p_access->psz_location, "#") != NULL)<br>+        {<br>+            char *location, working_split, saveptr;<br>+            strcpy(location, p_access->psz_location);<br>+            working_split = strtok_r(location, "#", &saveptr);<br>+            if (working_split != NULL)<br>+            {<br>+                oldfd = strtol(working_split, &end, 10);<br>+                working_split = strtok_r(NULL,"#",&saveptr);<br>+                if (working_split != NULL) {<br>+                    fd_offset = strtol(working_split, &end, 10);<br>+                    working_split = strtok_r(NULL,"#", &saveptr);<br>+                    if (working_split != NULL)<br>+                    {<br>+                        fd_size = strtol(working_split, &end, 10);<br>+                    }<br>+                    else<br>+                    {<br>+                        msg_Err (p_access, "cannot open file %s (%s). Invalid.",<br>+                                 p_access->psz_filepath ? p_access->psz_filepath<br>+                                                        : p_access->psz_location,<br>+                                 vlc_strerror_c(errno));<br>+                        dialog_Fatal (p_access, _("File reading failed"),<br>+                                      _("VLC could not open the file \"%s\" (%s). Invalid."),<br>+                                      p_access->psz_filepath ? p_access->psz_filepath<br>+                                                             : p_access->psz_location,<br>+                                      vlc_strerror(errno));<br>+                        return VLC_EGENERIC;<br>+                    }<br>+                }<br>+                else<br>+                {<br>+                    msg_Err (p_access, "cannot open file %s (%s). Invalid.",<br>+                             p_access->psz_filepath ? p_access->psz_filepath<br>+                                                    : p_access->psz_location,<br>+                             vlc_strerror_c(errno));<br>+                    dialog_Fatal (p_access, _("File reading failed"),<br>+                                  _("VLC could not open the file \"%s\" (%s). Invalid."),<br>+                                  p_access->psz_filepath ? p_access->psz_filepath<br>+                                                         : p_access->psz_location,<br>+                                  vlc_strerror(errno));<br>+                    return VLC_EGENERIC;<br>+                }<br>+            }<br>+            free(working_split);<br>+            free(location);<br>+            free(saveptr);<br>+        }<br>+        else<br>+        {<br>+            oldfd = strtol(p_access->psz_location, &end, 10);<br>+        }<br> <br>         if (*end == '\0')<br>             fd = vlc_dup (oldfd);<br>@@ -278,6 +340,11 @@<br>     access_sys_t *p_sys = p_access->p_sys;<br>     int fd = p_sys->fd;<br> <br>+    /* If this is the first read of a file with an offset, seek to that offset. */<br>+    if (p_sys->fd_offset != -1 && lseek(fd, 0, SEEK_CUR) == (off_t)0) {<br>+        lseek(fd, p_sys->fd_offset, SEEK_SET);<br>+    }<br>+<br>     ssize_t val = vlc_read_i11e (fd, p_buffer, i_len);<br>     if (val < 0)<br>     {<br>@@ -306,6 +373,12 @@<br> {<br>     p_access->info.b_eof = false;<br> <br>+    /* If this file has an offset, add offset to any seek position given. */<br>+    if (p_access->p_sys->fd_offset != -1)<br>+    {<br>+        i_pos = i_pos + p_access->p_sys->fd_offset;<br>+    }<br>+<br>     if (lseek (p_access->p_sys->fd, i_pos, SEEK_SET) == (off_t)-1)<br>         return VLC_EGENERIC;<br>     return VLC_SUCCESS;<br>@@ -347,7 +420,14 @@<br> <br>             if (fstat (p_sys->fd, &st) || !S_ISREG(st.st_mode))<br>                 return VLC_EGENERIC;<br>+            if (p_sys->fd_offset != -1)<br>+            {<br>+                *va_arg( args, uint64_t * ) = (off_t)p_sys->fd_size;<br>+            }<br>+            else<br>+            {<br>-            *va_arg( args, uint64_t * ) = st.st_size;<br>+                *va_arg( args, uint64_t * ) = st.st_size;<br>+            }<br>             break;<br>         }<br></div><br>EOF<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 18, 2015 at 2:55 PM, Kevin Whitaker <span dir="ltr"><<a href="mailto:kevin@lisnr.com" target="_blank">kevin@lisnr.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Looking for feedback on this initial code to allow fd uris with offsets. I'm not often in C land, so please feel free to point out things that may not be correct. <br><br></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Thu, Dec 17, 2015 at 12:10 PM, Jean-Baptiste Kempf <span dir="ltr"><<a href="mailto:jb@videolan.org" target="_blank">jb@videolan.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 17 Dec, Thomas Guillem wrote :<br>
<span>> You should have a look at the file module in vlc: modules/access/file.c,<br>
> especially, the "if (!strcasecmp (p_access->psz_access, "fd"))" block in<br>
> the FileOpen function. Here, you should extends the module to open an<br>
> uri that looks like "fd://<id>:offset:length"<br>
<br>
</span>please use #<br>
<br>
With my kindest regards,<br>
<span><font color="#888888"><br>
--<br>
Jean-Baptiste Kempf<br>
<a href="http://www.jbkempf.com/" rel="noreferrer" target="_blank">http://www.jbkempf.com/</a> - <a href="tel:%2B33%20672%20704%20734" value="+33672704734" target="_blank">+33 672 704 734</a><br>
Sent from my Electronic Device<br>
</font></span><div><div>_______________________________________________<br>
Android mailing list<br>
<a href="mailto:Android@videolan.org" target="_blank">Android@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/android" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/android</a><br>
</div></div></blockquote></div><br><br clear="all"><br></div></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13.333333969116211px;color:rgb(136,136,136)"><span><div><font style="font-family:arial,sans-serif" color="#444444"><b>Kevin Whitaker<br></b></font><div style="font-family:arial,sans-serif;font-size:13.333333969116211px;color:rgb(136,136,136)"><font color="#444444">Application Engineer | <b>LISNR<br></b></font></div><div style="font-family:arial,sans-serif;font-size:13.3333px;color:rgb(136,136,136)"><font color="#444444"><a href="mailto:kevin@lisnr.com" target="_blank">kevin@lisnr.com</a><b><br></b></font></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px;color:rgb(136,136,136)"><font color="#444444"><b><br></b></font></div></div></span><span style="font-size:12.8000001907349px"><div><font size="1"><img src="https://s3.amazonaws.com/uploads.hipchat.com/99879/899841/y2xxfSl4UjJlH8v/signatureLogo-01.png" height="21" width="96"></font></div><div><font size="1">  <a href="http://www.lisnr.com/" target="_blank">website</a> | <a href="http://twitter.com/lisnr" target="_blank">twitter</a> | <a href="http://facebook.com/getlisnr" target="_blank">facebook</a> </font></div><div><br></div><div style="color:rgb(0,0,0)"><font size="1" color="#000000"><br></font></div><div style="color:rgb(0,0,0)"><font size="1" color="#000000"> LISNR in the News:</font></div></span><div style="color:rgb(136,136,136);font-size:12.8000001907349px"> <a href="http://www.cnbc.com/id/102609977" style="font-size:x-small" target="_blank">CNBC - 2015 CNBC Disruptor 50 companies</a></div><div style="color:rgb(136,136,136);font-size:12.8000001907349px"> <a href="http://www.adweek.com/news/technology/mcdonalds-played-game-shark-tank-sxsw-and-heres-winner-163480" style="font-size:x-small" target="_blank">Adweek - McDonald's 'Shark Tank' Winner at SXSW</a></div><div style="color:rgb(136,136,136);font-size:12.8000001907349px"> <a href="http://techcrunch.com/2015/02/12/at-the-techstars-rga-demo-day-ten-new-iot-companies-go-live/" style="font-size:x-small" target="_blank">TechCrunch - R/GA Accelerator Demo Day</a></div><span style="font-size:12.8000001907349px"><div style="color:rgb(0,0,0)"><i style="font-family:'Times New Roman',serif"><span style="font-family:Arial,sans-serif"><font size="1"><br></font></span></i></div><div style="color:rgb(0,0,0)"><i style="font-family:'Times New Roman',serif"><span style="font-family:Arial,sans-serif"><font size="1">This
 email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are 
addressed.  If you are not the named addressee, you should not 
disseminate, distribute or copy this email. Please notify the sender 
immediately by email if you have received this email by mistake and 
delete this email from your system. If you are not the intended 
recipient, you are notified that disclosing, copying, distributing or 
taking any action in reliance on the contents of this information is 
strictly prohibited.  Please note that any views or opinions presented 
in this email are solely those of the author and do not necessarily 
represent those of the LISNR, INC.</font></span></i></div></span></div></div></div></div></div>
</div>
</blockquote></div><br><br clear="all"><br>-- <br><div><div dir="ltr"><div><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13.333333969116211px;color:rgb(136,136,136)"><div><font style="font-family:arial,sans-serif" color="#444444"><b>Kevin Whitaker<br></b></font><div style="font-family:arial,sans-serif;font-size:13.333333969116211px;color:rgb(136,136,136)"><font color="#444444">Application Engineer | <b>LISNR<br></b></font></div><div style="font-family:arial,sans-serif;font-size:13.3333px;color:rgb(136,136,136)"><font color="#444444"><a href="mailto:kevin@lisnr.com" target="_blank">kevin@lisnr.com</a><b><br></b></font></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px;color:rgb(136,136,136)"><font color="#444444"><b><br></b></font></div></div><span style="font-size:12.8000001907349px"><div><font size="1"><img src="https://s3.amazonaws.com/uploads.hipchat.com/99879/899841/y2xxfSl4UjJlH8v/signatureLogo-01.png" height="21" width="96"></font></div><div><font size="1">  <a href="http://www.lisnr.com/" target="_blank">website</a> | <a href="http://twitter.com/lisnr" target="_blank">twitter</a> | <a href="http://facebook.com/getlisnr" target="_blank">facebook</a> </font></div><div><br></div><div style="color:rgb(0,0,0)"><font size="1" color="#000000"><br></font></div><div style="color:rgb(0,0,0)"><font size="1" color="#000000"> LISNR in the News:</font></div></span><div style="color:rgb(136,136,136);font-size:12.8000001907349px"> <a href="http://www.cnbc.com/id/102609977" style="font-size:x-small" target="_blank">CNBC - 2015 CNBC Disruptor 50 companies</a></div><div style="color:rgb(136,136,136);font-size:12.8000001907349px"> <a href="http://www.adweek.com/news/technology/mcdonalds-played-game-shark-tank-sxsw-and-heres-winner-163480" style="font-size:x-small" target="_blank">Adweek - McDonald's 'Shark Tank' Winner at SXSW</a></div><div style="color:rgb(136,136,136);font-size:12.8000001907349px"> <a href="http://techcrunch.com/2015/02/12/at-the-techstars-rga-demo-day-ten-new-iot-companies-go-live/" style="font-size:x-small" target="_blank">TechCrunch - R/GA Accelerator Demo Day</a></div><span style="font-size:12.8000001907349px"><div style="color:rgb(0,0,0)"><i style="font-family:'Times New Roman',serif"><span style="font-family:Arial,sans-serif"><font size="1"><br></font></span></i></div><div style="color:rgb(0,0,0)"><i style="font-family:'Times New Roman',serif"><span style="font-family:Arial,sans-serif"><font size="1">This
 email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are 
addressed.  If you are not the named addressee, you should not 
disseminate, distribute or copy this email. Please notify the sender 
immediately by email if you have received this email by mistake and 
delete this email from your system. If you are not the intended 
recipient, you are notified that disclosing, copying, distributing or 
taking any action in reliance on the contents of this information is 
strictly prohibited.  Please note that any views or opinions presented 
in this email are solely those of the author and do not necessarily 
represent those of the LISNR, INC.</font></span></i></div></span></div></div></div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13.333333969116211px;color:rgb(136,136,136)"><div><font style="font-family:arial,sans-serif" color="#444444"><b>Kevin Whitaker<br></b></font><div style="font-family:arial,sans-serif;font-size:13.333333969116211px;color:rgb(136,136,136)"><font color="#444444">Application Engineer | <b>LISNR<br></b></font></div><div style="font-family:arial,sans-serif;font-size:13.3333px;color:rgb(136,136,136)"><font color="#444444"><a href="mailto:kevin@lisnr.com" target="_blank">kevin@lisnr.com</a><b><br></b></font></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px;color:rgb(136,136,136)"><font color="#444444"><b><br></b></font></div></div><span style="font-size:12.8000001907349px"><div><font size="1"><img src="https://s3.amazonaws.com/uploads.hipchat.com/99879/899841/y2xxfSl4UjJlH8v/signatureLogo-01.png" height="21" width="96"></font></div><div><font size="1">  <a href="http://www.lisnr.com/" target="_blank">website</a> | <a href="http://twitter.com/lisnr" target="_blank">twitter</a> | <a href="http://facebook.com/getlisnr" target="_blank">facebook</a> </font></div><div><br></div><div style="color:rgb(0,0,0)"><font size="1" color="#000000"><br></font></div><div style="color:rgb(0,0,0)"><font size="1" color="#000000"> LISNR in the News:</font></div></span><div style="color:rgb(136,136,136);font-size:12.8000001907349px"> <a href="http://www.cnbc.com/id/102609977" style="font-size:x-small" target="_blank">CNBC - 2015 CNBC Disruptor 50 companies</a></div><div style="color:rgb(136,136,136);font-size:12.8000001907349px"> <a href="http://www.adweek.com/news/technology/mcdonalds-played-game-shark-tank-sxsw-and-heres-winner-163480" style="font-size:x-small" target="_blank">Adweek - McDonald's 'Shark Tank' Winner at SXSW</a></div><div style="color:rgb(136,136,136);font-size:12.8000001907349px"> <a href="http://techcrunch.com/2015/02/12/at-the-techstars-rga-demo-day-ten-new-iot-companies-go-live/" style="font-size:x-small" target="_blank">TechCrunch - R/GA Accelerator Demo Day</a></div><span style="font-size:12.8000001907349px"><div style="color:rgb(0,0,0)"><i style="font-family:'Times New Roman',serif"><span style="font-family:Arial,sans-serif"><font size="1"><br></font></span></i></div><div style="color:rgb(0,0,0)"><i style="font-family:'Times New Roman',serif"><span style="font-family:Arial,sans-serif"><font size="1">This
 email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are 
addressed.  If you are not the named addressee, you should not 
disseminate, distribute or copy this email. Please notify the sender 
immediately by email if you have received this email by mistake and 
delete this email from your system. If you are not the intended 
recipient, you are notified that disclosing, copying, distributing or 
taking any action in reliance on the contents of this information is 
strictly prohibited.  Please note that any views or opinions presented 
in this email are solely those of the author and do not necessarily 
represent those of the LISNR, INC.</font></span></i></div></span></div></div></div></div></div>
</div>