As there is quite common for stream-consumers to be interested in the
associated mime-type, if any, of a stream; this helper function allows
access to that directly (instead of consumers having to manually parse
the string returned by stream_ContentType).
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
The function does not open MRLs, as correctly described in its
documentation, as such it is rather unfortunate that its name uses MRL
instead of URL (especially given that it cannot handle MRLs).
These changes are simply renaming all occurrences of the function, so
that the behavior of the function is properly reflected by its name.
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
This commit changes pf_readdir callback to its original behavior. Accesses and
streams now add items to a node.
Archive stream_filters will now be able to add nodes to a node (when an archive
has directory). This was not possible before.
This commit also adds an access_fsdir helper to help fs accesses (file, smb,
nfs, ftp, sftp) adding items to a node. These accesses need the same treatment
that is now done by this helper:
- hide hidden files or not (depending on "show-hiddenfiles" option)
- skip some file extensions (depending on "ignore-filetypes" option)
- sort items by type and alphabetically (depending on "directory-sort"
option).
- For a next commit: attach slaves to items
The directory demux won't do these operations anymore for every access/stream.
This commit doesn't change the interruptible state of the pf_readdir function,
accesses/streams are still interruptible in the middle of a pf_readdir call.
This partially reverts commit 88ffe15878.
Also:
- zip: fix seeking to end of file
- accesstweaks: fix segmentation fault when (inhibiting) seeking
- decomp: set callbacks only on successful init
Both functions can always fail. Even if the stream size is known,
and larger than the requested bytes, reading can fail due to lower
level errors. stream_Peek() can also fail to allocate memory.
Not checking the return value is a bug.
In most cases, there is no or little room for optimizing this, and
the benefits are minimal. This provides a generic implementation so
that each stream filter does not need to reinvent the wheel.