2 * This file is part of mplayer2.
4 * mplayer2 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 2 of the License, or
7 * (at your option) any later version.
9 * mplayer2 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 along
15 * with mplayer2. If not, see <http://www.gnu.org/licenses/>.
18 #include <quvi/quvi.h>
25 struct mp_resolve_result
*mp_resolve_quvi(const char *url
, struct MPOpts
*opts
)
34 // Don't try to use quvi on an URL that's not directly supported, since
35 // quvi will do a network access anyway in order to check for HTTP
37 // The documentation says this will fail on "shortened" URLs.
38 if (quvi_supported(q
, (char *)url
) != QUVI_OK
) {
43 mp_msg(MSGT_OPEN
, MSGL_INFO
, "[quvi] Checking URL...\n");
45 // Can use quvi_query_formats() to get a list of formats like this:
46 // "fmt05_240p|fmt18_360p|fmt34_360p|fmt35_480p|fmt43_360p|fmt44_480p"
47 // (This example is youtube specific.)
48 // That call requires an extra net access. quvi_next_media_url() doesn't
49 // seem to do anything useful. So we can't really do anything useful
50 // except pass through the user's format setting.
51 quvi_setopt(q
, QUVIOPT_FORMAT
, opts
->quvi_format
);
54 rc
= quvi_parse(q
, (char *)url
, &m
);
56 mp_msg(MSGT_OPEN
, MSGL_ERR
, "[quvi] %s\n", quvi_strerror(q
, rc
));
61 struct mp_resolve_result
*result
=
62 talloc_zero(NULL
, struct mp_resolve_result
);
66 if (quvi_getprop(m
, QUVIPROP_MEDIAURL
, &val
) == QUVI_OK
)
67 result
->url
= talloc_strdup(result
, val
);
69 if (quvi_getprop(m
, QUVIPROP_PAGETITLE
, &val
) == QUVI_OK
)
70 result
->title
= talloc_strdup(result
, val
);