Update doxy comments
[quvi.git] / examples / common.c
blobb20da56c5f7df2f86590135a4145c3b11368791f
1 /* quvi
2 * Copyright (C) 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 /* common.c -- Common functions etc. used by the examples */
22 #include <stdio.h>
23 #include <stdarg.h>
24 #include <quvi/quvi.h>
26 #include "common.h"
28 void spew_e(const char *fmt, ...)
30 va_list ap;
31 va_start(ap, fmt);
32 vfprintf(stderr, fmt, ap);
33 va_end(ap);
36 void check_error(quvi_t q, QUVIcode rc)
38 if (rc == QUVI_OK)
39 return;
41 fprintf(stderr, "error: %s\n", quvi_strerror(q, rc));
43 if (q != NULL)
44 quvi_close(&q);
46 exit(1);
49 void handle_resolve_status(quvi_word type)
51 if (type == QUVISTATUSTYPE_DONE)
52 spew_e("done.\n");
53 else
54 spew_e(":: Check for URL redirection ...");
57 void handle_fetch_status(quvi_word type, void *p)
59 switch (type)
61 default:
62 spew_e(":: Fetch %s ...", (char *)p);
63 break;
64 case QUVISTATUSTYPE_CONFIG:
65 spew_e(":: Fetch config ...");
66 break;
67 case QUVISTATUSTYPE_PLAYLIST:
68 spew_e(":: Fetch playlist ...");
69 break;
70 case QUVISTATUSTYPE_DONE:
71 spew_e("done.\n");
72 break;
76 void handle_verify_status(quvi_word type)
78 switch (type)
80 default:
81 spew_e(":: Verify media URL ...");
82 break;
83 case QUVISTATUSTYPE_DONE:
84 spew_e("done.\n");
85 break;
89 /* vim: set ts=2 sw=2 tw=72 expandtab: */