Describes the constants and the types used with the API.
#define QUVIINFO_VOID 0x100000 |
void type
#define QUVIINFO_LONG 0x200000 |
long type
#define QUVIINFO_STRING 0x300000 |
string type
#define QUVIINFO_DOUBLE 0x400000 |
double type
#define QUVIINFO_TYPEMASK 0xf00000 |
type mask
#define QUVIPROPERTY_STRING 0x100000 |
string type
#define QUVIPROPERTY_LONG 0x200000 |
long type
#define QUVIPROPERTY_DOUBLE 0x300000 |
double type
#define QUVIPROPERTY_VOID 0x400000 |
void type
#define QUVIPROPERTY_TYPEMASK 0xf00000 |
type mask
#define QUVI_WRITEFUNC_ABORT 0x10000000 |
Abort writing
typedef void* quvi_t |
libquvi session handle
typedef void* quvi_media_t |
Media parsing session handle.
typedef void* quvi_video_t |
Video parsing session handle.
typedef void* quvi_ident_t |
Webscript ident handle.
typedef int(* quvi_callback_status)(long param, void *data) |
Status callback function.
Callback function for status changes.
Example:
static int status_callback (long param, void *data) { quvi_word status, type; status = quvi_loword(param); type = quvi_hiword(param); switch (status) { case QUVISTATUS_RESOLVE: switch (type) { case QUVISTATUSTYPE_DONE: puts("done."); break; default: printf (":: Check for URL redirection ..."); break; } break; case QUVISTATUS_FETCH: switch (type) { case QUVISTATUSTYPE_CONFIG: printf(":: Fetch config ..."); break; case QUVISTATUSTYPE_PLAYLIST: printf(":: Fetch playlist ..."); break; case QUVISTATUSTYPE_DONE: puts("done."); break; default: printf(":: Fetch %s ...",(char*)data); break; } break; case QUVISTATUS_VERIFY: switch (type) { case QUVISTATUSTYPE_DONE: puts("done."); break; default: printf(":: Verify URL ..."); break; } break; } fflush(stdout); return (QUVI_OK); } int main (int argc, char *argv[]) { quvi_t quvi; quvi_init(&quvi); quvi_setopt(quvi, QUVIOPT_STATUSFUNCTION, status_callback); ... }
typedef int(* quvi_callback_write)(char *buffer, size_t size, size_t nitems, void *instream) |
Write callback function.
This function gets called by libquvi (or libcurl) as soon as there is data received that needs to be saved.
typedef uint32_t quvi_word |
Word type.
typedef uint8_t quvi_byte |
Byte type.
enum QUVIversion |
Types used with quvi_version()
enum QUVIcode |
Return codes
QUVI_OK |
OK |
QUVI_MEM |
Memory allocation failed |
QUVI_BADHANDLE |
Bad session handle |
QUVI_INVARG |
Invalid function argument |
QUVI_CURLINIT |
libcurl initialization failed |
QUVI_LAST |
Indicates end of list iteration |
QUVI_ABORTEDBYCALLBACK |
Aborted by callback function |
QUVI_LUAINIT |
Lua initialization failure |
QUVI_NOLUAWEBSITE |
Failed to find lua website scripts |
QUVI_NOLUAUTIL |
Failed to find lua util scripts |
_INTERNAL_QUVI_LAST |
For library internal use only |
QUVI_PCRE |
libpcre error occurred
|
QUVI_NOSUPPORT |
libquvi does not support the website |
QUVI_CALLBACK |
Callback error occurred
|
QUVI_ICONV |
libiconv error occurred |
QUVI_LUA |
LUA error occurred |
QUVI_CURL |
libcurl error occurred
|
enum QUVIstatus |
Status codes
QUVISTATUS_FETCH |
Status changed to fetch data from URL |
QUVISTATUS_VERIFY |
Status changed to verify media URL |
QUVISTATUS_RESOLVE |
Status changed to resolve redirection |
QUVISTATUS_SHORTENED |
Status changed to check for shortened URL
|
enum QUVIstatusType |
enum QUVIoption |
Option codes to be used with quvi_setopt()
QUVIOPT_FORMAT |
Requested format, the resulting format may be different from the requested one if the LUA script was unable to parse an URL to the requested format. The scripts are expected to fallback to the 'default' format if the requested format could not be parsed and raise an error if that failed as well. |
QUVIOPT_NOVERIFY |
Do not verify URL; content-type, content-length (of HTTP), etc. will not be queried |
QUVIOPT_STATUSFUNCTION |
Callback function for status updates
|
QUVIOPT_WRITEFUNCTION |
Callback function for writing data
|
QUVIOPT_NORESOLVE |
Do not attempt to resolve URLs that may be redirections, e.g. URL shortening services typically use redirections |
QUVIOPT_CATEGORY |
Bit pattern of (OR'd) website script categories |
QUVIOPT_FETCHFUNCTION |
Callback function for fetching data
|
QUVIOPT_RESOLVEFUNCTION |
Callback function for resolving URL redirections
|
QUVIOPT_VERIFYFUNCTION |
Callback function for verifying media stream URL
|
QUVIOPT_NOSHORTENED |
Do not "decompress" shortened URLs,
|
enum QUVIcategory |
Website script category
Specify which of the website script categories the application wants to use. The library defaults to QUVIPROTO_HTTP for historical reasons.
enum QUVIinfo |
Info codes to be used with quvi_getinfo()
The library creates a cURL handle which is used to fetch and verify parsed details. The cURL handle is initialized with the following libcurl options:
You can, of course, override those settings in your program. You can even use the cURL handle in your program until quvi_close() is called which will release the handle. See the src/quvi.c for an example of this. Note that libquvi uses the libcurl easy interface and not the multi interface.
QUVIINFO_NONE |
Placeholder |
QUVIINFO_CURL |
Session libcurl handle |
QUVIINFO_RESPONSECODE | |
QUVIINFO_CURLCODE |
Last server returned HTTP code Last libcurl returned code
|
QUVIINFO_HTTPCODE |
Last returned HTTP code by a server
|
_QUVIINFO_LAST |
Placeholder |
enum QUVIproperty |
Media property codes to be used with quvi_getprop()
QUVIPROP_NONE |
Placeholder |
QUVIPROP_HOSTID |
Host ID |
QUVIPROP_PAGEURL |
Page URL |
QUVIPROP_PAGETITLE |
Page title |
QUVIPROP_MEDIAID |
Media ID |
QUVIPROP_MEDIAURL |
Media URL |
QUVIPROP_MEDIACONTENTLENGTH |
Media content length in bytes |
QUVIPROP_MEDIACONTENTTYPE |
Media content-type |
QUVIPROP_FILESUFFIX |
Parsed file suffix |
QUVIPROP_RESPONSECODE |
Last server returned HTTP code |
QUVIPROP_FORMAT |
Requested format, set using QUVIOPT_FORMAT |
QUVIPROP_STARTTIME |
Start time for media |
QUVIPROP_MEDIATHUMBNAILURL |
Media cover URL, if any |
QUVIPROP_MEDIADURATION |
Media duration in msecs |
QUVIPROP_VIDEOID |
Video ID
|
QUVIPROP_VIDEOURL |
Video URL
|
QUVIPROP_VIDEOFILELENGTH |
Video file length
|
QUVIPROP_VIDEOFILECONTENTTYPE |
Video file content-type
|
QUVIPROP_VIDEOFILESUFFIX |
Video file suffix
|
QUVIPROP_HTTPCODE |
Last libcurl returned HTTP code
|
QUVIPROP_VIDEOFORMAT |
Requested video format, set using QUVIOPT_FORMAT
|
_QUVIPROP_LAST |
Placeholder |
enum QUVIidentProperty |