.gitignore: Add config.aux/compile
[libquvi.git] / examples / simple.c
blob1cfd5538f7a034051f53a600a2c5cc4024ed389a
1 /* libquvi
2 * Copyright (C) 2009-2011 Toni Gundogdu <legatvs@gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301 USA
20 /* simple.c - basic example */
22 #include <stdio.h>
23 #include <quvi/quvi.h>
25 #include "common.h"
27 static int status_callback(long param, void *data)
29 quvi_word status, type;
31 status = quvi_loword(param);
32 type = quvi_hiword(param);
34 printf("status: %d, type: %d\n", status, type);
36 return (0);
39 int main(int argc, char **argv)
41 quvi_media_t m; /* Media handle */
42 QUVIcode rc; /* quvi return code */
43 char *url; /* Holds parsed media stream URL */
44 quvi_t q; /* Session handle */
46 /* Start a new session. */
47 rc = quvi_init(&q);
48 check_error(q, rc);
50 /* Set session options. */
51 quvi_setopt(q, QUVIOPT_STATUSFUNCTION, &status_callback);
52 quvi_setopt(q, QUVIOPT_NOVERIFY, 1L); /* Do not verify media stream URL */
54 /* Parse media details from the specified URL. */
55 rc = quvi_parse(q, "http://vimeo.com/1485507", &m);
56 check_error(q, rc);
58 /* Access the parsed media details. */
59 quvi_getprop(m, QUVIPROP_MEDIAURL, &url);
60 puts(url);
62 /* When done with the parsed details, free them. */
63 quvi_parse_close(&m);
65 /* When done, close the session. */
66 quvi_close(&q);
68 return (0);
71 /* vim: set ts=2 sw=2 tw=72 expandtab: */