Types

Defines

#define QUVIINFO_VOID   0x100000
#define QUVIINFO_LONG   0x200000
#define QUVIINFO_STRING   0x300000
#define QUVIINFO_DOUBLE   0x400000
#define QUVIINFO_TYPEMASK   0xf00000
#define QUVIPROPERTY_STRING   0x100000
#define QUVIPROPERTY_LONG   0x200000
#define QUVIPROPERTY_DOUBLE   0x300000
#define QUVIPROPERTY_TYPEMASK   0xf00000
#define QUVI_WRITEFUNC_ABORT   0x10000000

Typedefs

typedef void * quvi_t
 libquvi session handle
typedef void * quvi_video_t
 Video parsing session handle.
typedef int(* quvi_callback_status )(long param, void *data)
 Status callback function.
typedef int(* quvi_callback_write )(char *buffer, size_t size, size_t nitems, void *instream)
 Write callback function.
typedef uint32_t quvi_word
 Word type.
typedef uint8_t quvi_byte
 Byte type.

Enumerations

enum  QUVIversion { QUVI_VERSION = 0x00, QUVI_VERSION_LONG }
enum  QUVIcode {
  QUVI_OK = 0x00, QUVI_MEM, QUVI_BADHANDLE, QUVI_INVARG,
  QUVI_CURLINIT, QUVI_LAST, QUVI_ABORTEDBYCALLBACK, QUVI_LUAINIT,
  QUVI_NOLUAWEBSITE, _INTERNAL_QUVI_LAST, QUVI_PCRE = 0x40, QUVI_NOSUPPORT,
  QUVI_CURL, QUVI_ICONV, QUVI_LUA
}
enum  QUVIstatus { QUVISTATUS_FETCH = 0x00, QUVISTATUS_VERIFY }
enum  QUVIstatusType { QUVISTATUSTYPE_PAGE = 0x00, QUVISTATUSTYPE_CONFIG, QUVISTATUSTYPE_PLAYLIST, QUVISTATUSTYPE_DONE }
enum  QUVIoption { QUVIOPT_FORMAT = 0x00, QUVIOPT_NOVERIFY, QUVIOPT_STATUSFUNCTION, QUVIOPT_WRITEFUNCTION }
enum  QUVIinfo {
  QUVIINFO_NONE = 0x00, QUVIINFO_CURL = QUVIINFO_VOID + 1, QUVIINFO_CURLCODE = QUVIINFO_LONG + 2, QUVIINFO_HTTPCODE = QUVIINFO_LONG + 3,
  _QUVIINFO_LAST = 3
}
enum  QUVIproperty {
  QUVIPROP_NONE = 0x00, QUVIPROP_HOSTID = QUVIPROPERTY_STRING + 1, QUVIPROP_PAGEURL = QUVIPROPERTY_STRING + 2, QUVIPROP_PAGETITLE = QUVIPROPERTY_STRING + 3,
  QUVIPROP_VIDEOID = QUVIPROPERTY_STRING + 4, QUVIPROP_VIDEOURL = QUVIPROPERTY_STRING + 5, QUVIPROP_VIDEOFILELENGTH = QUVIPROPERTY_DOUBLE + 6, QUVIPROP_VIDEOFILECONTENTTYPE = QUVIPROPERTY_STRING + 7,
  QUVIPROP_VIDEOFILESUFFIX = QUVIPROPERTY_STRING + 8, QUVIPROP_HTTPCODE = QUVIPROPERTY_LONG + 9, QUVIPROP_VIDEOFORMAT = QUVIPROPERTY_STRING + 10, _QUVIPROP_LAST = 10
}

Detailed Description

Describes the constants and the types used with the API.


Define Documentation

#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_TYPEMASK   0xf00000

type mask

#define QUVI_WRITEFUNC_ABORT   0x10000000

Abort writing


Typedef Documentation

typedef void* quvi_t

libquvi session handle

Examples:
quvi.c, and simple.c.
typedef void* quvi_video_t

