[vlc-devel] [PATCH] add in ability to read from any part of a file descriptor.

Hugo Beauzée-Luyssen hugo at beauzee.fr
Tue Jan 5 15:51:08 CET 2016


On 01/05/2016 03:35 PM, Kevin Whitaker wrote:
> Incoming from the android mailing list, this patch is intended to
> allow vlc to play from any point in a file descriptor.
>
> This is important on android because android assets are only
> accessible by inputstream or by way of a file descriptor that
> represents all the assets squished together. The Android asset manager
> gives a file descriptor, offset, and length that allows programs to
> find the right asset. I've tested this and have gotten it to play
> videos that were stored as assets, but this is my first time working
> in the vlc codebase, so let me know if everything is fine.
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>

Hi,

-    if (!strcasecmp (p_access->psz_access, "fd"))
-    {
+    /* Part of file to use */
+    long fd_offset = -1;
+    long fd_size = -1;
+
+    if (!strcasecmp (p_access->psz_access, "fd")) {
          char *end;

Please do not change the coding style

+            location = malloc(strlen(p_access->psz_location));
+            strcpy(location, p_access->psz_location);

Why not strdup? (In any case, your code doesn't check malloc return 
value and doesn't allocate enough space for the terminal 0)

You're leaking "location" in both error cases

Regards,


More information about the vlc-devel mailing list