<div dir="ltr">2014-05-26 11:41 GMT+02:00 Julien 'Lta' BALLET <span dir="ltr"><<a href="mailto:elthariel@gmail.com" target="_blank">elthariel@gmail.com</a>></span>:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Julien 'Lta' BALLET <<a href="mailto:contact@lta.io">contact@lta.io</a>><br>
<br>
Hi vlc-devel,<br>
Hi core maintainers,<br>
<br>
I've been working recently on a tiny library implementing SMB with an<br>
iOS compatible license and was about to start writing a vlc module for<br>
it. A smb module should have 3 parts:<br>
- Discovering other infected machines.<br>
- Browsing shares and folder inside of shares<br>
- Reading files<br>
<br>
While VLC has way to handle the first and last part. The middle one,<br>
browsing, seems to be an issue. After searching through VLC's code,<br>
i've found a solution in access/directory.c but not really the kind of<br>
solution i wanted to reproduce (it generates XSPF on-the-fly).<br>
After discussing the issue with j-b and felix, it appeared that they<br>
were similar concerns for UPNP and Bonjour.<br>
<br>
Here's then a patchset implementing a browsing system for input_item_t<br>
i'd like to submit to your expert attention.<br>
<br>
Why a browsing system ?<br>
<br>
- I'm working on a SMB client with an iOS compatible license and was<br>
about to integrate it when i discovered access/directory.c. I<br>
don't want to implement SMB browsing the same way.<br>
<br>
- Improving media discovery: Some service discovery protocols needs<br>
to forward items to other modules. A typical example is<br>
mDNS/Bonjour (works for UPNP as well). Bonjour allows you to<br>
discover services that use other protocols. When the Bonjour SD<br>
finds an ftp server, he cannot tells the user what's inside of the<br>
ftp server, that should be the responsability of a ftp module. So<br>
he needs to forward the discovered item (<a href="ftp://srv_addr" target="_blank">ftp://srv_addr</a>) to<br>
another module which speaks ftp.<br>
<br>
- Media discovery and browsing is a different job than the core<br>
media playback and streaming (input). Improving media discovery<br>
shouldn't make the core more complex. On the other hand,<br>
extracting browsing features to another subsytem will prevent<br>
people working on discovery and browsing to introduce bugs in the<br>
input core.<br>
<br>
- The lack of a proper item browsing system has led to clever but<br>
still somewhat dirty hacks, like on-demand generation of XSPF<br>
playlist when 'playing' a folder.<br>
<br>
- Making playlist files handling simpler.<br>
1. It'll be possible to mutualize some item_node handling code<br>
from playlists and to reduce coupling between core playlist<br>
and modules.<br>
2. It'll allow to move playlist parsing modules out of the demux<br>
system and folders.<br>
3. It'll make the playlist modules have a simple API and data<br>
structures (no seek, no ES, no control).<br>
<br>
- (It'll allow for playlist filters, althought i haven't found<br>
precise use cases for that. So let's no count that one.)<br>
<br>
What do i mean by 'browsing system' ? There's two things:<br>
<br>
- A new type of module: 'browse' module, whose job is to take an<br>
input_item_t (and optionnaly a stream) as an input and to fill an<br>
input_item_node_t as its output. Basically it's meant to read<br>
folders, playlists, discovery protocol and APIs.<br>
<br>
- A (very) lightweigt clone of the input_thread_t to handle the<br>
browse modules: browser_thread_t. The browser thread is integrated<br>
to the playlist loop, to have a consistent behavior with what<br>
happens with input.<br>
<br>
How it works ?<br>
<br>
- Browse modules have a very simple API: They expose only a<br>
pf_browse function. They receive an input_item_t item to browse,<br>
optionnaly a stream_t and a input_item_node_t to fill.<br>
<br>
- There are two kind of browse module. access_browser and browser.<br>
- access_browser are for browsing folders at a low<br>
(system/protocol) level (local, ftp, smb folders).<br>
- browser requires a stream_t and handle files/streams (API,<br>
playlist files).<br>
<br>
- Browsing thread looks like input_thread_t. While it carries most<br>
of its looks and behavior (events, state, API), it is much much<br>
simpler. He runs on it's own thread but will soon gain a<br>
synchronous and simpler API for usage in UIs.<br>
<br>
- Item gets a few flags (browsable/alread browsed) to handle node<br>
going back and forth between input and browsing.<br>
<br>
- When the playlist tries to play an item with the browsable flag<br>
it starts a browser thread instead of an input one.<br>
<br>
- input modules (especially access) have the opportunity to mark<br>
item as browsable, making the playlist retry them in the browser<br>
<br>
- A rewrite of access/directory.c is included to demonstrate this.<br>
A browser version of wpl playlist module is working, but needs some<br>
cleaning before submission.<br>
<br>
What still needs to be done ?<br>
<br>
- Gather all the precious constructive comments i hope to receive<br>
here and fix my code.<br>
<br>
- Implementing a fallback mechanism to try items in the browser if<br>
input was unable to read them, even after the PS input fallback.<br>
(BTW: I'm very curious about this, why PS is the input fallback ?)<br>
<br>
- Implementing a simple API call on top of that, in the spirit of<br>
input_Read()<br>
<br>
- Move playlist parsers to this system.<br>
<br>
All those item will be handled in about two weeks, after i finish<br>
preparing and giving an intensive week-long class in a french school.<br>
<br>
<br>
If you read this line, i thank you for the time you spent and encourage<br>
you to go forward and review the patchset :)<br>
<br>
<br>
Cheers,<br>
Lta.<br>
<br>
Julien 'Lta' BALLET (10):<br>
Adds a flag field in input_item_t. Adds browsable and already browsed<br>
flags enum definition<br>
Adds accessors functions for input_item_t flags<br>
Adds categories and help for browse modules<br>
Adds a new browsing facility whose job is to browse/expand items like<br>
folders, playlist or item from APIs.<br>
Adds INPUT_EVENT_BROWSE<br>
Adds VLC_ENEEDBROSE and make input report an item need browsing<br>
Integrates browsing inside of the playlist<br>
Moves a usefull function of access/directory.c from Remi<br>
Denis-Courmont to src/text/url.c<br>
Rewrite access/directory.c as an access_browser. No more xspf<br>
generation ... Yeah!<br>
Let's not fetch art for browsable items<br>
<br>
include/vlc_browsing.h | 138 ++++++++++<br>
include/vlc_common.h | 2 +<br>
include/vlc_config_cat.h | 13 +<br>
include/vlc_input.h | 4 +<br>
include/vlc_input_item.h | 12 +<br>
include/vlc_plugin.h | 2 +<br>
include/vlc_url.h | 1 +<br>
modules/access/directory.c | 537 ++++++++++++++++-----------------------<br>
modules/access/file.c | 29 +--<br>
modules/access/fs.c | 5 +-<br>
modules/access/fs.h | 3 -<br>
src/Makefile.am | 5 +<br>
src/browser/browse.c | 106 ++++++++<br>
src/browser/browser.c | 348 +++++++++++++++++++++++++<br>
src/browser/browser_internal.h | 48 ++++<br>
src/browser/event.c | 55 ++++<br>
src/browser/event.h | 36 +++<br>
src/input/event.c | 6 +<br>
src/input/event.h | 1 +<br>
src/input/input.c | 52 +++-<br>
src/input/item.c | 48 ++++<br>
src/libvlccore.sym | 5 +<br>
src/playlist/engine.c | 1 +<br>
src/playlist/fetcher.c | 4 +<br>
src/playlist/playlist_internal.h | 16 +-<br>
src/playlist/thread.c | 194 ++++++++++++--<br>
src/text/url.c | 38 +++<br>
27 files changed, 1329 insertions(+), 380 deletions(-)<br>
create mode 100644 include/vlc_browsing.h<br>
create mode 100644 src/browser/browse.c<br>
create mode 100644 src/browser/browser.c<br>
create mode 100644 src/browser/browser_internal.h<br>
create mode 100644 src/browser/event.c<br>
create mode 100644 src/browser/event.h<br>
<br>
--<br>
1.9.3<br>
_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="https://mailman.videolan.org/listinfo/vlc-devel" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
</blockquote></div><br>nitpick: please use the imperative style for commit messages, e.g. use "add" instead of "adds" or "added".<br clear="all"><br>-- <br>Félix Abecassis<div><a href="http://felix.abecassis.me" target="_blank">http://felix.abecassis.me</a></div>
</div></div>