Overview: Formats | |
API Functions | Functions that return format lists. |
Static list | Some API Functions return a static list of media formats. |
Dynamic list | Addresses the issues with the Static list. |
‘default’ and ‘best’ formats | ‘default’ and ‘best’ are not formats. |
More about ‘default’ and ‘best’ | How these are determined is webscript specific. |
Using quvi_query_formats | How to use quvi_query_formats as intended. |
Tips | Useful tips. |
Functions that return format lists.
Some API Functions return a static list of media formats. Until 0.2.17 these lists used to contain any number of media format strings that were assumed to be available to an URL. As of libquvi 0.2.17 these lists hold the value of either ‘default’ or ‘default|best’ and should be considered to be deprecated and not to be used in applications anymore.
The static lists were originally introduced to give the applications and their users some idea what formats were expected to be available to media. The problem with the static list is that many websites have only a selected number of formats available to their media. For example, one video could have a few formats available, whereas another might have several additional ones available.
This often lead to some confusion about the available formats and this has been addressed with the Dynamic list and quvi_query_formats that were introduced in libquvi 0.2.17.
Addresses the issues with the Static list. libquvi 0.2.17 adds a new function quvi_query_formats that creates the list, dynamically, from the data returned by the servers.
’default’ and ‘best’ are not formats. They strings are treated as constants and indicate
It should be noted that the webscripts are expected to fallback to ‘default’
How these are determined is webscript specific. When a webscript supports >1 formats
The webscripts typically default to the lowest (available) quality.
The webscripts compare the media quality proeprties and pick the one with the highest quality properties. Common to both ‘default’ and ‘best’ is that if the media quality property data is not available to the webscript, some alternative method is typically used instead to determine them.
How to use quvi_query_formats as intended.
Error handling omitted for brewity.
#define URL "http://foo.bar/baz" char *avail_formats, *get_format; quvi_media_t m; quvi_t q; quvi_init(&q); quvi_query_formats(q, URL, &avail_formats); /* * SKIP for brewity: * - Choose format string from the returned "avail_formats" * - Save the chosen value to "get_format" */ quvi_setopt(q, QUVIOPT_FORMAT, get_format); quvi_parse(q, URL, &m); /* SKIP: Do whatever with the parsed media details */ quvi_free(avail_formats); quvi_parse_close(&m); quvi_close(&q);
Useful tips.
Queries available formats to the URL.
QUVIcode quvi_query_formats( quvi_t session, char * url, char ** formats )
Returns the next supported website.
QUVIcode quvi_next_supported_website( quvi_t session, char ** domain, char ** formats )
Otherwise identical to quvi_supported but returns the `ident’ data.
QUVIcode quvi_supported_ident( quvi_t session, char * url, quvi_ident_t * ident )
Parses an URL.
QUVIcode quvi_parse( quvi_t session, char * url, quvi_media_t * media )
Sets a session option.
QUVIcode quvi_setopt( quvi_t session, QUVIoption option, ... )