![]() |
Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Audio file or device URI. More...
#include "roc_core/stddefs.h"
Go to the source code of this file.
Classes | |
struct | roc::address::IoURI |
Audio file or device URI. More... | |
Namespaces | |
roc | |
Root namespace. | |
Functions | |
bool | roc::address::parse_io_uri (const char *str, IoURI &result) |
Parse IoURI from string. More... | |
bool | roc::address::format_io_uri (const IoURI &uri, char *buf, size_t buf_size) |
Format IoURI to string. More... | |
Audio file or device URI.
Definition in file io_uri.h.
bool roc::address::format_io_uri | ( | const IoURI & | uri, |
char * | buf, | ||
size_t | buf_size | ||
) |
Format IoURI to string.
Formats a normalized form of the URI.
The path part of the URI is percent-encoded if necessary.
This function always uses the "file:" form (without "//") for files because this is the only form that supports both absolute and relative paths.
bool roc::address::parse_io_uri | ( | const char * | str, |
IoURI & | result | ||
) |
Parse IoURI from string.
The URI should be in one of the following forms:
Where:
Examples:
The URI syntax is defined by RFC 8089 and RFC 3986.
The path part of the URI is percent-decoded.
The RFC allows usages of file:// URIs both for local and remote files. Local files should use either empty or special "localhost" hostname. This parser only recognizes these two variants; other hostnames will be considered as a parsing error.
The RFC allows only absolute paths in file:// URIs. This parser additionally allows relative paths, but only in the "file:" form (without "//"). Relative paths are not allowed in the "file://" form (with "//") because it would lead to an ambiguity.
This parser also allows a non-standard "-" path for stdin/stdout.
This parser does not try to perform full URI validation. For example, it does not check that path contains only allowed symbols. If it can be parsed, it will be.