summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
Diffstat (limited to 'stream')
-rw-r--r--stream/open.c132
-rw-r--r--stream/stream.c24
2 files changed, 24 insertions, 132 deletions
diff --git a/stream/open.c b/stream/open.c
deleted file mode 100644
index 91e9ae2956..0000000000
--- a/stream/open.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "talloc.h"
-
-#ifdef __FreeBSD__
-#include <sys/cdrio.h>
-#endif
-
-#include "m_option.h"
-#include "options.h"
-#include "stream.h"
-#include "libmpdemux/demuxer.h"
-
-
-/// We keep these 2 for the gui atm, but they will be removed.
-int vcd_track=0;
-char* cdrom_device=NULL;
-char* dvd_device=NULL;
-int dvd_title=0;
-
-#ifdef CONFIG_LIBQUVI
-
-#include <quvi/quvi.h>
-
-static const char *resolve_quvi(const char *url, struct MPOpts *opts)
-{
- char *media_title, *media_url;
- quvi_media_t m;
- QUVIcode rc;
- quvi_t q;
-
- rc = quvi_init(&q);
- if (rc != QUVI_OK)
- 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);
- return NULL;
- }
-
- mp_msg(MSGT_OPEN, MSGL_INFO, "[quvi] Checking URL...\n");
-
- // Can use quvi_query_formats() to get a list of formats like this:
- // "fmt05_240p|fmt18_360p|fmt34_360p|fmt35_480p|fmt43_360p|fmt44_480p"
- // (This example is youtube specific.)
- // 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
- ? opts->quvi_format : "best");
-
- 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);
- return NULL;
- }
-
- quvi_getprop(m, QUVIPROP_PAGETITLE, &media_title);
- quvi_getprop(m, QUVIPROP_MEDIAURL, &media_url);
-
- mp_msg(MSGT_OPEN, MSGL_INFO, "[quvi] Site media title: '%s'\n",
- media_title);
- media_url = talloc_strdup(NULL, media_url);
-
- quvi_parse_close(&m);
- quvi_close(&q);
-
- return media_url;
-}
-#endif
-
-// Open a new stream (stdin/file/vcd/url)
-
-stream_t* open_stream(const char *filename, struct MPOpts *options,
- int *file_format)
-{
- if (!file_format)
- file_format = &(int){DEMUXER_TYPE_UNKNOWN};
- // Check if playlist or unknown
- if (*file_format != DEMUXER_TYPE_PLAYLIST){
- *file_format=DEMUXER_TYPE_UNKNOWN;
- }
-
-if(!filename) {
- mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n");
- return NULL;
-}
-
- const char *resolved = NULL;
-
-#ifdef CONFIG_LIBQUVI
- resolved = resolve_quvi(filename, options);
-#endif
-
- if (resolved)
- filename = resolved;
-
- stream_t *res = open_stream_full(filename,STREAM_READ,options,file_format);
- talloc_free((void *)resolved);
- return res;
-}
diff --git a/stream/stream.c b/stream/stream.c
index d7500cc790..ab0039e581 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -53,6 +53,12 @@
#include "cache2.h"
+/// We keep these 2 for the gui atm, but they will be removed.
+int vcd_track=0;
+char* cdrom_device=NULL;
+char* dvd_device=NULL;
+int dvd_title=0;
+
struct input_ctx;
static int (*stream_check_interrupt_cb)(struct input_ctx *ctx, int time);
static struct input_ctx *stream_check_interrupt_ctx;
@@ -199,6 +205,12 @@ stream_t *open_stream_full(const char *filename, int mode,
stream_t* s;
char *redirected_url = NULL;
+ int dummy;
+ if (!file_format)
+ file_format = &dummy;
+
+ *file_format = DEMUXER_TYPE_UNKNOWN;
+
for(i = 0 ; auto_open_streams[i] ; i++) {
sinfo = auto_open_streams[i];
if(!sinfo->protocols) {
@@ -235,6 +247,18 @@ stream_t *open_stream_full(const char *filename, int mode,
return NULL;
}
+stream_t* open_stream(const char *filename, struct MPOpts *options,
+ int *file_format)
+{
+
+if(!filename) {
+ mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n");
+ return NULL;
+}
+
+ return open_stream_full(filename,STREAM_READ,options,file_format);
+}
+
stream_t *open_output_stream(const char *filename, struct MPOpts *options)
{
int file_format; //unused