diff options
author | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-12-02 13:13:02 +0000 |
---|---|---|
committer | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-12-02 13:13:02 +0000 |
commit | 6e6214052c3863c3ab3d049b80ed7c51dfbe3cb1 (patch) | |
tree | 68f5cbdfd98e55677ac8dbef9f05fb84b274e9a8 | |
parent | 1f0c614110d544df6a04d9e199c2cb66fca409be (diff) | |
download | mpv-6e6214052c3863c3ab3d049b80ed7c51dfbe3cb1.tar.bz2 mpv-6e6214052c3863c3ab3d049b80ed7c51dfbe3cb1.tar.xz |
When IFO file is opened (detected by extension), set dvd-device to IFO file's
directory and start dvd:// stream instead of file://.
If VTS_<N>_*.IFO is opened, open stream as dvd://<N>
As Nico Sabbi said:
There is no no guarantie that title N is in titleset N,
but there are at least good chances.
The main purpose of this patch is ability to load DVDs, stored on HDD,
using OSD menu.
Modified patch from Benjamin Zores ben at geexbox dot org
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25238 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | stream/stream.c | 2 | ||||
-rw-r--r-- | stream/stream_dvd.c | 43 |
2 files changed, 45 insertions, 0 deletions
diff --git a/stream/stream.c b/stream/stream.c index d4f9050e2e..26725bbbb9 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -85,6 +85,7 @@ extern stream_info_t stream_info_null; extern stream_info_t stream_info_mf; extern stream_info_t stream_info_file; #ifdef USE_DVDREAD +extern stream_info_t stream_info_ifo; extern stream_info_t stream_info_dvd; #endif @@ -132,6 +133,7 @@ static const stream_info_t* const auto_open_streams[] = { #endif &stream_info_cue, #ifdef USE_DVDREAD + &stream_info_ifo, &stream_info_dvd, #endif #ifdef USE_DVDNAV diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 31ec2e1774..c7f5109cfc 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -24,6 +24,7 @@ #include <sys/ioctl.h> #endif +#include <libgen.h> #include <errno.h> #define FIRST_AC3_AID 128 @@ -1077,6 +1078,37 @@ fail: return STREAM_UNSUPPORTED; } +static int +ifo_stream_open (stream_t *stream, int mode, void *opts, int *file_format) +{ + char *ext; + char* filename; + struct stream_priv_s *dvd_priv; + + ext = strrchr (stream->url, '.'); + if (!ext || strcasecmp (ext + 1, "ifo")) + return STREAM_UNSUPPORTED; + + mp_msg(MSGT_DVD, MSGL_INFO, ".IFO detected. Redirecting to dvd://\n"); + if (!dvd_device) + dvd_device = strdup(dirname (stream->url)); + + filename = strdup(basename(stream->url)); + + dvd_priv=calloc(1, sizeof(struct stream_priv_s)); + if(!strncasecmp(filename,"vts_",4)) + { + if(sscanf(filename+3, "_%02d_", &dvd_priv->title)!=1) + dvd_priv->title=1; + }else + dvd_priv->title=1; + + free(filename); + free(stream->url); + stream->url=strdup("dvd://"); + + return open_s(stream, mode, dvd_priv, file_format); +} stream_info_t stream_info_dvd = { "DVD stream", @@ -1088,3 +1120,14 @@ stream_info_t stream_info_dvd = { &stream_opts, 1 // Urls are an option string }; + +stream_info_t stream_info_ifo = { + "DVD IFO input", + "ifo", + "Benjamin Zores", + "Mostly used to play DVDs on disk through OSD Menu", + ifo_stream_open, + { "file", "", NULL }, + NULL, + 0 +}; |