summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-05-27 22:48:04 +0200
committerwm4 <wm4@nowhere>2013-05-27 22:48:04 +0200
commitf05ec1c7389719f151b9d2053f0050abff7f7252 (patch)
treef729427b4673fb6a95c0407b52c655de3a9351f2
parent7ea5d085f94807bb4ae9e4c8d738dab138d73d49 (diff)
downloadmpv-f05ec1c7389719f151b9d2053f0050abff7f7252.tar.bz2
mpv-f05ec1c7389719f151b9d2053f0050abff7f7252.tar.xz
options: add allow-mimetype suboption for demux_lavf
This can control whether demux_lavf should use the HTTP mime type to determine the format, instead of probing the data with the libavformat API. Do this to allow easier debugging in case the mimetype is incorrect. (This is done only for AAC streams right now.)
-rw-r--r--DOCS/man/en/options.rst6
-rw-r--r--core/defaultopts.c3
-rw-r--r--core/options.h1
-rw-r--r--demux/demux_lavf.c3
4 files changed, 12 insertions, 1 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 8eec8408a7..9841e15b11 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -1113,6 +1113,12 @@
format detection less reliable. Can be used to force auto-detected
libavformat demuxers, even if libavformat considers the detection not
reliable enough. (Default: 26.)
+ allow-mimetype=<yes|no>
+ Allow deriving the format from the HTTP mimetype (default: yes). Set
+ this to no in case playing things from http mysteriously fails, even
+ though the same files work from local disk.
+
+ This is default in order to reduce latency when opening http streams.
format=<value>
Force a specific libavformat demuxer.
o=<key>=<value>[,<key>=<value>[,...]]
diff --git a/core/defaultopts.c b/core/defaultopts.c
index 1efb8a1c97..b55dea99f8 100644
--- a/core/defaultopts.c
+++ b/core/defaultopts.c
@@ -100,6 +100,9 @@ void set_default_mplayer_options(struct MPOpts *opts)
.ac3drc = 1.,
.downmix = 1,
},
+ .lavfdopts = {
+ .allow_mimetype = 1,
+ },
.input = {
.key_fifo_size = 7,
.ar_delay = 200,
diff --git a/core/options.h b/core/options.h
index 36a930a132..b2e38ec56d 100644
--- a/core/options.h
+++ b/core/options.h
@@ -223,6 +223,7 @@ typedef struct MPOpts {
int probesize;
int probescore;
int analyzeduration;
+ int allow_mimetype;
char *format;
char *cryptokey;
char *avopt;
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 2141d3ab0a..58fe390507 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -55,6 +55,7 @@ const m_option_t lavfdopts_conf[] = {
OPT_INTRANGE("probesize", lavfdopts.probesize, 0, 32, INT_MAX),
OPT_STRING("format", lavfdopts.format, 0),
OPT_INTRANGE("analyzeduration", lavfdopts.analyzeduration, 0, 0, INT_MAX),
+ OPT_FLAG("allow-mimetype", lavfdopts.allow_mimetype, 0),
OPT_INTRANGE("probescore", lavfdopts.probescore, 0, 0, 100),
OPT_STRING("cryptokey", lavfdopts.cryptokey, 0),
OPT_STRING("o", lavfdopts.avopt, 0),
@@ -218,7 +219,7 @@ static int lavf_check_file(demuxer_t *demuxer)
format = demuxer->stream->lavf_type;
if (!format)
format = avdevice_format;
- if (!format && demuxer->stream->mime_type)
+ if (!format && lavfdopts->allow_mimetype && demuxer->stream->mime_type)
format = (char *)find_demuxer_from_mime_type(demuxer->stream->mime_type);
if (format) {
if (strcmp(format, "help") == 0) {