Video parsing session handle.

Examples:
quvi.c, and simple.c.
typedef int(* quvi_callback_status)(long param, void *data)

Status callback function.

Callback function for status changes.

Note:
Returning a non-zero value from the callback function will stop libquvi

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_FETCH:
     switch (type) {
        default: printf(":: Fetch %s ...", (char *)data); break;
        case QUVISTATUSTYPE_CONFIG  : printf(":: Fetch config ..."); break;
        case QUVISTATUSTYPE_PLAYLIST: printf(":: Fetch playlist ..."); break;
        case QUVISTATUSTYPE_DONE    : puts("done."); break;
      }
      break;
   case QUVISTATUS_VERIFY:
     switch (type) {
     default: printf(":: Verify video link ..."); break;
     case QUVISTATUSTYPE_DONE: puts("done."); break;
     }
     break;
   }
   fflush(stdout);
 }
 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.

Note:
Returning QUVI_WRITEFUNC_ABORT from the callback function will stop write
typedef uint32_t quvi_word

Word type.

Examples:
quvi.c, and simple.c.
typedef uint8_t quvi_byte

Byte type.


Enumeration Type Documentation

Types used with quvi_version()

Enumerator:
QUVI_VERSION 

Version string only

QUVI_VERSION_LONG 

Version string, build date and misc. features

enum QUVIcode

Return codes

Enumerator:
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

_INTERNAL_QUVI_LAST 

For library internal use only

QUVI_PCRE 

libpcre error occurred

QUVI_NOSUPPORT 

libquvi does not support the video host

QUVI_CURL 

libcurl error occurred

QUVI_ICONV 

libiconv error occurred

QUVI_LUA 

lua error occurred

enum QUVIstatus

Status codes

Enumerator:
QUVISTATUS_FETCH 

Status changed to fetch (page, config, etc.)

QUVISTATUS_VERIFY 

Status changed to verify video link

Status type codes

Enumerator:
QUVISTATUSTYPE_PAGE 

Fetching video page

QUVISTATUSTYPE_CONFIG 

Fetching config

QUVISTATUSTYPE_PLAYLIST 

Fetching playlist

QUVISTATUSTYPE_DONE 

General purpose "done" status type

enum QUVIoption

Option codes to be used with quvi_setopt()

If you use QUVIOPT_NOVERIFY, the library will return zero for video file length and an empty string for video suffix. Both of them are parsed during the video link verification process from the server returned HTTP header fields content-length and content-type.

Enumerator:
QUVIOPT_FORMAT 

Requested video file format

QUVIOPT_NOVERIFY 

Do not verify video link

QUVIOPT_STATUSFUNCTION 

Callback function for status updates

QUVIOPT_WRITEFUNCTION 

Callback function for writing data

enum QUVIinfo

Info codes to be used with quvi_getinfo()

The library creates a cURL handle which is used to fetch and verify parsed video details. The cURL handle is initialized with the following libcurl options:

  • CURLOPT_USERAGENT ("Mozilla/5.0")
  • CURLOPT_FOLLOWLOCATION (1)
  • CURLOPT_NOBODY (0)

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.

Warning:
If you use the libquvi created cURL handle in your program, leave the releasing of the handle for the library to do.
Enumerator:
QUVIINFO_NONE 

Unused

QUVIINFO_CURL 

Session libcurl handle

QUVIINFO_CURLCODE 

Last libcurl returned code

QUVIINFO_HTTPCODE 

Last libcurl returned HTTP code

_QUVIINFO_LAST 

Placeholder

Video property codes to be used with quvi_getprop()

Enumerator:
QUVIPROP_NONE 

Unused

QUVIPROP_HOSTID 

Host ID

QUVIPROP_PAGEURL 

Video page link

QUVIPROP_PAGETITLE 

Video title

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

 All Files Functions Typedefs Enumerations Enumerator Defines

Generated on 5 Sep 2010 by  doxygen 1.6.1