make-w32.sh: generate ChangeLog
[quvi.git] / examples / simple.c
blob9bde4df7ba4ac248f6f99d77ae971f263689226e
1 /*
2 * Copyright (C) 2009 Toni Gundogdu.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program 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
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * simple.c -- a simplistic libquvi example.
20 * Ignores errors, see src/quvi.c for a more complete example.
23 #include <stdio.h>
24 #include <quvi/quvi.h>
26 static int status_callback(long param, void *data)
28 quvi_word status, type;
30 status = quvi_loword(param);
31 type = quvi_hiword(param);
33 printf("status: %d, type: %d\n", status, type);
35 return (0);
38 int main(int argc, char **argv)
40 quvi_t q; /* library handle */
41 quvi_video_t v; /* video handle */
42 char *lnk; /* holds parsed video link */
44 quvi_init(&q);
45 quvi_setopt(q, QUVIOPT_STATUSFUNCTION, &status_callback);
46 quvi_parse(q, "http://www.youtube.com/watch?v=DeWsZ2b_pK4", &v);
47 quvi_getprop(v, QUVIPROP_VIDEOURL, &lnk);
48 puts(lnk);
49 quvi_parse_close(&v);
50 quvi_close(&q);
52 return (0);