summarylogtreecommitdiffstats
path: root/quvi-0.9.patch
blob: 09d55903615fd1e01dfcc8f8d1fea760c9ef0a91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
This makes mplayer2 work with the new 0.9 branch of libquvi.
Please send issues to rat dot o dot drat at gmail dot com.
diff -Naur mplayer2/configure mplayer2.new/configure
--- mplayer2/configure	2014-02-24 19:37:11.154636312 +0100
+++ mplayer2.new/configure	2014-02-24 19:39:33.979771836 +0100
@@ -3187,7 +3187,7 @@
 echocheck "libquvi support"
 if test "$_libquvi" = auto ; then
     _libquvi=no
-    if pkg_config_add 'libquvi >= 0.4.1' ; then
+    if pkg_config_add 'libquvi-0.9' ; then
         _libquvi=yes
     fi
 fi
diff -Naur mplayer2/stream/quvi.c mplayer2.new/stream/quvi.c
--- mplayer2/stream/quvi.c	2014-02-24 19:37:08.347929591 +0100
+++ mplayer2.new/stream/quvi.c	2014-02-24 19:40:08.693559705 +0100
@@ -15,7 +15,7 @@
  * with mplayer2.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <quvi/quvi.h>
+#include <quvi.h>
 
 #include "talloc.h"
 #include "mp_msg.h"
@@ -24,19 +24,17 @@
 
 struct mp_resolve_result *mp_resolve_quvi(const char *url, struct MPOpts *opts)
 {
-    QUVIcode rc;
-
-    quvi_t q;
-    rc = quvi_init(&q);
-    if (rc != QUVI_OK)
+    quvi_t q = quvi_new();
+    if (quvi_ok(q) == QUVI_FALSE)
         return NULL;
 
     // Don't try to use quvi on an URL that's not directly supported, since
     // quvi will do a network access anyway in order to check for HTTP
     // redirections etc.
     // The documentation says this will fail on "shortened" URLs.
-    if (quvi_supported(q, (char *)url) != QUVI_OK) {
-        quvi_close(&q);
+    if (quvi_supports(q, (char *) url, QUVI_SUPPORTS_MODE_OFFLINE, 
+                                       QUVI_SUPPORTS_TYPE_ANY) == QUVI_FALSE) {
+        quvi_free(q);
         return NULL;
     }
 
@@ -48,13 +46,16 @@
     // That call requires an extra net access. quvi_next_media_url() doesn't
     // seem to do anything useful. So we can't really do anything useful
     // except pass through the user's format setting.
-    quvi_setopt(q, QUVIOPT_FORMAT, opts->quvi_format);
-
-    quvi_media_t m;
-    rc = quvi_parse(q, (char *)url, &m);
-    if (rc != QUVI_OK) {
-        mp_msg(MSGT_OPEN, MSGL_ERR, "[quvi] %s\n", quvi_strerror(q, rc));
-        quvi_close(&q);
+    quvi_media_t m = quvi_media_new(q, (char *) url);
+    if (quvi_ok(q) == QUVI_FALSE) {
+        mp_msg(MSGT_OPEN, MSGL_ERR, "[quvi] %s\n", quvi_errmsg(q));
+        quvi_free(q);
+        return NULL;
+    }
+    quvi_media_stream_select(m, opts->quvi_format);
+    if (quvi_ok(q) == QUVI_FALSE) {
+        mp_msg(MSGT_OPEN, MSGL_ERR, "[quvi] %s\n", quvi_errmsg(q));
+        quvi_free(q);
         return NULL;
     }
 
@@ -62,15 +63,17 @@
         talloc_zero(NULL, struct mp_resolve_result);
 
     char *val;
-
-    if (quvi_getprop(m, QUVIPROP_MEDIAURL, &val) == QUVI_OK)
+    
+    quvi_media_get(m, QUVI_MEDIA_STREAM_PROPERTY_URL, &val);
+    if (quvi_ok(q) == QUVI_TRUE)
         result->url = talloc_strdup(result, val);
 
-    if (quvi_getprop(m, QUVIPROP_PAGETITLE, &val) == QUVI_OK)
+    quvi_media_get(m, QUVI_MEDIA_PROPERTY_TITLE, &val);
+    if (quvi_ok(q) == QUVI_TRUE)
         result->title = talloc_strdup(result, val);
 
-    quvi_parse_close(&m);
-    quvi_close(&q);
+    quvi_media_free(m);
+    quvi_free(q);
 
     if (!result->url) {
         talloc_free(result);