summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-13 17:09:35 +0200
committerwm4 <wm4@nowhere>2012-10-14 22:26:41 +0200
commita19f197cb14a0ceec4bc1fe977502b8f8ab8f94e (patch)
treeb4de459e097301d352b6a46e5086c51dfd682231 /mplayer.c
parent9dfcd3e9a24a2d88578909233e2db24863f27b89 (diff)
downloadmpv-a19f197cb14a0ceec4bc1fe977502b8f8ab8f94e.tar.bz2
mpv-a19f197cb14a0ceec4bc1fe977502b8f8ab8f94e.tar.xz
core: show quvi page title in window title, clean up libquvi handling
Clean up handling of libquvi (which resolves URLs of streaming sites into URLs to the actual media playable by mpv). Move the code out of open.c to quvi.c, and invoke it explicitly from mplayer.c, instead of trying to resolve every filename passed to open_stream(). This allows easily passing metadata from the quvi context to the frontend. Expose QUVIPROP_PAGETITLE as "media-title" property, and use that instead of "filename" for the mplayer window title. (For YouTube, this is the video title.) It's cleaner too. Handle a potential reliability issue: check quvi_getprop return values. Since open.c contains barely anything but the open_stream() stub, move that to stream.c and delete open.c.
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/mplayer.c b/mplayer.c
index dcf9b62af0..0109778c17 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -3668,6 +3668,16 @@ static void add_subtitle_fonts_from_sources(struct MPContext *mpctx)
#endif
}
+static struct mp_resolve_result *resolve_url(const char *filename,
+ struct MPOpts *opts)
+{
+#ifdef CONFIG_LIBQUVI
+ return mp_resolve_quvi(filename, opts);
+#else
+ return NULL;
+#endif
+}
+
// Waiting for the slave master to send us a new file to play.
static void idle_loop(struct MPContext *mpctx)
{
@@ -3691,8 +3701,9 @@ static void play_current_file(struct MPContext *mpctx)
struct MPOpts *opts = &mpctx->opts;
mpctx->stop_play = 0;
-
mpctx->filename = NULL;
+ mpctx->file_format = DEMUXER_TYPE_UNKNOWN;
+
if (mpctx->playlist->current)
mpctx->filename = mpctx->playlist->current->filename;
@@ -3761,7 +3772,11 @@ static void play_current_file(struct MPContext *mpctx)
assert(mpctx->sh_video == NULL);
assert(mpctx->sh_sub == NULL);
- mpctx->stream = open_stream(mpctx->filename, opts, &mpctx->file_format);
+ char *stream_filename = mpctx->filename;
+ mpctx->resolve_result = resolve_url(stream_filename, opts);
+ if (mpctx->resolve_result)
+ stream_filename = mpctx->resolve_result->url;
+ mpctx->stream = open_stream(stream_filename, opts, &mpctx->file_format);
if (!mpctx->stream) { // error...
libmpdemux_was_interrupted(mpctx);
goto terminate_playback;
@@ -4032,6 +4047,9 @@ terminate_playback: // don't jump here after ao/vo/getch initialization!
uninit_player(mpctx, uninitialize_parts);
mpctx->filename = NULL;
+ mpctx->file_format = DEMUXER_TYPE_UNKNOWN;
+ talloc_free(mpctx->resolve_result);
+ mpctx->resolve_result = NULL;
vo_sub = NULL;
#ifdef CONFIG_ASS