2 * This file is part of MPlayer.
4 * MPlayer 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 * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 #include <sys/cdrio.h>
38 #include "libmpdemux/demuxer.h"
41 /// We keep these 2 for the gui atm, but they will be removed.
43 char* cdrom_device
=NULL
;
44 char* dvd_device
=NULL
;
49 #include <quvi/quvi.h>
51 static const char *resolve_quvi(const char *url
, struct MPOpts
*opts
)
53 char *media_title
, *media_url
;
62 // Don't try to use quvi on an URL that's not directly supported, since
63 // quvi will do a network access anyway in order to check for HTTP
65 // The documentation says this will fail on "shortened" URLs.
66 if (quvi_supported(q
, (char *)url
) != QUVI_OK
) {
71 mp_msg(MSGT_OPEN
, MSGL_INFO
, "[quvi] Checking URL...\n");
73 // Can use quvi_query_formats() to get a list of formats like this:
74 // "fmt05_240p|fmt18_360p|fmt34_360p|fmt35_480p|fmt43_360p|fmt44_480p"
75 // (This example is youtube specific.)
76 // That call requires an extra net access. quvi_next_media_url() doesn't
77 // seem to do anything useful. So we can't really do anything useful
78 // except pass through the user's format setting.
79 quvi_setopt(q
, QUVIOPT_FORMAT
, opts
->quvi_format
80 ? opts
->quvi_format
: "best");
82 rc
= quvi_parse(q
, (char *)url
, &m
);
84 mp_msg(MSGT_OPEN
, MSGL_ERR
, "[quvi] %s\n", quvi_strerror(q
, rc
));
89 quvi_getprop(m
, QUVIPROP_PAGETITLE
, &media_title
);
90 quvi_getprop(m
, QUVIPROP_MEDIAURL
, &media_url
);
92 mp_msg(MSGT_OPEN
, MSGL_INFO
, "[quvi] Site media title: '%s'\n",
94 media_url
= talloc_strdup(NULL
, media_url
);
103 // Open a new stream (stdin/file/vcd/url)
105 stream_t
* open_stream(const char *filename
, struct MPOpts
*options
,
109 file_format
= &(int){DEMUXER_TYPE_UNKNOWN
};
110 // Check if playlist or unknown
111 if (*file_format
!= DEMUXER_TYPE_PLAYLIST
){
112 *file_format
=DEMUXER_TYPE_UNKNOWN
;
116 mp_msg(MSGT_OPEN
,MSGL_ERR
,"NULL filename, report this bug\n");
120 const char *resolved
= NULL
;
122 #ifdef CONFIG_LIBQUVI
123 resolved
= resolve_quvi(filename
, options
);
129 stream_t
*res
= open_stream_full(filename
,STREAM_READ
,options
,file_format
);
130 talloc_free((void *)resolved
);