[Android] question about code structure to make modifications to vlc to support asset loading

Thomas Guillem thomas at gllm.fr
Thu Dec 17 17:10:38 CET 2015


On Thu, Dec 17, 2015, at 16:54, Kevin Whitaker wrote:
> I've been recently trying to solve to problem of how to get vlc to
> play files included in the assets folder of an android application.
> Some things I've found out are that assets never leave the apk file
> after install and that any android api will only give you an
> inputstream or file descriptor for an asset. I thought having a fd
> would be great since it seems vlc supports loading from those, but the
> trick is the fd the android api gives is the fd for the whole apk, not
> the individual asset file. The expectation is you take the offset and
> length they give you to grab the right bytes. So the problem now is
> that I don't see a way to feed vlc a fd plus a offset and length to
> pull from. I'm trying to see what kind of changes I'd need to make to
> vlc code to make this happen and was hoping someone here could help
> point me to the right spot. I thought posix/filesystem.c would be the
> right spot, but none of the methods looked like the ones related to
> reading from a fd. Thanks to anyone willing to help me.

Indeed, it would be a nice feature to have: opening a fd at a specified
offset with a specified length.

You should have a look at the file module in vlc: modules/access/file.c,
especially, the "if (!strcasecmp (p_access->psz_access, "fd"))" block in
the FileOpen function. Here, you should extends the module to open an
uri that looks like "fd://<id>:offset:length"

>
> --
>
> *Kevin Whitaker
*
> Application Engineer | *LISNR* kevin at lisnr.com**
>
>
>
> website[1] | twitter[2] | facebook[3]
>
> _________________________________________________
> Android mailing list Android at videolan.org
> https://mailman.videolan.org/listinfo/android



Links:

  1. http://www.lisnr.com/
  2. http://twitter.com/lisnr
  3. http://facebook.com/getlisnr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20151217/99c8c156/attachment.html>


More information about the Android mailing list