See also Overview.
quvi API | See also Overview. |
Functions | |
quvi_init | Creates a new session. |
quvi_close | Closes a previously started session. |
quvi_setopt | Sets a session option. |
quvi_getinfo | Returns session info. |
quvi_parse | Parses an URL. |
quvi_parse_close | Releases a previously allocated media handle. |
quvi_getprop | Returns a media property. |
Support | |
Functions | |
quvi_query_formats | Queries available formats to the URL. |
quvi_next_media_url | Iterates the media stream URLs. |
quvi_supported | Checks whether library supports the URL. |
quvi_supported_ident | Otherwise identical to quvi_supported but returns the `ident’ data. |
quvi_supported_ident_close | Releases a previously allocated ident handle. |
quvi_ident_getprop | Returns an ident property. |
quvi_next_supported_website | Returns the next supported website. |
quvi_strerror | Returns a corresponding error message to the return code. |
quvi_version | Returns a quvi version string. |
quvi_free | Frees allocated memory. |
QUVIcode quvi_init( quvi_t * session )
Creates a new session.
session | New session handle (receives) |
Non-zero value if an error occurred.
QUVIcode rc; quvi_t q; rc = quvi_init(&q); if (rc != QUVI_OK) { fprintf(stderr, "%s\n", quvi_strerror(q,rc)); return (rc); } quvi_close(&q);
QUVIcode quvi_setopt( quvi_t session, QUVIoption option, ... )
Sets a session option.
session | Session handle |
option | Option ID |
... | Parameter |
Non-zero value if an error occurred.
quvi_setopt(q, QUVIOPT_FORMAT, "best"); quvi_setopt(q, QUVIOPT_CATEGORY, QUVIPROTO_HTTP|QUVIPROTO_RTMP);
QUVIcode quvi_parse( quvi_t session, char * url, quvi_media_t * media )
Parses an URL.
session | Session handle |
url | URL (null-terminated string) |
media | Media handle (receives) |
Non-zero value if an error occurred.
quvi_media_t m; rc = quvi_parse(q, URL, &m); if (rc != QUVI_OK) { ... } quvi_parse_close(&m);
QUVIcode quvi_getprop( quvi_media_t media, QUVIproperty property, ... )
Returns a media property.
media | Media handle |
property | Property ID |
... | Parameter |
Non-zero value if an error occurred.
Error handling omitted for brewity.
double media_content_length; char *media_url; quvi_media_t m; quvi_t q; quvi_init(&q); quvi_parse(q, URL, &m); quvi_getprop(m, QUVIPROP_MEDIAURL, &media_url); quvi_getprop(m, QUVIPROP_MEDIACONTENTLENGTH, &media_content_length); quvi_parse_close(&m); quvi_close(&q);
Functions | |
quvi_query_formats | Queries available formats to the URL. |
quvi_next_media_url | Iterates the media stream URLs. |
quvi_supported | Checks whether library supports the URL. |
quvi_supported_ident | Otherwise identical to quvi_supported but returns the `ident’ data. |
quvi_supported_ident_close | Releases a previously allocated ident handle. |
quvi_ident_getprop | Returns an ident property. |
quvi_next_supported_website | Returns the next supported website. |
quvi_strerror | Returns a corresponding error message to the return code. |
quvi_version | Returns a quvi version string. |
quvi_free | Frees allocated memory. |
QUVIcode quvi_query_formats( quvi_t session, char * url, char ** formats )
Queries available formats to the URL. The query is done over an Internet connection. It resolves any shortened URLs unless QUVIOPT_NORESOLVE is set explicitly with quvi_setopt. This function checks also if an URL is supported, similarly to that quvi_supported.
Unlike quvi_supported, quvi_supported_ident and quvi_next_supported_website which all return a static format ID list as specified in the webscript’s `ident’ function, quvi_query_formats constructs the list of format IDs dynamically for each URL.
Please note that this function returns only ‘default’ to those URLs that have their corresponding webscripts handle only one (1) format. e.g. No internet connection is required in such case and a static string (‘default’) is returned to the caller instead.
session | Session handle |
url | URL (null-terminated string) |
formats | Null-terminated string (receives) |
A null-terminated string or NULL. quvi_free it when done.
Error handling omitted for brewity.
char *formats; quvi_t q; quvi_init(&q); quvi_query_formats(q, URL, &formats); puts(formats); quvi_free(formats); quvi_close(&q);
QUVIcode quvi_next_media_url( quvi_media_t media )
Iterates the media stream URLs.
media | Media handle |
Non-zero value if an error occurred or QUVI_LAST, otherwise QUVI_OK.
Error handling omitted for brewity.
quvi_media_t m; char *url; quvi_t q; quvi_init(&q); quvi_parse(q, URL, &m); do { quvi_getprop(m, QUVIPROP_MEDIAURL, &url); puts(url); } while (quvi_next_media_url(media) == QUVI_OK); quvi_parse_close(&m); quvi_close(&q);
QUVIcode quvi_supported( quvi_t session, char * url )
Checks whether library supports the URL. Does not require an Internet connection. Shortened URLs will fail with this function.
session | Session handle |
url | URL (null-terminated string) |
Non-zero value if an error occurred or QUVI_NOSUPPORT, otherwise QUVI_OK.
QUVIcode quvi_supported_ident( quvi_t session, char * url, quvi_ident_t * ident )
Otherwise identical to quvi_supported but returns the `ident’ data.
session | Session handle |
url | URL (null-terminated string) |
ident | Ident handle (receives) |
Non-zero value if an error occurred.
Error handling omitted for brewity.
quvi_ident_t ident; quvi_t q; quvi_init(&q); if (quvi_supported_ident(q, URL, &ident) == QUVI_OK) { char *formats; quvi_ident_getprop(ident, QUVI_IDENT_PROPERTY_FORMATS, &formats); puts(formats); quvi_supported_ident_close(&ident); } quvi_close(&q);
QUVIcode quvi_next_supported_website( quvi_t session, char ** domain, char ** formats )
Returns the next supported website.
session | Session handle |
domain | Null-terminated string containing the domain (receives) |
formats | Null-terminated (static) string containing formats (receives) |
Non-zero value if an error occurred or QUVI_LAST, otherwise QUVI_OK.
char *quvi_strerror( quvi_t session, QUVIcode code )
Returns a corresponding error message to the return code.
session | Session handle |
code | Return code |
A null-terminated string. Do not attempt to quvi_free it.
char *quvi_version( QUVIversion id )
Returns a quvi version string.
id | Version ID |
A null-terminated string. Do not attempt to quvi_free it.
Creates a new session.
QUVIcode quvi_init( quvi_t * session )
Closes a previously started session.
void quvi_close( quvi_t * session )
Sets a session option.
QUVIcode quvi_setopt( quvi_t session, QUVIoption option, ... )
Returns session info.
QUVIcode quvi_getinfo( quvi_t session, QUVIinfo info, ... )
Parses an URL.
QUVIcode quvi_parse( quvi_t session, char * url, quvi_media_t * media )
Releases a previously allocated media handle.
void quvi_parse_close( quvi_media_t * media )
Returns a media property.
QUVIcode quvi_getprop( quvi_media_t media, QUVIproperty property, ... )
Queries available formats to the URL.
QUVIcode quvi_query_formats( quvi_t session, char * url, char ** formats )
Iterates the media stream URLs.
QUVIcode quvi_next_media_url( quvi_media_t media )
Checks whether library supports the URL.
QUVIcode quvi_supported( quvi_t session, char * url )
Otherwise identical to quvi_supported but returns the `ident’ data.
QUVIcode quvi_supported_ident( quvi_t session, char * url, quvi_ident_t * ident )
Releases a previously allocated ident handle.
void quvi_supported_ident_close( quvi_ident_t * handle )
Returns an ident property.
QUVIcode quvi_ident_getprop( quvi_ident_t ident, QUVIidentProperty property, ... )
Returns the next supported website.
QUVIcode quvi_next_supported_website( quvi_t session, char ** domain, char ** formats )
Returns a corresponding error message to the return code.
char *quvi_strerror( quvi_t session, QUVIcode code )
Returns a quvi version string.
char *quvi_version( QUVIversion id )
Frees allocated memory.
void quvi_free( void * pointer )